@modern-js/app-tools 2.56.2-alpha.0 → 2.56.2-alpha.2

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.
@@ -41,6 +41,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
41
41
  const entryFiles = await (0, import_utils2.findEntryFiles)(serverRootDir, entryFilter);
42
42
  const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
43
43
  const currentProjectModules = import_node_path.default.join(appDir, "node_modules");
44
+ const dependencySearchRoot = import_node_path.default.resolve(appDir, "../../../../../../");
44
45
  const tracedFiles = Object.fromEntries(await Promise.all([
45
46
  ...fileTrace.reasons.entries()
46
47
  ].map(async ([_path, reasons]) => {
@@ -71,6 +72,13 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
71
72
  const packageJsonPath = match ? import_node_path.default.join(match[0], "package.json") : await (0, import_utils.pkgUp)({
72
73
  cwd: import_node_path.default.dirname(filePath)
73
74
  });
75
+ if (packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)) {
76
+ console.log("ffffffff", filePath);
77
+ const packageJson = await import_utils.fs.readJSON(packageJsonPath);
78
+ pkgPath = baseDir = import_node_path.default.dirname(packageJsonPath);
79
+ subpath = import_node_path.default.relative(baseDir, filePath);
80
+ pkgName = packageJson.name;
81
+ }
74
82
  }
75
83
  if (!baseDir) {
76
84
  return;
@@ -10,7 +10,7 @@ import { parseNodeModulePath } from "mlly";
10
10
  import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles as defaultTraceFiles, findPackageParents, resolveTracedPath, readDirRecursive } from "./utils";
11
11
  var handleDependencies = function() {
12
12
  var _ref = _async_to_generator(function(param) {
13
- var appDir, serverRootDir, includeEntries, _param_traceFiles, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, base, entryFiles, fileTrace, currentProjectModules, tracedFiles, _, tracedPackages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tracedFile, pkgName, tracedPackage, pkgJSON, tracedPackageVersion, shouldCopyWholePackage, _tracedPackageVersion_files, allFiles, err, multiVersionPkgs, singleVersionPackages, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tracedPackage1, versions, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, version, projectPkgJson, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _loop, _iterator3, _step3, err, outputPkgPath, newPkgJson, finalPkgJson;
13
+ var appDir, serverRootDir, includeEntries, _param_traceFiles, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, base, entryFiles, fileTrace, currentProjectModules, dependencySearchRoot, tracedFiles, _, tracedPackages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tracedFile, pkgName, tracedPackage, pkgJSON, tracedPackageVersion, shouldCopyWholePackage, _tracedPackageVersion_files, allFiles, err, multiVersionPkgs, singleVersionPackages, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tracedPackage1, versions, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, version, projectPkgJson, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _loop, _iterator3, _step3, err, outputPkgPath, newPkgJson, finalPkgJson;
14
14
  return _ts_generator(this, function(_state) {
15
15
  switch (_state.label) {
16
16
  case 0:
@@ -29,12 +29,13 @@ var handleDependencies = function() {
29
29
  case 2:
30
30
  fileTrace = _state.sent();
31
31
  currentProjectModules = path.join(appDir, "node_modules");
32
+ dependencySearchRoot = path.resolve(appDir, "../../../../../../");
32
33
  _ = Object.fromEntries;
33
34
  return [
34
35
  4,
35
36
  Promise.all(_to_consumable_array(fileTrace.reasons.entries()).map(function() {
36
37
  var _ref2 = _async_to_generator(function(param2) {
37
- var _param, _path, reasons, filePath, baseDir, pkgName2, subpath, pkgPath, parsed, MODERN_UTILS_PATH, MODERN_UTILS_PATH_REGEX, match, packageJsonPath, _tmp, parents, tracedFile2;
38
+ var _param, _path, reasons, filePath, baseDir, pkgName2, subpath, pkgPath, parsed, MODERN_UTILS_PATH, MODERN_UTILS_PATH_REGEX, match, packageJsonPath, _tmp, packageJson, parents, tracedFile2;
38
39
  return _ts_generator(this, function(_state2) {
39
40
  switch (_state2.label) {
40
41
  case 0:
@@ -77,7 +78,7 @@ var handleDependencies = function() {
77
78
  pkgPath = path.join(baseDir, pkgName2);
78
79
  return [
79
80
  3,
80
- 7
81
+ 8
81
82
  ];
82
83
  case 3:
83
84
  MODERN_UTILS_PATH = "packages/toolkit/utils";
@@ -105,8 +106,23 @@ var handleDependencies = function() {
105
106
  _state2.label = 6;
106
107
  case 6:
107
108
  packageJsonPath = _tmp;
108
- _state2.label = 7;
109
+ if (!(packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)))
110
+ return [
111
+ 3,
112
+ 8
113
+ ];
114
+ console.log("ffffffff", filePath);
115
+ return [
116
+ 4,
117
+ fse.readJSON(packageJsonPath)
118
+ ];
109
119
  case 7:
120
+ packageJson = _state2.sent();
121
+ pkgPath = baseDir = path.dirname(packageJsonPath);
122
+ subpath = path.relative(baseDir, filePath);
123
+ pkgName2 = packageJson.name;
124
+ _state2.label = 8;
125
+ case 8:
110
126
  if (!baseDir) {
111
127
  return [
112
128
  2
@@ -118,7 +134,7 @@ var handleDependencies = function() {
118
134
  return resolveTracedPath(base, p);
119
135
  }))
120
136
  ];
121
- case 8:
137
+ case 9:
122
138
  parents = _state2.sent();
123
139
  tracedFile2 = {
124
140
  path: filePath,
@@ -8,6 +8,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
8
8
  const entryFiles = await findEntryFiles(serverRootDir, entryFilter);
9
9
  const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
10
10
  const currentProjectModules = path.join(appDir, "node_modules");
11
+ const dependencySearchRoot = path.resolve(appDir, "../../../../../../");
11
12
  const tracedFiles = Object.fromEntries(await Promise.all([
12
13
  ...fileTrace.reasons.entries()
13
14
  ].map(async ([_path, reasons]) => {
@@ -38,6 +39,13 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
38
39
  const packageJsonPath = match ? path.join(match[0], "package.json") : await pkgUp({
39
40
  cwd: path.dirname(filePath)
40
41
  });
42
+ if (packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)) {
43
+ console.log("ffffffff", filePath);
44
+ const packageJson = await fse.readJSON(packageJsonPath);
45
+ pkgPath = baseDir = path.dirname(packageJsonPath);
46
+ subpath = path.relative(baseDir, filePath);
47
+ pkgName = packageJson.name;
48
+ }
41
49
  }
42
50
  if (!baseDir) {
43
51
  return;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.56.2-alpha.0",
18
+ "version": "2.56.2-alpha.2",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -89,18 +89,18 @@
89
89
  "std-env": "^3.7.0",
90
90
  "@modern-js/core": "2.56.1",
91
91
  "@modern-js/node-bundle-require": "2.56.1",
92
- "@modern-js/plugin-i18n": "2.56.1",
93
92
  "@modern-js/plugin": "2.56.1",
94
93
  "@modern-js/plugin-lint": "2.56.1",
95
- "@modern-js/server-utils": "2.56.1",
94
+ "@modern-js/plugin-i18n": "2.56.1",
95
+ "@modern-js/prod-server": "2.56.1",
96
+ "@modern-js/server": "2.56.1",
97
+ "@modern-js/server-core": "2.56.1",
98
+ "@modern-js/utils": "2.56.1",
99
+ "@modern-js/types": "2.56.1",
96
100
  "@modern-js/uni-builder": "2.56.1",
97
101
  "@modern-js/rsbuild-plugin-esbuild": "2.56.1",
98
- "@modern-js/types": "2.56.1",
99
- "@modern-js/plugin-data-loader": "2.56.1",
100
- "@modern-js/utils": "2.56.1",
101
- "@modern-js/server-core": "2.56.1",
102
- "@modern-js/prod-server": "2.56.1",
103
- "@modern-js/server": "2.56.1"
102
+ "@modern-js/server-utils": "2.56.1",
103
+ "@modern-js/plugin-data-loader": "2.56.1"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@rsbuild/plugin-swc": "1.0.1-beta.3",