jsii 5.9.30 → 5.9.31
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/lib/assembler.js +15 -7
- package/lib/assembler.js.map +1 -1
- package/lib/utils.d.ts +5 -0
- package/lib/utils.js +8 -0
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
package/lib/assembler.js
CHANGED
|
@@ -744,14 +744,22 @@ class Assembler {
|
|
|
744
744
|
if (!jsiiType.symbolId) {
|
|
745
745
|
jsiiType.symbolId = this.getSymbolId(node);
|
|
746
746
|
}
|
|
747
|
-
//
|
|
748
|
-
// target language
|
|
749
|
-
|
|
747
|
+
// Verify the declaration does not collide with a submodule at the same level in the hierarchy.
|
|
748
|
+
// Submodules get case-adjusted per target language, so names cannot collide with case-variations.
|
|
749
|
+
// We only check submodules and types with a shared parent namespace. Symbols at different nesting
|
|
750
|
+
// levels should not conflict with each other. E.g. "pkg.MyType" and "pkg.sub.my_type" are okay.
|
|
751
|
+
const typeFqnPrefix = (0, utils_2.parentFqn)(jsiiType.fqn);
|
|
752
|
+
for (const [submodule, submoduleSpec] of this._submodules.entries()) {
|
|
753
|
+
// Only check submodules that share the same parent namespace as the type
|
|
754
|
+
if (typeFqnPrefix !== (0, utils_2.parentFqn)(submoduleSpec.fqn)) {
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
// We build common variations of the submodule name to simulate what they would be called in various target languages.
|
|
758
|
+
// This is not entirely accurate because submodules may actually be renamed via .jsiirc files.
|
|
759
|
+
// It is however a good enough approximation for the compiler.
|
|
750
760
|
const candidates = Array.from(new Set([submodule.name, Case.camel(submodule.name), Case.pascal(submodule.name), Case.snake(submodule.name)]));
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const submoduleDeclName = _nameOrDeclarationNode(submodule);
|
|
754
|
-
this._diagnostics.push(jsii_diagnostic_1.JsiiDiagnostic.JSII_5011_SUBMODULE_NAME_CONFLICT.create(ts.getNameOfDeclaration(node) ?? node, submodule.name, jsiiType.name, candidates).addRelatedInformationIf(submoduleDeclName, 'This is the conflicting submodule declaration'));
|
|
761
|
+
if (candidates.some((name) => name === jsiiType.name)) {
|
|
762
|
+
this._diagnostics.push(jsii_diagnostic_1.JsiiDiagnostic.JSII_5011_SUBMODULE_NAME_CONFLICT.create(ts.getNameOfDeclaration(node) ?? node, submodule.name, jsiiType.name, candidates).addRelatedInformationIf(_nameOrDeclarationNode(submodule), 'This is the conflicting submodule declaration'));
|
|
755
763
|
}
|
|
756
764
|
}
|
|
757
765
|
if (LOG.isInfoEnabled()) {
|