@magda/org-tree 3.0.1 → 3.0.2-alpha.0

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.
@@ -1,3 +1,11 @@
1
+ // ../cjs-shim.js
2
+ import { createRequire } from "module";
3
+ import path from "path";
4
+ import url from "url";
5
+ globalThis.require = createRequire(import.meta.url);
6
+ globalThis.__filename = url.fileURLToPath(import.meta.url);
7
+ globalThis.__dirname = path.dirname(__filename);
8
+
1
9
  // ../../magda-typescript-common/dist/util/isUuid.js
2
10
  var uuidRegEx = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
11
  var isUuid = (id) => typeof id === "string" && uuidRegEx.test(id);
@@ -1,3 +1,11 @@
1
+ // ../cjs-shim.js
2
+ import { createRequire } from "module";
3
+ import path from "path";
4
+ import url from "url";
5
+ globalThis.require = createRequire(import.meta.url);
6
+ globalThis.__filename = url.fileURLToPath(import.meta.url);
7
+ globalThis.__dirname = path.dirname(__filename);
8
+
1
9
  // ../../magda-typescript-common/dist/util/isUuid.js
2
10
  var uuidRegEx = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
11
  var isUuid = (id) => typeof id === "string" && uuidRegEx.test(id);
package/dist/index.js CHANGED
@@ -12,6 +12,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  return require.apply(this, arguments);
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
+ var __esm = (fn, res) => function __init() {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ };
15
18
  var __commonJS = (cb, mod) => function __require2() {
16
19
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
20
  };
@@ -32,9 +35,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
35
  mod
33
36
  ));
34
37
 
38
+ // ../cjs-shim.js
39
+ import { createRequire } from "module";
40
+ import path from "path";
41
+ import url from "url";
42
+ var init_cjs_shim = __esm({
43
+ "../cjs-shim.js"() {
44
+ globalThis.require = createRequire(import.meta.url);
45
+ globalThis.__filename = url.fileURLToPath(import.meta.url);
46
+ globalThis.__dirname = path.dirname(__filename);
47
+ }
48
+ });
49
+
35
50
  // ../../node_modules/commander/lib/error.js
