Skip to content

Commit

Permalink
use object with null proto for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 21, 2024
1 parent 6871bac commit 576a293
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function mkdist(
const dtsOutputs = outputs.filter((o) => o.declaration && !o.skip);
if (dtsOutputs.length > 0) {
const vfs = new Map(dtsOutputs.map((o) => [o.srcPath, o.contents || ""]));
const declarations = {};
const declarations = Object.create(null);
for (const loader of [getVueDeclarations, getDeclarations]) {
Object.assign(declarations, await loader(vfs, options));
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/vue-dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function getVueDeclarations(
const SFC_EXT_RE = /\.vue\.[cm]?[jt]s$/;

function getFileMapping(vfs: Map<string, string>): Record<string, string> {
const files: Record<string, string> = {};
const files: Record<string, string> = Object.create(null);
for (const [srcPath] of vfs) {
if (SFC_EXT_RE.test(srcPath)) {
files[srcPath.replace(SFC_EXT_RE, ".vue")] = srcPath;
Expand Down

0 comments on commit 576a293

Please sign in to comment.