@nocobase/build 2.0.0-alpha.9 → 2.0.0-beta.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.
- package/lib/build.js +7 -7
- package/lib/buildClient.js +2 -1
- package/lib/buildPlugin.js +13 -4
- package/lib/constant.js +8 -1
- package/lib/utils/getPackages.js +4 -1
- package/package.json +2 -2
package/lib/build.js
CHANGED
|
@@ -32,19 +32,19 @@ __export(build_exports, {
|
|
|
32
32
|
buildPackages: () => buildPackages
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(build_exports);
|
|
35
|
-
var import_execa = __toESM(require("execa"));
|
|
36
35
|
var import_chalk = __toESM(require("chalk"));
|
|
36
|
+
var import_execa = __toESM(require("execa"));
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
|
-
var import_constant = require("./constant");
|
|
39
|
-
var import_buildClient = require("./buildClient");
|
|
40
38
|
var import_buildCjs = require("./buildCjs");
|
|
41
|
-
var
|
|
39
|
+
var import_buildClient = require("./buildClient");
|
|
42
40
|
var import_buildDeclaration = require("./buildDeclaration");
|
|
43
|
-
var import_utils = require("./utils");
|
|
44
|
-
var import_getPackages = require("./utils/getPackages");
|
|
45
|
-
var import_tarPlugin = require("./tarPlugin");
|
|
46
41
|
var import_buildEsm = require("./buildEsm");
|
|
42
|
+
var import_buildPlugin = require("./buildPlugin");
|
|
43
|
+
var import_constant = require("./constant");
|
|
44
|
+
var import_tarPlugin = require("./tarPlugin");
|
|
45
|
+
var import_utils = require("./utils");
|
|
47
46
|
var import_addlicense = require("./utils/addlicense");
|
|
47
|
+
var import_getPackages = require("./utils/getPackages");
|
|
48
48
|
const BUILD_ERROR = "build-error";
|
|
49
49
|
async function build(pkgs) {
|
|
50
50
|
const isDev = process.argv.includes("--development");
|
package/lib/buildClient.js
CHANGED
package/lib/buildPlugin.js
CHANGED
|
@@ -36,21 +36,21 @@ __export(buildPlugin_exports, {
|
|
|
36
36
|
writeExternalPackageVersion: () => writeExternalPackageVersion
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(buildPlugin_exports);
|
|
39
|
+
var import_rspack_plugin = require("@rsdoctor/rspack-plugin");
|
|
39
40
|
var import_core = require("@rspack/core");
|
|
40
41
|
var import_ncc = __toESM(require("@vercel/ncc"));
|
|
42
|
+
var bundleRequire = __toESM(require("bundle-require"));
|
|
41
43
|
var import_chalk = __toESM(require("chalk"));
|
|
42
44
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
43
45
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
44
46
|
var import_path = __toESM(require("path"));
|
|
45
47
|
var import_tsup = require("tsup");
|
|
46
|
-
var bundleRequire = __toESM(require("bundle-require"));
|
|
47
48
|
var import_constant = require("./constant");
|
|
49
|
+
var import_pluginEsbuildCommercialInject = __toESM(require("./plugins/pluginEsbuildCommercialInject"));
|
|
48
50
|
var import_utils = require("./utils");
|
|
49
51
|
var import_buildPluginUtils = require("./utils/buildPluginUtils");
|
|
50
52
|
var import_getDepsConfig = require("./utils/getDepsConfig");
|
|
51
|
-
var import_rspack_plugin = require("@rsdoctor/rspack-plugin");
|
|
52
53
|
var import_obfuscationResult = require("./utils/obfuscationResult");
|
|
53
|
-
var import_pluginEsbuildCommercialInject = __toESM(require("./plugins/pluginEsbuildCommercialInject"));
|
|
54
54
|
const validExts = [".ts", ".tsx", ".js", ".jsx", ".mjs"];
|
|
55
55
|
const serverGlobalFiles = ["src/**", "!src/client/**", ...import_constant.globExcludeFiles];
|
|
56
56
|
const clientGlobalFiles = ["src/**", "!src/server/**", ...import_constant.globExcludeFiles];
|
|
@@ -79,6 +79,8 @@ const external = [
|
|
|
79
79
|
"@nocobase/utils",
|
|
80
80
|
"@nocobase/license-kit",
|
|
81
81
|
"@nocobase/flow-engine",
|
|
82
|
+
"@nocobase/client-v2",
|
|
83
|
+
"@nocobase/shared",
|
|
82
84
|
// @nocobase/auth
|
|
83
85
|
"jsonwebtoken",
|
|
84
86
|
// @nocobase/cache
|
|
@@ -337,7 +339,11 @@ async function buildProPluginServer(cwd, userConfig, sourcemap, log) {
|
|
|
337
339
|
};
|
|
338
340
|
if (!cwd.includes(import_constant.PLUGIN_COMMERCIAL)) {
|
|
339
341
|
externalOptions.external = [/^[./]/];
|
|
340
|
-
externalOptions.noExternal = [
|
|
342
|
+
externalOptions.noExternal = [
|
|
343
|
+
entryFile,
|
|
344
|
+
/@nocobase\/plugin-commercial\/server/,
|
|
345
|
+
/dist\/server\/index\.js/
|
|
346
|
+
];
|
|
341
347
|
externalOptions.onSuccess = async () => {
|
|
342
348
|
const serverFiles2 = [import_path.default.join(cwd, target_dir, "server", "index.js")];
|
|
343
349
|
serverFiles2.forEach((file) => {
|
|
@@ -346,6 +352,9 @@ async function buildProPluginServer(cwd, userConfig, sourcemap, log) {
|
|
|
346
352
|
};
|
|
347
353
|
externalOptions.esbuildPlugins = [import_pluginEsbuildCommercialInject.default];
|
|
348
354
|
}
|
|
355
|
+
if (cwd.includes(import_constant.PLUGIN_COMMERCIAL)) {
|
|
356
|
+
externalOptions.noExternal = [/@nocobase\/plugin-license/, /dist\/server\/index\.js/];
|
|
357
|
+
}
|
|
349
358
|
await (0, import_tsup.build)(
|
|
350
359
|
userConfig.modifyTsupConfig({
|
|
351
360
|
entry: [entryFile],
|
package/lib/constant.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(constant_exports, {
|
|
|
36
36
|
PACKAGES_PATH: () => PACKAGES_PATH,
|
|
37
37
|
PLUGINS_DIR: () => PLUGINS_DIR,
|
|
38
38
|
PLUGIN_COMMERCIAL: () => PLUGIN_COMMERCIAL,
|
|
39
|
+
PLUGIN_LICENSE: () => PLUGIN_LICENSE,
|
|
39
40
|
PRESETS_DIR: () => PRESETS_DIR,
|
|
40
41
|
ROOT_PATH: () => ROOT_PATH,
|
|
41
42
|
TAR_OUTPUT_DIR: () => TAR_OUTPUT_DIR,
|
|
@@ -78,8 +79,13 @@ const PACKAGES_PATH = import_path.default.join(ROOT_PATH, "packages");
|
|
|
78
79
|
const PLUGINS_DIR = ["plugins", "samples", "pro-plugins"].concat((process.env.PLUGINS_DIRS || "").split(",")).filter(Boolean).map((name) => import_path.default.join(PACKAGES_PATH, name));
|
|
79
80
|
const PRESETS_DIR = import_path.default.join(PACKAGES_PATH, "presets");
|
|
80
81
|
const PLUGIN_COMMERCIAL = "@nocobase/plugin-commercial";
|
|
82
|
+
const PLUGIN_LICENSE = "@nocobase/plugin-license";
|
|
81
83
|
const getPluginPackages = (packages) => packages.filter((item) => PLUGINS_DIR.some((pluginDir) => item.location.startsWith(pluginDir))).sort((a, b) => {
|
|
82
|
-
|
|
84
|
+
const priority = {
|
|
85
|
+
[PLUGIN_LICENSE]: 0,
|
|
86
|
+
[PLUGIN_COMMERCIAL]: 1
|
|
87
|
+
};
|
|
88
|
+
return (priority[a.name] ?? 99) - (priority[b.name] ?? 99);
|
|
83
89
|
});
|
|
84
90
|
const getPresetsPackages = (packages) => packages.filter((item) => item.location.startsWith(PRESETS_DIR));
|
|
85
91
|
const CORE_APP = import_path.default.join(PACKAGES_PATH, "core/app");
|
|
@@ -104,6 +110,7 @@ const TAR_OUTPUT_DIR = process.env.TAR_PATH ? process.env.TAR_PATH : import_path
|
|
|
104
110
|
PACKAGES_PATH,
|
|
105
111
|
PLUGINS_DIR,
|
|
106
112
|
PLUGIN_COMMERCIAL,
|
|
113
|
+
PLUGIN_LICENSE,
|
|
107
114
|
PRESETS_DIR,
|
|
108
115
|
ROOT_PATH,
|
|
109
116
|
TAR_OUTPUT_DIR,
|
package/lib/utils/getPackages.js
CHANGED
|
@@ -32,10 +32,10 @@ __export(getPackages_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(getPackages_exports);
|
|
34
34
|
var import_topo = __toESM(require("@hapi/topo"));
|
|
35
|
+
var import_project = require("@lerna/project");
|
|
35
36
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
37
|
var import_path = __toESM(require("path"));
|
|
37
38
|
var import_constant = require("../constant");
|
|
38
|
-
var import_project = require("@lerna/project");
|
|
39
39
|
var import_utils = require("./utils");
|
|
40
40
|
function getPackagesPath(pkgs) {
|
|
41
41
|
const allPackageJson = import_fast_glob.default.sync(["*/*/package.json", "*/*/*/package.json"], {
|
|
@@ -67,6 +67,9 @@ function getPackages(pkgs) {
|
|
|
67
67
|
function sortPackages(packages) {
|
|
68
68
|
const sorter = new import_topo.default.Sorter();
|
|
69
69
|
for (const pkg of packages) {
|
|
70
|
+
if (pkg.name === "@nocobase/docs") {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
70
73
|
const pkgJson = require(`${pkg.location}/package.json`);
|
|
71
74
|
const after = Object.keys({ ...pkgJson.dependencies, ...pkgJson.devDependencies, ...pkgJson.peerDependencies });
|
|
72
75
|
sorter.add(pkg, { after, group: pkg.name });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/build",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "Library build tool based on rollup.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"build": "tsup",
|
|
55
55
|
"build:watch": "tsup --watch"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "b77a33ee933ae6e09d2d5dce017ca15d8552d57b"
|
|
58
58
|
}
|