@ssen/collect-dependencies
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.3
@@ -23,4 +23,8 @@ import { PackageJson } from 'type-fest'; | ||
selfNames?: Set<string>; | ||
fixImportPath?: (args: { | ||
importPath: string; | ||
filePath: string; | ||
}) => string; | ||
} | ||
export declare function collectDependencies({ rootDir, internalPackages, externalPackages, extensions, excludes, includes, compilerOptions, selfNames, }: CollectDependenciesParams): Promise<PackageJson.Dependency>; | ||
export declare function collectDependencies({ rootDir, internalPackages, externalPackages, extensions, excludes, includes, compilerOptions, selfNames, fixImportPath, }: CollectDependenciesParams): Promise<PackageJson.Dependency>; | ||
export {}; |
@@ -46,3 +46,3 @@ "use strict"; | ||
}; | ||
function collectDependencies({ rootDir, internalPackages, externalPackages, extensions = exports.collectTypeScript.extensions, excludes = exports.collectTypeScript.excludes, includes = exports.collectTypeScript.includes, compilerOptions = {}, selfNames = new Set(), }) { | ||
function collectDependencies({ rootDir, internalPackages, externalPackages, extensions = exports.collectTypeScript.extensions, excludes = exports.collectTypeScript.excludes, includes = exports.collectTypeScript.includes, compilerOptions = {}, selfNames = new Set(), fixImportPath, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -63,3 +63,9 @@ compilerOptions = Object.assign(Object.assign({ allowJs: extensions.some((ext) => /^.js/.test(ext)) }, compilerOptions), { rootDir }); | ||
node.moduleSpecifier.text) { | ||
importPaths.add(node.moduleSpecifier.text); | ||
const importPath = node.moduleSpecifier.text; | ||
importPaths.add(typeof fixImportPath === 'function' | ||
? fixImportPath({ | ||
importPath, | ||
filePath: file, | ||
}) | ||
: importPath); | ||
} | ||
@@ -70,3 +76,9 @@ // import('?') | ||
typescript_1.default.isStringLiteralLike(node.arguments[0])) { | ||
importPaths.add(node.arguments[0].text); | ||
const importPath = node.arguments[0].text; | ||
importPaths.add(typeof fixImportPath === 'function' | ||
? fixImportPath({ | ||
importPath, | ||
filePath: file, | ||
}) | ||
: importPath); | ||
} | ||
@@ -80,3 +92,9 @@ // require.resolve('?') | ||
typescript_1.default.isStringLiteralLike(node.arguments[0])) { | ||
importPaths.add(node.arguments[0].text); | ||
const importPath = node.arguments[0].text; | ||
importPaths.add(typeof fixImportPath === 'function' | ||
? fixImportPath({ | ||
importPath, | ||
filePath: file, | ||
}) | ||
: importPath); | ||
} | ||
@@ -88,3 +106,9 @@ // require('?') | ||
typescript_1.default.isStringLiteralLike(node.arguments[0])) { | ||
importPaths.add(node.arguments[0].text); | ||
const importPath = node.arguments[0].text; | ||
importPaths.add(typeof fixImportPath === 'function' | ||
? fixImportPath({ | ||
importPath, | ||
filePath: file, | ||
}) | ||
: importPath); | ||
} | ||
@@ -91,0 +115,0 @@ typescript_1.default.forEachChild(node, search); |
@@ -14,3 +14,3 @@ { | ||
"name": "@ssen/collect-dependencies", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.3", | ||
"dependencies": { | ||
@@ -17,0 +17,0 @@ "type-fest": "^0.15.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18487
253