36
51
  var require_error = __commonJS({
37
52
  "../../node_modules/commander/lib/error.js"(exports) {
53
+ init_cjs_shim();
38
54
  var CommanderError2 = class extends Error {
39
55
  /**
40
56
  * Constructs the CommanderError class
@@ -72,6 +88,7 @@ var require_error = __commonJS({
72
88
  // ../../node_modules/commander/lib/argument.js
73
89
  var require_argument = __commonJS({
74
90
  "../../node_modules/commander/lib/argument.js"(exports) {
91
+ init_cjs_shim();
75
92
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
76
93
  var Argument2 = class {
77
94
  /**
@@ -193,6 +210,7 @@ var require_argument = __commonJS({
193
210
  // ../../node_modules/commander/lib/help.js
194
211
  var require_help = __commonJS({
195
212
  "../../node_modules/commander/lib/help.js"(exports) {
213
+ init_cjs_shim();
196
214
  var { humanReadableArgName } = require_argument();
197
215
  var Help2 = class {
198
216
  constructor() {
@@ -580,6 +598,7 @@ var require_help = __commonJS({
580
598
  // ../../node_modules/commander/lib/option.js
581
599
  var require_option = __commonJS({
582
600
  "../../node_modules/commander/lib/option.js"(exports) {
601
+ init_cjs_shim();
583
602
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
584
603
  var Option2 = class {
585
604
  /**
@@ -853,6 +872,7 @@ var require_option = __commonJS({
853
872
  // ../../node_modules/commander/lib/suggestSimilar.js
854
873
  var require_suggestSimilar = __commonJS({
855
874
  "../../node_modules/commander/lib/suggestSimilar.js"(exports) {
875
+ init_cjs_shim();
856
876
  var maxDistance = 3;
857
877
  function editDistance(a, b) {
858
878
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -935,9 +955,10 @@ var require_suggestSimilar = __commonJS({
935
955
  // ../../node_modules/commander/lib/command.js
936
956
  var require_command = __commonJS({
937
957
  "../../node_modules/commander/lib/command.js"(exports) {
958
+ init_cjs_shim();
938
959
  var EventEmitter = __require("events").EventEmitter;
939
960
  var childProcess = __require("child_process");
940
- var path = __require("path");
961
+ var path2 = __require("path");
941
962
  var fs = __require("fs");
942
963
  var process2 = __require("process");
943
964
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1770,10 +1791,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1770
1791
  let launchWithNode = false;
1771
1792
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1772
1793
  function findFile(baseDir, baseName) {
1773
- const localBin = path.resolve(baseDir, baseName);
1794
+ const localBin = path2.resolve(baseDir, baseName);
1774
1795
  if (fs.existsSync(localBin))
1775
1796
  return localBin;
1776
- if (sourceExt.includes(path.extname(baseName)))
1797
+ if (sourceExt.includes(path2.extname(baseName)))
1777
1798
  return void 0;
1778
1799
  const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
1779
1800
  if (foundExt)
@@ -1791,19 +1812,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
1791
1812
  } catch (err) {
1792
1813
  resolvedScriptPath = this._scriptPath;
1793
1814
  }
1794
- executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
1815
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
1795
1816
  }
1796
1817
  if (executableDir) {
1797
1818
  let localFile = findFile(executableDir, executableFile);
1798
1819
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1799
- const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
1820
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
1800
1821
  if (legacyName !== this._name) {
1801
1822
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1802
1823
  }
1803
1824
  }
1804
1825
  executableFile = localFile || executableFile;
1805
1826
  }
1806
- launchWithNode = sourceExt.includes(path.extname(executableFile));
1827
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
1807
1828
  let proc;
1808
1829
  if (process2.platform !== "win32") {
1809
1830
  if (launchWithNode) {
@@ -2605,7 +2626,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2605
2626
  * @return {Command}
2606
2627
  */
2607
2628
  nameFromFilename(filename) {
2608
- this._name = path.basename(filename, path.extname(filename));
2629
+ this._name = path2.basename(filename, path2.extname(filename));
2609
2630
  return this;
2610
2631
  }
2611
2632
  /**
@@ -2619,10 +2640,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2619
2640
  * @param {string} [path]
2620
2641
  * @return {string|null|Command}
2621
2642
  */
2622
- executableDir(path2) {
2623
- if (path2 === void 0)
2643
+ executableDir(path3) {
2644
+ if (path3 === void 0)
2624
2645
  return this._executableDir;
2625
- this._executableDir = path2;
2646
+ this._executableDir = path3;
2626
2647
  return this;
2627
2648
  }
2628
2649
  /**
@@ -2795,6 +2816,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2795
2816
  // ../../node_modules/commander/index.js
2796
2817
  var require_commander = __commonJS({
2797
2818
  "../../node_modules/commander/index.js"(exports, module) {
2819
+ init_cjs_shim();
2798
2820
  var { Argument: Argument2 } = require_argument();
2799
2821
  var { Command: Command2 } = require_command();
2800
2822
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -2816,6 +2838,7 @@ var require_commander = __commonJS({
2816
2838
  var require_escape_string_regexp = __commonJS({
2817
2839
  "../../node_modules/escape-string-regexp/index.js"(exports, module) {
2818
2840
  "use strict";
2841
+ init_cjs_shim();
2819
2842
  var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
2820
2843
  module.exports = function(str) {
2821
2844
  if (typeof str !== "string") {
@@ -2830,6 +2853,7 @@ var require_escape_string_regexp = __commonJS({
2830
2853
  var require_color_name = __commonJS({
2831
2854
  "../../node_modules/color-convert/node_modules/color-name/index.js"(exports, module) {
2832
2855
  "use strict";
2856
+ init_cjs_shim();
2833
2857
  module.exports = {
2834
2858
  "aliceblue": [240, 248, 255],
2835
2859
  "antiquewhite": [250, 235, 215],
@@ -2986,6 +3010,7 @@ var require_color_name = __commonJS({
2986
3010
  // ../../node_modules/color-convert/conversions.js
2987
3011
  var require_conversions = __commonJS({
2988
3012
  "../../node_modules/color-convert/conversions.js"(exports, module) {
3013
+ init_cjs_shim();
2989
3014
  var cssKeywords = require_color_name();
2990
3015
  var reverseKeywords = {};
2991
3016
  for (key in cssKeywords) {
@@ -3699,6 +3724,7 @@ var require_conversions = __commonJS({
3699
3724
  // ../../node_modules/color-convert/route.js
3700
3725
  var require_route = __commonJS({
3701
3726
  "../../node_modules/color-convert/route.js"(exports, module) {
3727
+ init_cjs_shim();
3702
3728
  var conversions = require_conversions();
3703
3729
  function buildGraph() {
3704
3730
  var graph = {};
@@ -3738,15 +3764,15 @@ var require_route = __commonJS({
3738
3764
  };
3739
3765
  }
3740
3766
  function wrapConversion(toModel, graph) {
3741
- var path = [graph[toModel].parent, toModel];
3767
+ var path2 = [graph[toModel].parent, toModel];
3742
3768
  var fn = conversions[graph[toModel].parent][toModel];
3743
3769
  var cur = graph[toModel].parent;
3744
3770
  while (graph[cur].parent) {
3745
- path.unshift(graph[cur].parent);
3771
+ path2.unshift(graph[cur].parent);
3746
3772
  fn = link(conversions[graph[cur].parent][cur], fn);
3747
3773
  cur = graph[cur].parent;
3748
3774
  }
3749
- fn.conversion = path;
3775
+ fn.conversion = path2;
3750
3776
  return fn;
3751
3777
  }
3752
3778
  module.exports = function(fromModel) {
@@ -3769,6 +3795,7 @@ var require_route = __commonJS({
3769
3795
  // ../../node_modules/color-convert/index.js
3770
3796
  var require_color_convert = __commonJS({
3771
3797
  "../../node_modules/color-convert/index.js"(exports, module) {
3798
+ init_cjs_shim();
3772
3799
  var conversions = require_conversions();
3773
3800
  var route = require_route();
3774
3801
  var convert = {};
@@ -3829,6 +3856,7 @@ var require_color_convert = __commonJS({
3829
3856
  var require_ansi_styles = __commonJS({
3830
3857
  "../../node_modules/ansi-styles/index.js"(exports, module) {
3831
3858
  "use strict";
3859
+ init_cjs_shim();
3832
3860
  var colorConvert = require_color_convert();
3833
3861
  var wrapAnsi16 = (fn, offset) => function() {
3834
3862
  const code = fn.apply(colorConvert, arguments);
@@ -3972,6 +4000,7 @@ var require_ansi_styles = __commonJS({
3972
4000
  var require_has_flag = __commonJS({
3973
4001
  "../../node_modules/supports-color/node_modules/has-flag/index.js"(exports, module) {
3974
4002
  "use strict";
4003
+ init_cjs_shim();
3975
4004
  module.exports = (flag, argv) => {
3976
4005
  argv = argv || process.argv;
3977
4006
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -3986,6 +4015,7 @@ var require_has_flag = __commonJS({
3986
4015
  var require_supports_color = __commonJS({
3987
4016
  "../../node_modules/supports-color/index.js"(exports, module) {
3988
4017
  "use strict";
4018
+ init_cjs_shim();
3989
4019
  var os = __require("os");
3990
4020
  var hasFlag = require_has_flag();
3991
4021
  var env = process.env;
@@ -4081,6 +4111,7 @@ var require_supports_color = __commonJS({
4081
4111
  var require_templates = __commonJS({
4082
4112
  "../../scripts/node_modules/chalk/templates.js"(exports, module) {
4083
4113
  "use strict";
4114
+ init_cjs_shim();
4084
4115
  var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
4085
4116
  var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
4086
4117
  var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
@@ -4192,6 +4223,7 @@ var require_templates = __commonJS({
4192
4223
  var require_chalk = __commonJS({
4193
4224
  "../../scripts/node_modules/chalk/index.js"(exports, module) {
4194
4225
  "use strict";
4226
+ init_cjs_shim();
4195
4227
  var escapeStringRegexp = require_escape_string_regexp();
4196
4228
  var ansiStyles = require_ansi_styles();
4197
4229
  var stdoutColor = require_supports_color().stdout;
@@ -4355,8 +4387,12 @@ var require_chalk = __commonJS({
4355
4387
  }
4356
4388
  });
4357
4389
 
4390
+ // ../../scripts/org-tree/index.js
4391
+ init_cjs_shim();
4392
+
4358
4393
  // ../../node_modules/@magda/esm-utils/dist/esmUtils.js
4359
- import { createRequire } from "module";
4394
+ init_cjs_shim();
4395
+ import { createRequire as createRequire2 } from "module";
4360
4396
  function callsites() {
4361
4397
  const _prepareStackTrace = Error.prepareStackTrace;
4362
4398
  try {
@@ -4392,11 +4428,12 @@ function callerpath({ depth = 0 } = {}) {
4392
4428
  return callsite && callsite.getFileName();
4393
4429
  }
4394
4430
  function require2(id) {
4395
- const requireFrom = createRequire(callerpath({ depth: 1 }));
4431
+ const requireFrom = createRequire2(callerpath({ depth: 1 }));
4396
4432
  return requireFrom(id);
4397
4433
  }
4398
4434
 
4399
4435
  // ../../node_modules/commander/esm.mjs
4436
+ init_cjs_shim();
4400
4437
  var import_index = __toESM(require_commander(), 1);
4401
4438
  var {
4402
4439
  program,