mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-19 07:58:46 +01:00
Use protopiler for protocol buffers
Co-authored-by: Jamie Kyle <jamie@signal.org>
This commit is contained in:
34
codemods/protopiler-migration/02-remove-i.js
Normal file
34
codemods/protopiler-migration/02-remove-i.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2026 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
export default function transform(babel) {
|
||||
const { types: t } = babel;
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
TSQualifiedName(path) {
|
||||
const { node } = path;
|
||||
if (
|
||||
node.right.type !== 'Identifier' ||
|
||||
!/^I[A-Z][a-z]/.test(node.right.name)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't touch fuse.js
|
||||
if (node.left.type === 'Identifier' && node.left.name === 'Fuse') {
|
||||
return;
|
||||
}
|
||||
|
||||
path.replaceWith(
|
||||
t.TSQualifiedName(
|
||||
t.TSQualifiedName(
|
||||
node.left,
|
||||
t.Identifier(node.right.name.slice(1))
|
||||
),
|
||||
t.Identifier('Params')
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user