@davidwells/extract-deps 0.1.4 → 0.1.5

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 (54) hide show
  1. package/package.json +1 -1
  2. package/src/dep-graph.js +11 -0
  3. package/tests/fixtures/node-module-named-export/node_modules/fake-named-pkg/index.js +1 -2
  4. package/.claude/settings.local.json +0 -17
  5. package/types/dep-graph.d.ts +0 -45
  6. package/types/dep-graph.d.ts.map +0 -1
  7. package/types/detect-syntax.d.ts +0 -39
  8. package/types/detect-syntax.d.ts.map +0 -1
  9. package/types/extract-deps/_usage.d.ts +0 -20
  10. package/types/extract-deps/_usage.d.ts.map +0 -1
  11. package/types/extract-deps/examples/get-exports.d.ts +0 -2
  12. package/types/extract-deps/examples/get-exports.d.ts.map +0 -1
  13. package/types/extract-deps/src/detect-syntax.d.ts +0 -39
  14. package/types/extract-deps/src/detect-syntax.d.ts.map +0 -1
  15. package/types/extract-deps/src/get-exports.d.ts +0 -52
  16. package/types/extract-deps/src/get-exports.d.ts.map +0 -1
  17. package/types/extract-deps/src/get-imports.d.ts +0 -53
  18. package/types/extract-deps/src/get-imports.d.ts.map +0 -1
  19. package/types/extract-deps/src/get-requires.d.ts +0 -34
  20. package/types/extract-deps/src/get-requires.d.ts.map +0 -1
  21. package/types/extract-deps/src/index.d.ts +0 -39
  22. package/types/extract-deps/src/index.d.ts.map +0 -1
  23. package/types/extract-deps/src/utils.d.ts +0 -4
  24. package/types/extract-deps/src/utils.d.ts.map +0 -1
  25. package/types/extract-deps/tests/detect-syntax.test.d.ts +0 -2
  26. package/types/extract-deps/tests/detect-syntax.test.d.ts.map +0 -1
  27. package/types/extract-deps/tests/get-exports.test.d.ts +0 -2
  28. package/types/extract-deps/tests/get-exports.test.d.ts.map +0 -1
  29. package/types/extract-deps/tests/get-imports.test.d.ts +0 -2
  30. package/types/extract-deps/tests/get-imports.test.d.ts.map +0 -1
  31. package/types/extract-deps/tests/get-requires.test.d.ts +0 -2
  32. package/types/extract-deps/tests/get-requires.test.d.ts.map +0 -1
  33. package/types/extract-deps/tests/index.test.d.ts +0 -18
  34. package/types/extract-deps/tests/index.test.d.ts.map +0 -1
  35. package/types/extract-deps/tests/test-utils.d.ts +0 -9
  36. package/types/extract-deps/tests/test-utils.d.ts.map +0 -1
  37. package/types/get-cjs-exports.d.ts +0 -45
  38. package/types/get-cjs-exports.d.ts.map +0 -1
  39. package/types/get-exports.d.ts +0 -54
  40. package/types/get-exports.d.ts.map +0 -1
  41. package/types/get-imports.d.ts +0 -59
  42. package/types/get-imports.d.ts.map +0 -1
  43. package/types/get-requires.d.ts +0 -37
  44. package/types/get-requires.d.ts.map +0 -1
  45. package/types/index.d.ts +0 -45
  46. package/types/index.d.ts.map +0 -1
  47. package/types/packages-list/index.d.ts +0 -138
  48. package/types/packages-list/index.d.ts.map +0 -1
  49. package/types/utils.d.ts +0 -17
  50. package/types/utils.d.ts.map +0 -1
  51. package/types/vendor/inspect-parameters-declaration.d.ts +0 -4
  52. package/types/vendor/inspect-parameters-declaration.d.ts.map +0 -1
  53. package/types/verify-package-entries.d.ts +0 -30
  54. package/types/verify-package-entries.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davidwells/extract-deps",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Get imports and requires from a codebase without AST",
5
5
  "main": "src/index.js",
