Skip to content

Commit b01aad6

Browse files
authored
Cleanup declaration generation (#16758)
1. removed unneeded console call 2. Changed regex to both `core/` and local file reference to stay safe.
1 parent d70aea1 commit b01aad6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/dev/buildTools/src/generateDeclaration.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ function GetPackageDeclaration(
366366
}
367367
}
368368

369-
// if the import is a return-type import from core, we remove the import and the dot
370-
if (line.match(/import\("core(.*)"\)\./g)) {
369+
// if the import is a return-type import from core or local dir, we remove the import and the dot
370+
if (line.match(/import\("core(.*)"\)\./g) || line.match(/import\("\.(.*)"\)\./g)) {
371371
line = line.replace(/import\("(.*)"\)\./g, "");
372372
}
373373

@@ -414,10 +414,7 @@ function GetPackageDeclaration(
414414
}
415415
const devPackageToUse = isValidDevPackageName(localDevPackageMap, true) ? localDevPackageMap : devPackageName;
416416
const originalNamespace = getPublicPackageName(getPackageMappingByDevName(devPackageToUse).namespace);
417-
const namespace = getPublicPackageName(getPackageMappingByDevName(devPackageToUse).namespace, fullPath /*, fullPath*/);
418-
if (fullPath.indexOf("nodeParticleBuildState") !== -1) {
419-
console.log(`Replacing ${alias} with ${namespace}.${realClassName} in ${fullPath} for package ${devPackageToUse} (${originalNamespace})`);
420-
}
417+
const namespace = getPublicPackageName(getPackageMappingByDevName(devPackageToUse).namespace, fullPath);
421418
if (namespace !== defaultModuleName || originalNamespace !== namespace || alias !== realClassName) {
422419
const matchRegex = new RegExp(`([ <])(${alias})([^\\w])`, "g");
423420
if (exported) {

0 commit comments

Comments
 (0)