@modern-js/core 2.58.1 → 2.58.3
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/config/createDefaultConfig.d.ts +1 -1
- package/dist/config/createLoadedConfig.d.ts +1 -1
- package/dist/config/createLoadedConfig.js +1 -1
- package/dist/config/createResolvedConfig.d.ts +1 -1
- package/dist/config/loadConfig.js +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +2 -1
- package/dist/createCli.js +3 -3
- package/dist/loadPlugins.d.ts +2 -2
- package/dist/loadPlugins.js +1 -1
- package/dist/manager.d.ts +1 -1
- package/dist/nodeApi.d.ts +1 -1
- package/dist/runBin.d.ts +1 -1
- package/dist/types/config/index.d.ts +1 -1
- package/dist/types/context.d.ts +3 -1
- package/dist/types/coreOptions.d.ts +1 -1
- package/dist/types/hooks.d.ts +2 -2
- package/dist/types/plugin.d.ts +3 -3
- package/dist/types/pluginAPI.d.ts +3 -3
- package/dist/utils/commander.d.ts +1 -1
- package/dist/utils/createFileWatcher.js +1 -1
- package/dist/utils/initAppDir.d.ts +1 -1
- package/dist/utils/initAppDir.js +2 -4
- package/dist/utils/mergeConfig.d.ts +1 -1
- package/package.json +8 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UserConfig } from '../types';
|
|
1
|
+
import type { UserConfig } from '../types';
|
|
2
2
|
export declare function createDefaultConfig(): UserConfig;
|
|
@@ -33,8 +33,8 @@ __export(createLoadedConfig_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(createLoadedConfig_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
|
-
var import_lodash = require("@modern-js/utils/lodash");
|
|
37
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
|
38
38
|
var import_utils2 = require("../utils");
|
|
39
39
|
var import_loadConfig = require("./loadConfig");
|
|
40
40
|
const assignPkgConfig = (userConfig = {}, pkgConfig = {}) => (0, import_lodash.mergeWith)({}, userConfig, pkgConfig, (objValue, srcValue) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoadedConfig, NormalizedConfig, UserConfig } from '../types';
|
|
2
2
|
export declare const createResolveConfig: (loaded: LoadedConfig<{}>, configs: UserConfig[]) => Promise<NormalizedConfig>;
|
|
@@ -39,8 +39,8 @@ __export(loadConfig_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(loadConfig_exports);
|
|
41
41
|
var import_path = __toESM(require("path"));
|
|
42
|
-
var import_utils = require("@modern-js/utils");
|
|
43
42
|
var import_node_bundle_require = require("@modern-js/node-bundle-require");
|
|
43
|
+
var import_utils = require("@modern-js/utils");
|
|
44
44
|
const debug = (0, import_utils.createDebugger)("load-config");
|
|
45
45
|
const CONFIG_FILE_NAME = "modern.config";
|
|
46
46
|
const LOCAL_CONFIG_FILE_NAME = "modern.config.local";
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliPlugin,
|
|
1
|
+
import type { CliPlugin, IAppContext, NormalizedConfig, UserConfig } from './types';
|
|
2
2
|
export declare const AppContext: import("@modern-js/plugin").Context<IAppContext>;
|
|
3
3
|
export declare const ConfigContext: import("@modern-js/plugin").Context<UserConfig<any>>;
|
|
4
4
|
export declare const ResolvedConfigContext: import("@modern-js/plugin").Context<NormalizedConfig<any>>;
|
package/dist/context.js
CHANGED
|
@@ -39,8 +39,8 @@ __export(context_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(context_exports);
|
|
41
41
|
var import_path = __toESM(require("path"));
|
|
42
|
-
var import_utils = require("@modern-js/utils");
|
|
43
42
|
var import_plugin = require("@modern-js/plugin");
|
|
43
|
+
var import_utils = require("@modern-js/utils");
|
|
44
44
|
const AppContext = (0, import_plugin.createContext)({});
|
|
45
45
|
const ConfigContext = (0, import_plugin.createContext)({});
|
|
46
46
|
const ResolvedConfigContext = (0, import_plugin.createContext)({});
|
|
@@ -59,6 +59,7 @@ const initAppContext = ({ appDirectory, plugins, configFile, runtimeConfigFile,
|
|
|
59
59
|
ip: import_utils.address.ip(),
|
|
60
60
|
port: 0,
|
|
61
61
|
packageName: require(import_path.default.resolve(appDirectory, "./package.json")).name,
|
|
62
|
+
moduleType: require(import_path.default.resolve(appDirectory, "./package.json")).type || "commonjs",
|
|
62
63
|
srcDirectory: import_path.default.resolve(appDirectory, srcDir),
|
|
63
64
|
apiDirectory: import_path.default.resolve(appDirectory, apiDir),
|
|
64
65
|
lambdaDirectory: import_path.default.resolve(appDirectory, apiDir, "lambda"),
|
package/dist/createCli.js
CHANGED
|
@@ -23,12 +23,12 @@ __export(createCli_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(createCli_exports);
|
|
25
25
|
var import_utils = require("@modern-js/utils");
|
|
26
|
-
var
|
|
27
|
-
var import_loadPlugins = require("./loadPlugins");
|
|
26
|
+
var import_config = require("./config");
|
|
28
27
|
var import_context = require("./context");
|
|
29
28
|
var import_loadEnv = require("./loadEnv");
|
|
29
|
+
var import_loadPlugins = require("./loadPlugins");
|
|
30
30
|
var import_manager = require("./manager");
|
|
31
|
-
var
|
|
31
|
+
var import_utils2 = require("./utils");
|
|
32
32
|
var import_checkIsDuplicationPlugin = require("./utils/checkIsDuplicationPlugin");
|
|
33
33
|
const setProgramVersion = (version = "unknown") => {
|
|
34
34
|
import_utils.program.name("modern").usage("<command> [options]").version(version);
|
package/dist/loadPlugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InternalPlugins } from '@modern-js/types';
|
|
2
|
-
import type { CliPlugin,
|
|
1
|
+
import type { InternalPlugins } from '@modern-js/types';
|
|
2
|
+
import type { CliPlugin, OldPluginConfig, PluginConfig, UserConfig } from './types';
|
|
3
3
|
export declare const isOldPluginConfig: (config?: PluginConfig) => config is OldPluginConfig;
|
|
4
4
|
/**
|
|
5
5
|
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
package/dist/loadPlugins.js
CHANGED
|
@@ -31,7 +31,7 @@ const resolveCliPlugin = async (p, appDirectory) => {
|
|
|
31
31
|
const path = (0, import_utils.tryResolve)(pkg, appDirectory);
|
|
32
32
|
let module2;
|
|
33
33
|
try {
|
|
34
|
-
module2 = (0, import_utils.
|
|
34
|
+
module2 = await (0, import_utils.compatibleRequire)(path);
|
|
35
35
|
} catch (e) {
|
|
36
36
|
({ default: module2 } = await (0, import_utils.dynamicImport)(path));
|
|
37
37
|
}
|
package/dist/manager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasePluginAPI } from './types';
|
|
1
|
+
import type { BasePluginAPI } from './types';
|
|
2
2
|
export declare const manager: import("@modern-js/plugin").AsyncManager<{
|
|
3
3
|
beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
|
|
4
4
|
config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
|
package/dist/nodeApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreOptions } from '.';
|
|
1
|
+
import { type CoreOptions } from '.';
|
|
2
2
|
export declare const dev: (options?: CoreOptions, commandOptions?: string[]) => void;
|
|
3
3
|
export declare const build: (options?: CoreOptions, commandOptions?: string[]) => void;
|
|
4
4
|
export declare const deploy: (options?: CoreOptions, commandOptions?: string[]) => void;
|
package/dist/runBin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { CoreOptions } from '.';
|
|
2
|
+
import { type CoreOptions } from '.';
|
|
3
3
|
export declare const run: (otherCoreOptions?: CoreOptions, options?: {
|
|
4
4
|
override?: boolean | ((coreOptions: CoreOptions) => Promise<CoreOptions> | CoreOptions) | undefined;
|
|
5
5
|
}) => Promise<void>;
|
package/dist/types/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entrypoint,
|
|
1
|
+
import type { Entrypoint, HtmlPartials, HtmlTemplates, ServerPlugin, ServerRoute } from '@modern-js/types';
|
|
2
2
|
import type { UniBuilderInstance, UniBuilderWebpackInstance } from '@modern-js/uni-builder';
|
|
3
3
|
export type ToolsType = 'app-tools' | 'module-tools' | 'monorepo-tools';
|
|
4
4
|
export interface IAppContext {
|
|
@@ -34,6 +34,8 @@ export interface IAppContext {
|
|
|
34
34
|
port?: number;
|
|
35
35
|
/** Name of the current project's package.json */
|
|
36
36
|
packageName: string;
|
|
37
|
+
/** Type field of package.json */
|
|
38
|
+
moduleType: 'module' | 'commonjs';
|
|
37
39
|
/** Currently registered plugins */
|
|
38
40
|
plugins: any[];
|
|
39
41
|
/** Information for entry points */
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AsyncWaterfall, AsyncWorkflow, ParallelWorkflow, ToRunners, ToThreads, Workflow } from '@modern-js/plugin';
|
|
2
2
|
import type { Command } from '@modern-js/utils';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NormalizedConfig, UserConfig } from './config';
|
|
4
4
|
export type BaseHooks<Extends extends {
|
|
5
5
|
hooks?: ExtendHooks;
|
|
6
6
|
userConfig?: ExtendUserConfig;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AsyncSetup, PluginOptions } from '@modern-js/plugin';
|
|
2
|
-
import { BaseHooks } from './hooks';
|
|
3
|
-
import { BasePluginAPI } from './pluginAPI';
|
|
1
|
+
import type { AsyncSetup, PluginOptions } from '@modern-js/plugin';
|
|
2
|
+
import type { BaseHooks } from './hooks';
|
|
3
|
+
import type { BasePluginAPI } from './pluginAPI';
|
|
4
4
|
export type { InternalPlugins } from '@modern-js/types';
|
|
5
5
|
/** Plugin options of a cli plugin. */
|
|
6
6
|
export type CliPlugin<Extends extends {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { setAppContext, useAppContext,
|
|
3
|
-
import { BaseHooks } from './hooks';
|
|
1
|
+
import type { CommonAPI } from '@modern-js/plugin';
|
|
2
|
+
import type { setAppContext, useAppContext, useConfigContext, useResolvedConfigContext } from '../context';
|
|
3
|
+
import type { BaseHooks } from './hooks';
|
|
4
4
|
export type BasePluginAPI<Extends extends {
|
|
5
5
|
hooks?: ExtendHooks;
|
|
6
6
|
userConfig?: ExtendUserConfig;
|
|
@@ -32,8 +32,8 @@ __export(createFileWatcher_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(createFileWatcher_exports);
|
|
34
34
|
var import_crypto = __toESM(require("crypto"));
|
|
35
|
-
var path = __toESM(require("path"));
|
|
36
35
|
var fs = __toESM(require("fs"));
|
|
36
|
+
var path = __toESM(require("path"));
|
|
37
37
|
var import_utils = require("@modern-js/utils");
|
|
38
38
|
const debug = (0, import_utils.createDebugger)("watch-files");
|
|
39
39
|
const hashMap = /* @__PURE__ */ new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initAppDir: (
|
|
1
|
+
export declare const initAppDir: (currentDir?: string) => Promise<string>;
|
package/dist/utils/initAppDir.js
CHANGED
|
@@ -33,10 +33,8 @@ __export(initAppDir_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(initAppDir_exports);
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
-
const initAppDir = async (
|
|
37
|
-
|
|
38
|
-
cwd = process.cwd();
|
|
39
|
-
}
|
|
36
|
+
const initAppDir = async (currentDir) => {
|
|
37
|
+
const cwd = currentDir || process.cwd();
|
|
40
38
|
const pkg = await (0, import_utils.pkgUp)({
|
|
41
39
|
cwd
|
|
42
40
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NormalizedConfig, UserConfig } from '../types';
|
|
2
2
|
export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig> | NormalizedConfig<ExtendConfig>)[]) => NormalizedConfig<ExtendConfig>;
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"modern",
|
|
15
15
|
"modern.js"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.58.
|
|
17
|
+
"version": "2.58.3",
|
|
18
18
|
"jsnext:source": "./src/index.ts",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@swc/helpers": "0.5.3",
|
|
74
|
-
"@modern-js/node-bundle-require": "2.58.
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/
|
|
74
|
+
"@modern-js/node-bundle-require": "2.58.3",
|
|
75
|
+
"@modern-js/plugin": "2.58.3",
|
|
76
|
+
"@modern-js/utils": "2.58.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/jest": "^29",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"jest": "^29",
|
|
82
82
|
"tsm": "2.3.0",
|
|
83
83
|
"typescript": "^5",
|
|
84
|
-
"@
|
|
85
|
-
"@modern-js/types": "2.58.
|
|
86
|
-
"@scripts/jest-config": "2.58.
|
|
87
|
-
"@
|
|
84
|
+
"@modern-js/uni-builder": "2.58.3",
|
|
85
|
+
"@modern-js/types": "2.58.3",
|
|
86
|
+
"@scripts/jest-config": "2.58.3",
|
|
87
|
+
"@scripts/build": "2.58.3"
|
|
88
88
|
},
|
|
89
89
|
"sideEffects": false,
|
|
90
90
|
"publishConfig": {
|