6
6
  "exports": {
package/src/dep-graph.js CHANGED
@@ -40,6 +40,17 @@ function resolveImportPath(baseDir, importPath) {
40
40
  }
41
41
  }
42
42
 
43
+ // TypeScript convention: imports use .js/.mjs extensions that resolve to .ts/.mts files
44
+ // e.g. `import { foo } from './bar.js'` resolves to `./bar.ts`
45
+ const tsExtMap = { '.js': '.ts', '.mjs': '.mts', '.jsx': '.tsx' }
46
+ const importExt = path.extname(importPath)
47
+ if (tsExtMap[importExt]) {
48
+ const tsPath = path.resolve(baseDir, importPath.slice(0, -importExt.length) + tsExtMap[importExt])
49
+ if (isFileSync(tsPath)) {
50
+ return tsPath
51
+ }
52
+ }
53
+
43
54
  // Try directory with index file
44
55
  const indexExtensions = ['/index.js', '/index.mjs', '/index.ts']
45
56
  for (const indexExt of indexExtensions) {
@@ -1,4 +1,3 @@
1
- // Only has named export, no default export
2
1
  export function namedFunc() {
3
- return 'Hello from named export'
2
+ return 'hello'
4
3
  }
@@ -1,17 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(node:*)",
5
- "Bash(npm audit:*)",
6
- "Bash(npm view:*)",
7
- "Bash(npm pack:*)",
8
- "Bash(tar:*)",
9
- "Bash(npm install)",
10
- "Bash(npm test)",
11
- "Bash(npm test:*)",
12
- "Bash(npm run types:*)"
13
- ],
14
- "deny": [],
15
- "ask": []
16
- }
17
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Build dependency graph for a file and its dependencies
3
- * @param {string} filePath - File to analyze
4
- * @param {object} options - Options
5
- * @param {boolean} [options.buildGraph] - If true, build and return dependency graph. Default: true
6
- * @param {boolean} [options.verifyGraph] - If true, verify imports/exports. Default: true
7
- * @param {boolean} [options.verifyNodeModules] - If true, verify node_modules packages can be resolved. Default: false
8
- * @param {boolean} [options.includeNodeModules] - If true, include node_modules package names in the graph. Default: false
9
- * @param {boolean} [options.throwOnFirstError] - If true, throw immediately on first error. Default: false
10
- * @param {boolean} [options.returnErrors] - If true, return { graph, errors } instead of throwing. Default: false
11
- * @returns {Map<string, string[]>|{graph: Map, errors: Error[]}|undefined} - Dependency graph, or { graph, errors } if returnErrors is true. Returns undefined if buildGraph is false.
12
- */
13
- export function depGraph(filePath: string, options?: {
14
- buildGraph?: boolean;
15
- verifyGraph?: boolean;
16
- verifyNodeModules?: boolean;
17
- includeNodeModules?: boolean;
18
- throwOnFirstError?: boolean;
19
- returnErrors?: boolean;
20
- }): Map<string, string[]> | {
21
- graph: Map<any, any>;
22
- errors: Error[];
23
- } | undefined;
24
- /**
25
- * Get all dependency file paths in build order (dependencies first), deduplicated
26
- * @param {string} filePath - Entry file path
27
- * @param {object} options - Options to pass to depGraph
28
- * @param {boolean} [options.verifyGraph] - If true, verify imports/exports. Default: true
29
- * @param {boolean} [options.verifyNodeModules] - If true, verify node_modules packages can be resolved. Default: false
30
- * @param {boolean} [options.throwOnFirstError] - If true, throw immediately on first error. Default: false
31
- * @param {boolean} [options.returnErrors] - If true, include errors array in result instead of throwing
32
- * @returns {{ files: string[], nodeModules: string[], builtIns: string[], errors?: Error[] }} - Object with files in topological order, npm packages, and Node.js built-ins
33
- */
34
- export function resolveDepPaths(filePath: string, options?: {
35
- verifyGraph?: boolean;
36
- verifyNodeModules?: boolean;
37
- throwOnFirstError?: boolean;
38
- returnErrors?: boolean;
39
- }): {
40
- files: string[];
41
- nodeModules: string[];
42
- builtIns: string[];
43
- errors?: Error[];
44
- };
45
- //# sourceMappingURL=dep-graph.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dep-graph.d.ts","sourceRoot":"","sources":["../src/dep-graph.js"],"names":[],"mappings":"AA4RA;;;;;;;;;;;GAWG;AACH,mCAVW,MAAM,YAEd;IAA0B,UAAU,GAA5B,OAAO;IACW,WAAW,GAA7B,OAAO;IACW,iBAAiB,GAAnC,OAAO;IACW,kBAAkB,GAApC,OAAO;IACW,iBAAiB,GAAnC,OAAO;IACW,YAAY,GAA9B,OAAO;CACf,GAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAC;IAAC,KAAK,gBAAM;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAC,GAAC,SAAS,CA8BzE;AAGD;;;;;;;;;GASG;AACH,0CARW,MAAM,YAEd;IAA0B,WAAW,GAA7B,OAAO;IACW,iBAAiB,GAAnC,OAAO;IACW,iBAAiB,GAAnC,OAAO;IACW,YAAY,GAA9B,OAAO;CACf,GAAU;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,CAkF5F"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Options for detecting syntax within a code string.
3
- */
4
- export type DetectSyntaxOptions = {
5
- /**
6
- * - Indicates whether comments should be stripped from the code before syntax checking.
7
- */
8
- stripComments?: boolean;
9
- };
10
- /**
11
- * Options for detecting syntax within a code string.
12
- * @typedef {Object} DetectSyntaxOptions
13
- * @property {boolean} [stripComments=false] - Indicates whether comments should be stripped from the code before syntax checking.
14
- */
15
- /**
16
- * Determines if a given code string contains ECMAScript module syntax.
17
- *
18
- * @param {string} code - The source code to analyze.
19
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
20
- * @returns {boolean} `true` if the code contains ESM syntax, otherwise `false`.
21
- */
22
- export function hasESMSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
23
- /**
24
- * Determines if a given string of code contains CommonJS syntax.
25
- *
26
- * @param {string} code - The source code to analyze.
27
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
28
- * @returns {boolean} `true` if the code contains CommonJS syntax, `false` otherwise.
29
- */
30
- export function hasCJSSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
31
- /**
32
- * Analyzes the supplied code to determine if it contains ECMAScript module syntax, CommonJS syntax, or both.
33
- *
34
- * @param {string} code - The source code to analyze.
35
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
36
- * @returns {Object} An object indicating the presence of ESM syntax (`hasESM`), CJS syntax (`hasCJS`) and whether both syntaxes are present (`isMixed`).
37
- */
38
- export function detectSyntax(code: string, opts?: DetectSyntaxOptions): any;
39
- //# sourceMappingURL=detect-syntax.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-syntax.d.ts","sourceRoot":"","sources":["../src/detect-syntax.js"],"names":[],"mappings":";;;;;;;oBAcc,OAAO;;AAHrB;;;;GAIG;AAEH;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,GACjB,OAAO,CAMnB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,GACjB,OAAO,CAMnB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,OAe7B"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Analyze dependencies in the lerna fixture
3
- */
4
- export function analyzeLernaFixture(): void;
5
- /**
6
- * Example of using extractDeps with actual code files
7
- */
8
- export function analyzeCodeDependencies(): void;
9
- /**
10
- * Read and parse a package.json file
11
- * @param {string} filePath - Path to the package.json file
12
- * @returns {Object} Parsed package.json content
13
- */
14
- export function readPackageJson(filePath: string): any;
15
- /**
16
- * Get all package.json files in the lerna fixture
17
- * @returns {Array} Array of package.json file paths
18
- */
19
- export function getPackageJsonFiles(): any[];
20
- //# sourceMappingURL=_usage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_usage.d.ts","sourceRoot":"","sources":["../../_usage.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH,4CA8BC;AAED;;GAEG;AACH,gDA4CC;AA7HD;;;;GAIG;AACH,0CAHW,MAAM,OAWhB;AAED;;;GAGG;AACH,6CAsBC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=get-exports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-exports.d.ts","sourceRoot":"","sources":["../../../examples/get-exports.js"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
1
- /**
2
- * Options for detecting syntax within a code string.
3
- */
4
- export type DetectSyntaxOptions = {
5
- /**
6
- * - Indicates whether comments should be stripped from the code before syntax checking.
7
- */
8
- stripComments?: boolean;
9
- };
10
- /**
11
- * Options for detecting syntax within a code string.
12
- * @typedef {Object} DetectSyntaxOptions
13
- * @property {boolean} [stripComments=false] - Indicates whether comments should be stripped from the code before syntax checking.
14
- */
15
- /**
16
- * Determines if a given code string contains ECMAScript module syntax.
17
- *
18
- * @param {string} code - The source code to analyze.
19
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
20
- * @returns {boolean} `true` if the code contains ESM syntax, otherwise `false`.
21
- */
22
- export function hasESMSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
23
- /**
24
- * Determines if a given string of code contains CommonJS syntax.
25
- *
26
- * @param {string} code - The source code to analyze.
27
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
28
- * @returns {boolean} `true` if the code contains CommonJS syntax, `false` otherwise.
29
- */
30
- export function hasCJSSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
31
- /**
32
- * Analyzes the supplied code to determine if it contains ECMAScript module syntax, CommonJS syntax, or both.
33
- *
34
- * @param {string} code - The source code to analyze.
35
- * @param {DetectSyntaxOptions} opts - See {@link DetectSyntaxOptions}.
36
- * @returns {Object} An object indicating the presence of ESM syntax (`hasESM`), CJS syntax (`hasCJS`) and whether both syntaxes are present (`isMixed`).
37
- */
38
- export function detectSyntax(code: string, opts?: DetectSyntaxOptions): any;
39
- //# sourceMappingURL=detect-syntax.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-syntax.d.ts","sourceRoot":"","sources":["../../../src/detect-syntax.js"],"names":[],"mappings":";;;;;;;oBAec,OAAO;;AAHrB;;;;GAIG;AAEH;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,GACjB,OAAO,CAMnB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,GACjB,OAAO,CAMnB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,SACN,mBAAmB,OAe7B"}
@@ -1,52 +0,0 @@
1
- export function getExports(code: any, options?: {}): any[];
2
- export function getDefaultExports(targetText?: string): {
3
- line: string;
4
- exportType: string;
5
- exportName: any;
6
- exportValue: string;
7
- index: number;
8
- isExport: boolean;
9
- }[];
10
- export function getNamedExports(targetText?: string): {
11
- line: string;
12
- exportType: string;
13
- exportName: string;
14
- index: number;
15
- isExport: boolean;
16
- }[];
17
- export function getNamedDeclarationExports(targetText?: string): any[];
18
- export function getAllExports(targetText?: string): {
19
- line: string;
20
- exportType: string;
21
- from: string;
22
- index: number;
23
- isExport: boolean;
24
- }[];
25
- export function getNamespaceExports(targetText?: string): {
26
- line: string;
27
- exportType: string;
28
- namespace: string;
29
- from: string;
30
- index: number;
31
- isExport: boolean;
32
- }[];
33
- export function getTypeExports(targetText?: string): {
34
- line: string;
35
- exportType: string;
36
- exportName: string;
37
- index: number;
38
- isExport: boolean;
39
- }[];
40
- export function getAssertionExports(targetText?: string): {
41
- line: string;
42
- exportType: string;
43
- exportName: string;
44
- definitions: any;
45
- from: string;
46
- assertion: string;
47
- assertionType: string;
48
- index: number;
49
- isExport: boolean;
50
- isAssertion: boolean;
51
- }[];
52
- //# sourceMappingURL=get-exports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-exports.d.ts","sourceRoot":"","sources":["../../../src/get-exports.js"],"names":[],"mappings":"AAiBA,2DAsBC;AAED;;;;;;;IA4BC;AAED;;;;;;IAeC;AAED,uEAmBC;AAED;;;;;;IAeC;AAED;;;;;;;IAgBC;AAED;;;;;;IAeC;AAED;;;;;;;;;;;IAuBC"}
@@ -1,53 +0,0 @@
1
- export function getImports(code: any, options?: {}): {
2
- line: string;
3
- varType: string;
4
- varName: string;
5
- definitions: any;
6
- from: string;
7
- index: number;
8
- isImport: boolean;
9
- isRelative: boolean;
10
- }[];
11
- export function getStaticImports(targetText?: string): {
12
- line: string;
13
- varType: string;
14
- varName: string;
15
- definitions: any;
16
- from: string;
17
- index: number;
18
- isImport: boolean;
19
- isRelative: boolean;
20
- }[];
21
- export function getTypeImports(targetText?: string): {
22
- importStatement: string;
23
- importPath: string;
24
- importName: string;
25
- index: number;
26
- isImport: boolean;
27
- isRelative: boolean;
28
- }[];
29
- export function getDynamicImports(targetText?: string): {
30
- line: string;
31
- varType: string;
32
- varName: string;
33
- definitions: any;
34
- from: string;
35
- index: number;
36
- isImport: boolean;
37
- isRelative: boolean;
38
- isDynamic: boolean;
39
- }[];
40
- export function getAssertionImports(targetText?: string): {
41
- line: string;
42
- varType: string;
43
- varName: string;
44
- definitions: any;
45
- from: string;
46
- assertion: string;
47
- assertionType: string;
48
- index: number;
49
- isImport: boolean;
50
- isRelative: boolean;
51
- isAssertion: boolean;
52
- }[];
53
- //# sourceMappingURL=get-imports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-imports.d.ts","sourceRoot":"","sources":["../../../src/get-imports.js"],"names":[],"mappings":"AAWA;;;;;;;;;IAQC;AAGD;;;;;;;;;IAkBC;AAED;;;;;;;IAgBC;AAED;;;;;;;;;;IAoBC;AAED;;;;;;;;;;;;IAwBC"}
@@ -1,34 +0,0 @@
1
- export function getRequires(code: any): {
2
- line: string;
3
- varType: string;
4
- varName: string;
5
- definitions: any;
6
- from: string;
7
- index: number;
8
- isRequire: boolean;
9
- isRelative: boolean;
10
- isDynamic: boolean;
11
- }[];
12
- export function getStaticRequires(targetText?: string): {
13
- line: string;
14
- varType: string;
15
- varName: string;
16
- definitions: any;
17
- from: string;
18
- index: number;
19
- isRequire: boolean;
20
- isRelative: boolean;
21
- isDynamic: boolean;
22
- }[];
23
- export function getDynamicRequires(code: any): {
24
- line: string;
25
- varType: string;
26
- varName: string;
27
- definitions: any;
28
- from: string;
29
- index: number;
30
- isRequire: boolean;
31
- isRelative: boolean;
32
- isDynamic: boolean;
33
- }[];
34
- //# sourceMappingURL=get-requires.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-requires.d.ts","sourceRoot":"","sources":["../../../src/get-requires.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;IAIC;AA5BD;;;;;;;;;;IAsBC;AArDD;;;;;;;;;;IA4BC"}
@@ -1,39 +0,0 @@
1
- export function extractDeps(code: any): {
2
- imports: {
3
- line: string;
4
- varType: string;
5
- varName: string;
6
- definitions: any;
7
- from: string;
8
- index: number;
9
- isImport: boolean;
10
- isRelative: boolean;
11
- }[];
12
- requires: {
13
- line: string;
14
- varType: string;
15
- varName: string;
16
- definitions: any;
17
- from: string;
18
- index: number;
19
- isRequire: boolean;
20
- isRelative: boolean;
21
- isDynamic: boolean;
22
- }[];
23
- exports: any[];
24
- };
25
- import { getRequires } from "./get-requires";
26
- import { getDynamicRequires } from "./get-requires";
27
- import { getStaticRequires } from "./get-requires";
28
- import { getImports } from "./get-imports";
29
- import { getStaticImports } from "./get-imports";
30
- import { getDynamicImports } from "./get-imports";
31
- import { getExports } from "./get-exports";
32
- import { getDefaultExports } from "./get-exports";
33
- import { getNamedExports } from "./get-exports";
34
- import { getNamedDeclarationExports } from "./get-exports";
35
- import { getAllExports } from "./get-exports";
36
- import { getNamespaceExports } from "./get-exports";
37
- import { getTypeExports } from "./get-exports";
38
- export { getRequires, getDynamicRequires, getStaticRequires, getImports, getStaticImports, getDynamicImports, getExports, getDefaultExports, getNamedExports, getNamedDeclarationExports, getAllExports, getNamespaceExports, getTypeExports };
39
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;EAQC"}
@@ -1,4 +0,0 @@
1
- export function isRelativeImport(importLocation: any): boolean;
2
- export function isRelativeImportWithQuotes(importLocation: any): boolean;
3
- export function getNames(names?: any[]): any;
4
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.js"],"names":[],"mappings":"AAEA,+DAEC;AAED,yEAKC;AAED,6CA2CC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=detect-syntax.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-syntax.test.d.ts","sourceRoot":"","sources":["../../../tests/detect-syntax.test.js"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=get-exports.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-exports.test.d.ts","sourceRoot":"","sources":["../../../tests/get-exports.test.js"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=get-imports.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-imports.test.d.ts","sourceRoot":"","sources":["../../../tests/get-imports.test.js"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=get-requires.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-requires.test.d.ts","sourceRoot":"","sources":["../../../tests/get-requires.test.js"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- export type PackageDeps = {
2
- /**
3
- * - Package name
4
- */
5
- name: string;
6
- /**
7
- * - Path to main file
8
- */
9
- mainFile: string;
10
- /**
11
- * - Extracted dependencies
12
- */
13
- deps: {
14
- imports: any[];
15
- requires: any[];
16
- };
17
- };
18
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../tests/index.test.js"],"names":[],"mappings":";;;;UAWc,MAAM;;;;cACN,MAAM;;;;;QAEM,OAAO;QACP,QAAQ"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Normalizes test results by removing the `index` field from import/require objects
3
- * This is useful for testing since index values can vary and aren't part of the core functionality
4
- * @param {Array|Object} result - The result object or array of result objects to normalize
5
- * @returns {Array|Object} - The normalized result with index fields removed
6
- */
7
- export function normalizeTestResult(result: any[] | any): any[] | any;
8
- export function deepLog(myObject: any): void;
9
- //# sourceMappingURL=test-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../tests/test-utils.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,4CAHW,WAAY,GACV,WAAY,CAcxB;AAED,6CAEC"}
@@ -1,45 +0,0 @@
1
- export function getCjsExports(code: any): any[];
2
- export function getModuleExportsAssignment(originalText?: string, sanitizedText?: string): {
3
- line: string;
4
- exportType: string;
5
- exportName: string;
6
- exportDefinitionName: any;
7
- exportValue: string;
8
- index: number;
9
- isExport: boolean;
10
- }[];
11
- export function getModuleExportsProperty(originalText?: string, sanitizedText?: string): {
12
- line: string;
13
- exportType: string;
14
- exportName: string;
15
- exportValue: string;
16
- index: number;
17
- isExport: boolean;
18
- }[];
19
- export function getExportsProperty(originalText?: string, sanitizedText?: string): {
20
- line: string;
21
- exportType: string;
22
- exportName: string;
23
- exportValue: string;
24
- index: number;
25
- isExport: boolean;
26
- }[];
27
- export function getObjectAssignExports(originalText?: string, sanitizedText?: string): {
28
- line: string;
29
- exportType: string;
30
- exportName: string;
31
- exportValue: string;
32
- index: number;
33
- isExport: boolean;
34
- }[];
35
- export function getDefinePropertyExports(originalText?: string, sanitizedText?: string): {
36
- line: string;
37
- exportType: string;
38
- exportName: string;
39
- exportValue: string;
40
- exportDefinitionName: string;
41
- index: number;
42
- isExport: boolean;
43
- isDefineProperty: boolean;
44
- }[];
45
- //# sourceMappingURL=get-cjs-exports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-cjs-exports.d.ts","sourceRoot":"","sources":["../src/get-cjs-exports.js"],"names":[],"mappings":"AAoCA,gDAiCC;AA+BD;;;;;;;;IAqGC;AAED;;;;;;;IAqBC;AAED;;;;;;;IAqBC;AAED;;;;;;;IAiDC;AAED;;;;;;;;;IAwEC"}
@@ -1,54 +0,0 @@
1
- export function getExports(code?: string, options?: {}): any[];
2
- export function getDefaultExports(targetText?: string): {
3
- line: string;
4
- exportType: string;
5
- exportName: string;
6
- exportDefinitionName: any;
7
- exportValue: string;
8
- index: number;
9
- isExport: boolean;
10
- }[];
11
- export function getNamedExports(targetText?: string): {
12
- line: string;
13
- exportType: string;
14
- exportName: string;
15
- index: number;
16
- isExport: boolean;
17
- }[];
18
- export function getNamedDeclarationExports(targetText?: string): any[];
19
- export function getAllExports(targetText?: string): {
20
- line: string;
21
- exportType: string;
22
- from: string;
23
- index: number;
24
- isExport: boolean;
25
- }[];
26
- export function getNamespaceExports(targetText?: string): {
27
- line: string;
28
- exportType: string;
29
- namespace: string;
30
- from: string;
31
- index: number;
32
- isExport: boolean;
33
- }[];
34
- export function getTypeExports(targetText?: string): {
35
- line: string;
36
- exportType: string;
37
- exportName: string;
38
- index: number;
39
- isExport: boolean;
40
- }[];
41
- export function getAssertionExports(targetText?: string): {
42
- line: string;
43
- exportType: string;
44
- exportName: string;
45
- definitions: any;
46
- keys: any;
47
- from: string;
48
- assertion: string;
49
- assertionType: string;
50
- index: number;
51
- isExport: boolean;
52
- isAssertion: boolean;
53
- }[];
54
- //# sourceMappingURL=get-exports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-exports.d.ts","sourceRoot":"","sources":["../src/get-exports.js"],"names":[],"mappings":"AAiBA,+DAiCC;AAED;;;;;;;;IAqDC;AAED;;;;;;IAeC;AAED,uEAuBC;AAED;;;;;;IAeC;AAED;;;;;;;IAgBC;AAED;;;;;;IAeC;AAED;;;;;;;;;;;;IA0BC"}
@@ -1,59 +0,0 @@
1
- export function getImports(code?: string, options?: {}): {
2
- line: string;
3
- varType: string;
4
- varName: string;
5
- definitions: any;
6
- from: string;
7
- index: number;
8
- isImport: boolean;
9
- isRelative: boolean;
10
- isBuiltIn: boolean;
11
- }[];
12
- export function getStaticImports(targetText?: string): {
13
- line: string;
14
- varType: string;
15
- varName: string;
16
- definitions: any;
17
- from: string;
18
- index: number;
19
- isImport: boolean;
20
- isRelative: boolean;
21
- isBuiltIn: boolean;
22
- }[];
23
- export function getTypeImports(targetText?: string): {
24
- importStatement: string;
25
- importPath: string;
26
- importName: string;
27
- index: number;
28
- isImport: boolean;
29
- isTypeImport: boolean;
30
- isRelative: boolean;
31
- isBuiltIn: boolean;
32
- }[];
33
- export function getDynamicImports(targetText?: string): {
34
- line: string;
35
- varType: string;
36
- varName: string;
37
- definitions: any;
38
- from: string;
39
- index: number;
40
- isImport: boolean;
41
- isRelative: boolean;
42
- isBuiltIn: boolean;
43
- isDynamic: boolean;
44
- }[];
45
- export function getAssertionImports(targetText?: string): {
46
- line: string;
47
- varType: string;
48
- varName: string;
49
- definitions: any;
50
- from: string;
51
- assertion: string;
52
- assertionType: string;
53
- index: number;
54
- isImport: boolean;
55
- isRelative: boolean;
56
- isBuiltIn: boolean;
57
- isAssertion: boolean;
58
- }[];
59
- //# sourceMappingURL=get-imports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-imports.d.ts","sourceRoot":"","sources":["../src/get-imports.js"],"names":[],"mappings":"AAWA;;;;;;;;;;IAUC;AAGD;;;;;;;;;;IAmBC;AAED;;;;;;;;;IAkBC;AAED;;;;;;;;;;;IAqBC;AAED;;;;;;;;;;;;;IAyBC"}
@@ -1,37 +0,0 @@
1
- export function getRequires(code: any): {
2
- line: string;
3
- varType: string;
4
- varName: string;
5
- definitions: any;
6
- from: string;
7
- index: number;
8
- isRequire: boolean;
9
- isRelative: boolean;
10
- isBuiltIn: boolean;
11
- isDynamic: boolean;
12
- }[];
13
- export function getStaticRequires(targetText?: string): {
14
- line: string;
15
- varType: string;
16
- varName: string;
17
- definitions: any;
18
- from: string;
19
- index: number;
20
- isRequire: boolean;
21
- isRelative: boolean;
22
- isBuiltIn: boolean;
23
- isDynamic: boolean;
24
- }[];
25
- export function getDynamicRequires(code: any): {
26
- line: string;
27
- varType: string;
28
- varName: string;
29
- definitions: any;
30
- from: string;
31
- index: number;
32
- isRequire: boolean;
33
- isRelative: boolean;
34
- isBuiltIn: boolean;
35
- isDynamic: boolean;
36
- }[];
37
- //# sourceMappingURL=get-requires.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-requires.d.ts","sourceRoot":"","sources":["../src/get-requires.js"],"names":[],"mappings":"AAgEA;;;;;;;;;;;IAIC;AA7BD;;;;;;;;;;;IAuBC;AAvDD;;;;;;;;;;;IA6BC"}
package/types/index.d.ts DELETED
@@ -1,45 +0,0 @@
1
- export function extractDeps(code: any, filePath?: string): {
2
- imports: {
3
- line: string;
4
- varType: string;
5
- varName: string;
6
- definitions: any;
7
- from: string;
8
- index: number;
9
- isImport: boolean;
10
- isRelative: boolean;
11
- isBuiltIn: boolean;
12
- }[];
13
- exports: any[];
14
- requires: {
15
- line: string;
16
- varType: string;
17
- varName: string;
18
- definitions: any;
19
- from: string;
20
- index: number;
21
- isRequire: boolean;
22
- isRelative: boolean;
23
- isBuiltIn: boolean;
24
- isDynamic: boolean;
25
- }[];
26
- moduleExports: any[];
27
- };
28
- import { hasESMSyntax } from "./detect-syntax";
29
- import { hasCJSSyntax } from "./detect-syntax";
30
- import { detectSyntax } from "./detect-syntax";
31
- import { getRequires } from "./get-requires";
32
- import { getDynamicRequires } from "./get-requires";
33
- import { getStaticRequires } from "./get-requires";
34
- import { getImports } from "./get-imports";
35
- import { getStaticImports } from "./get-imports";
36
- import { getDynamicImports } from "./get-imports";
37
- import { getExports } from "./get-exports";
38
- import { getDefaultExports } from "./get-exports";
39
- import { getNamedExports } from "./get-exports";
40
- import { getNamedDeclarationExports } from "./get-exports";
41
- import { getAllExports } from "./get-exports";
42
- import { getNamespaceExports } from "./get-exports";
43
- import { getTypeExports } from "./get-exports";
44
- export { hasESMSyntax, hasCJSSyntax, detectSyntax, getRequires, getDynamicRequires, getStaticRequires, getImports, getStaticImports, getDynamicImports, getExports, getDefaultExports, getNamedExports, getNamedDeclarationExports, getAllExports, getNamespaceExports, getTypeExports };
45
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBC"}
@@ -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
@@ -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,4 +0,0 @@
1
- export function inspectParameters(source: any): any;
2
- export function getParametersNames(source: any): any;
3
- export function getParametersNamesFromInspection(inspectedParameters: any): any;
4
- //# sourceMappingURL=inspect-parameters-declaration.d.ts.map
@@ -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"}