@fairfox/polly 0.6.0 → 0.6.1
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.
|
@@ -1671,6 +1671,7 @@ class HandlerExtractor {
|
|
|
1671
1671
|
extractHandlers() {
|
|
1672
1672
|
const handlers = [];
|
|
1673
1673
|
const messageTypes = new Set;
|
|
1674
|
+
const invalidMessageTypes = new Set;
|
|
1674
1675
|
const sourceFiles = this.project.getSourceFiles();
|
|
1675
1676
|
if (process.env["POLLY_DEBUG"]) {
|
|
1676
1677
|
console.log(`[DEBUG] Loaded ${sourceFiles.length} source files`);
|
|
@@ -1684,17 +1685,30 @@ class HandlerExtractor {
|
|
|
1684
1685
|
const fileHandlers = this.extractFromFile(sourceFile);
|
|
1685
1686
|
handlers.push(...fileHandlers);
|
|
1686
1687
|
for (const handler of fileHandlers) {
|
|
1687
|
-
|
|
1688
|
+
if (this.isValidTLAIdentifier(handler.messageType)) {
|
|
1689
|
+
messageTypes.add(handler.messageType);
|
|
1690
|
+
} else {
|
|
1691
|
+
invalidMessageTypes.add(handler.messageType);
|
|
1692
|
+
}
|
|
1688
1693
|
}
|
|
1689
1694
|
}
|
|
1690
1695
|
if (process.env["POLLY_DEBUG"]) {
|
|
1691
1696
|
console.log(`[DEBUG] Total handlers extracted: ${handlers.length}`);
|
|
1697
|
+
if (invalidMessageTypes.size > 0) {
|
|
1698
|
+
console.log(`[DEBUG] Filtered ${invalidMessageTypes.size} invalid message type(s) from handlers`);
|
|
1699
|
+
}
|
|
1692
1700
|
}
|
|
1693
1701
|
return {
|
|
1694
1702
|
handlers,
|
|
1695
1703
|
messageTypes
|
|
1696
1704
|
};
|
|
1697
1705
|
}
|
|
1706
|
+
isValidTLAIdentifier(s) {
|
|
1707
|
+
if (!s || s.length === 0) {
|
|
1708
|
+
return false;
|
|
1709
|
+
}
|
|
1710
|
+
return /^[a-zA-Z][a-zA-Z0-9_]*$/.test(s);
|
|
1711
|
+
}
|
|
1698
1712
|
extractFromFile(sourceFile) {
|
|
1699
1713
|
const handlers = [];
|
|
1700
1714
|
const filePath = sourceFile.getFilePath();
|
|
@@ -4003,4 +4017,4 @@ Stack trace:`, COLORS.gray));
|
|
|
4003
4017
|
process.exit(1);
|
|
4004
4018
|
});
|
|
4005
4019
|
|
|
4006
|
-
//# debugId=
|
|
4020
|
+
//# debugId=698279082E1D6F3764756E2164756E21
|