@nodesecure/scanner 5.3.0 → 6.0.1

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.
Files changed (90) hide show
  1. package/README.md +6 -116
  2. package/dist/class/logger.class.d.ts +27 -0
  3. package/dist/class/logger.class.d.ts.map +1 -0
  4. package/dist/class/logger.class.js +52 -0
  5. package/dist/class/logger.class.js.map +1 -0
  6. package/dist/comparePayloads.d.ts +66 -0
  7. package/dist/comparePayloads.d.ts.map +1 -0
  8. package/dist/comparePayloads.js +147 -0
  9. package/dist/comparePayloads.js.map +1 -0
  10. package/dist/depWalker.d.ts +10 -0
  11. package/dist/depWalker.d.ts.map +1 -0
  12. package/dist/depWalker.js +205 -0
  13. package/dist/depWalker.js.map +1 -0
  14. package/dist/i18n/english.d.ts +9 -0
  15. package/dist/i18n/english.d.ts.map +1 -0
  16. package/dist/i18n/english.js +6 -0
  17. package/dist/i18n/english.js.map +1 -0
  18. package/dist/i18n/french.d.ts +9 -0
  19. package/dist/i18n/french.d.ts.map +1 -0
  20. package/dist/i18n/french.js +6 -0
  21. package/dist/i18n/french.js.map +1 -0
  22. package/dist/index.d.ts +11 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +68 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/npmRegistry.d.ts +9 -0
  27. package/dist/npmRegistry.d.ts.map +1 -0
  28. package/dist/npmRegistry.js +125 -0
  29. package/dist/npmRegistry.js.map +1 -0
  30. package/dist/types.d.ts +216 -0
  31. package/dist/types.d.ts.map +1 -0
  32. package/dist/types.js +4 -0
  33. package/dist/types.js.map +1 -0
  34. package/dist/utils/addMissingVersionFlags.d.ts +3 -0
  35. package/dist/utils/addMissingVersionFlags.d.ts.map +1 -0
  36. package/dist/utils/addMissingVersionFlags.js +21 -0
  37. package/dist/utils/addMissingVersionFlags.js.map +1 -0
  38. package/dist/utils/dirname.d.ts +2 -0
  39. package/dist/utils/dirname.d.ts.map +1 -0
  40. package/dist/utils/dirname.js +8 -0
  41. package/dist/utils/dirname.js.map +1 -0
  42. package/dist/utils/getLinks.d.ts +7 -0
  43. package/dist/utils/getLinks.d.ts.map +1 -0
  44. package/dist/utils/getLinks.js +32 -0
  45. package/dist/utils/getLinks.js.map +1 -0
  46. package/dist/utils/index.d.ts +11 -0
  47. package/dist/utils/index.d.ts.map +1 -0
  48. package/dist/utils/index.js +9 -0
  49. package/dist/utils/index.js.map +1 -0
  50. package/dist/utils/urlToString.d.ts +2 -0
  51. package/dist/utils/urlToString.d.ts.map +1 -0
  52. package/dist/utils/urlToString.js +6 -0
  53. package/dist/utils/urlToString.js.map +1 -0
  54. package/dist/utils/warnings.d.ts +9 -0
  55. package/dist/utils/warnings.d.ts.map +1 -0
  56. package/dist/utils/warnings.js +49 -0
  57. package/dist/utils/warnings.js.map +1 -0
  58. package/package.json +24 -42
  59. package/LICENSE +0 -21
  60. package/i18n/english.js +0 -6
  61. package/i18n/french.js +0 -7
  62. package/index.d.ts +0 -14
  63. package/index.js +0 -74
  64. package/src/class/dependency.class.js +0 -113
  65. package/src/class/logger.class.js +0 -54
  66. package/src/constants.js +0 -13
  67. package/src/depWalker.js +0 -388
  68. package/src/manifest.js +0 -94
  69. package/src/npmRegistry.js +0 -168
  70. package/src/tarball.js +0 -210
  71. package/src/utils/addMissingVersionFlags.js +0 -24
  72. package/src/utils/analyzeDependencies.js +0 -71
  73. package/src/utils/booleanToFlags.js +0 -12
  74. package/src/utils/dirname.js +0 -9
  75. package/src/utils/filterDependencyKind.js +0 -44
  76. package/src/utils/getLinks.js +0 -36
  77. package/src/utils/getPackageName.js +0 -21
  78. package/src/utils/getTarballComposition.js +0 -38
  79. package/src/utils/index.js +0 -18
  80. package/src/utils/isGitDependency.js +0 -11
  81. package/src/utils/isSensitiveFile.js +0 -17
  82. package/src/utils/mergeDependencies.js +0 -30
  83. package/src/utils/parseManifestAuthor.js +0 -45
  84. package/src/utils/semver.js +0 -62
  85. package/src/utils/warnings.js +0 -44
  86. package/types/api.d.ts +0 -15
  87. package/types/logger.d.ts +0 -38
  88. package/types/scanner.d.ts +0 -251
  89. package/types/tarball.d.ts +0 -63
  90. package/types/walker.d.ts +0 -8
