@davidwells/extract-deps 0.1.3 → 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.
- package/package.json +1 -1
- package/src/dep-graph.js +51 -21
- package/tests/dep-graph.test.js +29 -0
- package/tests/fixtures/node-module-named-export/handler-correct.js +6 -0
- package/tests/fixtures/node-module-named-export/handler.js +6 -0
- package/tests/fixtures/node-module-named-export/node_modules/fake-named-pkg/index.js +3 -0
- package/tests/fixtures/node-module-named-export/node_modules/fake-named-pkg/package.json +6 -0
- package/tests/fixtures/node-module-named-export/package.json +4 -0
- package/.claude/settings.local.json +0 -17
- package/types/dep-graph.d.ts +0 -44
- 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 -54
- package/types/get-imports.d.ts.map +0 -1
- package/types/get-requires.d.ts +0 -34
- package/types/get-requires.d.ts.map +0 -1
- package/types/index.d.ts +0 -43
- 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 -5
- 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
package/package.json
CHANGED
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) {
|
|
@@ -106,23 +117,34 @@ function verifyImportedValuesExist(dep, targetDeps, targetPath, sourcePath, erro
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
|
-
// For non-destructured imports,
|
|
120
|
+
// For non-destructured imports, verify there's a default export
|
|
121
|
+
// Only applies to ESM imports - CJS require() gets whatever module.exports is
|
|
110
122
|
else {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (dep.isESM) {
|
|
124
|
+
// ESM import X from 'pkg' requires a default export
|
|
125
|
+
const hasModuleExports = targetDeps.moduleExports && targetDeps.moduleExports.length > 0
|
|
126
|
+
const hasESMExports = targetDeps.exports && targetDeps.exports.length > 0
|
|
127
|
+
const hasDefaultExport =
|
|
128
|
+
hasModuleExports ||
|
|
129
|
+
(hasESMExports && targetDeps.exports.some(exp => exp.exportType === 'default'))
|
|
130
|
+
|
|
131
|
+
// Only fail if we can detect exports but none are default
|
|
132
|
+
// If we can't detect any exports (e.g., complex/minified file), assume valid
|
|
133
|
+
const hasDetectableExports = hasModuleExports || hasESMExports
|
|
134
|
+
|
|
135
|
+
if (hasDetectableExports && !hasDefaultExport) {
|
|
136
|
+
const error = new Error(
|
|
137
|
+
`Import not found: "${targetPath}" does not have a default export.\n` +
|
|
138
|
+
`Import statement: ${dep.line}\n` +
|
|
139
|
+
`Importing from: ${sourcePath}`
|
|
140
|
+
)
|
|
141
|
+
if (throwOnFirstError) {
|
|
142
|
+
throw error
|
|
143
|
+
}
|
|
144
|
+
errors.push(error)
|
|
123
145
|
}
|
|
124
|
-
errors.push(error)
|
|
125
146
|
}
|
|
147
|
+
// CJS require() can get any module.exports - no default check needed
|
|
126
148
|
}
|
|
127
149
|
}
|
|
128
150
|
|
|
@@ -166,20 +188,20 @@ function buildGraphRecursively(
|
|
|
166
188
|
// Collect all relative dependencies
|
|
167
189
|
const relativeDeps = []
|
|
168
190
|
if (deps.requires && deps.requires.length > 0) {
|
|
169
|
-
relativeDeps.push(...deps.requires.filter(req => req.isRelative))
|
|
191
|
+
relativeDeps.push(...deps.requires.filter(req => req.isRelative).map(req => ({ ...req, isESM: false })))
|
|
170
192
|
}
|
|
171
193
|
if (deps.imports && deps.imports.length > 0) {
|
|
172
|
-
relativeDeps.push(...deps.imports.filter(imp => imp.isRelative))
|
|
194
|
+
relativeDeps.push(...deps.imports.filter(imp => imp.isRelative).map(imp => ({ ...imp, isESM: true })))
|
|
173
195
|
}
|
|
174
196
|
|
|
175
197
|
// Collect all non-relative dependencies (node_modules)
|
|
176
198
|
const nodeModuleDeps = []
|
|
177
199
|
if (verifyNodeModules || includeNodeModules) {
|
|
178
200
|
if (deps.requires && deps.requires.length > 0) {
|
|
179
|
-
nodeModuleDeps.push(...deps.requires.filter(req => !req.isRelative))
|
|
201
|
+
nodeModuleDeps.push(...deps.requires.filter(req => !req.isRelative).map(req => ({ ...req, isESM: false })))
|
|
180
202
|
}
|
|
181
203
|
if (deps.imports && deps.imports.length > 0) {
|
|
182
|
-
nodeModuleDeps.push(...deps.imports.filter(imp => !imp.isRelative))
|
|
204
|
+
nodeModuleDeps.push(...deps.imports.filter(imp => !imp.isRelative).map(imp => ({ ...imp, isESM: true })))
|
|
183
205
|
}
|
|
184
206
|
}
|
|
185
207
|
|
|
@@ -242,11 +264,11 @@ function buildGraphRecursively(
|
|
|
242
264
|
continue
|
|
243
265
|
}
|
|
244
266
|
|
|
267
|
+
let resolvedPath
|
|
245
268
|
try {
|
|
246
|
-
//
|
|
269
|
+
// resolveImport throws if file doesn't exist
|
|
247
270
|
const resolved = resolveImport(from, parentURL)
|
|
248
|
-
|
|
249
|
-
// If we get here, the module resolved successfully
|
|
271
|
+
resolvedPath = fileURLToPath(resolved)
|
|
250
272
|
} catch (error) {
|
|
251
273
|
const err = new Error(
|
|
252
274
|
`"${line}" could not be resolved in ${filePath}\n\n` +
|
|
@@ -258,6 +280,14 @@ function buildGraphRecursively(
|
|
|
258
280
|
throw err
|
|
259
281
|
}
|
|
260
282
|
errors.push(err)
|
|
283
|
+
continue
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Verify import/export styles match (only needed for ESM imports)
|
|
287
|
+
if (dep.isESM) {
|
|
288
|
+
const targetContent = fs.readFileSync(resolvedPath, 'utf8')
|
|
289
|
+
const targetDeps = extractDeps(targetContent)
|
|
290
|
+
verifyImportedValuesExist(dep, targetDeps, resolvedPath, filePath, errors, throwOnFirstError)
|
|
261
291
|
}
|
|
262
292
|
}
|
|
263
293
|
}
|
package/tests/dep-graph.test.js
CHANGED
|
@@ -521,4 +521,33 @@ test('resolveDepPaths with returnErrors: true and no errors', () => {
|
|
|
521
521
|
assert.is(result.errors.length, 0, 'Should have no errors')
|
|
522
522
|
})
|
|
523
523
|
|
|
524
|
+
// Node module export verification tests
|
|
525
|
+
const NODE_MODULE_NAMED_FIXTURE = path.resolve(__dirname, './fixtures/node-module-named-export/handler.js')
|
|
526
|
+
const NODE_MODULE_NAMED_CORRECT = path.resolve(__dirname, './fixtures/node-module-named-export/handler-correct.js')
|
|
527
|
+
|
|
528
|
+
test('verifyNodeModules: true should catch default import when only named exports exist', () => {
|
|
529
|
+
let errorMessage = ''
|
|
530
|
+
try {
|
|
531
|
+
depGraph(NODE_MODULE_NAMED_FIXTURE, { verifyNodeModules: true })
|
|
532
|
+
} catch (error) {
|
|
533
|
+
errorMessage = error.message
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
assert.ok(errorMessage.includes('does not have a default export'), 'Should detect missing default export')
|
|
537
|
+
assert.ok(errorMessage.includes('fake-named-pkg'), 'Should mention the package')
|
|
538
|
+
})
|
|
539
|
+
|
|
540
|
+
test('verifyNodeModules: true should pass for correct named import', () => {
|
|
541
|
+
assert.not.throws(() => {
|
|
542
|
+
depGraph(NODE_MODULE_NAMED_CORRECT, { verifyNodeModules: true })
|
|
543
|
+
}, 'Should pass for correct named import')
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
test('verifyNodeModules with returnErrors should collect export mismatch errors', () => {
|
|
547
|
+
const result = depGraph(NODE_MODULE_NAMED_FIXTURE, { verifyNodeModules: true, returnErrors: true })
|
|
548
|
+
|
|
549
|
+
assert.ok(result.errors.length > 0, 'Should have errors')
|
|
550
|
+
assert.ok(result.errors[0].message.includes('does not have a default export'), 'Should be default export error')
|
|
551
|
+
})
|
|
552
|
+
|
|
524
553
|
test.run()
|
|
@@ -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
|
-
}
|
package/types/dep-graph.d.ts
DELETED
|
@@ -1,44 +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[], errors?: Error[] }} - Object with files in topological order and unique node_modules
|
|
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
|
-
errors?: Error[];
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=dep-graph.d.ts.map
|
package/types/dep-graph.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dep-graph.d.ts","sourceRoot":"","sources":["../src/dep-graph.js"],"names":[],"mappings":"AAmQA;;;;;;;;;;;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,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,CA4ExE"}
|
package/types/detect-syntax.d.ts
DELETED
|
@@ -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,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 +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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.js"],"names":[],"mappings":"AAEA,+DAEC;AAED,yEAKC;AAED,6CA2CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detect-syntax.test.d.ts","sourceRoot":"","sources":["../../../tests/detect-syntax.test.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-exports.test.d.ts","sourceRoot":"","sources":["../../../tests/get-exports.test.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-imports.test.d.ts","sourceRoot":"","sources":["../../../tests/get-imports.test.js"],"names":[],"mappings":""}
|
|
@@ -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"}
|
package/types/get-exports.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export function getExports(code: any, 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,2DA+BC;AAED;;;;;;;;IAqDC;AAED;;;;;;IAeC;AAED,uEAuBC;AAED;;;;;;IAeC;AAED;;;;;;;IAgBC;AAED;;;;;;IAeC;AAED;;;;;;;;;;;;IA0BC"}
|
package/types/get-imports.d.ts
DELETED
|
@@ -1,54 +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
|
-
isTypeImport: boolean;
|
|
28
|
-
isRelative: boolean;
|
|
29
|
-
}[];
|
|
30
|
-
export function getDynamicImports(targetText?: string): {
|
|
31
|
-
line: string;
|
|
32
|
-
varType: string;
|
|
33
|
-
varName: string;
|
|
34
|
-
definitions: any;
|
|
35
|
-
from: string;
|
|
36
|
-
index: number;
|
|
37
|
-
isImport: boolean;
|
|
38
|
-
isRelative: boolean;
|
|
39
|
-
isDynamic: boolean;
|
|
40
|
-
}[];
|
|
41
|
-
export function getAssertionImports(targetText?: string): {
|
|
42
|
-
line: string;
|
|
43
|
-
varType: string;
|
|
44
|
-
varName: string;
|
|
45
|
-
definitions: any;
|
|
46
|
-
from: string;
|
|
47
|
-
assertion: string;
|
|
48
|
-
assertionType: string;
|
|
49
|
-
index: number;
|
|
50
|
-
isImport: boolean;
|
|
51
|
-
isRelative: boolean;
|
|
52
|
-
isAssertion: boolean;
|
|
53
|
-
}[];
|
|
54
|
-
//# 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;;;;;;;;IAiBC;AAED;;;;;;;;;;IAoBC;AAED;;;;;;;;;;;;IAwBC"}
|
package/types/get-requires.d.ts
DELETED
|
@@ -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"}
|
package/types/index.d.ts
DELETED
|
@@ -1,43 +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
|
-
}[];
|
|
12
|
-
exports: any[];
|
|
13
|
-
requires: {
|
|
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
|
-
isDynamic: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
moduleExports: any[];
|
|
25
|
-
};
|
|
26
|
-
import { hasESMSyntax } from "./detect-syntax";
|
|
27
|
-
import { hasCJSSyntax } from "./detect-syntax";
|
|
28
|
-
import { detectSyntax } from "./detect-syntax";
|
|
29
|
-
import { getRequires } from "./get-requires";
|
|
30
|
-
import { getDynamicRequires } from "./get-requires";
|
|
31
|
-
import { getStaticRequires } from "./get-requires";
|
|
32
|
-
import { getImports } from "./get-imports";
|
|
33
|
-
import { getStaticImports } from "./get-imports";
|
|
34
|
-
import { getDynamicImports } from "./get-imports";
|
|
35
|
-
import { getExports } from "./get-exports";
|
|
36
|
-
import { getDefaultExports } from "./get-exports";
|
|
37
|
-
import { getNamedExports } from "./get-exports";
|
|
38
|
-
import { getNamedDeclarationExports } from "./get-exports";
|
|
39
|
-
import { getAllExports } from "./get-exports";
|
|
40
|
-
import { getNamespaceExports } from "./get-exports";
|
|
41
|
-
import { getTypeExports } from "./get-exports";
|
|
42
|
-
export { hasESMSyntax, hasCJSSyntax, detectSyntax, getRequires, getDynamicRequires, getStaticRequires, getImports, getStaticImports, getDynamicImports, getExports, getDefaultExports, getNamedExports, getNamedDeclarationExports, getAllExports, getNamespaceExports, getTypeExports };
|
|
43
|
-
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
DELETED
|
@@ -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,5 +0,0 @@
|
|
|
1
|
-
export function isRelativeImport(importLocation: any): boolean;
|
|
2
|
-
export function isRelativeImportWithQuotes(importLocation: any): boolean;
|
|
3
|
-
export function getNames(names: any, aliasKey?: string): any;
|
|
4
|
-
export function extractExportName(exportValue: any): any;
|
|
5
|
-
//# 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":"AAEA,+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"}
|