@modern-js/app-tools 2.48.6 → 2.49.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/builder/builder-webpack/index.js +1 -1
- package/dist/cjs/commands/build.js +3 -0
- package/dist/cjs/commands/dev.js +16 -16
- package/dist/cjs/commands/serve.js +14 -22
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/plugins/deploy/dependencies.js +257 -0
- package/dist/cjs/plugins/deploy/entrys/netlify.js +95 -0
- package/dist/cjs/plugins/deploy/entrys/node.js +88 -0
- package/dist/cjs/plugins/deploy/entrys/vercel.js +95 -0
- package/dist/cjs/plugins/deploy/index.js +140 -0
- package/dist/cjs/plugins/deploy/utils.js +150 -0
- package/dist/cjs/utils/createServer.js +5 -27
- package/dist/cjs/utils/env.js +2 -2
- package/dist/cjs/utils/register.js +103 -0
- package/dist/esm/builder/builder-webpack/index.js +1 -1
- package/dist/esm/commands/build.js +16 -9
- package/dist/esm/commands/dev.js +34 -38
- package/dist/esm/commands/serve.js +28 -32
- package/dist/esm/index.js +3 -1
- package/dist/esm/plugins/deploy/dependencies.js +726 -0
- package/dist/esm/plugins/deploy/entrys/netlify.js +41 -0
- package/dist/esm/plugins/deploy/entrys/node.js +39 -0
- package/dist/esm/plugins/deploy/entrys/vercel.js +41 -0
- package/dist/esm/plugins/deploy/index.js +219 -0
- package/dist/esm/plugins/deploy/utils.js +244 -0
- package/dist/esm/utils/createServer.js +14 -50
- package/dist/esm/utils/env.js +1 -1
- package/dist/esm/utils/register.js +129 -0
- package/dist/esm-node/builder/builder-webpack/index.js +1 -1
- package/dist/esm-node/commands/build.js +3 -0
- package/dist/esm-node/commands/dev.js +17 -17
- package/dist/esm-node/commands/serve.js +14 -12
- package/dist/esm-node/index.js +3 -1
- package/dist/esm-node/plugins/deploy/dependencies.js +223 -0
- package/dist/esm-node/plugins/deploy/entrys/netlify.js +71 -0
- package/dist/esm-node/plugins/deploy/entrys/node.js +64 -0
- package/dist/esm-node/plugins/deploy/entrys/vercel.js +71 -0
- package/dist/esm-node/plugins/deploy/index.js +110 -0
- package/dist/esm-node/plugins/deploy/utils.js +109 -0
- package/dist/esm-node/utils/createServer.js +6 -17
- package/dist/esm-node/utils/env.js +1 -1
- package/dist/esm-node/utils/register.js +69 -0
- package/dist/types/plugins/deploy/dependencies.d.ts +1 -0
- package/dist/types/plugins/deploy/entrys/netlify.d.ts +5 -0
- package/dist/types/plugins/deploy/entrys/node.d.ts +5 -0
- package/dist/types/plugins/deploy/entrys/vercel.d.ts +5 -0
- package/dist/types/plugins/deploy/index.d.ts +4 -0
- package/dist/types/plugins/deploy/utils.d.ts +27 -0
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/utils/createServer.d.ts +4 -9
- package/dist/types/utils/register.d.ts +3 -0
- package/package.json +28 -22
@@ -0,0 +1,71 @@
|
|
1
|
+
import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG } from "@modern-js/utils";
|
2
|
+
import { genPluginImportsCode, getPluginsCode, severAppContextTemplate } from "../utils";
|
3
|
+
function genVercelEntry({ config, plugins, appContext } = {}) {
|
4
|
+
const defaultConfig = {
|
5
|
+
server: {
|
6
|
+
port: 8080
|
7
|
+
},
|
8
|
+
output: {
|
9
|
+
path: "."
|
10
|
+
}
|
11
|
+
};
|
12
|
+
return `
|
13
|
+
|
14
|
+
const fs = require('node:fs/promises');
|
15
|
+
const path = require('node:path');
|
16
|
+
const { createNetlifyFunction } = require('@modern-js/prod-server/netlify');
|
17
|
+
${genPluginImportsCode(plugins || [])}
|
18
|
+
|
19
|
+
let requestHandler = null;
|
20
|
+
|
21
|
+
if(!process.env.NODE_ENV){
|
22
|
+
process.env.NODE_ENV = 'production';
|
23
|
+
}
|
24
|
+
|
25
|
+
async function createHandler() {
|
26
|
+
try {
|
27
|
+
let routes = [];
|
28
|
+
const routeFilepath = path.join(__dirname, "${ROUTE_SPEC_FILE}");
|
29
|
+
try {
|
30
|
+
await fs.access(routeFilepath);
|
31
|
+
const content = await fs.readFile(routeFilepath, "utf-8");
|
32
|
+
const routeSpec = JSON.parse(content);
|
33
|
+
routes = routeSpec.routes;
|
34
|
+
} catch (error) {
|
35
|
+
console.warn('route.json not found, continuing with empty routes.');
|
36
|
+
}
|
37
|
+
|
38
|
+
const prodServerOptions = {
|
39
|
+
pwd: __dirname,
|
40
|
+
routes,
|
41
|
+
config: ${JSON.stringify(config || defaultConfig)},
|
42
|
+
serverConfigFile: '${DEFAULT_SERVER_CONFIG}',
|
43
|
+
plugins: ${getPluginsCode(plugins || [])},
|
44
|
+
appContext: ${appContext ? severAppContextTemplate(appContext) : "undefined"},
|
45
|
+
disableCustomHook: true
|
46
|
+
}
|
47
|
+
|
48
|
+
requestHandler = await createNetlifyFunction(prodServerOptions)
|
49
|
+
|
50
|
+
return requestHandler
|
51
|
+
} catch(error) {
|
52
|
+
console.error(error);
|
53
|
+
process.exit(1);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
createHandler();
|
58
|
+
|
59
|
+
const handleRequest = async(request, context) => {
|
60
|
+
if(typeof requestHandler !== 'function'){
|
61
|
+
await createHandler();
|
62
|
+
}
|
63
|
+
return requestHandler(request, context);
|
64
|
+
}
|
65
|
+
|
66
|
+
export default handleRequest;
|
67
|
+
`;
|
68
|
+
}
|
69
|
+
export {
|
70
|
+
genVercelEntry
|
71
|
+
};
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import { fs as fse, getInternalPlugins } from "@modern-js/utils";
|
3
|
+
import { getProjectUsage } from "./utils";
|
4
|
+
import { handleDependencies } from "./dependencies";
|
5
|
+
var deploy_default = () => ({
|
6
|
+
name: "@modern-js/plugin-deploy",
|
7
|
+
pre: [
|
8
|
+
"@modern-js/plugin-bff",
|
9
|
+
"@modern-js/plugin-server"
|
10
|
+
],
|
11
|
+
setup: (api) => {
|
12
|
+
return {
|
13
|
+
async beforeDeploy() {
|
14
|
+
const deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
15
|
+
const appContext = api.useAppContext();
|
16
|
+
const { appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName } = appContext;
|
17
|
+
const configContext = api.useResolvedConfigContext();
|
18
|
+
const outputDirectory = path.join(appDirectory, ".output");
|
19
|
+
let funcsDirectory = outputDirectory;
|
20
|
+
let staticDirectory = path.join(outputDirectory, "static");
|
21
|
+
await fse.remove(outputDirectory);
|
22
|
+
if (deployTarget === "node") {
|
23
|
+
await fse.copy(distDirectory, outputDirectory, {
|
24
|
+
filter: (src) => {
|
25
|
+
const distStaticDirectory = path.join(distDirectory, "static");
|
26
|
+
return !src.includes(distStaticDirectory);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
}
|
30
|
+
if (deployTarget === "vercel") {
|
31
|
+
funcsDirectory = path.join(outputDirectory, "functions");
|
32
|
+
staticDirectory = path.join(outputDirectory, "static");
|
33
|
+
await fse.copy(distDirectory, funcsDirectory, {
|
34
|
+
filter: (src) => {
|
35
|
+
const distStaticDirectory = path.join(distDirectory, "static");
|
36
|
+
return !src.includes(distStaticDirectory);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
await fse.copy(path.join(distDirectory, "static"), staticDirectory);
|
40
|
+
await fse.writeJSON(path.join(funcsDirectory, ".vc-config.json"), {
|
41
|
+
runtime: "nodejs16.x",
|
42
|
+
handler: "index.js",
|
43
|
+
launcherType: "Nodejs",
|
44
|
+
shouldAddHelpers: false,
|
45
|
+
supportsResponseStreaming: true
|
46
|
+
});
|
47
|
+
}
|
48
|
+
const { bff } = configContext;
|
49
|
+
const config = {
|
50
|
+
output: {
|
51
|
+
path: "."
|
52
|
+
},
|
53
|
+
bff
|
54
|
+
};
|
55
|
+
const plugins = getInternalPlugins(appDirectory, serverInternalPlugins);
|
56
|
+
const serverAppContext = {
|
57
|
+
sharedDirectory: `path.join(__dirname, "${path.relative(appDirectory, sharedDirectory)}")`,
|
58
|
+
apiDirectory: `path.join(__dirname, "${path.relative(appDirectory, apiDirectory)}")`,
|
59
|
+
lambdaDirectory: `path.join(__dirname, "${path.relative(appDirectory, lambdaDirectory)}")`,
|
60
|
+
metaName
|
61
|
+
};
|
62
|
+
let code = ``;
|
63
|
+
console.log("deployTarget111111111", deployTarget);
|
64
|
+
switch (deployTarget) {
|
65
|
+
case "node": {
|
66
|
+
const { genNodeEntry } = await import("./entrys/node");
|
67
|
+
code = genNodeEntry({
|
68
|
+
plugins,
|
69
|
+
config,
|
70
|
+
appContext: serverAppContext
|
71
|
+
});
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
case "vercel": {
|
75
|
+
const { genVercelEntry } = await import("./entrys/vercel");
|
76
|
+
code = genVercelEntry({
|
77
|
+
plugins,
|
78
|
+
config,
|
79
|
+
appContext: serverAppContext
|
80
|
+
});
|
81
|
+
break;
|
82
|
+
}
|
83
|
+
case "netlify": {
|
84
|
+
const { genNetlifyEntry } = await import("./entrys/netlify");
|
85
|
+
code = genNetlifyEntry({
|
86
|
+
plugins,
|
87
|
+
config,
|
88
|
+
appContext: serverAppContext
|
89
|
+
});
|
90
|
+
break;
|
91
|
+
}
|
92
|
+
default: {
|
93
|
+
code = `throw new Error("unknown deploy target, MODERNJS_DEPLOY should be set");`;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
const { useSSR, useAPI, useWebServer } = getProjectUsage(appDirectory, distDirectory);
|
97
|
+
const entryFilePath = path.join(funcsDirectory, "index.js");
|
98
|
+
if (useSSR || useAPI || useWebServer) {
|
99
|
+
await fse.writeFile(entryFilePath, code);
|
100
|
+
}
|
101
|
+
await handleDependencies(appDirectory, funcsDirectory, [
|
102
|
+
"@modern-js/prod-server"
|
103
|
+
]);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
}
|
107
|
+
});
|
108
|
+
export {
|
109
|
+
deploy_default as default
|
110
|
+
};
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import os from "node:os";
|
3
|
+
import { ROUTE_SPEC_FILE, fs as fse, isDepExists } from "@modern-js/utils";
|
4
|
+
import { parseNodeModulePath } from "mlly";
|
5
|
+
const severAppContextTemplate = (serverAppContext) => {
|
6
|
+
return `{
|
7
|
+
sharedDirectory: ${serverAppContext.sharedDirectory},
|
8
|
+
apiDirectory: ${serverAppContext.apiDirectory},
|
9
|
+
lambdaDirectory: ${serverAppContext.lambdaDirectory},
|
10
|
+
}`;
|
11
|
+
};
|
12
|
+
const getPluginsCode = (plugins) => `[${plugins.map((_, index) => `plugin_${index}()`).join(",")}]`;
|
13
|
+
const genPluginImportsCode = (plugins) => {
|
14
|
+
return plugins.map((plugin, index) => `
|
15
|
+
let plugin_${index} = require('${plugin}')
|
16
|
+
plugin_${index} = plugin_${index}.default || plugin_${index}
|
17
|
+
`).join(";\n");
|
18
|
+
};
|
19
|
+
const getProjectUsage = (appDirectory, distDirectory) => {
|
20
|
+
const routeJSON = path.join(distDirectory, ROUTE_SPEC_FILE);
|
21
|
+
const { routes } = fse.readJSONSync(routeJSON);
|
22
|
+
let useSSR = false;
|
23
|
+
let useAPI = false;
|
24
|
+
routes.forEach((route) => {
|
25
|
+
if (route.isSSR) {
|
26
|
+
useSSR = true;
|
27
|
+
}
|
28
|
+
if (route.isApi) {
|
29
|
+
useAPI = true;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
const useWebServer = isDepExists(appDirectory, "@modern-js/plugin-server");
|
33
|
+
return {
|
34
|
+
useSSR,
|
35
|
+
useAPI,
|
36
|
+
useWebServer
|
37
|
+
};
|
38
|
+
};
|
39
|
+
function applyProductionCondition(exports) {
|
40
|
+
if (!exports || typeof exports === "string") {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
if (exports.production) {
|
44
|
+
if (typeof exports.production === "string") {
|
45
|
+
exports.default = exports.production;
|
46
|
+
} else {
|
47
|
+
Object.assign(exports, exports.production);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
for (const key in exports) {
|
51
|
+
applyProductionCondition(exports[key]);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
function applyPublicCondition(pkg) {
|
55
|
+
var _pkg_publishConfig;
|
56
|
+
if (pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig = pkg.publishConfig) === null || _pkg_publishConfig === void 0 ? void 0 : _pkg_publishConfig.exports) {
|
57
|
+
var _pkg_publishConfig1;
|
58
|
+
pkg.exports = pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig1 = pkg.publishConfig) === null || _pkg_publishConfig1 === void 0 ? void 0 : _pkg_publishConfig1.exports;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
const writePackage = async (pkg, version, projectDir, _pkgPath) => {
|
62
|
+
const pkgPath = _pkgPath || pkg.name;
|
63
|
+
for (const src of pkg.versions[version].files) {
|
64
|
+
if (src.includes("node_modules")) {
|
65
|
+
const { subpath } = parseNodeModulePath(src);
|
66
|
+
const dest = path.join(projectDir, "node_modules", pkgPath, subpath);
|
67
|
+
const dirname = path.dirname(dest);
|
68
|
+
await fse.ensureDir(dirname);
|
69
|
+
await fse.copyFile(src, dest);
|
70
|
+
} else {
|
71
|
+
const subpath = path.relative(pkg.versions[version].path, src);
|
72
|
+
const dest = path.join(projectDir, "node_modules", pkgPath, subpath);
|
73
|
+
const dirname = path.dirname(dest);
|
74
|
+
await fse.ensureDir(dirname);
|
75
|
+
await fse.copyFile(src, dest);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
const { pkgJSON } = pkg.versions[version];
|
79
|
+
applyPublicCondition(pkgJSON);
|
80
|
+
const packageJsonPath = path.join(projectDir, "node_modules", pkgPath, "package.json");
|
81
|
+
await fse.ensureDir(path.dirname(packageJsonPath));
|
82
|
+
await fse.writeFile(packageJsonPath, JSON.stringify(pkgJSON, null, 2));
|
83
|
+
};
|
84
|
+
const isWindows = os.platform() === "win32";
|
85
|
+
const linkPackage = async (from, to, projectRootDir) => {
|
86
|
+
const src = path.join(projectRootDir, "node_modules", from);
|
87
|
+
const dest = path.join(projectRootDir, "node_modules", to);
|
88
|
+
const dstStat = await fse.lstat(dest).catch(() => null);
|
89
|
+
const exists = dstStat === null || dstStat === void 0 ? void 0 : dstStat.isSymbolicLink();
|
90
|
+
if (exists) {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
await fse.mkdir(path.dirname(dest), {
|
94
|
+
recursive: true
|
95
|
+
});
|
96
|
+
await fse.symlink(path.relative(path.dirname(dest), src), dest, isWindows ? "junction" : "dir").catch((error) => {
|
97
|
+
console.error("Cannot link", from, "to", to, error);
|
98
|
+
});
|
99
|
+
};
|
100
|
+
export {
|
101
|
+
applyProductionCondition,
|
102
|
+
applyPublicCondition,
|
103
|
+
genPluginImportsCode,
|
104
|
+
getPluginsCode,
|
105
|
+
getProjectUsage,
|
106
|
+
linkPackage,
|
107
|
+
severAppContextTemplate,
|
108
|
+
writePackage
|
109
|
+
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { createDevServer } from "@modern-js/server";
|
2
|
+
import { initProdMiddlewares } from "@modern-js/prod-server";
|
2
3
|
let server = null;
|
3
4
|
const getServer = () => server;
|
4
5
|
const setServer = (newServer) => {
|
@@ -6,32 +7,20 @@ const setServer = (newServer) => {
|
|
6
7
|
};
|
7
8
|
const closeServer = async () => {
|
8
9
|
if (server) {
|
9
|
-
|
10
|
+
server.close();
|
10
11
|
server = null;
|
11
12
|
}
|
12
13
|
};
|
13
14
|
const createServer = async (options) => {
|
14
15
|
if (server) {
|
15
|
-
|
16
|
+
server.close();
|
16
17
|
}
|
17
|
-
server =
|
18
|
-
|
19
|
-
return app;
|
20
|
-
};
|
21
|
-
const injectDataLoaderPlugin = (internalPlugins) => {
|
22
|
-
const DataLoaderPlugin = require.resolve("@modern-js/plugin-data-loader/server");
|
23
|
-
return {
|
24
|
-
...internalPlugins,
|
25
|
-
"@modern-js/plugin-data-loader": {
|
26
|
-
path: DataLoaderPlugin,
|
27
|
-
forced: true
|
28
|
-
}
|
29
|
-
};
|
18
|
+
server = await createDevServer(options, initProdMiddlewares);
|
19
|
+
return server;
|
30
20
|
};
|
31
21
|
export {
|
32
22
|
closeServer,
|
33
23
|
createServer,
|
34
24
|
getServer,
|
35
|
-
injectDataLoaderPlugin,
|
36
25
|
setServer
|
37
26
|
};
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import path from "node:path";
|
2
|
+
import { fs, getAliasConfig, readTsConfigByFile } from "@modern-js/utils";
|
3
|
+
const registerCompiler = async (appDir = process.cwd(), distDir, alias) => {
|
4
|
+
const TS_CONFIG_FILENAME = `tsconfig.json`;
|
5
|
+
const tsconfigPath = path.resolve(appDir, TS_CONFIG_FILENAME);
|
6
|
+
const isTsProject = await fs.pathExists(tsconfigPath);
|
7
|
+
const aliasConfig = getAliasConfig(alias, {
|
8
|
+
appDirectory: appDir,
|
9
|
+
tsconfigPath
|
10
|
+
});
|
11
|
+
const { paths = {}, absoluteBaseUrl = "./" } = aliasConfig;
|
12
|
+
const tsPaths = Object.keys(paths).reduce((o, key) => {
|
13
|
+
let tsPath = paths[key];
|
14
|
+
if (typeof tsPath === "string" && path.isAbsolute(tsPath)) {
|
15
|
+
tsPath = path.relative(absoluteBaseUrl, tsPath);
|
16
|
+
}
|
17
|
+
if (typeof tsPath === "string") {
|
18
|
+
tsPath = [
|
19
|
+
tsPath
|
20
|
+
];
|
21
|
+
}
|
22
|
+
return {
|
23
|
+
...o,
|
24
|
+
[`${key}`]: tsPath
|
25
|
+
};
|
26
|
+
}, {});
|
27
|
+
let tsConfig = {};
|
28
|
+
if (isTsProject) {
|
29
|
+
tsConfig = readTsConfigByFile(tsconfigPath);
|
30
|
+
}
|
31
|
+
try {
|
32
|
+
const tsNode = await import("ts-node");
|
33
|
+
const tsNodeOptions = tsConfig["ts-node"];
|
34
|
+
if (isTsProject) {
|
35
|
+
tsNode.register({
|
36
|
+
project: tsconfigPath,
|
37
|
+
scope: true,
|
38
|
+
// for env.d.ts, https://www.npmjs.com/package/ts-node#missing-types
|
39
|
+
files: true,
|
40
|
+
transpileOnly: true,
|
41
|
+
ignore: [
|
42
|
+
"(?:^|/)node_modules/",
|
43
|
+
`(?:^|/)${distDir}/`
|
44
|
+
],
|
45
|
+
...tsNodeOptions
|
46
|
+
});
|
47
|
+
}
|
48
|
+
} catch (error) {
|
49
|
+
const esbuildRegister = await import("esbuild-register/dist/node");
|
50
|
+
esbuildRegister.register({
|
51
|
+
tsconfigRaw: isTsProject ? tsConfig : void 0,
|
52
|
+
hookIgnoreNodeModules: true,
|
53
|
+
hookMatcher: (fileName) => !fileName.startsWith(distDir)
|
54
|
+
});
|
55
|
+
}
|
56
|
+
const tsConfigPaths = await import("@modern-js/utils/tsconfig-paths");
|
57
|
+
if (await fs.pathExists(appDir)) {
|
58
|
+
const loaderRes = tsConfigPaths.loadConfig(appDir);
|
59
|
+
if (loaderRes.resultType === "success") {
|
60
|
+
tsConfigPaths.register({
|
61
|
+
baseUrl: absoluteBaseUrl || "./",
|
62
|
+
paths: tsPaths
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
};
|
67
|
+
export {
|
68
|
+
registerCompiler
|
69
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const handleDependencies: (appDir: string, serverRootDir: string, include: string[]) => Promise<void>;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { PackageJson } from 'pkg-types';
|
2
|
+
export type ServerAppContext = {
|
3
|
+
sharedDirectory: string;
|
4
|
+
apiDirectory: string;
|
5
|
+
lambdaDirectory: string;
|
6
|
+
metaName: string;
|
7
|
+
};
|
8
|
+
export declare const severAppContextTemplate: (serverAppContext: ServerAppContext) => string;
|
9
|
+
export declare const getPluginsCode: (plugins: string[]) => string;
|
10
|
+
export declare const genPluginImportsCode: (plugins: string[]) => string;
|
11
|
+
export declare const getProjectUsage: (appDirectory: string, distDirectory: string) => {
|
12
|
+
useSSR: boolean;
|
13
|
+
useAPI: boolean;
|
14
|
+
useWebServer: boolean;
|
15
|
+
};
|
16
|
+
export declare function applyProductionCondition(exports: PackageJson['exports']): void;
|
17
|
+
export declare function applyPublicCondition(pkg: PackageJson): void;
|
18
|
+
export type TracedPackage = {
|
19
|
+
name: string;
|
20
|
+
versions: Record<string, {
|
21
|
+
pkgJSON: PackageJson;
|
22
|
+
path: string;
|
23
|
+
files: string[];
|
24
|
+
}>;
|
25
|
+
};
|
26
|
+
export declare const writePackage: (pkg: TracedPackage, version: string, projectDir: string, _pkgPath?: string) => Promise<void>;
|
27
|
+
export declare const linkPackage: (from: string, to: string, projectRootDir: string) => Promise<void>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { JestConfig } from '@modern-js/types';
|
2
2
|
import type { PluginSwcOptions } from '@rsbuild/plugin-swc';
|
3
|
-
import type { PluginEsbuildOptions } from '@rsbuild
|
3
|
+
import type { PluginEsbuildOptions } from '@modern-js/rsbuild-plugin-esbuild';
|
4
4
|
import type { UniBuilderConfig } from '@modern-js/uni-builder';
|
5
5
|
import type { UnwrapBuilderConfig, Bundler } from '../utils';
|
6
6
|
export type Tailwindcss = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
import type {
|
3
|
-
|
1
|
+
/// <reference types="node" />
|
2
|
+
import type { Server } from 'node:http';
|
3
|
+
import { ModernDevServerOptions } from '@modern-js/server';
|
4
|
+
export declare const getServer: () => Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | null;
|
4
5
|
export declare const setServer: (newServer: Server) => void;
|
5
6
|
export declare const closeServer: () => Promise<void>;
|
6
7
|
export declare const createServer: (options: ModernDevServerOptions) => Promise<Server>;
|
7
|
-
export declare const injectDataLoaderPlugin: (internalPlugins: InternalPlugins) => {
|
8
|
-
'@modern-js/plugin-data-loader': {
|
9
|
-
path: string;
|
10
|
-
forced: boolean;
|
11
|
-
};
|
12
|
-
};
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.49.1-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -69,37 +69,43 @@
|
|
69
69
|
"@babel/parser": "^7.22.15",
|
70
70
|
"@babel/traverse": "^7.23.2",
|
71
71
|
"@babel/types": "^7.23.0",
|
72
|
-
"@rsbuild/
|
73
|
-
"@rsbuild/plugin-node-polyfill": "0.6.
|
74
|
-
"@rsbuild/shared": "0.6.
|
75
|
-
"@
|
72
|
+
"@rsbuild/core": "0.6.4",
|
73
|
+
"@rsbuild/plugin-node-polyfill": "0.6.4",
|
74
|
+
"@rsbuild/shared": "0.6.4",
|
75
|
+
"@swc/helpers": "0.5.3",
|
76
|
+
"@vercel/nft": "^0.26.4",
|
76
77
|
"es-module-lexer": "^1.1.0",
|
77
78
|
"esbuild": "0.17.19",
|
78
|
-
"
|
79
|
-
"
|
80
|
-
"
|
81
|
-
"@modern-js/
|
82
|
-
"@modern-js/
|
83
|
-
"@modern-js/plugin": "2.
|
84
|
-
"@modern-js/plugin-i18n": "2.
|
85
|
-
"@modern-js/
|
86
|
-
"@modern-js/
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/server
|
89
|
-
"@modern-js/
|
90
|
-
"@modern-js/server-
|
91
|
-
"@modern-js/
|
79
|
+
"esbuild-register": "^3.5.0",
|
80
|
+
"mlly": "^1.6.1",
|
81
|
+
"pkg-types": "^1.1.0",
|
82
|
+
"@modern-js/core": "2.49.0",
|
83
|
+
"@modern-js/node-bundle-require": "2.49.0",
|
84
|
+
"@modern-js/plugin": "2.49.0",
|
85
|
+
"@modern-js/plugin-i18n": "2.49.0",
|
86
|
+
"@modern-js/plugin-lint": "2.49.0",
|
87
|
+
"@modern-js/prod-server": "2.49.0",
|
88
|
+
"@modern-js/rsbuild-plugin-esbuild": "0.6.3",
|
89
|
+
"@modern-js/server": "2.49.0",
|
90
|
+
"@modern-js/plugin-data-loader": "2.49.0",
|
91
|
+
"@modern-js/server-utils": "2.49.0",
|
92
|
+
"@modern-js/server-core": "2.49.0",
|
93
|
+
"@modern-js/types": "2.49.0",
|
94
|
+
"@modern-js/uni-builder": "2.49.0",
|
95
|
+
"@modern-js/utils": "2.49.0"
|
92
96
|
},
|
93
97
|
"devDependencies": {
|
94
|
-
"@rsbuild/plugin-swc": "0.6.
|
98
|
+
"@rsbuild/plugin-swc": "0.6.4",
|
95
99
|
"@types/babel__traverse": "7.18.5",
|
96
100
|
"@types/jest": "^29",
|
97
101
|
"@types/node": "^14",
|
98
102
|
"jest": "^29",
|
103
|
+
"ts-node": "^10.9.1",
|
104
|
+
"tsconfig-paths": "^4.2.0",
|
99
105
|
"typescript": "^5",
|
100
106
|
"webpack": "^5.91.0",
|
101
|
-
"@scripts/build": "2.
|
102
|
-
"@scripts/jest-config": "2.
|
107
|
+
"@scripts/build": "2.49.0",
|
108
|
+
"@scripts/jest-config": "2.49.0"
|
103
109
|
},
|
104
110
|
"sideEffects": false,
|
105
111
|
"publishConfig": {
|