diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index deae575..d16c864 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -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); diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 4f0fb82..ee2029c 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -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; @@ -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)) {