@modern-js/app-tools 2.57.2-alpha.0 → 2.58.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/builder/generator/index.js +2 -2
- package/dist/cjs/builder/index.js +2 -2
- package/dist/cjs/commands/build.js +0 -19
- package/dist/cjs/commands/dev.js +0 -9
- package/dist/cjs/commands/index.js +8 -8
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/analyze/index.js +3 -3
- package/dist/cjs/plugins/deploy/dependencies/index.js +12 -2
- package/dist/cjs/plugins/deploy/dependencies/utils.js +73 -13
- package/dist/cjs/plugins/deploy/platforms/netlify.js +5 -14
- package/dist/cjs/plugins/deploy/platforms/{netlify-handler.js → netlifyEntry.js} +4 -6
- package/dist/cjs/plugins/deploy/platforms/node.js +4 -13
- package/dist/cjs/plugins/deploy/platforms/vercel.js +5 -14
- package/dist/cjs/plugins/deploy/platforms/{vercel-handler.js → vercelEntry.js} +1 -27
- package/dist/cjs/utils/config.js +7 -23
- package/dist/cjs/utils/loadPlugins.js +1 -1
- package/dist/cjs/utils/register.js +22 -49
- package/dist/esm/builder/builder-rspack/adapterCopy.js +4 -3
- package/dist/esm/builder/generator/getBuilderEnvironments.js +2 -0
- package/dist/esm/builder/generator/index.js +1 -1
- package/dist/esm/builder/index.js +2 -2
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +1 -1
- package/dist/esm/commands/build.js +16 -9
- package/dist/esm/commands/dev.js +55 -37
- package/dist/esm/commands/index.js +7 -7
- package/dist/esm/index.js +1 -42
- package/dist/esm/plugins/analyze/index.js +10 -6
- package/dist/esm/plugins/deploy/dependencies/index.js +28 -8
- package/dist/esm/plugins/deploy/dependencies/utils.js +290 -10
- package/dist/esm/utils/config.js +6 -21
- package/dist/esm/utils/createServer.js +1 -1
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +2 -2
- package/dist/esm-node/builder/generator/getBuilderEnvironments.js +1 -1
- package/dist/esm-node/builder/generator/index.js +1 -1
- package/dist/esm-node/builder/index.js +2 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +1 -1
- package/dist/esm-node/commands/build.js +3 -0
- package/dist/esm-node/commands/dev.js +24 -16
- package/dist/esm-node/commands/index.js +7 -7
- package/dist/esm-node/index.js +1 -17
- package/dist/esm-node/plugins/analyze/index.js +7 -5
- package/dist/esm-node/plugins/deploy/dependencies/index.js +26 -7
- package/dist/esm-node/plugins/deploy/dependencies/utils.js +83 -3
- package/dist/esm-node/utils/config.js +5 -20
- package/dist/esm-node/utils/createServer.js +1 -1
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/plugins/deploy/dependencies/index.d.ts +5 -3
- package/dist/types/plugins/deploy/dependencies/utils.d.ts +7 -1
- package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +2 -0
- package/dist/types/utils/config.d.ts +0 -5
- package/package.json +23 -21
- package/dist/cjs/esm/esbuild-loader.mjs +0 -20
- package/dist/cjs/esm/register-esm.mjs +0 -65
- package/dist/cjs/esm/ts-node-loader.mjs +0 -21
- package/dist/cjs/esm/utils.mjs +0 -43
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +0 -3
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +0 -1
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +0 -3
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +0 -3
- package/dist/esm/custom-loader.mjs +0 -41
- package/dist/esm/register-esm.mjs +0 -22
- package/dist/esm-node/esm/esbuild-loader.js +0 -39
- package/dist/esm-node/esm/register-esm.js +0 -39
- package/dist/esm-node/esm/ts-node-loader.js +0 -42
- package/dist/types/esm/esbuild-loader.d.mts +0 -6
- package/dist/types/esm/register-esm.d.mts +0 -5
- package/dist/types/esm/ts-node-loader.d.mts +0 -6
- package/dist/types/esm/utils.d.mts +0 -6
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +0 -1
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +0 -1
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.cts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +0 -1
- /package/dist/cjs/plugins/deploy/platforms/{node-entry.js → nodeEntry.js} +0 -0
- /package/dist/types/plugins/deploy/platforms/{node-entry.d.ts → nodeEntry.d.ts} +0 -0
@@ -1,41 +0,0 @@
|
|
1
|
-
import { pathToFileURL } from 'url';
|
2
|
-
import { resolve as tsNodeResolve } from 'ts-node/esm';
|
3
|
-
import * as tsConfigPaths from 'tsconfig-paths';
|
4
|
-
import fs from 'fs/promises'
|
5
|
-
import { getAliasConfig } from '@modern-js/utils';
|
6
|
-
import path from 'path'
|
7
|
-
|
8
|
-
|
9
|
-
let matchPath;
|
10
|
-
export function initialize({ appDir, alias }){
|
11
|
-
const TS_CONFIG_FILENAME = `tsconfig.json`;
|
12
|
-
const aliasConfig = getAliasConfig(alias, {
|
13
|
-
appDirectory: appDir,
|
14
|
-
tsconfigPath: path.resolve(appDir, TS_CONFIG_FILENAME),
|
15
|
-
});
|
16
|
-
const { paths = {}, absoluteBaseUrl = './' } = aliasConfig;
|
17
|
-
const tsPaths = Object.keys(paths).reduce((o, key) => {
|
18
|
-
let tsPath = paths[key];
|
19
|
-
if (typeof tsPath === 'string' && path.isAbsolute(tsPath)) {
|
20
|
-
tsPath = path.relative(absoluteBaseUrl, tsPath);
|
21
|
-
}
|
22
|
-
if (typeof tsPath === 'string') {
|
23
|
-
tsPath = [tsPath];
|
24
|
-
}
|
25
|
-
return {
|
26
|
-
...o,
|
27
|
-
[`${key}`]: tsPath,
|
28
|
-
};
|
29
|
-
}, {});
|
30
|
-
|
31
|
-
matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, tsPaths);
|
32
|
-
}
|
33
|
-
|
34
|
-
export function resolve(specifier, context, defaultResolve) {
|
35
|
-
const match = matchPath(specifier);
|
36
|
-
return match
|
37
|
-
? tsNodeResolve(pathToFileURL(match).href, context, defaultResolve)
|
38
|
-
: tsNodeResolve(specifier, context, defaultResolve);
|
39
|
-
}
|
40
|
-
|
41
|
-
export { transformSource, load } from 'ts-node/esm';
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { register } from 'node:module';
|
2
|
-
import path from 'node:path';
|
3
|
-
|
4
|
-
export const registerEsm = async ({
|
5
|
-
appDir,
|
6
|
-
distDir,
|
7
|
-
alias
|
8
|
-
}) => {
|
9
|
-
// These can be overridden by ts-node options in tsconfig.json
|
10
|
-
process.env.TS_NODE_TRANSPILE_ONLY = true;
|
11
|
-
process.env.TS_NODE_PROJECT = path.join(appDir, 'tsconfig.json');
|
12
|
-
process.env.TS_NODE_SCOPE = true;
|
13
|
-
process.env.TS_NODE_FILES = true;
|
14
|
-
process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${path.relative(appDir, distDir)}/`
|
15
|
-
register('./custom-loader.mjs', import.meta.url, {
|
16
|
-
data: {
|
17
|
-
appDir,
|
18
|
-
distDir,
|
19
|
-
alias
|
20
|
-
}
|
21
|
-
});
|
22
|
-
};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { pathToFileURL } from "url";
|
2
|
-
import * as tsConfigPaths from "@modern-js/utils/tsconfig-paths";
|
3
|
-
import { getAliasConfig } from "@modern-js/utils";
|
4
|
-
import path from "path";
|
5
|
-
let matchPath;
|
6
|
-
function initialize({ appDir, alias }) {
|
7
|
-
const TS_CONFIG_FILENAME = `tsconfig.json`;
|
8
|
-
const aliasConfig = getAliasConfig(alias, {
|
9
|
-
appDirectory: appDir,
|
10
|
-
tsconfigPath: path.resolve(appDir, TS_CONFIG_FILENAME)
|
11
|
-
});
|
12
|
-
const { paths = {}, absoluteBaseUrl = "./" } = aliasConfig;
|
13
|
-
const tsPaths = Object.keys(paths).reduce((o, key) => {
|
14
|
-
let tsPath = paths[key];
|
15
|
-
if (typeof tsPath === "string" && path.isAbsolute(tsPath)) {
|
16
|
-
tsPath = path.relative(absoluteBaseUrl, tsPath);
|
17
|
-
}
|
18
|
-
if (typeof tsPath === "string") {
|
19
|
-
tsPath = [
|
20
|
-
tsPath
|
21
|
-
];
|
22
|
-
}
|
23
|
-
return {
|
24
|
-
...o,
|
25
|
-
[`${key}`]: tsPath
|
26
|
-
};
|
27
|
-
}, {});
|
28
|
-
matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, tsPaths);
|
29
|
-
}
|
30
|
-
function resolve(specifier, context, defaultResolve) {
|
31
|
-
const match = matchPath(specifier);
|
32
|
-
return match ? defaultResolve(pathToFileURL(match).href, context) : defaultResolve(specifier, context);
|
33
|
-
}
|
34
|
-
import { load } from "esbuild-register/loader";
|
35
|
-
export {
|
36
|
-
initialize,
|
37
|
-
load,
|
38
|
-
resolve
|
39
|
-
};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
const import_meta = {};
|
2
|
-
import { register } from "node:module";
|
3
|
-
import path from "node:path";
|
4
|
-
const checkDep = async (dep) => {
|
5
|
-
try {
|
6
|
-
await import(dep);
|
7
|
-
return true;
|
8
|
-
} catch (error) {
|
9
|
-
return false;
|
10
|
-
}
|
11
|
-
};
|
12
|
-
const registerEsm = async ({ appDir, distDir, alias }) => {
|
13
|
-
const hasTsNode = await checkDep("ts-node");
|
14
|
-
if (hasTsNode) {
|
15
|
-
process.env.TS_NODE_TRANSPILE_ONLY = true;
|
16
|
-
process.env.TS_NODE_PROJECT = path.join(appDir, "tsconfig.json");
|
17
|
-
process.env.TS_NODE_SCOPE = true;
|
18
|
-
process.env.TS_NODE_FILES = true;
|
19
|
-
process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${path.relative(appDir, distDir)}/`;
|
20
|
-
register("./ts-node-loader.mjs", import_meta.url, {
|
21
|
-
data: {
|
22
|
-
appDir,
|
23
|
-
distDir,
|
24
|
-
alias
|
25
|
-
}
|
26
|
-
});
|
27
|
-
} else {
|
28
|
-
register("./esbuild-loader.mjs", import_meta.url, {
|
29
|
-
data: {
|
30
|
-
appDir,
|
31
|
-
distDir,
|
32
|
-
alias
|
33
|
-
}
|
34
|
-
});
|
35
|
-
}
|
36
|
-
};
|
37
|
-
export {
|
38
|
-
registerEsm
|
39
|
-
};
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import { pathToFileURL } from "url";
|
2
|
-
import { resolve as tsNodeResolve } from "ts-node/esm";
|
3
|
-
import * as tsConfigPaths from "@modern-js/utils/tsconfig-paths";
|
4
|
-
import { getAliasConfig } from "@modern-js/utils";
|
5
|
-
import path from "path";
|
6
|
-
console.log("ttttttttttttt", tsConfigPaths);
|
7
|
-
let matchPath;
|
8
|
-
function initialize({ appDir, alias }) {
|
9
|
-
const TS_CONFIG_FILENAME = `tsconfig.json`;
|
10
|
-
const aliasConfig = getAliasConfig(alias, {
|
11
|
-
appDirectory: appDir,
|
12
|
-
tsconfigPath: path.resolve(appDir, TS_CONFIG_FILENAME)
|
13
|
-
});
|
14
|
-
const { paths = {}, absoluteBaseUrl = "./" } = aliasConfig;
|
15
|
-
const tsPaths = Object.keys(paths).reduce((o, key) => {
|
16
|
-
let tsPath = paths[key];
|
17
|
-
if (typeof tsPath === "string" && path.isAbsolute(tsPath)) {
|
18
|
-
tsPath = path.relative(absoluteBaseUrl, tsPath);
|
19
|
-
}
|
20
|
-
if (typeof tsPath === "string") {
|
21
|
-
tsPath = [
|
22
|
-
tsPath
|
23
|
-
];
|
24
|
-
}
|
25
|
-
return {
|
26
|
-
...o,
|
27
|
-
[`${key}`]: tsPath
|
28
|
-
};
|
29
|
-
}, {});
|
30
|
-
matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, tsPaths);
|
31
|
-
}
|
32
|
-
function resolve(specifier, context, defaultResolve) {
|
33
|
-
const match = matchPath(specifier);
|
34
|
-
return match ? tsNodeResolve(pathToFileURL(match).href, context, defaultResolve) : tsNodeResolve(specifier, context, defaultResolve);
|
35
|
-
}
|
36
|
-
import { transformSource, load } from "ts-node/esm";
|
37
|
-
export {
|
38
|
-
initialize,
|
39
|
-
load,
|
40
|
-
resolve,
|
41
|
-
transformSource
|
42
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export default handler;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { handler as default } from "./netlify-handler.cjs";
|
@@ -1 +0,0 @@
|
|
1
|
-
export function handler(request: any, context: any): Promise<any>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export function handler(req: any, res: any): Promise<any>;
|
File without changes
|
File without changes
|