@modern-js/app-tools 2.56.2-alpha.1 → 2.56.2-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -36,21 +36,12 @@ var import_utils = require("@modern-js/utils");
|
|
36
36
|
var import_pkg_types = require("pkg-types");
|
37
37
|
var import_mlly = require("mlly");
|
38
38
|
var import_utils2 = require("./utils");
|
39
|
-
const createGetMonoRoot = (appDir) => {
|
40
|
-
let monorepoRoot;
|
41
|
-
return () => {
|
42
|
-
if (!monorepoRoot) {
|
43
|
-
monorepoRoot = (0, import_utils.findMonorepoRoot)(appDir, 8);
|
44
|
-
}
|
45
|
-
return monorepoRoot;
|
46
|
-
};
|
47
|
-
};
|
48
39
|
const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = import_utils2.traceFiles, entryFilter, modifyPackageJson, copyWholePackage }) => {
|
49
40
|
const base = "/";
|
50
41
|
const entryFiles = await (0, import_utils2.findEntryFiles)(serverRootDir, entryFilter);
|
51
42
|
const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
|
52
43
|
const currentProjectModules = import_node_path.default.join(appDir, "node_modules");
|
53
|
-
const
|
44
|
+
const dependencySearchRoot = import_node_path.default.resolve(appDir, "../../../../../../");
|
54
45
|
const tracedFiles = Object.fromEntries(await Promise.all([
|
55
46
|
...fileTrace.reasons.entries()
|
56
47
|
].map(async ([_path, reasons]) => {
|
@@ -78,14 +69,11 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
|
|
78
69
|
const MODERN_UTILS_PATH = "packages/toolkit/utils";
|
79
70
|
const MODERN_UTILS_PATH_REGEX = new RegExp(`(.*${MODERN_UTILS_PATH})`);
|
80
71
|
const match = filePath.match(MODERN_UTILS_PATH_REGEX);
|
81
|
-
const monorepoRoot = getMonorepoRoot();
|
82
72
|
const packageJsonPath = match ? import_node_path.default.join(match[0], "package.json") : await (0, import_utils.pkgUp)({
|
83
73
|
cwd: import_node_path.default.dirname(filePath)
|
84
74
|
});
|
85
|
-
if (packageJsonPath &&
|
86
|
-
|
87
|
-
console.log("filePath", filePath, packageJsonPath);
|
88
|
-
}
|
75
|
+
if (packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)) {
|
76
|
+
console.log("ffffffff", filePath);
|
89
77
|
const packageJson = await import_utils.fs.readJSON(packageJsonPath);
|
90
78
|
pkgPath = baseDir = import_node_path.default.dirname(packageJsonPath);
|
91
79
|
subpath = import_node_path.default.relative(baseDir, filePath);
|
@@ -4,22 +4,13 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
5
5
|
import { _ as _ts_values } from "@swc/helpers/_/_ts_values";
|
6
6
|
import path from "node:path";
|
7
|
-
import {
|
7
|
+
import { fs as fse, pkgUp, semver } from "@modern-js/utils";
|
8
8
|
import { readPackageJSON } from "pkg-types";
|
9
9
|
import { parseNodeModulePath } from "mlly";
|
10
10
|
import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles as defaultTraceFiles, findPackageParents, resolveTracedPath, readDirRecursive } from "./utils";
|
11
|
-
var createGetMonoRoot = function(appDir) {
|
12
|
-
var monorepoRoot;
|
13
|
-
return function() {
|
14
|
-
if (!monorepoRoot) {
|
15
|
-
monorepoRoot = findMonorepoRoot(appDir, 8);
|
16
|
-
}
|
17
|
-
return monorepoRoot;
|
18
|
-
};
|
19
|
-
};
|
20
11
|
var handleDependencies = function() {
|
21
12
|
var _ref = _async_to_generator(function(param) {
|
22
|
-
var appDir, serverRootDir, includeEntries, _param_traceFiles, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, base, entryFiles, fileTrace, currentProjectModules,
|
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;
|
23
14
|
return _ts_generator(this, function(_state) {
|
24
15
|
switch (_state.label) {
|
25
16
|
case 0:
|
@@ -38,13 +29,13 @@ var handleDependencies = function() {
|
|
38
29
|
case 2:
|
39
30
|
fileTrace = _state.sent();
|
40
31
|
currentProjectModules = path.join(appDir, "node_modules");
|
41
|
-
|
32
|
+
dependencySearchRoot = path.resolve(appDir, "../../../../../../");
|
42
33
|
_ = Object.fromEntries;
|
43
34
|
return [
|
44
35
|
4,
|
45
36
|
Promise.all(_to_consumable_array(fileTrace.reasons.entries()).map(function() {
|
46
37
|
var _ref2 = _async_to_generator(function(param2) {
|
47
|
-
var _param, _path, reasons, filePath, baseDir, pkgName2, subpath, pkgPath, parsed, MODERN_UTILS_PATH, MODERN_UTILS_PATH_REGEX, match,
|
38
|
+
var _param, _path, reasons, filePath, baseDir, pkgName2, subpath, pkgPath, parsed, MODERN_UTILS_PATH, MODERN_UTILS_PATH_REGEX, match, packageJsonPath, _tmp, packageJson, parents, tracedFile2;
|
48
39
|
return _ts_generator(this, function(_state2) {
|
49
40
|
switch (_state2.label) {
|
50
41
|
case 0:
|
@@ -93,7 +84,6 @@ var handleDependencies = function() {
|
|
93
84
|
MODERN_UTILS_PATH = "packages/toolkit/utils";
|
94
85
|
MODERN_UTILS_PATH_REGEX = new RegExp("(.*".concat(MODERN_UTILS_PATH, ")"));
|
95
86
|
match = filePath.match(MODERN_UTILS_PATH_REGEX);
|
96
|
-
monorepoRoot = getMonorepoRoot();
|
97
87
|
if (!match)
|
98
88
|
return [
|
99
89
|
3,
|
@@ -116,14 +106,12 @@ var handleDependencies = function() {
|
|
116
106
|
_state2.label = 6;
|
117
107
|
case 6:
|
118
108
|
packageJsonPath = _tmp;
|
119
|
-
if (!(packageJsonPath &&
|
109
|
+
if (!(packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)))
|
120
110
|
return [
|
121
111
|
3,
|
122
112
|
8
|
123
113
|
];
|
124
|
-
|
125
|
-
console.log("filePath", filePath, packageJsonPath);
|
126
|
-
}
|
114
|
+
console.log("ffffffff", filePath);
|
127
115
|
return [
|
128
116
|
4,
|
129
117
|
fse.readJSON(packageJsonPath)
|
@@ -1,23 +1,14 @@
|
|
1
1
|
import path from "node:path";
|
2
|
-
import {
|
2
|
+
import { fs as fse, pkgUp, semver } from "@modern-js/utils";
|
3
3
|
import { readPackageJSON } from "pkg-types";
|
4
4
|
import { parseNodeModulePath } from "mlly";
|
5
5
|
import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles as defaultTraceFiles, findPackageParents, resolveTracedPath, readDirRecursive } from "./utils";
|
6
|
-
const createGetMonoRoot = (appDir) => {
|
7
|
-
let monorepoRoot;
|
8
|
-
return () => {
|
9
|
-
if (!monorepoRoot) {
|
10
|
-
monorepoRoot = findMonorepoRoot(appDir, 8);
|
11
|
-
}
|
12
|
-
return monorepoRoot;
|
13
|
-
};
|
14
|
-
};
|
15
6
|
const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = defaultTraceFiles, entryFilter, modifyPackageJson, copyWholePackage }) => {
|
16
7
|
const base = "/";
|
17
8
|
const entryFiles = await findEntryFiles(serverRootDir, entryFilter);
|
18
9
|
const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
|
19
10
|
const currentProjectModules = path.join(appDir, "node_modules");
|
20
|
-
const
|
11
|
+
const dependencySearchRoot = path.resolve(appDir, "../../../../../../");
|
21
12
|
const tracedFiles = Object.fromEntries(await Promise.all([
|
22
13
|
...fileTrace.reasons.entries()
|
23
14
|
].map(async ([_path, reasons]) => {
|
@@ -45,14 +36,11 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
|
|
45
36
|
const MODERN_UTILS_PATH = "packages/toolkit/utils";
|
46
37
|
const MODERN_UTILS_PATH_REGEX = new RegExp(`(.*${MODERN_UTILS_PATH})`);
|
47
38
|
const match = filePath.match(MODERN_UTILS_PATH_REGEX);
|
48
|
-
const monorepoRoot = getMonorepoRoot();
|
49
39
|
const packageJsonPath = match ? path.join(match[0], "package.json") : await pkgUp({
|
50
40
|
cwd: path.dirname(filePath)
|
51
41
|
});
|
52
|
-
if (packageJsonPath &&
|
53
|
-
|
54
|
-
console.log("filePath", filePath, packageJsonPath);
|
55
|
-
}
|
42
|
+
if (packageJsonPath && packageJsonPath.startsWith(dependencySearchRoot)) {
|
43
|
+
console.log("ffffffff", filePath);
|
56
44
|
const packageJson = await fse.readJSON(packageJsonPath);
|
57
45
|
pkgPath = baseDir = path.dirname(packageJsonPath);
|
58
46
|
subpath = path.relative(baseDir, filePath);
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.56.2-alpha.
|
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",
|
@@ -87,19 +87,19 @@
|
|
87
87
|
"mlly": "^1.6.1",
|
88
88
|
"pkg-types": "^1.1.0",
|
89
89
|
"std-env": "^3.7.0",
|
90
|
-
"@modern-js/node-bundle-require": "2.56.1",
|
91
90
|
"@modern-js/core": "2.56.1",
|
91
|
+
"@modern-js/node-bundle-require": "2.56.1",
|
92
92
|
"@modern-js/plugin": "2.56.1",
|
93
|
-
"@modern-js/plugin-i18n": "2.56.1",
|
94
93
|
"@modern-js/plugin-lint": "2.56.1",
|
95
|
-
"@modern-js/
|
94
|
+
"@modern-js/plugin-i18n": "2.56.1",
|
96
95
|
"@modern-js/prod-server": "2.56.1",
|
96
|
+
"@modern-js/server": "2.56.1",
|
97
97
|
"@modern-js/server-core": "2.56.1",
|
98
98
|
"@modern-js/utils": "2.56.1",
|
99
|
-
"@modern-js/server-utils": "2.56.1",
|
100
99
|
"@modern-js/types": "2.56.1",
|
101
100
|
"@modern-js/uni-builder": "2.56.1",
|
102
101
|
"@modern-js/rsbuild-plugin-esbuild": "2.56.1",
|
102
|
+
"@modern-js/server-utils": "2.56.1",
|
103
103
|
"@modern-js/plugin-data-loader": "2.56.1"
|
104
104
|
},
|
105
105
|
"devDependencies": {
|