@modern-js/app-tools 3.8.3 → 3.9.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.
@@ -46,6 +46,7 @@ const registerModuleHooks = async ({ appDir, distDir, baseUrl, paths })=>{
46
46
  process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${external_node_path_namespaceObject.relative(appDir, distDir)}/`;
47
47
  register('./ts-node-loader.mjs', __rslib_import_meta_url__, {
48
48
  data: {
49
+ appDir,
49
50
  baseUrl,
50
51
  paths
51
52
  }
@@ -10,6 +10,7 @@ export const registerModuleHooks = async ({ appDir, distDir, baseUrl, paths })=>
10
10
  process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${path.relative(appDir, distDir)}/`;
11
11
  register('./ts-node-loader.mjs', import.meta.url, {
12
12
  data: {
13
+ appDir,
13
14
  baseUrl,
14
15
  paths
15
16
  }
@@ -32,17 +32,13 @@ __webpack_require__.d(__webpack_exports__, {
32
32
  load: ()=>load,
33
33
  resolve: ()=>resolve
34
34
  });
35
- const external_url_namespaceObject = require("url");
36
- const utils_namespaceObject = require("@modern-js/utils");
37
- const tsconfig_paths_namespaceObject = require("@modern-js/utils/tsconfig-paths");
38
35
  const esm_namespaceObject = require("ts-node/esm");
39
- let matchPath;
40
- async function initialize({ baseUrl, paths }) {
41
- matchPath = (0, tsconfig_paths_namespaceObject.createMatchPath)(baseUrl || './', paths || {});
36
+ const external_ts_paths_loader_js_namespaceObject = require("./ts-paths-loader.js");
37
+ async function initialize(config) {
38
+ await (0, external_ts_paths_loader_js_namespaceObject.initialize)(config);
42
39
  }
43
40
  function resolve(specifier, context, defaultResolve) {
44
- const match = (0, utils_namespaceObject.findMatchedSourcePath)(matchPath, specifier);
45
- return match ? (0, esm_namespaceObject.resolve)((0, external_url_namespaceObject.pathToFileURL)((0, utils_namespaceObject.findSourceEntry)(match) || match).href, context, defaultResolve) : (0, esm_namespaceObject.resolve)(specifier, context, defaultResolve);
41
+ return (0, external_ts_paths_loader_js_namespaceObject.resolve)(specifier, context, (specifier, context)=>(0, esm_namespaceObject.resolve)(specifier, context, defaultResolve));
46
42
  }
47
43
  function load(url, context, defaultLoad) {
48
44
  const filePath = new URL(url).pathname;
@@ -1,15 +1,11 @@
1
- import { pathToFileURL } from 'url';
2
- import { findMatchedSourcePath, findSourceEntry } from '@modern-js/utils';
3
- import { createMatchPath } from '@modern-js/utils/tsconfig-paths';
4
1
  import { resolve as tsNodeResolve } from 'ts-node/esm';
5
2
  import { load as tsNodeLoad } from 'ts-node/esm';
6
- let matchPath;
7
- export async function initialize({ baseUrl, paths }) {
8
- matchPath = createMatchPath(baseUrl || './', paths || {});
3
+ import { initialize as initializeTsPathsLoader, resolve as resolveTsPaths } from './ts-paths-loader.mjs';
4
+ export async function initialize(config) {
5
+ await initializeTsPathsLoader(config);
9
6
  }
10
7
  export function resolve(specifier, context, defaultResolve) {
11
- const match = findMatchedSourcePath(matchPath, specifier);
12
- return match ? tsNodeResolve(pathToFileURL(findSourceEntry(match) || match).href, context, defaultResolve) : tsNodeResolve(specifier, context, defaultResolve);
8
+ return resolveTsPaths(specifier, context, (specifier, context)=>tsNodeResolve(specifier, context, defaultResolve));
13
9
  }
14
10
  export function load(url, context, defaultLoad) {
15
11
  const filePath = new URL(url).pathname;
@@ -10,6 +10,7 @@ const registerModuleHooks = async ({ appDir, distDir, baseUrl, paths })=>{
10
10
  process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${node_path.relative(appDir, distDir)}/`;
11
11
  register('./ts-node-loader.mjs', import.meta.url, {
12
12
  data: {
13
+ appDir,
13
14
  baseUrl,
14
15
  paths
15
16
  }
@@ -1,14 +1,10 @@
1
- import { pathToFileURL } from "url";
2
- import { findMatchedSourcePath, findSourceEntry } from "@modern-js/utils";
3
- import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
4
1
  import { load, resolve } from "ts-node/esm";
5
- let matchPath;
6
- async function initialize({ baseUrl, paths }) {
7
- matchPath = createMatchPath(baseUrl || './', paths || {});
2
+ import { initialize, resolve as external_ts_paths_loader_mjs_resolve } from "./ts-paths-loader.mjs";
3
+ async function ts_node_loader_initialize(config) {
4
+ await initialize(config);
8
5
  }
9
6
  function ts_node_loader_resolve(specifier, context, defaultResolve) {
10
- const match = findMatchedSourcePath(matchPath, specifier);
11
- return match ? resolve(pathToFileURL(findSourceEntry(match) || match).href, context, defaultResolve) : resolve(specifier, context, defaultResolve);
7
+ return external_ts_paths_loader_mjs_resolve(specifier, context, (specifier, context)=>resolve(specifier, context, defaultResolve));
12
8
  }
13
9
  function ts_node_loader_load(url, context, defaultLoad) {
14
10
  const filePath = new URL(url).pathname;
@@ -16,4 +12,4 @@ function ts_node_loader_load(url, context, defaultLoad) {
16
12
  if (filePath.includes('node_modules')) return defaultLoad(url, context);
17
13
  return load(url, context, defaultLoad);
18
14
  }
19
- export { initialize, ts_node_loader_load as load, ts_node_loader_resolve as resolve };
15
+ export { ts_node_loader_initialize as initialize, ts_node_loader_load as load, ts_node_loader_resolve as resolve };
@@ -11,6 +11,7 @@ const registerModuleHooks = async ({ appDir, distDir, baseUrl, paths })=>{
11
11
  process.env.TS_NODE_IGNORE = `(?:^|/)node_modules/,(?:^|/)${node_path.relative(appDir, distDir)}/`;
12
12
  register('./ts-node-loader.mjs', import.meta.url, {
13
13
  data: {
14
+ appDir,
14
15
  baseUrl,
15
16
  paths
16
17
  }
@@ -1,15 +1,11 @@
1
1
  import "node:module";
2
- import { pathToFileURL } from "url";
3
- import { findMatchedSourcePath, findSourceEntry } from "@modern-js/utils";
4
- import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
5
2
  import { load, resolve } from "ts-node/esm";
6
- let matchPath;
7
- async function initialize({ baseUrl, paths }) {
8
- matchPath = createMatchPath(baseUrl || './', paths || {});
3
+ import { initialize, resolve as external_ts_paths_loader_mjs_resolve } from "./ts-paths-loader.mjs";
4
+ async function ts_node_loader_initialize(config) {
5
+ await initialize(config);
9
6
  }
10
7
  function ts_node_loader_resolve(specifier, context, defaultResolve) {
11
- const match = findMatchedSourcePath(matchPath, specifier);
12
- return match ? resolve(pathToFileURL(findSourceEntry(match) || match).href, context, defaultResolve) : resolve(specifier, context, defaultResolve);
8
+ return external_ts_paths_loader_mjs_resolve(specifier, context, (specifier, context)=>resolve(specifier, context, defaultResolve));
13
9
  }
14
10
  function ts_node_loader_load(url, context, defaultLoad) {
15
11
  const filePath = new URL(url).pathname;
@@ -17,4 +13,4 @@ function ts_node_loader_load(url, context, defaultLoad) {
17
13
  if (filePath.includes('node_modules')) return defaultLoad(url, context);
18
14
  return load(url, context, defaultLoad);
19
15
  }
20
- export { initialize, ts_node_loader_load as load, ts_node_loader_resolve as resolve };
16
+ export { ts_node_loader_initialize as initialize, ts_node_loader_load as load, ts_node_loader_resolve as resolve };
@@ -1,6 +1,3 @@
1
- export function initialize({ baseUrl, paths }: {
2
- baseUrl: any;
3
- paths: any;
4
- }): Promise<void>;
1
+ export function initialize(config: any): Promise<void>;
5
2
  export function resolve(specifier: any, context: any, defaultResolve: any): any;
6
3
  export function load(url: any, context: any, defaultLoad: any): any;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.8.3",
18
+ "version": "3.9.0",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -126,16 +126,16 @@
126
126
  "ndepe": "^0.1.13",
127
127
  "pkg-types": "^1.3.1",
128
128
  "std-env": "^3.10.0",
129
- "@modern-js/builder": "3.8.3",
130
- "@modern-js/i18n-utils": "3.8.3",
131
- "@modern-js/plugin": "3.8.3",
132
- "@modern-js/plugin-data-loader": "3.8.3",
133
- "@modern-js/prod-server": "3.8.3",
134
- "@modern-js/server-core": "3.8.3",
135
- "@modern-js/server": "3.8.3",
136
- "@modern-js/server-utils": "3.8.3",
137
- "@modern-js/types": "3.8.3",
138
- "@modern-js/utils": "3.8.3"
129
+ "@modern-js/builder": "3.9.0",
130
+ "@modern-js/i18n-utils": "3.9.0",
131
+ "@modern-js/plugin-data-loader": "3.9.0",
132
+ "@modern-js/plugin": "3.9.0",
133
+ "@modern-js/prod-server": "3.9.0",
134
+ "@modern-js/server": "3.9.0",
135
+ "@modern-js/server-core": "3.9.0",
136
+ "@modern-js/server-utils": "3.9.0",
137
+ "@modern-js/types": "3.9.0",
138
+ "@modern-js/utils": "3.9.0"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@rslib/core": "0.23.2",