@@ -1,38 +0,0 @@
1
- // Import Node.js Dependencies
2
- import fs from "fs/promises";
3
- import path from "path";
4
-
5
- // Import Third-party Dependencies
6
- import { walk } from "@nodesecure/fs-walk";
7
-
8
- export async function getTarballComposition(tarballDir) {
9
- const ext = new Set();
10
- const files = [];
11
- const dirs = [];
12
- let { size } = await fs.stat(tarballDir);
13
-
14
- for await (const [dirent, file] of walk(tarballDir)) {
15
- if (dirent.isFile()) {
16
- ext.add(path.extname(file));
17
- files.push(file);
18
- }
19
- else if (dirent.isDirectory()) {
20
- dirs.push(file);
21
- }
22
- }
23
-
24
- const sizeUnfilteredResult = await Promise.allSettled([
25
- ...files.map((file) => fs.stat(file)),
26
- ...dirs.map((file) => fs.stat(file))
27
- ]);
28
- const sizeAll = sizeUnfilteredResult
29
- .filter((promiseSettledResult) => promiseSettledResult.status === "fulfilled")
30
- .map((promiseSettledResult) => promiseSettledResult.value);
31
- size += sizeAll.reduce((prev, curr) => prev + curr.size, 0);
32
-
33
- return {
34
- ext,
35
- size,
36
- files: files.map((fileLocation) => path.relative(tarballDir, fileLocation)).sort()
37
- };
38
- }
@@ -1,18 +0,0 @@
1
- export * from "./getTarballComposition.js";
2
- export * from "./isSensitiveFile.js";
3
- export * from "./isGitDependency.js";
4
- export * from "./getPackageName.js";
5
- export * from "./mergeDependencies.js";
6
- export * from "./semver.js";
7
- export * from "./dirname.js";
8
- export * from "./warnings.js";
9
- export * from "./filterDependencyKind.js";
10
- export * from "./analyzeDependencies.js";
11
- export * from "./booleanToFlags.js";
12
- export * from "./addMissingVersionFlags.js";
13
- export * from "./parseManifestAuthor.js";
14
- export * from "./getLinks.js";
15
-
16
- export const NPM_TOKEN = typeof process.env.NODE_SECURE_TOKEN === "string" ?
17
- { token: process.env.NODE_SECURE_TOKEN } :
18
- {};
@@ -1,11 +0,0 @@
1
- /**
2
- * @example isGitDependency("github:NodeSecure/scanner") // => true
3
- * @example isGitDependency("git+ssh://git@github.com:npm/cli#semver:^5.0") // => true
4
- * @example isGitDependency(">=1.0.2 <2.1.2") // => false
5
- * @example isGitDependency("http://asdf.com/asdf.tar.gz") // => false
6
- * @param {string} version
7
- * @returns {boolean}
8
- */
9
- export function isGitDependency(version) {
10
- return /^git(:|\+|hub:)/.test(version);
11
- }
@@ -1,17 +0,0 @@
1
- // Import Node.js Dependencies
2
- import path from "path";
3
-
4
- // CONSTANTS
5
- const kSensitiveFileName = new Set([".npmrc", ".env"]);
6
- const kSensitiveFileExtension = new Set([".key", ".pem"]);
7
-
8
- /**
9
- * @see https://github.com/jandre/safe-commit-hook/blob/master/git-deny-patterns.json
10
- *
11
- * @param {!string} fileName
12
- * @returns {boolean}
13
- */
14
- export function isSensitiveFile(fileName) {
15
- return kSensitiveFileName.has(path.basename(fileName)) ||
16
- kSensitiveFileExtension.has(path.extname(fileName));
17
- }
@@ -1,30 +0,0 @@
1
- export function mergeDependencies(manifest, types = ["dependencies"]) {
2
- const dependencies = new Map();
3
- const customResolvers = new Map();
4
- const alias = new Map();
5
-
6
- for (const fieldName of types) {
7
- if (!Reflect.has(manifest, fieldName)) {
8
- continue;
9
- }
10
- const dep = manifest[fieldName];
11
-
12
- for (const [name, version] of Object.entries(dep)) {
13
- /**
14
- * Version can be file:, github:, git:, git+, ./...
15
- * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#dependencies
16
- */
17
- if (/^([a-zA-Z]+:|git\+|\.\\)/.test(version)) {
18
- customResolvers.set(name, version);
19
- if (!version.startsWith("npm:")) {
20
- continue;
21
- }
22
- alias.set(name, version.slice(4));
23
- }
24
-
25
- dependencies.set(name, version);
26
- }
27
- }
28
-
29
- return { dependencies, customResolvers, alias };
30
- }
@@ -1,45 +0,0 @@
1
- export function manifestAuthorRegex() {
2
- return /^([^<(]+?)?[ \t]*(?:<([^>(]+?)>)?[ \t]*(?:\(([^)]+?)\)|$)/gm;
3
- }
4
-
5
- /**
6
- * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#people-fields-author-contributors
7
- */
8
- export function parseManifestAuthor(manifestAuthorField) {
9
- if (typeof manifestAuthorField !== "string") {
10
- throw new TypeError("expected manifestAuthorField to be a string");
11
- }
12
-
13
- if (!/\w/.test(manifestAuthorField)) {
14
- return null;
15
- }
16
-
17
- const match = manifestAuthorRegex().exec(manifestAuthorField);
18
- if (!match) {
19
- return null;
20
- }
21
- const author = {
22
- name: match[1]
23
- };
24
-
25
- for (let id = 2; id < match.length; id++) {
26
- const val = match[id] || "";
27
-
28
- if (val.includes("@")) {
29
- author.email = val;
30
- }
31
- else if (val.includes("http")) {
32
- author.url = val;
33
- }
34
- }
35
-
36
- return author;
37
- }
38
-
39
- export function parseAuthor(author) {
40
- if (typeof author === "string") {
41
- return parseManifestAuthor(author);
42
- }
43
-
44
- return !author || Object.keys(author).length === 0 ? null : author;
45
- }
@@ -1,62 +0,0 @@
1
- // Import Third-party Dependencies
2
- import pacote from "pacote";
3
- import semver from "semver";
4
- import { getLocalRegistryURL } from "@nodesecure/npm-registry-sdk";
5
-
6
- // Import Internal Dependencies
7
- import { NPM_TOKEN } from "./index.js";
8
-
9
- /**
10
- * @param {!string} version semver range
11
- * @returns {string} semver version
12
- *
13
- * @example
14
- * cleanRange(">=1.5.0"); // 1.5.0
15
- * cleanRange("^2.0.0"); // 2.0.0
16
- */
17
- export function cleanRange(version) {
18
- // TODO: how do we handle complicated range like pkg-name@1 || 2 or pkg-name@2.1.2 < 3
19
- const firstChar = version.charAt(0);
20
- if (firstChar === "^" || firstChar === "<" || firstChar === ">" || firstChar === "=" || firstChar === "~") {
21
- return version.slice(version.charAt(1) === "=" ? 2 : 1);
22
- }
23
-
24
- return version;
25
- }
26
-
27
- /**
28
- * @param {!string} depName dependency name (WITHOUT version/range)
29
- * @param {!string} range semver range, ex: >=1.5.0
30
- */
31
- export async function getExpectedSemVer(depName, range) {
32
- try {
33
- const { versions, "dist-tags": { latest } } = await pacote.packument(depName, {
34
- ...NPM_TOKEN, registry: getLocalRegistryURL()
35
- });
36
- const currVersion = semver.maxSatisfying(Object.keys(versions), range);
37
-
38
- return currVersion === null ? [latest, true] : [currVersion, semver.eq(latest, currVersion)];
39
- }
40
- catch (err) {
41
- return [cleanRange(range), true];
42
- }
43
- }
44
-
45
- export async function getCleanDependencyName([depName, range]) {
46
- const [depVer, isLatest] = await getExpectedSemVer(depName, range);
47
-
48
- return [`${depName}@${range}`, `${depName}@${depVer}`, isLatest];
49
- }
50
-
51
- export function getSemVerWarning(value) {
52
- return {
53
- kind: "zero-semver",
54
- file: "package.json",
55
- value,
56
- location: null,
57
- i18n: "sast_warnings.zeroSemVer",
58
- severity: "Information",
59
- source: "Scanner",
60
- experimental: false
61
- };
62
- }
@@ -1,44 +0,0 @@
1
- // Import Node.js Dependencies
2
- import path from "node:path";
3
-
4
- // Import Third-party Dependencies
5
- import * as i18n from "@nodesecure/i18n";
6
- import { extractAllAuthors } from "@nodesecure/authors";
7
-
8
- // Import Internal Dependencies
9
- import { getDirNameFromUrl } from "./dirname.js";
10
-
11
- await i18n.extendFromSystemPath(
12
- path.join(getDirNameFromUrl(import.meta.url), "..", "..", "i18n")
13
- );
14
-
15
- // CONSTANTS
16
- const kDetectedDep = i18n.taggedString`The dependency '${0}' has been detected in the dependency Tree.`;
17
- const kFlaggedAuthors = [{
18
- name: "marak",
19
- email: "marak.squires@gmail.com"
20
- }];
21
- const kDependencyWarnMessage = Object.freeze({
22
- "@scarf/scarf": await i18n.getToken("scanner.disable_scarf"),
23
- iohook: await i18n.getToken("scanner.keylogging")
24
- });
25
-
26
- /**
27
- * @param {Map<string, any>} dependenciesMap
28
- */
29
- export async function getDependenciesWarnings(dependenciesMap) {
30
- const warnings = [...Object.keys(kDependencyWarnMessage)]
31
- .filter((depName) => dependenciesMap.has(depName))
32
- .map((depName) => `${kDetectedDep(depName)} ${kDependencyWarnMessage[depName]}`);
33
-
34
- // TODO: add support for RC configuration
35
- const res = await extractAllAuthors(
36
- { dependencies: Object.fromEntries(dependenciesMap) },
37
- { flags: kFlaggedAuthors, domainInformations: false }
38
- );
39
-
40
- return {
41
- warnings,
42
- flaggedAuthors: res.flaggedAuthors
43
- };
44
- }
package/types/api.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import Scanner from "./scanner.js";
2
- import { Logger, LoggerEvents } from "./logger.js";
3
-
4
- export {
5
- cwd,
6
- from,
7
- verify,
8
- ScannerLoggerEvents
9
- }
10
-
11
- declare const ScannerLoggerEvents: LoggerEvents;
12
-
13
- declare function cwd(location: string, options?: Scanner.Options, logger?: Logger): Promise<Scanner.Payload>;
14
- declare function from(packageName: string, options?: Omit<Scanner.Options, "includeDevDeps">, logger?: Logger): Promise<Scanner.Payload>;
15
- declare function verify(packageName?: string | null): Promise<Scanner.VerifyPayload>;
package/types/logger.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import { EventEmitter } from "events";
2
-
3
- export {
4
- Logger,
5
- LoggerEventData,
6
- LoggerEvents
7
- }
8
-
9
- interface LoggerEvents {
10
- readonly done: "depWalkerFinished";
11
- readonly analysis: {
12
- readonly tree: "walkTree";
13
- readonly tarball: "tarball";
14
- readonly registry: "registry";
15
- };
16
- readonly manifest: {
17
- readonly read: "readManifest";
18
- readonly fetch: "fetchManifest";
19
- };
20
- }
21
-
22
- interface LoggerEventData {
23
- /** UNIX Timestamp */
24
- startedAt: number;
25
- /** Count of triggered event */
26
- count: number;
27
- }
28
-
29
- declare class Logger extends EventEmitter {
30
- public events: Map<string, LoggerEventData>;
31
-
32
- constructor();
33
-
34
- start(eventName: string): Logger;
35
- end(eventName: string): Logger;
36
- tick(eventName: string): Logger;
37
- count(eventName: string): number;
38
- }
@@ -1,251 +0,0 @@
1
- // Import NodeSecure Dependencies
2
- import * as JSXRay from "@nodesecure/js-x-ray";
3
- import { license as License } from "@nodesecure/ntlp";
4
- import * as Vuln from "@nodesecure/vuln";
5
-
6
- // Import Third-party Dependencies
7
- import { extractedAuthor } from "@nodesecure/authors";
8
-
9
- export = Scanner;
10
-
11
- declare namespace Scanner {
12
- export interface Author {
13
- name: string;
14
- email?: string;
15
- url?: string;
16
- npmAvatar?: string;
17
- }
18
-
19
- export interface Maintainer {
20
- name: string;
21
- email: string;
22
- npmAvatar?: string;
23
- }
24
-
25
- export interface Publisher {
26
- /**
27
- * Publisher npm user name.
28
- */
29
- name: string;
30
- /**
31
- * Publisher npm user email.
32
- */
33
- email: string;
34
- /**
35
- * First version published.
36
- */
37
- version: string;
38
- /**
39
- * Date of the first publication
40
- * @example 2021-08-10T20:45:08.342Z
41
- */
42
- at: string;
43
- /**
44
- * Path to publisher's avatar on "https://www.npmjs.com"
45
- * @example /npm-avatar/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.LwimMJA3puF3ioGeS-tfczR3370GXBZMIL-bdpu4hOU
46
- */
47
- npmAvatar?: string;
48
- }
49
-
50
- export interface DependencyLinks {
51
- /** NPM Registry page */
52
- npm: string;
53
- /** Homepage URL */
54
- homepage?: string;
55
- /** VCS repository URL */
56
- repository?: string;
57
- }
58
-
59
- export interface DependencyVersion {
60
- /** Id of the package (useful for usedBy relation) */
61
- id: number;
62
- isDevDependency: boolean;
63
- /**
64
- * Tell if the given package exist on the configured remote registry (npm by default)
65
- * @default true
66
- */
67
- existOnRemoteRegistry: boolean;
68
- /** By whom (id) is used the package */
69
- usedBy: Record<string, string>;
70
- /** Size on disk of the extracted tarball (in bytes) */
71
- size: number;
72
- /** Package description */
73
- description: string;
74
- /** Author of the package. This information is not trustable and can be empty. */
75
- author: Author | null;
76
- engines: {
77
- node?: string;
78
- npm?: string;
79
- };
80
- repository: {
81
- type: string;
82
- url: string;
83
- };
84
- scripts: Record<string, string>;
85
- /**
86
- * JS-X-Ray warnings
87
- *
88
- * @see https://github.com/NodeSecure/js-x-ray/blob/master/WARNINGS.md
89
- */
90
- warnings: JSXRay.Warning<JSXRay.WarningDefault>[];
91
- /** Tarball composition (files and dependencies) */
92
- composition: {
93
- /** Files extensions (.js, .md, .exe etc..) */
94
- extensions: string[];
95
- files: string[];
96
- /** Minified files (foo.min.js etc..) */
97
- minified: string[];
98
- alias: Record<string, string>;
99
- required_files: string[];
100
- required_thirdparty: string[];
101
- required_nodejs: string[];
102
- required_subpath: string[];
103
- unused: string[];
104
- missing: string[];
105
- };
106
- /**
107
- * Package licenses with SPDX expression.
108
- *
109
- * @see https://github.com/NodeSecure/licenses-conformance
110
- * @see https://github.com/NodeSecure/npm-tarball-license-parser
111
- */
112
- license: License[];
113
- /**
114
- * Flags (Array of string)
115
- *
116
- * @see https://github.com/NodeSecure/flags/blob/main/FLAGS.md
117
- */
118
- flags: string[];
119
- /**
120
- * If the dependency is a GIT repository
121
- */
122
- gitUrl: null | string;
123
- /**
124
- * Version MD5 integrity hash
125
- * Generated by the scanner to verify manifest/tarball confusion
126
- *
127
- * (Not supported on GIT dependency)
128
- */
129
- integrity?: string;
130
- links: DependencyLinks;
131
- }
132
-
133
- export interface Dependency {
134
- /** NPM Registry metadata */
135
- metadata: {
136
- /** Count of dependencies */
137
- dependencyCount: number;
138
- /** Number of releases published on npm */
139
- publishedCount: number;
140
- lastUpdateAt: number;
141
- /** Last version SemVer */
142
- lastVersion: number;
143
- hasChangedAuthor: boolean;
144
- hasManyPublishers: boolean;
145
- hasReceivedUpdateInOneYear: boolean;
146
- /** Author of the package. This information is not trustable and can be empty. */
147
- author: Author | null;
148
- /** Package home page */
149
- homepage: string | null;
150
- /**
151
- * List of maintainers (list of people in the organization related to the package)
152
- */
153
- maintainers: Maintainer[];
154
- /**
155
- * List of people who published this package
156
- */
157
- publishers: Publisher[];
158
- /**
159
- * Version MD5 integrity hash
160
- * Generated by the scanner to verify manifest/tarball confusion
161
- */
162
- integrity: Record<string, string>;
163
- }
164
- /** List of versions of this package available in the dependency tree (In the payload) */
165
- versions: Record<string, DependencyVersion>;
166
- /**
167
- * Vulnerabilities fetched dependending on the selected vulnerabilityStrategy
168
- *
169
- * @see https://github.com/NodeSecure/vuln
170
- */
171
- vulnerabilities: Vuln.Strategy.StandardVulnerability[];
172
- }
173
-
174
- export type GlobalWarning = string[];
175
- export type FlaggedAuthors = extractedAuthor[];
176
- export type Dependencies = Record<string, Dependency>;
177
-
178
- export interface Payload {
179
- /** Payload unique id */
180
- id: string;
181
- /** Name of the analyzed package */
182
- rootDependencyName: string;
183
- /** Global warnings list */
184
- warnings: GlobalWarning[];
185
- /** List of flagged authors */
186
- flaggedAuthors: FlaggedAuthors[];
187
- /** All the dependencies of the package (flattened) */
188
- dependencies: Dependencies;
189
- /** Version of the scanner used to generate the result */
190
- scannerVersion: string;
191
- /** Vulnerability strategy name (npm, snyk, node) */
192
- vulnerabilityStrategy: Vuln.Strategy.Kind;
193
- }
194
-
195
- export interface VerifyPayload {
196
- files: {
197
- list: string[];
198
- extensions: string[];
199
- minified: string[];
200
- };
201
- directorySize: number;
202
- uniqueLicenseIds: string[];
203
- licenses: License[];
204
- ast: {
205
- dependencies: Record<string, JSXRay.Dependency>;
206
- warnings: JSXRay.Warning<JSXRay.WarningDefault>[];
207
- };
208
- }
209
-
210
- export interface Options {
211
- /**
212
- * Maximum tree depth
213
- *
214
- * @default 4
215
- */
216
- readonly maxDepth?: number;
217
- readonly registry?: string | URL;
218
- /**
219
- * Use root package-lock.json. This will have the effect of triggering the Arborist package.
220
- *
221
- * @default false for from() API
222
- * @default true for cwd() API
223
- */
224
- readonly usePackageLock?: boolean;
225
- /**
226
- * Include project devDependencies (only available for cwd command)
227
- *
228
- * @default false
229
- */
230
- readonly includeDevDeps?: boolean;
231
- /**
232
- * Vulnerability strategy name (npm, snyk, node)
233
- *
234
- * @default NONE
235
- */
236
- readonly vulnerabilityStrategy: Vuln.Strategy.Kind;
237
- /**
238
- * Analyze root package.
239
- *
240
- * @default false for from() API
241
- * @default true for cwd() API
242
- */
243
- readonly forceRootAnalysis?: boolean;
244
- /**
245
- * Deeper dependencies analysis with cwd() API.
246
- *
247
- * @default false
248
- */
249
- readonly fullLockMode?: boolean;
250
- }
251
- }
@@ -1,63 +0,0 @@
1
- import ntlp from "@nodesecure/ntlp";
2
- import Locker from "@slimio/lock";
3
- import { Logger } from "./logger.js";
4
-
5
- export = tarball;
6
-
7
- declare namespace tarball {
8
- export interface ManifestData {
9
- /** Dependencies in package.json */
10
- packageDeps: string[];
11
- /** DevDependencies in package.json */
12
- packageDevDeps: string[];
13
- /** Does package.json contain a 'gypfile' property ? */
14
- packageGyp: boolean;
15
- }
16
-
17
- export interface ScannedFileResult {
18
- /** Dependencies in try/catch block (probably optional dependencies) */
19
- inTryDeps: string[];
20
- /** Dependencies required or imported */
21
- dependencies: string[];
22
- /** Required or imported javascript files */
23
- filesDependencies: string[];
24
- }
25
-
26
- export interface ScannedPackageResult {
27
- files: {
28
- /** Complete list of files for the given package */
29
- list: string[];
30
- /** Complete list of extensions (.js, .md etc.) */
31
- extensions: string[];
32
- /** List of minified javascript files */
33
- minified: string[];
34
- };
35
- /** Size of the directory in bytes */
36
- directorySize: number;
37
- /** Unique license contained in the tarball (MIT, ISC ..) */
38
- uniqueLicenseIds: string[];
39
- /** All licenses with their SPDX */
40
- licenses: ntlp.license[];
41
- ast: {
42
- dependencies: any;
43
- warnings: any[];
44
- };
45
- }
46
-
47
- export interface ScanDirOrArchiveOptions {
48
- ref: any;
49
- locker: Locker;
50
- tmpLocation: string;
51
- logger: Logger;
52
- }
53
-
54
- export interface ScanFileOptions {
55
- name: string;
56
- ref: any;
57
- }
58
-
59
- export function readManifest(dest: string, ref: any): Promise<ManifestData>;
60
- export function scanFile(dest: string, file: string, options: ScanFileOptions): Promise<ScannedFileResult | null>;
61
- export function scanPackage(dest: string, packageName?: string): Promise<ScannedPackageResult>;
62
- export function scanDirOrArchive(name: string, version: string, options: ScanDirOrArchiveOptions): Promise<void>;
63
- }
package/types/walker.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { Manifest } from "@npm/types";
2
- import Scanner from "./scanner.js";
3
-
4
- export {
5
- depWalker
6
- }
7
-
8
- declare function depWalker(manifest: Manifest, options?: Scanner.Options): Promise<Scanner.Payload>;