Skip to content

Commit 26ada5f

Browse files
fix(client): fix export map for index exports, accept BunFile (#11)
1 parent 9729975 commit 26ada5f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

scripts/utils/postprocess-files.cjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ async function postprocess() {
5050
if (entry.isDirectory() && entry.name !== 'src' && entry.name !== 'internal' && entry.name !== 'bin') {
5151
const subpath = './' + entry.name;
5252
newExports[subpath + '/*.mjs'] = {
53-
default: subpath + '/*.mjs',
53+
default: [subpath + '/*.mjs', subpath + '/*/index.mjs'],
5454
};
5555
newExports[subpath + '/*.js'] = {
56-
default: subpath + '/*.js',
56+
default: [subpath + '/*.js', subpath + '/*/index.js'],
5757
};
5858
newExports[subpath + '/*'] = {
59-
import: subpath + '/*.mjs',
60-
require: subpath + '/*.js',
59+
import: [subpath + '/*.mjs', subpath + '/*/index.mjs'],
60+
require: [subpath + '/*.js', subpath + '/*/index.js'],
6161
};
6262
} else if (entry.isFile() && /\.[cm]?js$/.test(entry.name)) {
6363
const { name, ext } = path.parse(entry.name);

src/internal/uploads.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ interface FileLike extends BlobLike {
5252
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
5353
readonly lastModified: number;
5454
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
55-
readonly name: string;
55+
readonly name?: string | undefined;
5656
}
5757
declare var FileClass: {
5858
prototype: FileLike;
@@ -126,7 +126,7 @@ export async function toFile(
126126
if (File && value instanceof File) {
127127
return value;
128128
}
129-
return makeFile([await value.arrayBuffer()], value.name);
129+
return makeFile([await value.arrayBuffer()], value.name ?? 'unknown_file');
130130
}
131131

132132
if (isResponseLike(value)) {

0 commit comments

Comments
 (0)