Skip to content

Commit 626ad3d

Browse files
Copilotv-jiaodi
andcommitted
revert: remove platform-specific browser helper variant logic from binder.ts (reverts 34c79d6)
Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>
1 parent c2d67f8 commit 626ad3d

3 files changed

Lines changed: 0 additions & 73 deletions

File tree

packages/typespec-test/test/batch_modular/generated/typespec-ts/src/static-helpers/serialization/get-binary-response-browser.mts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/typespec-test/test/openai_modular/generated/typespec-ts/src/static-helpers/serialization/get-binary-response-browser.mts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/typespec-ts/src/framework/hooks/binder.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -309,39 +309,6 @@ class BinderImp implements Binder {
309309
}
310310
}
311311

312-
// Ensure platform-specific variants (e.g. *-browser.*, *-react-native.*)
313-
// are preserved whenever their base helper is referenced.
314-
const platformSuffixes = ["-browser", "-react-native"];
315-
const helpersWithReferences = Array.from(usedHelperFiles);
316-
for (const helperFile of helpersWithReferences) {
317-
const directory = helperFile.getDirectory();
318-
const filePath = helperFile.getFilePath();
319-
const fileName = path.basename(filePath);
320-
const dotIndex = fileName.indexOf(".");
321-
const baseName =
322-
dotIndex === -1 ? fileName : fileName.substring(0, dotIndex);
323-
const variantPrefix = `${baseName}-`;
324-
325-
for (const sibling of directory.getSourceFiles()) {
326-
if (usedHelperFiles.has(sibling)) {
327-
continue;
328-
}
329-
const siblingPath = sibling.getFilePath();
330-
const siblingName = path.basename(siblingPath);
331-
const siblingDotIndex = siblingName.indexOf(".");
332-
const siblingBaseName =
333-
siblingDotIndex === -1
334-
? siblingName
335-
: siblingName.substring(0, siblingDotIndex);
336-
337-
if (
338-
siblingBaseName.startsWith(variantPrefix) &&
339-
platformSuffixes.some((suffix) => siblingBaseName.endsWith(suffix))
340-
) {
341-
usedHelperFiles.add(sibling);
342-
}
343-
}
344-
}
345312
function isFileUnused(file: SourceFile) {
346313
return !usedHelperFiles.has(file);
347314
}

0 commit comments

Comments
 (0)