Skip to content

Commit

Permalink
fix(client): fix export map for index exports, accept BunFile (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 14, 2025
1 parent c41e942 commit 7d38d98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions scripts/utils/postprocess-files.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ async function postprocess() {
if (entry.isDirectory() && entry.name !== 'src' && entry.name !== 'internal' && entry.name !== 'bin') {
const subpath = './' + entry.name;
newExports[subpath + '/*.mjs'] = {
default: subpath + '/*.mjs',
default: [subpath + '/*.mjs', subpath + '/*/index.mjs'],
};
newExports[subpath + '/*.js'] = {
default: subpath + '/*.js',
default: [subpath + '/*.js', subpath + '/*/index.js'],
};
newExports[subpath + '/*'] = {
import: subpath + '/*.mjs',
require: subpath + '/*.js',
import: [subpath + '/*.mjs', subpath + '/*/index.mjs'],
require: [subpath + '/*.js', subpath + '/*/index.js'],
};
} else if (entry.isFile() && /\.[cm]?js$/.test(entry.name)) {
const { name, ext } = path.parse(entry.name);
Expand Down
4 changes: 2 additions & 2 deletions src/internal/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface FileLike extends BlobLike {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
readonly lastModified: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
readonly name: string;
readonly name?: string | undefined;
}
declare var FileClass: {
prototype: FileLike;
Expand Down Expand Up @@ -126,7 +126,7 @@ export async function toFile(
if (File && value instanceof File) {
return value;
}
return makeFile([await value.arrayBuffer()], value.name);
return makeFile([await value.arrayBuffer()], value.name ?? 'unknown_file');
}

if (isResponseLike(value)) {
Expand Down

0 comments on commit 7d38d98

Please sign in to comment.