@nocobase/build 2.1.0-beta.30 → 2.1.0-beta.32

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.
@@ -32,7 +32,6 @@ __export(buildPlugin_exports, {
32
32
  buildPluginServer: () => buildPluginServer,
33
33
  buildProPluginServer: () => buildProPluginServer,
34
34
  buildServerDeps: () => buildServerDeps,
35
- deleteServerFiles: () => deleteServerFiles,
36
35
  writeExternalPackageVersion: () => writeExternalPackageVersion
37
36
  });
38
37
  module.exports = __toCommonJS(buildPlugin_exports);
@@ -47,6 +46,7 @@ var import_path = __toESM(require("path"));
47
46
  var import_tsup = require("tsup");
48
47
  var import_constant = require("./constant");
49
48
  var import_pluginEsbuildCommercialInject = __toESM(require("./plugins/pluginEsbuildCommercialInject"));
49
+ var import_deleteServerFiles = require("./deleteServerFiles");
50
50
  var import_utils = require("./utils");
51
51
  var import_buildPluginUtils = require("./utils/buildPluginUtils");
52
52
  var import_getDepsConfig = require("./utils/getDepsConfig");
@@ -249,36 +249,6 @@ async function copyAiDocSources(cwd, log) {
249
249
  await import_fs_extra.default.writeJSON(rootMetaPath, Array.from(rootMetaMap.values()), { spaces: 2 });
250
250
  }
251
251
  }
252
- function deleteServerFiles(cwd, log) {
253
- log("delete server files");
254
- const files = import_fast_glob.default.globSync(["*"], {
255
- cwd: import_path.default.join(cwd, target_dir),
256
- absolute: true,
257
- deep: 1,
258
- onlyFiles: true
259
- });
260
- const dirs = import_fast_glob.default.globSync(["*", "!client", "!node_modules"], {
261
- cwd: import_path.default.join(cwd, target_dir),
262
- absolute: true,
263
- deep: 1,
264
- onlyDirectories: true
265
- });
266
- const extraClientDirs = import_fast_glob.default.globSync(["client-v2"], {
267
- cwd: import_path.default.join(cwd, target_dir),
268
- absolute: true,
269
- deep: 1,
270
- onlyDirectories: true
271
- });
272
- [...files, ...dirs.filter((item) => !extraClientDirs.includes(item)), ...extraClientDirs].forEach((item) => {
273
- if (item.endsWith(`${import_path.default.sep}client-v2`) || item.endsWith(`/client-v2`)) {
274
- return;
275
- }
276
- if (item.endsWith(`${import_path.default.sep}client`) || item.endsWith(`/client`)) {
277
- return;
278
- }
279
- import_fs_extra.default.removeSync(item);
280
- });
281
- }
282
252
  function writeExternalPackageVersion(cwd, log) {
283
253
  log("write external version");
284
254
  const sourceFiles = import_fast_glob.default.globSync(sourceGlobalFiles, { cwd, absolute: true }).map((item) => import_fs_extra.default.readFileSync(item, "utf-8"));
@@ -380,7 +350,7 @@ async function buildPluginServer(cwd, userConfig, sourcemap, log) {
380
350
  if (otherExts.length) {
381
351
  log("%s will not be processed, only be copied to the dist directory.", import_chalk.default.yellow(otherExts.join(",")));
382
352
  }
383
- deleteServerFiles(cwd, log);
353
+ (0, import_deleteServerFiles.deleteServerFiles)(cwd, log);
384
354
  await (0, import_tsup.build)(
385
355
  userConfig.modifyTsupConfig({
386
356
  entry: serverFiles,
@@ -415,7 +385,7 @@ async function buildProPluginServer(cwd, userConfig, sourcemap, log) {
415
385
  if (otherExts.length) {
416
386
  log("%s will not be processed, only be copied to the dist directory.", import_chalk.default.yellow(otherExts.join(",")));
417
387
  }
418
- deleteServerFiles(cwd, log);
388
+ (0, import_deleteServerFiles.deleteServerFiles)(cwd, log);
419
389
  let tsconfig = bundleRequire.loadTsConfig(import_path.default.join(cwd, "tsconfig.json"));
420
390
  import_fs_extra.default.writeFileSync(
421
391
  import_path.default.join(cwd, "tsconfig.json"),
@@ -562,7 +532,7 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log, lane = "client
562
532
  // will be generated by the custom plugin
563
533
  clean: true,
564
534
  library: {
565
- name: packageJson.name,
535
+ name: lane === "client-v2" ? `${packageJson.name}/client-v2` : packageJson.name,
566
536
  type: "umd",
567
537
  umdNamedDefine: true
568
538
  }
@@ -767,6 +737,5 @@ async function buildPlugin(cwd, userConfig, sourcemap, log) {
767
737
  buildPluginServer,
768
738
  buildProPluginServer,
769
739
  buildServerDeps,
770
- deleteServerFiles,
771
740
  writeExternalPackageVersion
772
741
  });
@@ -0,0 +1,68 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var deleteServerFiles_exports = {};
29
+ __export(deleteServerFiles_exports, {
30
+ deleteServerFiles: () => deleteServerFiles,
31
+ shouldPreserveDistEntry: () => shouldPreserveDistEntry
32
+ });
33
+ module.exports = __toCommonJS(deleteServerFiles_exports);
34
+ var import_fast_glob = __toESM(require("fast-glob"));
35
+ var import_fs_extra = __toESM(require("fs-extra"));
36
+ var import_path = __toESM(require("path"));
37
+ const targetDir = "dist";
38
+ const preservedDistEntries = /* @__PURE__ */ new Set(["client", "client-v2"]);
39
+ function shouldPreserveDistEntry(item) {
40
+ return preservedDistEntries.has(import_path.default.win32.basename(item));
41
+ }
42
+ function deleteServerFiles(cwd, log) {
43
+ log("delete server files");
44
+ const distDir = import_path.default.join(cwd, targetDir);
45
+ const files = import_fast_glob.default.globSync(["*"], {
46
+ cwd: distDir,
47
+ absolute: true,
48
+ deep: 1,
49
+ onlyFiles: true
50
+ });
51
+ const dirs = import_fast_glob.default.globSync(["*", "!node_modules"], {
52
+ cwd: distDir,
53
+ absolute: true,
54
+ deep: 1,
55
+ onlyDirectories: true
56
+ });
57
+ [...files, ...dirs].forEach((item) => {
58
+ if (shouldPreserveDistEntry(item)) {
59
+ return;
60
+ }
61
+ import_fs_extra.default.removeSync(item);
62
+ });
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ deleteServerFiles,
67
+ shouldPreserveDistEntry
68
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/build",
3
- "version": "2.1.0-beta.30",
3
+ "version": "2.1.0-beta.32",
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": "1a493069cd0d8a4f403668bfe592879678c894b2"
56
+ "gitHead": "659c5efe992da7118d33c768bbd9e837a2c4716f"
57
57
  }