@nocobase/build 2.1.0-beta.34 → 2.1.0-beta.35
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.
- package/lib/build.js +10 -1
- package/lib/buildPlugin.js +2 -0
- package/lib/utils/getDepsConfig.js +8 -4
- package/package.json +2 -2
package/lib/build.js
CHANGED
|
@@ -127,12 +127,21 @@ async function build(pkgs) {
|
|
|
127
127
|
});
|
|
128
128
|
const appClient = packages.find((item) => item.location === import_constant.CORE_APP);
|
|
129
129
|
if (appClient) {
|
|
130
|
-
await (0, import_utils.runProfiledStage)(profile, "app shell", async () => {
|
|
130
|
+
await (0, import_utils.runProfiledStage)(profile, "app client shell", async () => {
|
|
131
131
|
await (0, import_utils.runScript)(["rsbuild", "build", "--config", import_path.default.join(import_constant.CORE_APP, "client", "rsbuild.config.ts")], import_constant.ROOT_PATH, {
|
|
132
132
|
APP_ROOT: import_path.default.join(import_constant.CORE_APP, "client"),
|
|
133
133
|
ANALYZE: process.env.BUILD_ANALYZE === "true" ? "1" : void 0
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
+
await (0, import_utils.runProfiledStage)(profile, "app client-v2 shell", async () => {
|
|
137
|
+
await (0, import_utils.runScript)(
|
|
138
|
+
["rsbuild", "build", "--config", import_path.default.join(import_constant.CORE_APP, "client-v2", "rsbuild.config.ts")],
|
|
139
|
+
import_constant.ROOT_PATH,
|
|
140
|
+
{
|
|
141
|
+
ANALYZE: process.env.BUILD_ANALYZE === "true" ? "1" : void 0
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
});
|
|
136
145
|
}
|
|
137
146
|
(0, import_utils.writeToCache)(BUILD_ERROR, {});
|
|
138
147
|
} finally {
|
package/lib/buildPlugin.js
CHANGED
|
@@ -318,8 +318,10 @@ async function buildServerDeps(cwd, serverFiles, log) {
|
|
|
318
318
|
});
|
|
319
319
|
await (0, import_ncc.default)(dep, nccConfig).then(
|
|
320
320
|
({ code, assets }) => {
|
|
321
|
+
import_fs_extra.default.ensureDirSync(import_path.default.dirname(mainFile));
|
|
321
322
|
import_fs_extra.default.writeFileSync(mainFile, code, "utf-8");
|
|
322
323
|
Object.entries(assets).forEach(([name, item]) => {
|
|
324
|
+
import_fs_extra.default.ensureDirSync(import_path.default.dirname(import_path.default.join(outputDir, name)));
|
|
323
325
|
import_fs_extra.default.writeFileSync(import_path.default.join(outputDir, name), item.source, {
|
|
324
326
|
encoding: "utf-8",
|
|
325
327
|
mode: item.permissions
|
|
@@ -33,6 +33,7 @@ __export(getDepsConfig_exports, {
|
|
|
33
33
|
winPath: () => winPath
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(getDepsConfig_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
36
37
|
var import_path = __toESM(require("path"));
|
|
37
38
|
function winPath(path2) {
|
|
38
39
|
const isExtendedLengthPath = /^\\\\\?\\/.test(path2);
|
|
@@ -41,6 +42,9 @@ function winPath(path2) {
|
|
|
41
42
|
}
|
|
42
43
|
return path2.replace(/\\/g, "/");
|
|
43
44
|
}
|
|
45
|
+
function realpathSync(filePath) {
|
|
46
|
+
return import_fs.default.realpathSync.native?.(filePath) ?? import_fs.default.realpathSync(filePath);
|
|
47
|
+
}
|
|
44
48
|
function getRltExternalsFromDeps(depExternals, current) {
|
|
45
49
|
return Object.entries(depExternals).reduce(
|
|
46
50
|
(r, [dep, target]) => {
|
|
@@ -56,23 +60,23 @@ function getRltExternalsFromDeps(depExternals, current) {
|
|
|
56
60
|
}
|
|
57
61
|
function getDepPkgPath(dep, cwd) {
|
|
58
62
|
try {
|
|
59
|
-
return require.resolve(`${dep}/package.json`, { paths: [cwd] });
|
|
63
|
+
return realpathSync(require.resolve(`${dep}/package.json`, { paths: [cwd] }));
|
|
60
64
|
} catch {
|
|
61
65
|
const mainFile = require.resolve(`${dep}`, { paths: cwd ? [cwd] : void 0 });
|
|
62
66
|
const packageDir = mainFile.slice(0, mainFile.indexOf(dep.replace("/", import_path.default.sep)) + dep.length);
|
|
63
|
-
return import_path.default.join(packageDir, "package.json");
|
|
67
|
+
return realpathSync(import_path.default.join(packageDir, "package.json"));
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
function getDepsConfig(cwd, outDir, depsName, external) {
|
|
67
71
|
const pkgExternals = external.reduce((r, dep) => ({ ...r, [dep]: dep }), {});
|
|
68
72
|
const depExternals = {};
|
|
69
73
|
const deps = depsName.reduce((acc, packageName) => {
|
|
70
|
-
const depEntryPath = require.resolve(packageName, { paths: [cwd] });
|
|
74
|
+
const depEntryPath = realpathSync(require.resolve(packageName, { paths: [cwd] }));
|
|
71
75
|
const depPkgPath = getDepPkgPath(packageName, cwd);
|
|
72
76
|
const depPkg = require(depPkgPath);
|
|
73
77
|
const depDir = import_path.default.dirname(depPkgPath);
|
|
74
78
|
const outputDir = import_path.default.join(outDir, packageName);
|
|
75
|
-
const mainFile = import_path.default.join(outputDir,
|
|
79
|
+
const mainFile = import_path.default.join(outputDir, import_path.default.relative(depDir, depEntryPath));
|
|
76
80
|
acc[depEntryPath] = {
|
|
77
81
|
nccConfig: {
|
|
78
82
|
minify: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/build",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.35",
|
|
4
4
|
"description": "Library build tool based on rollup.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"build": "tsup",
|
|
54
54
|
"build:watch": "tsup --watch"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "74310d8b9e9581fcde14b5a93d12b41ddb5bb325"
|
|
57
57
|
}
|