@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.
Files changed (78) hide show
  1. package/dist/cjs/builder/builder-webpack/index.js +1 -1
  2. package/dist/cjs/builder/generator/index.js +2 -2
  3. package/dist/cjs/builder/index.js +2 -2
  4. package/dist/cjs/commands/build.js +0 -19
  5. package/dist/cjs/commands/dev.js +0 -9
  6. package/dist/cjs/commands/index.js +8 -8
  7. package/dist/cjs/index.js +1 -1
  8. package/dist/cjs/plugins/analyze/index.js +3 -3
  9. package/dist/cjs/plugins/deploy/dependencies/index.js +12 -2
  10. package/dist/cjs/plugins/deploy/dependencies/utils.js +73 -13
  11. package/dist/cjs/plugins/deploy/platforms/netlify.js +5 -14
  12. package/dist/cjs/plugins/deploy/platforms/{netlify-handler.js → netlifyEntry.js} +4 -6
  13. package/dist/cjs/plugins/deploy/platforms/node.js +4 -13
  14. package/dist/cjs/plugins/deploy/platforms/vercel.js +5 -14
  15. package/dist/cjs/plugins/deploy/platforms/{vercel-handler.js → vercelEntry.js} +1 -27
  16. package/dist/cjs/utils/config.js +7 -23
  17. package/dist/cjs/utils/loadPlugins.js +1 -1
  18. package/dist/cjs/utils/register.js +22 -49
  19. package/dist/esm/builder/builder-rspack/adapterCopy.js +4 -3
  20. package/dist/esm/builder/generator/getBuilderEnvironments.js +2 -0
  21. package/dist/esm/builder/generator/index.js +1 -1
  22. package/dist/esm/builder/index.js +2 -2
  23. package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +1 -1
  24. package/dist/esm/commands/build.js +16 -9
  25. package/dist/esm/commands/dev.js +55 -37
  26. package/dist/esm/commands/index.js +7 -7
  27. package/dist/esm/index.js +1 -42
  28. package/dist/esm/plugins/analyze/index.js +10 -6
  29. package/dist/esm/plugins/deploy/dependencies/index.js +28 -8
  30. package/dist/esm/plugins/deploy/dependencies/utils.js +290 -10
  31. package/dist/esm/utils/config.js +6 -21
  32. package/dist/esm/utils/createServer.js +1 -1
  33. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +2 -2
  34. package/dist/esm-node/builder/generator/getBuilderEnvironments.js +1 -1
  35. package/dist/esm-node/builder/generator/index.js +1 -1
  36. package/dist/esm-node/builder/index.js +2 -2
  37. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +1 -1
  38. package/dist/esm-node/commands/build.js +3 -0
  39. package/dist/esm-node/commands/dev.js +24 -16
  40. package/dist/esm-node/commands/index.js +7 -7
  41. package/dist/esm-node/index.js +1 -17
  42. package/dist/esm-node/plugins/analyze/index.js +7 -5
  43. package/dist/esm-node/plugins/deploy/dependencies/index.js +26 -7
  44. package/dist/esm-node/plugins/deploy/dependencies/utils.js +83 -3
  45. package/dist/esm-node/utils/config.js +5 -20
  46. package/dist/esm-node/utils/createServer.js +1 -1
  47. package/dist/types/builder/index.d.ts +1 -1
  48. package/dist/types/plugins/deploy/dependencies/index.d.ts +5 -3
  49. package/dist/types/plugins/deploy/dependencies/utils.d.ts +7 -1
  50. package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +2 -0
  51. package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +2 -0
  52. package/dist/types/utils/config.d.ts +0 -5
  53. package/package.json +23 -21
  54. package/dist/cjs/esm/esbuild-loader.mjs +0 -20
  55. package/dist/cjs/esm/register-esm.mjs +0 -65
  56. package/dist/cjs/esm/ts-node-loader.mjs +0 -21
  57. package/dist/cjs/esm/utils.mjs +0 -43
  58. package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +0 -3
  59. package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +0 -1
  60. package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +0 -3
  61. package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +0 -3
  62. package/dist/esm/custom-loader.mjs +0 -41
  63. package/dist/esm/register-esm.mjs +0 -22
  64. package/dist/esm-node/esm/esbuild-loader.js +0 -39
  65. package/dist/esm-node/esm/register-esm.js +0 -39
  66. package/dist/esm-node/esm/ts-node-loader.js +0 -42
  67. package/dist/types/esm/esbuild-loader.d.mts +0 -6
  68. package/dist/types/esm/register-esm.d.mts +0 -5
  69. package/dist/types/esm/ts-node-loader.d.mts +0 -6
  70. package/dist/types/esm/utils.d.mts +0 -6
  71. package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +0 -1
  72. package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +0 -1
  73. package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +0 -1
  74. package/dist/types/plugins/deploy/platforms/vercel-entry.d.cts +0 -2
  75. package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +0 -2
  76. package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +0 -1
  77. /package/dist/cjs/plugins/deploy/platforms/{node-entry.js → nodeEntry.js} +0 -0
  78. /package/dist/types/plugins/deploy/platforms/{node-entry.d.ts → nodeEntry.d.ts} +0 -0
@@ -1,3 +0,0 @@
1
- "use strict";
2
- const { handler } = require("./vercel-handler.cjs");
3
- module.exports = handler;
@@ -1,3 +0,0 @@
1
- import { handler } from './vercel-handler.cjs';
2
-
3
- export default handler;
@@ -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,6 +0,0 @@
1
- export function initialize({ appDir, alias, tsconfigPath }: {
2
- appDir: any;
3
- alias: any;
4
- tsconfigPath: any;
5
- }): Promise<void>;
6
- export function resolve(specifier: any, context: any, defaultResolve: any): any;
@@ -1,5 +0,0 @@
1
- export function registerEsm({ appDir, distDir, alias }: {
2
- appDir: any;
3
- distDir: any;
4
- alias: any;
5
- }): Promise<void>;
@@ -1,6 +0,0 @@
1
- export function initialize({ appDir, alias, tsconfigPath }: {
2
- appDir: any;
3
- alias: any;
4
- tsconfigPath: any;
5
- }): Promise<void>;
6
- export function resolve(specifier: any, context: any, defaultResolve: any): any;
@@ -1,6 +0,0 @@
1
- export function createMatchPath({ alias, appDir, tsconfigPath }: {
2
- alias: any;
3
- appDir: any;
4
- tsconfigPath: any;
5
- }): tsConfigPaths.MatchPath;
6
- import tsConfigPaths from '@modern-js/utils/tsconfig-paths';
@@ -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,2 +0,0 @@
1
- export = handler;
2
- import { handler } from "./vercel-handler.cjs";
@@ -1,2 +0,0 @@
1
- export default handler;
2
- import { handler } from './vercel-handler.cjs';
@@ -1 +0,0 @@
1
- export function handler(req: any, res: any): Promise<any>;