@davidwells/extract-deps 0.1.4 → 0.1.7
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/package.json +1 -1
- package/src/dep-graph.js +26 -0
- package/src/get-imports.js +23 -9
- package/src/get-requires.js +6 -4
- package/tests/dep-graph.test.js +90 -0
- package/tests/fixtures/esm-namespace-fixture/index.js +5 -0
- package/tests/fixtures/esm-namespace-fixture/package.json +4 -0
- package/tests/fixtures/esm-namespace-fixture/utils.js +7 -0
- package/tests/fixtures/esm-reexport-fixture/barrel.js +1 -0
- package/tests/fixtures/esm-reexport-fixture/impl.js +7 -0
- package/tests/fixtures/esm-reexport-fixture/index.js +5 -0
- package/tests/fixtures/esm-reexport-fixture/package.json +4 -0
- package/tests/fixtures/node-module-named-export/node_modules/fake-named-pkg/index.js +1 -2
- package/tests/fixtures/ts-patterns-fixture/constants.ts +2 -0
- package/tests/fixtures/ts-patterns-fixture/index.ts +17 -0
- package/tests/fixtures/ts-patterns-fixture/package.json +4 -0
- package/tests/fixtures/ts-patterns-fixture/transforms.ts +7 -0
- package/tests/fixtures/ts-patterns-fixture/utils.ts +7 -0
- package/tests/get-imports.test.js +101 -4
- package/tests/get-requires.test.js +60 -0
- package/.claude/settings.local.json +0 -17
- package/types/dep-graph.d.ts +0 -45
- package/types/dep-graph.d.ts.map +0 -1
- package/types/detect-syntax.d.ts +0 -39
- package/types/detect-syntax.d.ts.map +0 -1
- package/types/extract-deps/_usage.d.ts +0 -20
- package/types/extract-deps/_usage.d.ts.map +0 -1
- package/types/extract-deps/examples/get-exports.d.ts +0 -2
- package/types/extract-deps/examples/get-exports.d.ts.map +0 -1
- package/types/extract-deps/src/detect-syntax.d.ts +0 -39
- package/types/extract-deps/src/detect-syntax.d.ts.map +0 -1
- package/types/extract-deps/src/get-exports.d.ts +0 -52
- package/types/extract-deps/src/get-exports.d.ts.map +0 -1
- package/types/extract-deps/src/get-imports.d.ts +0 -53
- package/types/extract-deps/src/get-imports.d.ts.map +0 -1
- package/types/extract-deps/src/get-requires.d.ts +0 -34
- package/types/extract-deps/src/get-requires.d.ts.map +0 -1
- package/types/extract-deps/src/index.d.ts +0 -39
- package/types/extract-deps/src/index.d.ts.map +0 -1
- package/types/extract-deps/src/utils.d.ts +0 -4
- package/types/extract-deps/src/utils.d.ts.map +0 -1
- package/types/extract-deps/tests/detect-syntax.test.d.ts +0 -2
- package/types/extract-deps/tests/detect-syntax.test.d.ts.map +0 -1
- package/types/extract-deps/tests/get-exports.test.d.ts +0 -2
- package/types/extract-deps/tests/get-exports.test.d.ts.map +0 -1
- package/types/extract-deps/tests/get-imports.test.d.ts +0 -2
- package/types/extract-deps/tests/get-imports.test.d.ts.map +0 -1
- package/types/extract-deps/tests/get-requires.test.d.ts +0 -2
- package/types/extract-deps/tests/get-requires.test.d.ts.map +0 -1
- package/types/extract-deps/tests/index.test.d.ts +0 -18
- package/types/extract-deps/tests/index.test.d.ts.map +0 -1
- package/types/extract-deps/tests/test-utils.d.ts +0 -9
- package/types/extract-deps/tests/test-utils.d.ts.map +0 -1
- package/types/get-cjs-exports.d.ts +0 -45
- package/types/get-cjs-exports.d.ts.map +0 -1
- package/types/get-exports.d.ts +0 -54
- package/types/get-exports.d.ts.map +0 -1
- package/types/get-imports.d.ts +0 -59
- package/types/get-imports.d.ts.map +0 -1
- package/types/get-requires.d.ts +0 -37
- package/types/get-requires.d.ts.map +0 -1
- package/types/index.d.ts +0 -45
- package/types/index.d.ts.map +0 -1
- package/types/packages-list/index.d.ts +0 -138
- package/types/packages-list/index.d.ts.map +0 -1
- package/types/utils.d.ts +0 -17
- package/types/utils.d.ts.map +0 -1
- package/types/vendor/inspect-parameters-declaration.d.ts +0 -4
- package/types/vendor/inspect-parameters-declaration.d.ts.map +0 -1
- package/types/verify-package-entries.d.ts +0 -30
- package/types/verify-package-entries.d.ts.map +0 -1
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
export type PackagePath = {
|
|
2
|
-
/**
|
|
3
|
-
* - Relative path from root (e.g. './packages/foo/package.json')
|
|
4
|
-
*/
|
|
5
|
-
relative: string;
|
|
6
|
-
/**
|
|
7
|
-
* - Clean relative path without leading ./ (e.g. 'packages/foo/package.json')
|
|
8
|
-
*/
|
|
9
|
-
nice: string;
|
|
10
|
-
/**
|
|
11
|
-
* - Full absolute path to package.json
|
|
12
|
-
*/
|
|
13
|
-
full: string;
|
|
14
|
-
};
|
|
15
|
-
export type PackageDir = {
|
|
16
|
-
/**
|
|
17
|
-
* - Relative directory path from root
|
|
18
|
-
*/
|
|
19
|
-
relative: string;
|
|
20
|
-
/**
|
|
21
|
-
* - Clean relative directory path without leading ./
|
|
22
|
-
*/
|
|
23
|
-
nice: string;
|
|
24
|
-
/**
|
|
25
|
-
* - Full absolute path to directory
|
|
26
|
-
*/
|
|
27
|
-
full: string;
|
|
28
|
-
};
|
|
29
|
-
export type Package = {
|
|
30
|
-
/**
|
|
31
|
-
* - Package name from package.json
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* - Whether this is the root package
|
|
36
|
-
*/
|
|
37
|
-
isRoot: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* - Package.json path information
|
|
40
|
-
*/
|
|
41
|
-
path: PackagePath;
|
|
42
|
-
/**
|
|
43
|
-
* - Directory path information
|
|
44
|
-
*/
|
|
45
|
-
dir: PackageDir;
|
|
46
|
-
/**
|
|
47
|
-
* - Full package.json contents
|
|
48
|
-
*/
|
|
49
|
-
pkg: any;
|
|
50
|
-
/**
|
|
51
|
-
* - List of available npm scripts
|
|
52
|
-
*/
|
|
53
|
-
scripts: string[];
|
|
54
|
-
/**
|
|
55
|
-
* - List of dependency names
|
|
56
|
-
*/
|
|
57
|
-
deps: string[];
|
|
58
|
-
/**
|
|
59
|
-
* - List of dependencies with versions (e.g. ['lodash@4.17.21'])
|
|
60
|
-
*/
|
|
61
|
-
depVersions: string[];
|
|
62
|
-
/**
|
|
63
|
-
* - List of peer dependency names
|
|
64
|
-
*/
|
|
65
|
-
peerDeps: string[];
|
|
66
|
-
/**
|
|
67
|
-
* - List of peer dependencies with versions
|
|
68
|
-
*/
|
|
69
|
-
peerDepVersions: string[];
|
|
70
|
-
/**
|
|
71
|
-
* - List of dev dependency names
|
|
72
|
-
*/
|
|
73
|
-
devDeps: string[];
|
|
74
|
-
/**
|
|
75
|
-
* - List of dev dependencies with versions
|
|
76
|
-
*/
|
|
77
|
-
devDepVersions: string[];
|
|
78
|
-
};
|
|
79
|
-
export type GetPackagesListOptions = {
|
|
80
|
-
/**
|
|
81
|
-
* - Root directory to search for packages
|
|
82
|
-
*/
|
|
83
|
-
dir: string;
|
|
84
|
-
/**
|
|
85
|
-
* - Whether to search recursively
|
|
86
|
-
*/
|
|
87
|
-
recursive?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* - Array of regex patterns to exclude
|
|
90
|
-
*/
|
|
91
|
-
exclude?: RegExp[];
|
|
92
|
-
/**
|
|
93
|
-
* - Whether to exclude root packages (isRoot: true)
|
|
94
|
-
*/
|
|
95
|
-
excludeRoot?: boolean;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* @typedef {Object} PackagePath
|
|
99
|
-
* @property {string} relative - Relative path from root (e.g. './packages/foo/package.json')
|
|
100
|
-
* @property {string} nice - Clean relative path without leading ./ (e.g. 'packages/foo/package.json')
|
|
101
|
-
* @property {string} full - Full absolute path to package.json
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* @typedef {Object} PackageDir
|
|
105
|
-
* @property {string} relative - Relative directory path from root
|
|
106
|
-
* @property {string} nice - Clean relative directory path without leading ./
|
|
107
|
-
* @property {string} full - Full absolute path to directory
|
|
108
|
-
*/
|
|
109
|
-
/**
|
|
110
|
-
* @typedef {Object} Package
|
|
111
|
-
* @property {string} name - Package name from package.json
|
|
112
|
-
* @property {boolean} isRoot - Whether this is the root package
|
|
113
|
-
* @property {PackagePath} path - Package.json path information
|
|
114
|
-
* @property {PackageDir} dir - Directory path information
|
|
115
|
-
* @property {Object} pkg - Full package.json contents
|
|
116
|
-
* @property {string[]} scripts - List of available npm scripts
|
|
117
|
-
* @property {string[]} deps - List of dependency names
|
|
118
|
-
* @property {string[]} depVersions - List of dependencies with versions (e.g. ['lodash@4.17.21'])
|
|
119
|
-
* @property {string[]} peerDeps - List of peer dependency names
|
|
120
|
-
* @property {string[]} peerDepVersions - List of peer dependencies with versions
|
|
121
|
-
* @property {string[]} devDeps - List of dev dependency names
|
|
122
|
-
* @property {string[]} devDepVersions - List of dev dependencies with versions
|
|
123
|
-
*/
|
|
124
|
-
/**
|
|
125
|
-
* @typedef {Object} GetPackagesListOptions
|
|
126
|
-
* @property {string} dir - Root directory to search for packages
|
|
127
|
-
* @property {boolean} [recursive=true] - Whether to search recursively
|
|
128
|
-
* @property {RegExp[]} [exclude=[/node_modules/]] - Array of regex patterns to exclude
|
|
129
|
-
* @property {boolean} [excludeRoot=false] - Whether to exclude root packages (isRoot: true)
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* Gets a list of all packages in a directory
|
|
133
|
-
* @param {string|GetPackagesListOptions} dirOrOpts - Directory path or options object
|
|
134
|
-
* @param {Partial<GetPackagesListOptions>} [opts] - Options object
|
|
135
|
-
* @returns {Promise<Package[]>} Array of package information
|
|
136
|
-
*/
|
|
137
|
-
export function getPackagesList(dirOrOpts: string | GetPackagesListOptions, opts?: Partial<GetPackagesListOptions>): Promise<Package[]>;
|
|
138
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages-list/index.js"],"names":[],"mappings":";;;;cAKc,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;;;cAKN,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;;;UAKN,MAAM;;;;YACN,OAAO;;;;UACP,WAAW;;;;SACX,UAAU;;;;;;;;aAEV,MAAM,EAAE;;;;UACR,MAAM,EAAE;;;;iBACR,MAAM,EAAE;;;;cACR,MAAM,EAAE;;;;qBACR,MAAM,EAAE;;;;aACR,MAAM,EAAE;;;;oBACR,MAAM,EAAE;;;;;;SAKR,MAAM;;;;gBACN,OAAO;;;;cACP,MAAM,EAAE;;;;kBACR,OAAO;;AAnCrB;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AACH,2CAJW,MAAM,GAAC,sBAAsB,SAC7B,QAAQ,sBAAsB,CAAC,GAC7B,QAAQ,OAAO,EAAE,CAAC,CA+D9B"}
|
package/types/utils.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strip comments from code, preserving :// in URLs
|
|
3
|
-
* @param {string} code
|
|
4
|
-
* @returns {string}
|
|
5
|
-
*/
|
|
6
|
-
export function stripComments(code: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Check if a module specifier is a Node.js built-in
|
|
9
|
-
* @param {string} moduleName - The module specifier (e.g., 'fs', 'node:fs/promises')
|
|
10
|
-
* @returns {boolean}
|
|
11
|
-
*/
|
|
12
|
-
export function isBuiltIn(moduleName: string): boolean;
|
|
13
|
-
export function isRelativeImport(importLocation: any): boolean;
|
|
14
|
-
export function isRelativeImportWithQuotes(importLocation: any): boolean;
|
|
15
|
-
export function getNames(names: any, aliasKey?: string): any;
|
|
16
|
-
export function extractExportName(exportValue: any): any;
|
|
17
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/types/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAYlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,GACJ,OAAO,CAUnB;AAED,+DAEC;AAED,yEAKC;AAgFD,6DA+DC;AAGD,yDAqCC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-parameters-declaration.d.ts","sourceRoot":"","sources":["../../src/vendor/inspect-parameters-declaration.js"],"names":[],"mappings":"AA0QA,oDAaC;AAtBD,qDAGC;AAED,gFAEC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extract all entry points from package.json
|
|
3
|
-
* @param {string} packageJsonPath - Path to package.json
|
|
4
|
-
* @returns {Array<{field: string, path: string, resolvedPath: string}>} - Array of entry point objects
|
|
5
|
-
*/
|
|
6
|
-
export function getPackageEntryPoints(packageJsonPath: string): Array<{
|
|
7
|
-
field: string;
|
|
8
|
-
path: string;
|
|
9
|
-
resolvedPath: string;
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Verify all package.json entry points and collect dependencies
|
|
13
|
-
* @param {string} packagePath - Path to package.json
|
|
14
|
-
* @param {object} options - Options
|
|
15
|
-
* @param {boolean} [options.collectDeps] - If true, collect dependency paths for each entry point. Default: true
|
|
16
|
-
* @param {boolean} [options.verifyGraph] - If true, verify imports/exports. Default: true
|
|
17
|
-
* @param {boolean} [options.throwIfErrors] - If true, throw an error if there are any errors. Default: false
|
|
18
|
-
* @returns {{entryPoints: Array, sourceFiles: Set, errors: Array}} - Verification results
|
|
19
|
-
*/
|
|
20
|
-
export function verifyPackageEntries(packagePath: string, options?: {
|
|
21
|
-
collectDeps?: boolean;
|
|
22
|
-
verifyGraph?: boolean;
|
|
23
|
-
throwIfErrors?: boolean;
|
|
24
|
-
}): {
|
|
25
|
-
entryPoints: any[];
|
|
26
|
-
sourceFiles: Set<any>;
|
|
27
|
-
errors: any[];
|
|
28
|
-
};
|
|
29
|
-
export function collectEntryPoints(packageJson: any, packageDir: any): any[];
|
|
30
|
-
//# sourceMappingURL=verify-package-entries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-package-entries.d.ts","sourceRoot":"","sources":["../src/verify-package-entries.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,uDAHW,MAAM,GACJ,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,CAAC,CAOtE;AAmGD;;;;;;;;GAQG;AACH,kDAPW,MAAM,YAEd;IAA0B,WAAW,GAA7B,OAAO;IACW,WAAW,GAA7B,OAAO;IACW,aAAa,GAA/B,OAAO;CACf,GAAU;IAAC,WAAW,QAAQ;IAAC,WAAW,WAAM;IAAC,MAAM,QAAO;CAAC,CAoEjE;AA5KD,6EA8DC"}
|