@modern-js/plugin 3.0.0-alpha.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/run/config/loadConfig.js +10 -10
- package/dist/esm/cli/api.mjs +1 -1
- package/dist/esm/cli/context.mjs +1 -1
- package/dist/esm/cli/hooks.mjs +1 -1
- package/dist/esm/cli/index.mjs +6 -6
- package/dist/esm/cli/run/config/createLoadedConfig.mjs +2 -2
- package/dist/esm/cli/run/config/createResolvedConfig.mjs +1 -1
- package/dist/esm/cli/run/config/loadConfig.mjs +12 -11
- package/dist/esm/cli/run/create.mjs +9 -9
- package/dist/esm/cli/run/index.mjs +5 -5
- package/dist/esm/cli/run/run.mjs +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/runtime/context.mjs +1 -1
- package/dist/esm/runtime/hooks.mjs +1 -1
- package/dist/esm/runtime/index.mjs +4 -4
- package/dist/esm/runtime/run/create.mjs +3 -3
- package/dist/esm/runtime/run/index.mjs +1 -1
- package/dist/esm/server/context.mjs +1 -1
- package/dist/esm/server/hooks.mjs +1 -1
- package/dist/esm/server/index.mjs +4 -4
- package/dist/esm/server/run/create.mjs +3 -3
- package/dist/esm/server/run/index.mjs +1 -1
- package/dist/esm-node/cli/api.mjs +1 -0
- package/dist/esm-node/cli/context.mjs +1 -0
- package/dist/esm-node/cli/hooks.mjs +1 -0
- package/dist/esm-node/cli/index.mjs +1 -0
- package/dist/esm-node/cli/run/config/createLoadedConfig.mjs +1 -0
- package/dist/esm-node/cli/run/config/createResolvedConfig.mjs +1 -0
- package/dist/esm-node/cli/run/config/loadConfig.mjs +15 -11
- package/dist/esm-node/cli/run/create.mjs +1 -0
- package/dist/esm-node/cli/run/index.mjs +1 -0
- package/dist/esm-node/cli/run/run.mjs +1 -0
- package/dist/esm-node/cli/run/types.mjs +1 -0
- package/dist/esm-node/cli/run/utils/checkIsDuplicationPlugin.mjs +1 -0
- package/dist/esm-node/cli/run/utils/commander.mjs +1 -0
- package/dist/esm-node/cli/run/utils/createFileWatcher.mjs +1 -0
- package/dist/esm-node/cli/run/utils/debug.mjs +1 -0
- package/dist/esm-node/cli/run/utils/initAppDir.mjs +1 -0
- package/dist/esm-node/cli/run/utils/mergeConfig.mjs +1 -0
- package/dist/esm-node/hooks.mjs +1 -0
- package/dist/esm-node/index.mjs +1 -0
- package/dist/esm-node/manager.mjs +1 -0
- package/dist/esm-node/runtime/api.mjs +1 -0
- package/dist/esm-node/runtime/context.mjs +1 -0
- package/dist/esm-node/runtime/hooks.mjs +1 -0
- package/dist/esm-node/runtime/index.mjs +1 -0
- package/dist/esm-node/runtime/run/create.mjs +1 -0
- package/dist/esm-node/runtime/run/index.mjs +1 -0
- package/dist/esm-node/runtime/run/types.mjs +1 -0
- package/dist/esm-node/server/api.mjs +1 -0
- package/dist/esm-node/server/context.mjs +1 -0
- package/dist/esm-node/server/hooks.mjs +1 -0
- package/dist/esm-node/server/index.mjs +1 -0
- package/dist/esm-node/server/run/create.mjs +1 -0
- package/dist/esm-node/server/run/index.mjs +1 -0
- package/dist/esm-node/server/run/types.mjs +1 -0
- package/dist/esm-node/types/cli/api.mjs +1 -0
- package/dist/esm-node/types/cli/context.mjs +1 -0
- package/dist/esm-node/types/cli/hooks.mjs +1 -0
- package/dist/esm-node/types/cli/index.mjs +1 -0
- package/dist/esm-node/types/cli/plugin.mjs +1 -0
- package/dist/esm-node/types/hooks.mjs +1 -0
- package/dist/esm-node/types/index.mjs +1 -0
- package/dist/esm-node/types/plugin.mjs +1 -0
- package/dist/esm-node/types/runtime/api.mjs +1 -0
- package/dist/esm-node/types/runtime/context.mjs +1 -0
- package/dist/esm-node/types/runtime/hooks.mjs +1 -0
- package/dist/esm-node/types/runtime/index.mjs +1 -0
- package/dist/esm-node/types/runtime/plugin.mjs +1 -0
- package/dist/esm-node/types/server/api.mjs +1 -0
- package/dist/esm-node/types/server/context.mjs +1 -0
- package/dist/esm-node/types/server/hooks.mjs +1 -0
- package/dist/esm-node/types/server/index.mjs +1 -0
- package/dist/esm-node/types/server/plugin.mjs +1 -0
- package/dist/esm-node/types/utils.mjs +1 -0
- package/package.json +24 -25
|
@@ -42,7 +42,6 @@ const external_path_namespaceObject = require("path");
|
|
|
42
42
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
43
43
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
44
44
|
const external_jiti_namespaceObject = require("jiti");
|
|
45
|
-
var external_jiti_default = /*#__PURE__*/ __webpack_require__.n(external_jiti_namespaceObject);
|
|
46
45
|
const getConfigFilePath = (appDirectory, configFilePath)=>{
|
|
47
46
|
if (external_path_default().isAbsolute(configFilePath)) return configFilePath;
|
|
48
47
|
return external_path_default().resolve(appDirectory, configFilePath);
|
|
@@ -59,15 +58,16 @@ const clearFilesOverTime = async (targetDir, overtime)=>{
|
|
|
59
58
|
}
|
|
60
59
|
} catch (err) {}
|
|
61
60
|
};
|
|
62
|
-
function loadConfigContent(configFile) {
|
|
63
|
-
const
|
|
64
|
-
|
|
61
|
+
async function loadConfigContent(configFile) {
|
|
62
|
+
const jitiFrom = __filename;
|
|
63
|
+
const jiti = (0, external_jiti_namespaceObject.createJiti)(jitiFrom, {
|
|
65
64
|
requireCache: false,
|
|
66
65
|
interopDefault: true
|
|
67
66
|
});
|
|
68
67
|
if (!utils_namespaceObject.fs.existsSync(configFile)) throw new Error(`Configuration file does not exist: ${configFile}`);
|
|
69
68
|
try {
|
|
70
|
-
|
|
69
|
+
let config;
|
|
70
|
+
config = jiti(configFile);
|
|
71
71
|
return config.default || config;
|
|
72
72
|
} catch (e) {
|
|
73
73
|
if (e instanceof Error) e.message = `Get Error while loading config file: ${configFile}, please check it and retry.\n${e.message || ''}`;
|
|
@@ -75,23 +75,23 @@ function loadConfigContent(configFile) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
const loadTypeScriptFile = (filePath)=>{
|
|
78
|
-
const
|
|
79
|
-
esmResolve: true,
|
|
78
|
+
const jiti = (0, external_jiti_namespaceObject.createJiti)(__filename, {
|
|
80
79
|
requireCache: false,
|
|
81
80
|
interopDefault: true
|
|
82
81
|
});
|
|
83
82
|
if (!utils_namespaceObject.fs.existsSync(filePath)) throw new Error(`TypeScript file does not exist: ${filePath}`);
|
|
84
83
|
try {
|
|
85
|
-
return
|
|
84
|
+
return jiti(filePath);
|
|
86
85
|
} catch (e) {
|
|
87
86
|
if (e instanceof Error) e.message = `Get Error while loading TypeScript file: ${filePath}, please check it and retry.\n${e.message || ''}`;
|
|
88
87
|
throw e;
|
|
89
88
|
}
|
|
90
89
|
};
|
|
91
90
|
const loadConfig = async (appDirectory, configFile)=>{
|
|
92
|
-
const
|
|
91
|
+
const pkg = await (0, utils_namespaceObject.compatibleRequire)(external_path_default().resolve(appDirectory, './package.json'));
|
|
92
|
+
const packageName = pkg.name;
|
|
93
93
|
let config;
|
|
94
|
-
if (configFile) config = loadConfigContent(configFile);
|
|
94
|
+
if (configFile) config = await loadConfigContent(configFile);
|
|
95
95
|
return {
|
|
96
96
|
packageName,
|
|
97
97
|
configFile,
|
package/dist/esm/cli/api.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assign as lodash_assign } from "@modern-js/utils/lodash";
|
|
2
|
-
import { debug } from "./run/utils/debug";
|
|
2
|
+
import { debug } from "./run/utils/debug.mjs";
|
|
3
3
|
function initPluginAPI({ context, pluginManager }) {
|
|
4
4
|
const { hooks, extendsHooks, plugins } = context;
|
|
5
5
|
function getAppContext() {
|
package/dist/esm/cli/context.mjs
CHANGED
package/dist/esm/cli/hooks.mjs
CHANGED
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { initPluginAPI } from "./api";
|
|
2
|
-
import { createContext, initAppContext } from "./context";
|
|
3
|
-
import { initHooks } from "./hooks";
|
|
4
|
-
import { cli, createCli, createLoadedConfig, initAppDir } from "./run";
|
|
5
|
-
import { createStorybookOptions } from "./run/create";
|
|
6
|
-
import { mergeConfig } from "./run/utils/mergeConfig";
|
|
1
|
+
import { initPluginAPI } from "./api.mjs";
|
|
2
|
+
import { createContext, initAppContext } from "./context.mjs";
|
|
3
|
+
import { initHooks } from "./hooks.mjs";
|
|
4
|
+
import { cli, createCli, createLoadedConfig, initAppDir } from "./run/index.mjs";
|
|
5
|
+
import { createStorybookOptions } from "./run/create.mjs";
|
|
6
|
+
import { mergeConfig } from "./run/utils/mergeConfig.mjs";
|
|
7
7
|
export { cli, createCli, createContext, createLoadedConfig, createStorybookOptions, initAppContext, initAppDir, initHooks, initPluginAPI, mergeConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONFIG_FILE_EXTENSIONS, chalk, fs, getCommand, getNodeEnv, isDevCommand, logger } from "@modern-js/utils";
|
|
2
|
-
import { mergeConfig } from "../utils/mergeConfig";
|
|
3
|
-
import { getConfigFilePath, loadConfig } from "./loadConfig";
|
|
2
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
3
|
+
import { getConfigFilePath, loadConfig } from "./loadConfig.mjs";
|
|
4
4
|
async function getConfigObject(config) {
|
|
5
5
|
if ('function' == typeof config) return await config({
|
|
6
6
|
env: getNodeEnv(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDebugger } from "@modern-js/utils";
|
|
2
|
-
import { mergeConfig } from "../utils/mergeConfig";
|
|
2
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
3
3
|
const debug = createDebugger('resolve-config');
|
|
4
4
|
const createResolveConfig = async (loaded, configs)=>{
|
|
5
5
|
const { config: userConfig } = loaded;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, globby } from "@modern-js/utils";
|
|
3
|
-
import
|
|
2
|
+
import { compatibleRequire, fs, globby } from "@modern-js/utils";
|
|
3
|
+
import { createJiti } from "jiti";
|
|
4
4
|
const getConfigFilePath = (appDirectory, configFilePath)=>{
|
|
5
5
|
if (path.isAbsolute(configFilePath)) return configFilePath;
|
|
6
6
|
return path.resolve(appDirectory, configFilePath);
|
|
@@ -17,15 +17,16 @@ const clearFilesOverTime = async (targetDir, overtime)=>{
|
|
|
17
17
|
}
|
|
18
18
|
} catch (err) {}
|
|
19
19
|
};
|
|
20
|
-
function loadConfigContent(configFile) {
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
async function loadConfigContent(configFile) {
|
|
21
|
+
const jitiFrom = import.meta.url;
|
|
22
|
+
const jiti = createJiti(jitiFrom, {
|
|
23
23
|
requireCache: false,
|
|
24
24
|
interopDefault: true
|
|
25
25
|
});
|
|
26
26
|
if (!fs.existsSync(configFile)) throw new Error(`Configuration file does not exist: ${configFile}`);
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
let config;
|
|
29
|
+
config = await jiti.import(configFile, {});
|
|
29
30
|
return config.default || config;
|
|
30
31
|
} catch (e) {
|
|
31
32
|
if (e instanceof Error) e.message = `Get Error while loading config file: ${configFile}, please check it and retry.\n${e.message || ''}`;
|
|
@@ -33,23 +34,23 @@ function loadConfigContent(configFile) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
const loadTypeScriptFile = (filePath)=>{
|
|
36
|
-
const
|
|
37
|
-
esmResolve: true,
|
|
37
|
+
const jiti = createJiti(__filename, {
|
|
38
38
|
requireCache: false,
|
|
39
39
|
interopDefault: true
|
|
40
40
|
});
|
|
41
41
|
if (!fs.existsSync(filePath)) throw new Error(`TypeScript file does not exist: ${filePath}`);
|
|
42
42
|
try {
|
|
43
|
-
return
|
|
43
|
+
return jiti(filePath);
|
|
44
44
|
} catch (e) {
|
|
45
45
|
if (e instanceof Error) e.message = `Get Error while loading TypeScript file: ${filePath}, please check it and retry.\n${e.message || ''}`;
|
|
46
46
|
throw e;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const loadConfig = async (appDirectory, configFile)=>{
|
|
50
|
-
const
|
|
50
|
+
const pkg = await compatibleRequire(path.resolve(appDirectory, './package.json'));
|
|
51
|
+
const packageName = pkg.name;
|
|
51
52
|
let config;
|
|
52
|
-
if (configFile) config = loadConfigContent(configFile);
|
|
53
|
+
if (configFile) config = await loadConfigContent(configFile);
|
|
53
54
|
return {
|
|
54
55
|
packageName,
|
|
55
56
|
configFile,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createDebugger, logger } from "@modern-js/utils";
|
|
2
2
|
import { program } from "@modern-js/utils/commander";
|
|
3
3
|
import { loadEnv } from "@rsbuild/core";
|
|
4
|
-
import { createPluginManager } from "../../manager";
|
|
5
|
-
import { initPluginAPI } from "../api";
|
|
6
|
-
import { createContext, initAppContext } from "../context";
|
|
7
|
-
import { createLoadedConfig } from "./config/createLoadedConfig";
|
|
8
|
-
import { createResolveConfig } from "./config/createResolvedConfig";
|
|
9
|
-
import { checkIsDuplicationPlugin } from "./utils/checkIsDuplicationPlugin";
|
|
10
|
-
import { initCommandsMap, setProgramVersion } from "./utils/commander";
|
|
11
|
-
import { createFileWatcher } from "./utils/createFileWatcher";
|
|
12
|
-
import { initAppDir } from "./utils/initAppDir";
|
|
4
|
+
import { createPluginManager } from "../../manager.mjs";
|
|
5
|
+
import { initPluginAPI } from "../api.mjs";
|
|
6
|
+
import { createContext, initAppContext } from "../context.mjs";
|
|
7
|
+
import { createLoadedConfig } from "./config/createLoadedConfig.mjs";
|
|
8
|
+
import { createResolveConfig } from "./config/createResolvedConfig.mjs";
|
|
9
|
+
import { checkIsDuplicationPlugin } from "./utils/checkIsDuplicationPlugin.mjs";
|
|
10
|
+
import { initCommandsMap, setProgramVersion } from "./utils/commander.mjs";
|
|
11
|
+
import { createFileWatcher } from "./utils/createFileWatcher.mjs";
|
|
12
|
+
import { initAppDir } from "./utils/initAppDir.mjs";
|
|
13
13
|
const debug = createDebugger('plugin');
|
|
14
14
|
const createCli = ()=>{
|
|
15
15
|
let initOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createCli } from "./create";
|
|
2
|
-
import { createLoadedConfig } from "./config/createLoadedConfig";
|
|
3
|
-
import { initAppDir } from "./utils/initAppDir";
|
|
4
|
-
import { loadTypeScriptFile } from "./config/loadConfig";
|
|
5
|
-
import { run } from "./run";
|
|
1
|
+
import { createCli } from "./create.mjs";
|
|
2
|
+
import { createLoadedConfig } from "./config/createLoadedConfig.mjs";
|
|
3
|
+
import { initAppDir } from "./utils/initAppDir.mjs";
|
|
4
|
+
import { loadTypeScriptFile } from "./config/loadConfig.mjs";
|
|
5
|
+
import { run } from "./run.mjs";
|
|
6
6
|
const cli = createCli();
|
|
7
7
|
export { cli, createCli, createLoadedConfig, initAppDir, loadTypeScriptFile, run };
|
package/dist/esm/cli/run/run.mjs
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createPluginManager } from "./manager";
|
|
2
|
-
import { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createSyncHook } from "./hooks";
|
|
1
|
+
import { createPluginManager } from "./manager.mjs";
|
|
2
|
+
import { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createSyncHook } from "./hooks.mjs";
|
|
3
3
|
export { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createPluginManager, createSyncHook };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { initPluginAPI } from "./api";
|
|
2
|
-
import { createRuntimeContext, initRuntimeContext } from "./context";
|
|
3
|
-
import { initHooks } from "./hooks";
|
|
4
|
-
import { runtime } from "./run";
|
|
1
|
+
import { initPluginAPI } from "./api.mjs";
|
|
2
|
+
import { createRuntimeContext, initRuntimeContext } from "./context.mjs";
|
|
3
|
+
import { initHooks } from "./hooks.mjs";
|
|
4
|
+
import { runtime } from "./run/index.mjs";
|
|
5
5
|
export { createRuntimeContext, initHooks, initPluginAPI, initRuntimeContext, runtime };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
2
|
-
import { createPluginManager } from "../../manager";
|
|
3
|
-
import { initPluginAPI } from "
|
|
4
|
-
import { createRuntimeContext, initRuntimeContext } from "
|
|
2
|
+
import { createPluginManager } from "../../manager.mjs";
|
|
3
|
+
import { initPluginAPI } from "../api.mjs";
|
|
4
|
+
import { createRuntimeContext, initRuntimeContext } from "../context.mjs";
|
|
5
5
|
const createRuntime = ()=>{
|
|
6
6
|
let initOptions;
|
|
7
7
|
const pluginManager = createPluginManager();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { initPluginAPI } from "./api";
|
|
2
|
-
import { createServerContext, initServerContext } from "./context";
|
|
3
|
-
import { initHooks } from "./hooks";
|
|
4
|
-
import { createServer, server } from "./run";
|
|
1
|
+
import { initPluginAPI } from "./api.mjs";
|
|
2
|
+
import { createServerContext, initServerContext } from "./context.mjs";
|
|
3
|
+
import { initHooks } from "./hooks.mjs";
|
|
4
|
+
import { createServer, server } from "./run/index.mjs";
|
|
5
5
|
export { createServer, createServerContext, initHooks, initPluginAPI, initServerContext, server };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createPluginManager } from "../../manager";
|
|
2
|
-
import { initPluginAPI } from "
|
|
3
|
-
import { createServerContext, initServerContext } from "
|
|
1
|
+
import { createPluginManager } from "../../manager.mjs";
|
|
2
|
+
import { initPluginAPI } from "../api.mjs";
|
|
3
|
+
import { createServerContext, initServerContext } from "../context.mjs";
|
|
4
4
|
const createServer = ()=>{
|
|
5
5
|
let initOptions;
|
|
6
6
|
const pluginManager = createPluginManager();
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
1
3
|
import path from "path";
|
|
2
|
-
import { fs, globby } from "@modern-js/utils";
|
|
3
|
-
import
|
|
4
|
+
import { compatibleRequire, fs, globby } from "@modern-js/utils";
|
|
5
|
+
import { createJiti } from "jiti";
|
|
6
|
+
var loadConfig_filename = __rspack_fileURLToPath(import.meta.url);
|
|
4
7
|
const getConfigFilePath = (appDirectory, configFilePath)=>{
|
|
5
8
|
if (path.isAbsolute(configFilePath)) return configFilePath;
|
|
6
9
|
return path.resolve(appDirectory, configFilePath);
|
|
@@ -17,15 +20,16 @@ const clearFilesOverTime = async (targetDir, overtime)=>{
|
|
|
17
20
|
}
|
|
18
21
|
} catch (err) {}
|
|
19
22
|
};
|
|
20
|
-
function loadConfigContent(configFile) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
async function loadConfigContent(configFile) {
|
|
24
|
+
const jitiFrom = import.meta.url;
|
|
25
|
+
const jiti = createJiti(jitiFrom, {
|
|
23
26
|
requireCache: false,
|
|
24
27
|
interopDefault: true
|
|
25
28
|
});
|
|
26
29
|
if (!fs.existsSync(configFile)) throw new Error(`Configuration file does not exist: ${configFile}`);
|
|
27
30
|
try {
|
|
28
|
-
|
|
31
|
+
let config;
|
|
32
|
+
config = await jiti.import(configFile, {});
|
|
29
33
|
return config.default || config;
|
|
30
34
|
} catch (e) {
|
|
31
35
|
if (e instanceof Error) e.message = `Get Error while loading config file: ${configFile}, please check it and retry.\n${e.message || ''}`;
|
|
@@ -33,23 +37,23 @@ function loadConfigContent(configFile) {
|
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
const loadTypeScriptFile = (filePath)=>{
|
|
36
|
-
const
|
|
37
|
-
esmResolve: true,
|
|
40
|
+
const jiti = createJiti(loadConfig_filename, {
|
|
38
41
|
requireCache: false,
|
|
39
42
|
interopDefault: true
|
|
40
43
|
});
|
|
41
44
|
if (!fs.existsSync(filePath)) throw new Error(`TypeScript file does not exist: ${filePath}`);
|
|
42
45
|
try {
|
|
43
|
-
return
|
|
46
|
+
return jiti(filePath);
|
|
44
47
|
} catch (e) {
|
|
45
48
|
if (e instanceof Error) e.message = `Get Error while loading TypeScript file: ${filePath}, please check it and retry.\n${e.message || ''}`;
|
|
46
49
|
throw e;
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
const loadConfig = async (appDirectory, configFile)=>{
|
|
50
|
-
const
|
|
53
|
+
const pkg = await compatibleRequire(path.resolve(appDirectory, './package.json'));
|
|
54
|
+
const packageName = pkg.name;
|
|
51
55
|
let config;
|
|
52
|
-
if (configFile) config = loadConfigContent(configFile);
|
|
56
|
+
if (configFile) config = await loadConfigContent(configFile);
|
|
53
57
|
return {
|
|
54
58
|
packageName,
|
|
55
59
|
configFile,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
package/dist/esm-node/hooks.mjs
CHANGED
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { createPluginManager } from "./manager.mjs";
|
|
2
3
|
import { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createSyncHook } from "./hooks.mjs";
|
|
3
4
|
export { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createPluginManager, createSyncHook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
package/package.json
CHANGED
|
@@ -15,52 +15,51 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.0.0
|
|
19
|
-
"jsnext:source": "./src/index.ts",
|
|
18
|
+
"version": "3.0.0",
|
|
20
19
|
"types": "./dist/types/index.d.ts",
|
|
21
20
|
"main": "./dist/cjs/index.js",
|
|
22
|
-
"module": "./dist/esm-node/index.mjs",
|
|
23
21
|
"exports": {
|
|
24
22
|
".": {
|
|
25
23
|
"types": "./dist/types/index.d.ts",
|
|
24
|
+
"modern:source": "./src/index.ts",
|
|
26
25
|
"node": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"import": "./dist/esm/index.mjs",
|
|
26
|
+
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"import": "./dist/esm-node/index.mjs",
|
|
30
28
|
"require": "./dist/cjs/index.js"
|
|
31
29
|
},
|
|
32
30
|
"default": "./dist/esm/index.mjs"
|
|
33
31
|
},
|
|
34
32
|
"./run": {
|
|
35
33
|
"types": "./dist/types/cli/run/index.d.ts",
|
|
36
|
-
"
|
|
34
|
+
"modern:source": "./src/cli/run/index.ts",
|
|
35
|
+
"node": {
|
|
36
|
+
"import": "./dist/esm-node/cli/run/index.mjs",
|
|
37
|
+
"require": "./dist/cjs/cli/run/index.js"
|
|
38
|
+
},
|
|
37
39
|
"default": "./dist/cjs/cli/run/index.js"
|
|
38
40
|
},
|
|
39
41
|
"./cli": {
|
|
40
42
|
"types": "./dist/types/cli/index.d.ts",
|
|
41
43
|
"modern:source": "./src/cli/index.ts",
|
|
42
|
-
"
|
|
44
|
+
"node": {
|
|
45
|
+
"import": "./dist/esm-node/cli/index.mjs",
|
|
46
|
+
"require": "./dist/cjs/cli/index.js"
|
|
47
|
+
},
|
|
43
48
|
"default": "./dist/cjs/cli/index.js"
|
|
44
49
|
},
|
|
45
50
|
"./runtime": {
|
|
46
51
|
"types": "./dist/types/runtime/index.d.ts",
|
|
47
52
|
"modern:source": "./src/runtime/index.tsx",
|
|
48
|
-
"jsnext:source": "./src/runtime/index.tsx",
|
|
49
|
-
"node": {
|
|
50
|
-
"import": "./dist/esm/runtime/index.mjs",
|
|
51
|
-
"require": "./dist/cjs/runtime/index.js"
|
|
52
|
-
},
|
|
53
53
|
"default": "./dist/esm/runtime/index.mjs"
|
|
54
54
|
},
|
|
55
55
|
"./server": {
|
|
56
56
|
"types": "./dist/types/server/index.d.ts",
|
|
57
57
|
"modern:source": "./src/server/index.ts",
|
|
58
|
-
"jsnext:source": "./src/server/index.ts",
|
|
59
58
|
"node": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
59
|
+
"import": "./dist/esm-node/server/index.mjs",
|
|
60
|
+
"require": "./dist/cjs/server/index.js"
|
|
62
61
|
},
|
|
63
|
-
"default": "./dist/
|
|
62
|
+
"default": "./dist/cjs/server/index.js"
|
|
64
63
|
}
|
|
65
64
|
},
|
|
66
65
|
"typesVersions": {
|
|
@@ -83,19 +82,19 @@
|
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
84
|
"dependencies": {
|
|
85
|
+
"@rsbuild/core": "2.0.0-beta.1",
|
|
86
86
|
"@swc/helpers": "^0.5.17",
|
|
87
|
-
"jiti": "
|
|
88
|
-
"@
|
|
89
|
-
"@modern-js/
|
|
90
|
-
"@modern-js/utils": "3.0.0
|
|
91
|
-
"@modern-js/types": "3.0.0-alpha.1"
|
|
87
|
+
"jiti": "^2.6.1",
|
|
88
|
+
"@modern-js/runtime-utils": "3.0.0",
|
|
89
|
+
"@modern-js/types": "3.0.0",
|
|
90
|
+
"@modern-js/utils": "3.0.0"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
93
|
+
"@rslib/core": "0.19.4",
|
|
94
94
|
"@types/node": "^20",
|
|
95
|
-
"@types/react": "^19.2.
|
|
96
|
-
"@rslib/core": "0.19.1",
|
|
95
|
+
"@types/react": "^19.2.10",
|
|
97
96
|
"typescript": "^5",
|
|
98
|
-
"@modern-js/builder": "3.0.0
|
|
97
|
+
"@modern-js/builder": "3.0.0",
|
|
99
98
|
"@modern-js/rslib": "2.68.10"
|
|
100
99
|
},
|
|
101
100
|
"sideEffects": false,
|