@rsdoctor/graph 0.4.12 → 1.0.0-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.
@@ -33,7 +33,7 @@ __export(module_exports, {
33
33
  module.exports = __toCommonJS(module_exports);
34
34
  var import_types = require("@rsdoctor/types");
35
35
  var import_path = __toESM(require("path"));
36
- var import_lodash = require("lodash");
36
+ var import_common = require("@rsdoctor/utils/common");
37
37
  var import_dependency = require("./dependency");
38
38
  var import_statement = require("./statement");
39
39
  var import_utils = require("./utils");
@@ -212,7 +212,7 @@ class Module {
212
212
  // The largest lower bound.
213
213
  bias: 1
214
214
  });
215
- if ((0, import_lodash.isNumber)(startInSource.line)) {
215
+ if (import_common.Lodash.isNumber(startInSource.line)) {
216
216
  source.start = {
217
217
  line: startInSource.line,
218
218
  column: startInSource.column ?? void 0
@@ -225,7 +225,7 @@ class Module {
225
225
  // The smallest lower bound
226
226
  // bias: 2,
227
227
  });
228
- if ((0, import_lodash.isNumber)(endInSource.line)) {
228
+ if (import_common.Lodash.isNumber(endInSource.line)) {
229
229
  source.end = {
230
230
  line: endInSource.line,
231
231
  column: endInSource.column ?? void 0
@@ -23,7 +23,7 @@ __export(utils_exports, {
23
23
  isSameRange: () => isSameRange
24
24
  });
25
25
  module.exports = __toCommonJS(utils_exports);
26
- var import_lodash = require("lodash");
26
+ var import_common = require("@rsdoctor/utils/common");
27
27
  function isSamePosition(po1, po2) {
28
28
  return po1.line === po2.line && po1.column === po2.column;
29
29
  }
@@ -31,10 +31,10 @@ function isSameRange(po1, po2) {
31
31
  if (!isSamePosition(po1.start, po2.start)) {
32
32
  return false;
33
33
  }
34
- if (!(0, import_lodash.isNil)(po1.end) && !(0, import_lodash.isNil)(po2.end)) {
34
+ if (!import_common.Lodash.isNil(po1.end) && !import_common.Lodash.isNil(po2.end)) {
35
35
  return isSamePosition(po1.end, po2.end);
36
36
  }
37
- return (0, import_lodash.isUndefined)(po1.end) && (0, import_lodash.isUndefined)(po2.end);
37
+ return import_common.Lodash.isUndefined(po1.end) && import_common.Lodash.isUndefined(po2.end);
38
38
  }
39
39
  const NAME_WITH_LOADERS = /!/;
40
40
  const NAME_WITH_MODULES = /\s\+\s\d*\smodules$/;
@@ -44,7 +44,7 @@ function getModuleName(name) {
44
44
  return "";
45
45
  }
46
46
  if (NAME_WITH_LOADERS.test(name)) {
47
- const normalizedName = (0, import_lodash.last)(name.split(NAME_WITH_LOADERS));
47
+ const normalizedName = import_common.Lodash.last(name.split(NAME_WITH_LOADERS));
48
48
  if (normalizedName?.trim()) {
49
49
  return normalizedName;
50
50
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var graph_exports = {};
20
30
  __export(graph_exports, {
@@ -22,7 +32,7 @@ __export(graph_exports, {
22
32
  readPackageJson: () => import_utils2.readPackageJson
23
33
  });
24
34
  module.exports = __toCommonJS(graph_exports);
25
- var import_lodash = require("lodash");
35
+ var import_lodash = __toESM(require("lodash.unionby"));
26
36
  var import_path = require("path");
27
37
  var import_types = require("@rsdoctor/types");
28
38
  var import_package = require("./package");
@@ -132,9 +142,9 @@ class PackageGraph {
132
142
  return this._dependencies.filter((item) => !item.package);
133
143
  }
134
144
  getDuplicatePackages() {
135
- return (0, import_lodash.unionBy)(
145
+ return (0, import_lodash.default)(
136
146
  Array.from(this._pkgNameMap.values()).map((pkgs) => {
137
- return (0, import_lodash.unionBy)(pkgs, "version");
147
+ return (0, import_lodash.default)(pkgs, "version");
138
148
  }).filter((pkgs) => pkgs.length > 1),
139
149
  (pkgs) => pkgs[0].name
140
150
  );
@@ -1,6 +1,6 @@
1
1
  import { SDK } from "@rsdoctor/types";
2
2
  import path from "path";
3
- import { isNumber } from "lodash";
3
+ import { Lodash } from "@rsdoctor/utils/common";
4
4
  import { Dependency } from "./dependency";
5
5
  import { Statement } from "./statement";
6
6
  import { getModuleName } from "./utils";
@@ -179,7 +179,7 @@ class Module {
179
179
  // The largest lower bound.
180
180
  bias: 1
181
181
  });
182
- if (isNumber(startInSource.line)) {
182
+ if (Lodash.isNumber(startInSource.line)) {
183
183
  source.start = {
184
184
  line: startInSource.line,
185
185
  column: startInSource.column ?? void 0
@@ -192,7 +192,7 @@ class Module {
192
192
  // The smallest lower bound
193
193
  // bias: 2,
194
194
  });
195
- if (isNumber(endInSource.line)) {
195
+ if (Lodash.isNumber(endInSource.line)) {
196
196
  source.end = {
197
197
  line: endInSource.line,
198
198
  column: endInSource.column ?? void 0
@@ -1,4 +1,4 @@
1
- import { last, isUndefined, isNil } from "lodash";
1
+ import { Lodash } from "@rsdoctor/utils/common";
2
2
  function isSamePosition(po1, po2) {
3
3
  return po1.line === po2.line && po1.column === po2.column;
4
4
  }
@@ -6,10 +6,10 @@ function isSameRange(po1, po2) {
6
6
  if (!isSamePosition(po1.start, po2.start)) {
7
7
  return false;
8
8
  }
9
- if (!isNil(po1.end) && !isNil(po2.end)) {
9
+ if (!Lodash.isNil(po1.end) && !Lodash.isNil(po2.end)) {
10
10
  return isSamePosition(po1.end, po2.end);
11
11
  }
12
- return isUndefined(po1.end) && isUndefined(po2.end);
12
+ return Lodash.isUndefined(po1.end) && Lodash.isUndefined(po2.end);
13
13
  }
14
14
  const NAME_WITH_LOADERS = /!/;
15
15
  const NAME_WITH_MODULES = /\s\+\s\d*\smodules$/;
@@ -19,7 +19,7 @@ function getModuleName(name) {
19
19
  return "";
20
20
  }
21
21
  if (NAME_WITH_LOADERS.test(name)) {
22
- const normalizedName = last(name.split(NAME_WITH_LOADERS));
22
+ const normalizedName = Lodash.last(name.split(NAME_WITH_LOADERS));
23
23
  if (normalizedName?.trim()) {
24
24
  return normalizedName;
25
25
  }
@@ -1,4 +1,4 @@
1
- import { unionBy } from "lodash";
1
+ import unionBy from "lodash.unionby";
2
2
  import { resolve } from "path";
3
3
  import { SDK } from "@rsdoctor/types";
4
4
  import { Package } from "./package";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/graph",
3
- "version": "0.4.12",
3
+ "version": "1.0.0-alpha.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -14,16 +14,16 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "lodash": "^4.17.21",
17
+ "lodash.unionby": "^4.8.0",
18
18
  "socket.io": "4.8.1",
19
19
  "source-map": "^0.7.4",
20
- "@rsdoctor/types": "0.4.12",
21
- "@rsdoctor/utils": "0.4.12"
20
+ "@rsdoctor/types": "1.0.0-alpha.0",
21
+ "@rsdoctor/utils": "1.0.0-alpha.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/body-parser": "1.19.5",
25
25
  "@types/estree": "1.0.5",
26
- "@types/lodash": "^4.17.13",
26
+ "@types/lodash.unionby": "^4.8.9",
27
27
  "@types/node": "^16",
28
28
  "fs-extra": "^11.1.1",
29
29
  "tslib": "2.8.1",