@modern-js/app-tools 2.57.2-alpha.0 → 2.58.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.
Files changed (73) 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 +0 -1
  10. package/dist/cjs/plugins/deploy/dependencies/utils.js +0 -11
  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 +1 -1
  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 +16 -8
  30. package/dist/esm/plugins/deploy/dependencies/utils.js +15 -7
  31. package/dist/esm/utils/createServer.js +1 -1
  32. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +2 -2
  33. package/dist/esm-node/builder/generator/getBuilderEnvironments.js +1 -1
  34. package/dist/esm-node/builder/generator/index.js +1 -1
  35. package/dist/esm-node/builder/index.js +2 -2
  36. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +1 -1
  37. package/dist/esm-node/commands/build.js +3 -0
  38. package/dist/esm-node/commands/dev.js +24 -16
  39. package/dist/esm-node/commands/index.js +7 -7
  40. package/dist/esm-node/index.js +1 -17
  41. package/dist/esm-node/plugins/analyze/index.js +7 -5
  42. package/dist/esm-node/plugins/deploy/dependencies/index.js +15 -7
  43. package/dist/esm-node/plugins/deploy/dependencies/utils.js +11 -2
  44. package/dist/esm-node/utils/createServer.js +1 -1
  45. package/dist/types/builder/index.d.ts +1 -1
  46. package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +2 -0
  47. package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +2 -0
  48. package/package.json +18 -18
  49. package/dist/cjs/esm/esbuild-loader.mjs +0 -20
  50. package/dist/cjs/esm/register-esm.mjs +0 -65
  51. package/dist/cjs/esm/ts-node-loader.mjs +0 -21
  52. package/dist/cjs/esm/utils.mjs +0 -43
  53. package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +0 -3
  54. package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +0 -1
  55. package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +0 -3
  56. package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +0 -3
  57. package/dist/esm/custom-loader.mjs +0 -41
  58. package/dist/esm/register-esm.mjs +0 -22
  59. package/dist/esm-node/esm/esbuild-loader.js +0 -39
  60. package/dist/esm-node/esm/register-esm.js +0 -39
  61. package/dist/esm-node/esm/ts-node-loader.js +0 -42
  62. package/dist/types/esm/esbuild-loader.d.mts +0 -6
  63. package/dist/types/esm/register-esm.d.mts +0 -5
  64. package/dist/types/esm/ts-node-loader.d.mts +0 -6
  65. package/dist/types/esm/utils.d.mts +0 -6
  66. package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +0 -1
  67. package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +0 -1
  68. package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +0 -1
  69. package/dist/types/plugins/deploy/platforms/vercel-entry.d.cts +0 -2
  70. package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +0 -2
  71. package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +0 -1
  72. /package/dist/cjs/plugins/deploy/platforms/{node-entry.js → nodeEntry.js} +0 -0
  73. /package/dist/types/plugins/deploy/platforms/{node-entry.d.ts → nodeEntry.d.ts} +0 -0
@@ -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>;