@modern-js/core 1.9.2 → 1.10.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/CHANGELOG.md +15 -0
- package/compiled/ajv-keywords/index.d.ts +1 -0
- package/compiled/ajv-keywords/package.json +1 -1
- package/compiled/better-ajv-errors/index.d.ts +1 -0
- package/compiled/better-ajv-errors/package.json +1 -1
- package/compiled/v8-compile-cache/index.d.ts +1 -0
- package/compiled/v8-compile-cache/package.json +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +19 -28
- package/dist/config/types/index.d.ts +36 -36
- package/dist/index.js +55 -60
- package/dist/initWatcher.js +3 -12
- package/package.json +7 -8
- package/tsconfig.json +1 -0
- package/compiled/ajv-keywords/ajv/dist/ajv.d.ts +0 -16
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/code.d.ts +0 -40
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/index.d.ts +0 -79
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/scope.d.ts +0 -79
- package/compiled/ajv-keywords/ajv/dist/compile/errors.d.ts +0 -13
- package/compiled/ajv-keywords/ajv/dist/compile/index.d.ts +0 -80
- package/compiled/ajv-keywords/ajv/dist/compile/ref_error.d.ts +0 -6
- package/compiled/ajv-keywords/ajv/dist/compile/resolve.d.ts +0 -12
- package/compiled/ajv-keywords/ajv/dist/compile/rules.d.ts +0 -28
- package/compiled/ajv-keywords/ajv/dist/compile/util.d.ts +0 -40
- package/compiled/ajv-keywords/ajv/dist/compile/validate/index.d.ts +0 -42
- package/compiled/ajv-keywords/ajv/dist/compile/validate/subschema.d.ts +0 -47
- package/compiled/ajv-keywords/ajv/dist/core.d.ts +0 -173
- package/compiled/ajv-keywords/ajv/dist/runtime/validation_error.d.ts +0 -7
- package/compiled/ajv-keywords/ajv/dist/types/index.d.ts +0 -183
- package/compiled/ajv-keywords/ajv/dist/types/json-schema.d.ts +0 -124
- package/compiled/ajv-keywords/ajv/dist/types/jtd-schema.d.ts +0 -169
- package/compiled/ajv-keywords/dist/index.d.ts +0 -4
- package/compiled/ajv-keywords/uri-js/dist/es5/uri.all.d.ts +0 -59
- package/compiled/better-ajv-errors/ajv/dist/ajv.d.ts +0 -16
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/code.d.ts +0 -40
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/index.d.ts +0 -79
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/scope.d.ts +0 -79
- package/compiled/better-ajv-errors/ajv/dist/compile/errors.d.ts +0 -13
- package/compiled/better-ajv-errors/ajv/dist/compile/index.d.ts +0 -80
- package/compiled/better-ajv-errors/ajv/dist/compile/ref_error.d.ts +0 -6
- package/compiled/better-ajv-errors/ajv/dist/compile/resolve.d.ts +0 -12
- package/compiled/better-ajv-errors/ajv/dist/compile/rules.d.ts +0 -28
- package/compiled/better-ajv-errors/ajv/dist/compile/util.d.ts +0 -40
- package/compiled/better-ajv-errors/ajv/dist/compile/validate/index.d.ts +0 -42
- package/compiled/better-ajv-errors/ajv/dist/compile/validate/subschema.d.ts +0 -47
- package/compiled/better-ajv-errors/ajv/dist/core.d.ts +0 -173
- package/compiled/better-ajv-errors/ajv/dist/runtime/validation_error.d.ts +0 -7
- package/compiled/better-ajv-errors/ajv/dist/types/index.d.ts +0 -183
- package/compiled/better-ajv-errors/ajv/dist/types/json-schema.d.ts +0 -124
- package/compiled/better-ajv-errors/ajv/dist/types/jtd-schema.d.ts +0 -169
- package/compiled/better-ajv-errors/typings.d.ts +0 -24
- package/compiled/better-ajv-errors/uri-js/dist/es5/uri.all.d.ts +0 -59
- package/dist/js/modern/cli.js +0 -29
- package/dist/js/modern/config/defaults.js +0 -103
- package/dist/js/modern/config/index.js +0 -115
- package/dist/js/modern/config/mergeConfig.js +0 -22
- package/dist/js/modern/config/schema/deploy.js +0 -17
- package/dist/js/modern/config/schema/index.js +0 -107
- package/dist/js/modern/config/schema/output.js +0 -147
- package/dist/js/modern/config/schema/server.js +0 -170
- package/dist/js/modern/config/schema/source.js +0 -59
- package/dist/js/modern/config/schema/tools.js +0 -36
- package/dist/js/modern/config/types/electron.js +0 -1
- package/dist/js/modern/config/types/index.js +0 -1
- package/dist/js/modern/config/types/less.js +0 -0
- package/dist/js/modern/config/types/sass.js +0 -0
- package/dist/js/modern/config/types/ssg.js +0 -0
- package/dist/js/modern/config/types/test.js +0 -0
- package/dist/js/modern/config/types/unbundle.js +0 -0
- package/dist/js/modern/context.js +0 -63
- package/dist/js/modern/index.js +0 -169
- package/dist/js/modern/initWatcher.js +0 -62
- package/dist/js/modern/loadEnv.js +0 -14
- package/dist/js/modern/loadPlugins.js +0 -122
- package/dist/js/modern/manager.js +0 -28
- package/dist/js/modern/pluginAPI.js +0 -11
- package/dist/js/modern/utils/commander.js +0 -19
- package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
- package/dist/js/node/cli.js +0 -35
- package/dist/js/node/config/defaults.js +0 -110
- package/dist/js/node/config/index.js +0 -182
- package/dist/js/node/config/mergeConfig.js +0 -32
- package/dist/js/node/config/schema/deploy.js +0 -26
- package/dist/js/node/config/schema/index.js +0 -127
- package/dist/js/node/config/schema/output.js +0 -156
- package/dist/js/node/config/schema/server.js +0 -179
- package/dist/js/node/config/schema/source.js +0 -68
- package/dist/js/node/config/schema/tools.js +0 -43
- package/dist/js/node/config/types/electron.js +0 -5
- package/dist/js/node/config/types/index.js +0 -5
- package/dist/js/node/config/types/less.js +0 -0
- package/dist/js/node/config/types/sass.js +0 -0
- package/dist/js/node/config/types/ssg.js +0 -0
- package/dist/js/node/config/types/test.js +0 -0
- package/dist/js/node/config/types/unbundle.js +0 -0
- package/dist/js/node/context.js +0 -93
- package/dist/js/node/index.js +0 -329
- package/dist/js/node/initWatcher.js +0 -82
- package/dist/js/node/loadEnv.js +0 -30
- package/dist/js/node/loadPlugins.js +0 -134
- package/dist/js/node/manager.js +0 -45
- package/dist/js/node/pluginAPI.js +0 -54
- package/dist/js/node/utils/commander.js +0 -32
- package/dist/js/node/utils/repeatKeyWarning.js +0 -31
- package/dist/types/cli.d.ts +0 -1
- package/dist/types/config/defaults.d.ts +0 -28
- package/dist/types/config/index.d.ts +0 -12
- package/dist/types/config/mergeConfig.d.ts +0 -31
- package/dist/types/config/schema/deploy.d.ts +0 -16
- package/dist/types/config/schema/index.d.ts +0 -466
- package/dist/types/config/schema/output.d.ts +0 -146
- package/dist/types/config/schema/server.d.ts +0 -182
- package/dist/types/config/schema/source.d.ts +0 -58
- package/dist/types/config/schema/tools.d.ts +0 -36
- package/dist/types/config/types/electron.d.ts +0 -13
- package/dist/types/config/types/index.d.ts +0 -252
- package/dist/types/config/types/less.d.ts +0 -10
- package/dist/types/config/types/sass.d.ts +0 -8
- package/dist/types/config/types/ssg.d.ts +0 -13
- package/dist/types/config/types/test.d.ts +0 -15
- package/dist/types/config/types/unbundle.d.ts +0 -28
- package/dist/types/context.d.ts +0 -47
- package/dist/types/index.d.ts +0 -64
- package/dist/types/initWatcher.d.ts +0 -3
- package/dist/types/loadEnv.d.ts +0 -1
- package/dist/types/loadPlugins.d.ts +0 -44
- package/dist/types/manager.d.ts +0 -75
- package/dist/types/pluginAPI.d.ts +0 -13
- package/dist/types/utils/commander.d.ts +0 -4
- package/dist/types/utils/repeatKeyWarning.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0ee4bb4e: feat: prebundle webpack loaders and plugins
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a22d3ea8: fix: package manager name in logs and comments
|
|
12
|
+
- 5c00db22: fix: ignore existed schema properties
|
|
13
|
+
- 92f4909e: fix: cli.init should return correct appContext
|
|
14
|
+
- Updated dependencies [0ee4bb4e]
|
|
15
|
+
- Updated dependencies [6fa74d5f]
|
|
16
|
+
- @modern-js/utils@1.7.0
|
|
17
|
+
|
|
3
18
|
## 1.9.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ajv-keywords","author":"Evgeny Poberezkin","version":"5.1.0","license":"MIT","types":"
|
|
1
|
+
{"name":"ajv-keywords","author":"Evgeny Poberezkin","version":"5.1.0","license":"MIT","types":"index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"better-ajv-errors","author":"Rifat Nabi <to.rifat@gmail.com>","version":"1.2.0","license":"Apache-2.0","types":"
|
|
1
|
+
{"name":"better-ajv-errors","author":"Rifat Nabi <to.rifat@gmail.com>","version":"1.2.0","license":"Apache-2.0","types":"index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"v8-compile-cache","author":"Andres Suarez <zertosh@gmail.com>","version":"2.3.0","license":"MIT"}
|
|
1
|
+
{"name":"v8-compile-cache","author":"Andres Suarez <zertosh@gmail.com>","version":"2.3.0","license":"MIT","types":"index.d.ts"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export * from './types';
|
|
|
9
9
|
export declare const addServerConfigToDeps: (dependencies: string[], appDirectory: string, serverConfigFile: string) => Promise<void>;
|
|
10
10
|
export declare const defineConfig: (config: ConfigParam) => ConfigParam;
|
|
11
11
|
export declare const loadUserConfig: (appDirectory: string, filePath?: string | undefined, packageJsonConfig?: string | undefined) => Promise<LoadedConfig>;
|
|
12
|
-
export declare const resolveConfig: (loaded: LoadedConfig, configs: UserConfig[], schemas: PluginValidateSchema[], restartWithExistingPort: number, argv: string[], onSchemaError?: (error: ErrorObject) => void) => Promise<NormalizedConfig>;
|
|
12
|
+
export declare const resolveConfig: (loaded: LoadedConfig, configs: UserConfig[], schemas: PluginValidateSchema[], restartWithExistingPort: number, argv: string[], onSchemaError?: (error: ErrorObject) => void | Promise<void>) => Promise<NormalizedConfig>;
|
package/dist/config/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -13,15 +9,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
11
|
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
14
|
};
|
|
@@ -41,20 +28,20 @@ Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function
|
|
|
41
28
|
const schema_1 = require("./schema");
|
|
42
29
|
const debug = (0, utils_1.createDebugger)('resolve-config');
|
|
43
30
|
__exportStar(require("./types"), exports);
|
|
44
|
-
const addServerConfigToDeps = (dependencies, appDirectory, serverConfigFile) =>
|
|
45
|
-
const serverConfig =
|
|
31
|
+
const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
|
|
32
|
+
const serverConfig = await (0, utils_1.getServerConfig)(appDirectory, serverConfigFile);
|
|
46
33
|
if (serverConfig) {
|
|
47
34
|
dependencies.push(serverConfig);
|
|
48
35
|
}
|
|
49
|
-
}
|
|
36
|
+
};
|
|
50
37
|
exports.addServerConfigToDeps = addServerConfigToDeps;
|
|
51
38
|
const defineConfig = (config) => config;
|
|
52
39
|
exports.defineConfig = defineConfig;
|
|
53
|
-
const loadUserConfig = (appDirectory, filePath, packageJsonConfig) =>
|
|
54
|
-
const loaded =
|
|
40
|
+
const loadUserConfig = async (appDirectory, filePath, packageJsonConfig) => {
|
|
41
|
+
const loaded = await (0, load_config_1.loadConfig)(appDirectory, filePath, packageJsonConfig);
|
|
55
42
|
const config = !loaded
|
|
56
43
|
? {}
|
|
57
|
-
:
|
|
44
|
+
: await (typeof loaded.config === 'function'
|
|
58
45
|
? loaded.config(0)
|
|
59
46
|
: loaded.config);
|
|
60
47
|
return {
|
|
@@ -64,9 +51,9 @@ const loadUserConfig = (appDirectory, filePath, packageJsonConfig) => __awaiter(
|
|
|
64
51
|
filePath: loaded === null || loaded === void 0 ? void 0 : loaded.path,
|
|
65
52
|
dependencies: (loaded === null || loaded === void 0 ? void 0 : loaded.dependencies) || [],
|
|
66
53
|
};
|
|
67
|
-
}
|
|
54
|
+
};
|
|
68
55
|
exports.loadUserConfig = loadUserConfig;
|
|
69
|
-
const showAdditionalPropertiesError = (error) => {
|
|
56
|
+
const showAdditionalPropertiesError = async (error) => {
|
|
70
57
|
if (error.keyword === 'additionalProperties' &&
|
|
71
58
|
error.params.additionalProperty) {
|
|
72
59
|
const target = [
|
|
@@ -77,11 +64,12 @@ const showAdditionalPropertiesError = (error) => {
|
|
|
77
64
|
.join('.');
|
|
78
65
|
const name = Object.keys(utils_1.PLUGIN_SCHEMAS).find(key => utils_1.PLUGIN_SCHEMAS[key].some((schemaItem) => schemaItem.target === target));
|
|
79
66
|
if (name) {
|
|
80
|
-
|
|
67
|
+
const packageManager = await (0, utils_1.getPackageManager)();
|
|
68
|
+
utils_1.signale.warn(`The configuration of ${utils_1.chalk.bold(target)} is provided by plugin ${utils_1.chalk.bold(name)}. Please use ${utils_1.chalk.bold(`${packageManager} run new`)} to enable the corresponding capability.\n`);
|
|
81
69
|
}
|
|
82
70
|
}
|
|
83
71
|
};
|
|
84
|
-
const resolveConfig = (loaded, configs, schemas, restartWithExistingPort, argv, onSchemaError = showAdditionalPropertiesError) =>
|
|
72
|
+
const resolveConfig = async (loaded, configs, schemas, restartWithExistingPort, argv, onSchemaError = showAdditionalPropertiesError) => {
|
|
85
73
|
var _a, _b;
|
|
86
74
|
const { config: userConfig, jsConfig, pkgConfig } = loaded;
|
|
87
75
|
const ajv = new ajv_1.default({ $data: true, strict: false });
|
|
@@ -92,8 +80,11 @@ const resolveConfig = (loaded, configs, schemas, restartWithExistingPort, argv,
|
|
|
92
80
|
// validate user config.
|
|
93
81
|
const valid = validate(userConfig);
|
|
94
82
|
if (!valid && ((_a = validate.errors) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
95
|
-
onSchemaError(validate === null || validate === void 0 ? void 0 : validate.errors[0]);
|
|
96
|
-
const errors = (0, better_ajv_errors_1.default)(validateSchema, userConfig, (_b = validate.errors) === null || _b === void 0 ? void 0 : _b.map(e => (
|
|
83
|
+
await onSchemaError(validate === null || validate === void 0 ? void 0 : validate.errors[0]);
|
|
84
|
+
const errors = (0, better_ajv_errors_1.default)(validateSchema, userConfig, (_b = validate.errors) === null || _b === void 0 ? void 0 : _b.map(e => ({
|
|
85
|
+
...e,
|
|
86
|
+
dataPath: e.instancePath,
|
|
87
|
+
})), {
|
|
97
88
|
indent: 2,
|
|
98
89
|
});
|
|
99
90
|
utils_1.signale.log(errors);
|
|
@@ -115,10 +106,10 @@ const resolveConfig = (loaded, configs, schemas, restartWithExistingPort, argv,
|
|
|
115
106
|
}
|
|
116
107
|
else {
|
|
117
108
|
// get port for new dev server
|
|
118
|
-
resolved.server.port =
|
|
109
|
+
resolved.server.port = await (0, utils_1.getPort)(resolved.server.port);
|
|
119
110
|
}
|
|
120
111
|
}
|
|
121
112
|
debug('resolved %o', resolved);
|
|
122
113
|
return resolved;
|
|
123
|
-
}
|
|
114
|
+
};
|
|
124
115
|
exports.resolveConfig = resolveConfig;
|
|
@@ -33,9 +33,9 @@ export interface SourceConfig {
|
|
|
33
33
|
moduleScopes?: Array<string | RegExp> | ((scopes: Array<string | RegExp>) => void) | ((scopes: Array<string | RegExp>) => Array<string | RegExp>);
|
|
34
34
|
include?: Array<string | RegExp>;
|
|
35
35
|
/**
|
|
36
|
-
* The configuration of `source.designSystem` is provided by
|
|
37
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
38
|
-
* @requires
|
|
36
|
+
* The configuration of `source.designSystem` is provided by `tailwindcss` plugin.
|
|
37
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
38
|
+
* @requires `tailwindcss` plugin
|
|
39
39
|
*/
|
|
40
40
|
designSystem?: Record<string, any>;
|
|
41
41
|
}
|
|
@@ -82,15 +82,15 @@ export interface OutputConfig {
|
|
|
82
82
|
enableTsLoader?: boolean;
|
|
83
83
|
/**
|
|
84
84
|
* Disables lazy import support for styles, currently supports antd and arco-design.
|
|
85
|
-
* The configuration of `output.disableAutoImportStyle` is provided by
|
|
86
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
87
|
-
* @requires
|
|
85
|
+
* The configuration of `output.disableAutoImportStyle` is provided by `unbundle` plugin.
|
|
86
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
87
|
+
* @requires `unbundle` plugin
|
|
88
88
|
*/
|
|
89
89
|
disableAutoImportStyle?: boolean;
|
|
90
90
|
/**
|
|
91
|
-
* The configuration of `output.ssg` is provided by
|
|
92
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
93
|
-
* @requires
|
|
91
|
+
* The configuration of `output.ssg` is provided by `ssg` plugin.
|
|
92
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
93
|
+
* @requires `ssg` plugin
|
|
94
94
|
*/
|
|
95
95
|
ssg?: SSGConfig;
|
|
96
96
|
}
|
|
@@ -115,15 +115,15 @@ export interface DevConfig {
|
|
|
115
115
|
assetPrefix?: string | boolean;
|
|
116
116
|
https?: boolean;
|
|
117
117
|
/**
|
|
118
|
-
* The configuration of `dev.proxy` is provided by
|
|
119
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
120
|
-
* @requires
|
|
118
|
+
* The configuration of `dev.proxy` is provided by `proxy` plugin.
|
|
119
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
120
|
+
* @requires `proxy` plugin
|
|
121
121
|
*/
|
|
122
122
|
proxy?: DevProxyOptions;
|
|
123
123
|
/**
|
|
124
|
-
* The configuration of `dev.unbundle` is provided by
|
|
125
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
126
|
-
* @requires
|
|
124
|
+
* The configuration of `dev.unbundle` is provided by `unbundle` plugin.
|
|
125
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
126
|
+
* @requires `unbundle` plugin
|
|
127
127
|
*/
|
|
128
128
|
unbundle?: UnbundleConfig;
|
|
129
129
|
}
|
|
@@ -167,27 +167,27 @@ export interface ToolsConfig {
|
|
|
167
167
|
minifyCss?: ConfigFunction;
|
|
168
168
|
esbuild?: Record<string, unknown>;
|
|
169
169
|
/**
|
|
170
|
-
* The configuration of `tools.tailwindcss` is provided by
|
|
171
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
172
|
-
* @requires
|
|
170
|
+
* The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.
|
|
171
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
172
|
+
* @requires `tailwindcss` plugin
|
|
173
173
|
*/
|
|
174
174
|
tailwindcss?: Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
|
175
175
|
/**
|
|
176
|
-
* The configuration of `tools.jest` is provided by
|
|
177
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
178
|
-
* @requires
|
|
176
|
+
* The configuration of `tools.jest` is provided by `testing` plugin.
|
|
177
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
178
|
+
* @requires `testing` plugin
|
|
179
179
|
*/
|
|
180
180
|
jest?: TestConfig['jest'];
|
|
181
181
|
/**
|
|
182
|
-
* The configuration of `tools.sass` is provided by
|
|
183
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
184
|
-
* @requires
|
|
182
|
+
* The configuration of `tools.sass` is provided by `sass` plugin.
|
|
183
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
184
|
+
* @requires `sass` plugin
|
|
185
185
|
*/
|
|
186
186
|
sass?: SassConfig;
|
|
187
187
|
/**
|
|
188
|
-
* The configuration of `tools.less` is provided by
|
|
189
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
190
|
-
* @requires
|
|
188
|
+
* The configuration of `tools.less` is provided by `less` plugin.
|
|
189
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
190
|
+
* @requires `less` plugin
|
|
191
191
|
*/
|
|
192
192
|
less?: LessConfig;
|
|
193
193
|
}
|
|
@@ -212,21 +212,21 @@ export interface UserConfig {
|
|
|
212
212
|
runtime?: RuntimeConfig;
|
|
213
213
|
runtimeByEntries?: RuntimeByEntriesConfig;
|
|
214
214
|
/**
|
|
215
|
-
* The configuration of `bff` is provided by
|
|
216
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
217
|
-
* @requires
|
|
215
|
+
* The configuration of `bff` is provided by `bff` plugin.
|
|
216
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
217
|
+
* @requires `bff` plugin
|
|
218
218
|
*/
|
|
219
219
|
bff?: BffConfig;
|
|
220
220
|
/**
|
|
221
|
-
* The configuration of `testing` is provided by
|
|
222
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
223
|
-
* @requires
|
|
221
|
+
* The configuration of `testing` is provided by `testing` plugin.
|
|
222
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
223
|
+
* @requires `testing` plugin
|
|
224
224
|
*/
|
|
225
225
|
testing?: TestConfig;
|
|
226
226
|
/**
|
|
227
|
-
* The configuration of `electron` is provided by
|
|
228
|
-
* Please use `yarn new` to enable the corresponding capability.
|
|
229
|
-
* @requires
|
|
227
|
+
* The configuration of `electron` is provided by `electron` plugin.
|
|
228
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
229
|
+
* @requires `electron` plugin
|
|
230
230
|
*/
|
|
231
231
|
electron?: ElectronConfig;
|
|
232
232
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -13,15 +9,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
11
|
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
14
|
};
|
|
@@ -60,23 +47,26 @@ utils_1.program
|
|
|
60
47
|
.name('modern')
|
|
61
48
|
.usage('<command> [options]')
|
|
62
49
|
.version(process.env.MODERN_JS_VERSION || '0.1.0');
|
|
63
|
-
const initAppDir = (cwd) =>
|
|
50
|
+
const initAppDir = async (cwd) => {
|
|
64
51
|
if (!cwd) {
|
|
65
52
|
// eslint-disable-next-line no-param-reassign
|
|
66
53
|
cwd = process.cwd();
|
|
67
54
|
}
|
|
68
|
-
const pkg =
|
|
55
|
+
const pkg = await (0, utils_1.pkgUp)({ cwd });
|
|
69
56
|
if (!pkg) {
|
|
70
57
|
throw new Error(`no package.json found in current work dir: ${cwd}`);
|
|
71
58
|
}
|
|
72
59
|
return path_1.default.dirname(pkg);
|
|
73
|
-
}
|
|
60
|
+
};
|
|
74
61
|
exports.initAppDir = initAppDir;
|
|
75
62
|
const mergeOptions = (options) => {
|
|
76
63
|
const defaultOptions = {
|
|
77
64
|
serverConfigFile: utils_1.DEFAULT_SERVER_CONFIG,
|
|
78
65
|
};
|
|
79
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
...defaultOptions,
|
|
68
|
+
...options,
|
|
69
|
+
};
|
|
80
70
|
};
|
|
81
71
|
exports.mergeOptions = mergeOptions;
|
|
82
72
|
const createCli = () => {
|
|
@@ -84,17 +74,17 @@ const createCli = () => {
|
|
|
84
74
|
let isRestart = false;
|
|
85
75
|
let restartWithExistingPort = 0;
|
|
86
76
|
let restartOptions;
|
|
87
|
-
const init = (argv = [], options) =>
|
|
77
|
+
const init = async (argv = [], options) => {
|
|
88
78
|
var _a, _b;
|
|
89
79
|
(0, node_1.enable)();
|
|
90
80
|
manager_1.manager.clear();
|
|
91
81
|
const mergedOptions = (0, exports.mergeOptions)(options);
|
|
92
82
|
restartOptions = mergedOptions;
|
|
93
|
-
const appDirectory =
|
|
83
|
+
const appDirectory = await initAppDir();
|
|
94
84
|
(0, commander_1.initCommandsMap)();
|
|
95
85
|
const metaName = (_b = (_a = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.options) === null || _a === void 0 ? void 0 : _a.metaName) !== null && _b !== void 0 ? _b : 'MODERN';
|
|
96
86
|
(0, loadEnv_1.loadEnv)(appDirectory, process.env[`${metaName.toUpperCase()}_ENV`]);
|
|
97
|
-
const loaded =
|
|
87
|
+
const loaded = await (0, config_1.loadUserConfig)(appDirectory, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.configFile, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.packageJsonConfig);
|
|
98
88
|
const plugins = (0, loadPlugins_1.loadPlugins)(appDirectory, loaded.config, {
|
|
99
89
|
internalPlugins: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.plugins,
|
|
100
90
|
transformPlugin: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.transformPlugin,
|
|
@@ -113,10 +103,10 @@ const createCli = () => {
|
|
|
113
103
|
context_1.ConfigContext.set(loaded.config);
|
|
114
104
|
context_1.AppContext.set(appContext);
|
|
115
105
|
});
|
|
116
|
-
hooksRunner =
|
|
106
|
+
hooksRunner = await manager_1.manager.init();
|
|
117
107
|
['SIGINT', 'SIGTERM', 'unhandledRejection', 'uncaughtException'].forEach(event => {
|
|
118
|
-
process.on(event, (err) =>
|
|
119
|
-
|
|
108
|
+
process.on(event, async (err) => {
|
|
109
|
+
await hooksRunner.beforeExit();
|
|
120
110
|
if (err instanceof Error) {
|
|
121
111
|
utils_1.logger.error(err.stack);
|
|
122
112
|
}
|
|
@@ -124,53 +114,58 @@ const createCli = () => {
|
|
|
124
114
|
// eslint-disable-next-line no-process-exit
|
|
125
115
|
process.exit(1);
|
|
126
116
|
});
|
|
127
|
-
})
|
|
117
|
+
});
|
|
128
118
|
});
|
|
129
|
-
const extraConfigs =
|
|
130
|
-
const extraSchemas =
|
|
131
|
-
const config =
|
|
132
|
-
const { resolved } =
|
|
119
|
+
const extraConfigs = await hooksRunner.config();
|
|
120
|
+
const extraSchemas = await hooksRunner.validateSchema();
|
|
121
|
+
const config = await (0, config_1.resolveConfig)(loaded, extraConfigs, extraSchemas, restartWithExistingPort, argv, options === null || options === void 0 ? void 0 : options.onSchemaError);
|
|
122
|
+
const { resolved } = await hooksRunner.resolvedConfig({
|
|
133
123
|
resolved: config,
|
|
134
124
|
});
|
|
135
125
|
// update context value
|
|
136
126
|
manager_1.manager.run(() => {
|
|
137
127
|
context_1.ConfigContext.set(loaded.config);
|
|
138
128
|
context_1.ResolvedConfigContext.set(resolved);
|
|
139
|
-
context_1.AppContext.set(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
function run(argv, options) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const { loadedConfig, appContext, resolved } = yield init(argv, options);
|
|
147
|
-
yield hooksRunner.commands({ program: utils_1.program });
|
|
148
|
-
(0, initWatcher_1.initWatcher)(loadedConfig, appContext.appDirectory, resolved.source.configDir, hooksRunner, argv);
|
|
149
|
-
manager_1.manager.run(() => utils_1.program.parse(process.argv));
|
|
129
|
+
context_1.AppContext.set({
|
|
130
|
+
...appContext,
|
|
131
|
+
port: resolved.server.port,
|
|
132
|
+
distDirectory: (0, utils_1.ensureAbsolutePath)(appDirectory, resolved.output.path),
|
|
133
|
+
});
|
|
150
134
|
});
|
|
135
|
+
await hooksRunner.prepare();
|
|
136
|
+
return {
|
|
137
|
+
loadedConfig: loaded,
|
|
138
|
+
// appContext may be updated in `prepare` hook, should return latest value
|
|
139
|
+
appContext: (0, context_1.useAppContext)(),
|
|
140
|
+
resolved,
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
async function run(argv, options) {
|
|
144
|
+
const { loadedConfig, appContext, resolved } = await init(argv, options);
|
|
145
|
+
await hooksRunner.commands({ program: utils_1.program });
|
|
146
|
+
(0, initWatcher_1.initWatcher)(loadedConfig, appContext.appDirectory, resolved.source.configDir, hooksRunner, argv);
|
|
147
|
+
manager_1.manager.run(() => utils_1.program.parse(process.argv));
|
|
151
148
|
}
|
|
152
|
-
function restart() {
|
|
149
|
+
async function restart() {
|
|
153
150
|
var _a, _b;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
151
|
+
isRestart = true;
|
|
152
|
+
restartWithExistingPort = isRestart ? (_b = (_a = context_1.AppContext.use().value) === null || _a === void 0 ? void 0 : _a.port) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
153
|
+
utils_1.logger.info('Restart...\n');
|
|
154
|
+
let hasGetError = false;
|
|
155
|
+
const runner = manager_1.manager.useRunner();
|
|
156
|
+
await runner.beforeRestart();
|
|
157
|
+
try {
|
|
158
|
+
await init(process.argv.slice(2), restartOptions);
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
console.error(err);
|
|
162
|
+
hasGetError = true;
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
if (!hasGetError) {
|
|
166
|
+
manager_1.manager.run(() => utils_1.program.parse(process.argv));
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
if (!hasGetError) {
|
|
170
|
-
manager_1.manager.run(() => utils_1.program.parse(process.argv));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
168
|
+
}
|
|
174
169
|
}
|
|
175
170
|
return {
|
|
176
171
|
init,
|
package/dist/initWatcher.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -20,10 +11,10 @@ const utils_1 = require("@modern-js/utils");
|
|
|
20
11
|
const debug = (0, utils_1.createDebugger)('watch-files');
|
|
21
12
|
const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
22
13
|
const hashMap = new Map();
|
|
23
|
-
const initWatcher = (loaded, appDirectory, configDir, hooksRunner, argv) =>
|
|
14
|
+
const initWatcher = async (loaded, appDirectory, configDir, hooksRunner, argv) => {
|
|
24
15
|
// only add fs watcher on dev mode.
|
|
25
16
|
if (((0, utils_1.isDev)() || (0, utils_1.isTest)()) && argv[0] === 'dev') {
|
|
26
|
-
const extraFiles =
|
|
17
|
+
const extraFiles = await hooksRunner.watchFiles();
|
|
27
18
|
const configPath = path_1.default.join(appDirectory, configDir);
|
|
28
19
|
const watched = [
|
|
29
20
|
`${configPath}/html`,
|
|
@@ -71,5 +62,5 @@ const initWatcher = (loaded, appDirectory, configDir, hooksRunner, argv) => __aw
|
|
|
71
62
|
});
|
|
72
63
|
return watcher;
|
|
73
64
|
}
|
|
74
|
-
}
|
|
65
|
+
};
|
|
75
66
|
exports.initWatcher = initWatcher;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.10.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"main": "./dist/index.js",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@modern-js/load-config": "^1.3.1",
|
|
44
44
|
"@modern-js/plugin": "^1.3.3",
|
|
45
|
-
"@modern-js/utils": "^1.
|
|
45
|
+
"@modern-js/utils": "^1.7.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@jest/types": "^27.0.6",
|
|
49
|
-
"@modern-js/types": "1.5.
|
|
49
|
+
"@modern-js/types": "1.5.2",
|
|
50
50
|
"@scripts/build": "0.0.0",
|
|
51
51
|
"@scripts/jest-config": "0.0.0",
|
|
52
52
|
"@types/babel__code-frame": "^7.0.3",
|
|
@@ -63,19 +63,18 @@
|
|
|
63
63
|
"electron-builder": "22.7.0",
|
|
64
64
|
"terser-webpack-plugin": "^5.1.4",
|
|
65
65
|
"typescript": "^4",
|
|
66
|
-
"webpack": "^5.71.0"
|
|
67
|
-
"webpack-chain": "^6.5.1"
|
|
66
|
+
"webpack": "^5.71.0"
|
|
68
67
|
},
|
|
69
68
|
"sideEffects": false,
|
|
70
69
|
"publishConfig": {
|
|
71
70
|
"registry": "https://registry.npmjs.org/",
|
|
72
|
-
"access": "public"
|
|
73
|
-
"types": "./dist/index.d.ts"
|
|
71
|
+
"access": "public"
|
|
74
72
|
},
|
|
75
73
|
"scripts": {
|
|
76
74
|
"new": "modern new",
|
|
77
75
|
"build": "tsc",
|
|
78
76
|
"dev": "tsc --watch",
|
|
79
77
|
"test": "jest"
|
|
80
|
-
}
|
|
78
|
+
},
|
|
79
|
+
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
81
80
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnySchemaObject } from './types';
|
|
2
|
-
import AjvCore from './core';
|
|
3
|
-
declare class Ajv extends AjvCore {
|
|
4
|
-
_addVocabularies(): void;
|
|
5
|
-
_addDefaultMetaSchema(): void;
|
|
6
|
-
defaultMeta(): string | AnySchemaObject | undefined;
|
|
7
|
-
}
|
|
8
|
-
export default Ajv;
|
|
9
|
-
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
|
10
|
-
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
|
11
|
-
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
|
12
|
-
export { KeywordCxt } from "./compile/validate";
|
|
13
|
-
export { DefinedError } from "./vocabularies/errors";
|
|
14
|
-
export { JSONType } from "./compile/rules";
|
|
15
|
-
export { JSONSchemaType } from "./types/json-schema";
|
|
16
|
-
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare abstract class _CodeOrName {
|
|
2
|
-
abstract readonly str: string;
|
|
3
|
-
abstract readonly names: UsedNames;
|
|
4
|
-
abstract toString(): string;
|
|
5
|
-
abstract emptyStr(): boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const IDENTIFIER: RegExp;
|
|
8
|
-
export declare class Name extends _CodeOrName {
|
|
9
|
-
readonly str: string;
|
|
10
|
-
constructor(s: string);
|
|
11
|
-
toString(): string;
|
|
12
|
-
emptyStr(): boolean;
|
|
13
|
-
get names(): UsedNames;
|
|
14
|
-
}
|
|
15
|
-
export declare class _Code extends _CodeOrName {
|
|
16
|
-
readonly _items: readonly CodeItem[];
|
|
17
|
-
private _str?;
|
|
18
|
-
private _names?;
|
|
19
|
-
constructor(code: string | readonly CodeItem[]);
|
|
20
|
-
toString(): string;
|
|
21
|
-
emptyStr(): boolean;
|
|
22
|
-
get str(): string;
|
|
23
|
-
get names(): UsedNames;
|
|
24
|
-
}
|
|
25
|
-
export declare type CodeItem = Name | string | number | boolean | null;
|
|
26
|
-
export declare type UsedNames = Record<string, number | undefined>;
|
|
27
|
-
export declare type Code = _Code | Name;
|
|
28
|
-
export declare type SafeExpr = Code | number | boolean | null;
|
|
29
|
-
export declare const nil: _Code;
|
|
30
|
-
declare type CodeArg = SafeExpr | string | undefined;
|
|
31
|
-
export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code;
|
|
32
|
-
export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code;
|
|
33
|
-
export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void;
|
|
34
|
-
export declare function strConcat(c1: Code, c2: Code): Code;
|
|
35
|
-
export declare function stringify(x: unknown): Code;
|
|
36
|
-
export declare function safeStringify(x: unknown): string;
|
|
37
|
-
export declare function getProperty(key: Code | string | number): Code;
|
|
38
|
-
export declare function getEsmExportName(key: Code | string | number): Code;
|
|
39
|
-
export declare function regexpCode(rx: RegExp): Code;
|
|
40
|
-
export {};
|