Skip to content

Commit

Permalink
fix: don't strip underscore attributes in .manifest() (#358)
Browse files Browse the repository at this point in the history
This was a quirk of how we were using read-package-json-fast.
Only its package.json file parsing was doing that step
  • Loading branch information
wraithgar committed Apr 24, 2024
1 parent 0cd82be commit 116b277
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/registry.js
Expand Up @@ -127,11 +127,12 @@ class RegistryFetcher extends Fetcher {
}

const packument = await this.packument()
const steps = PackageJson.normalizeSteps.filter(s => s !== '_attributes')
const mani = await new PackageJson().fromContent(pickManifest(packument, this.spec.fetchSpec, {
...this.opts,
defaultTag: this.defaultTag,
before: this.before,
})).normalize().then(p => p.content)
})).normalize({ steps }).then(p => p.content)

/* XXX add ETARGET and E403 revalidation of cached packuments here */

Expand Down
2 changes: 2 additions & 0 deletions test/registry.js
Expand Up @@ -1267,6 +1267,7 @@ t.test('option replaceRegistryHost', rhTest => {
dist: {
tarball: 'https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz',
},
_test: true,
},
},
})
Expand All @@ -1291,6 +1292,7 @@ t.test('option replaceRegistryHost', rhTest => {
const manifest = await fetcher.manifest()
ct.equal(manifest.dist.tarball, 'https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz')
const tarball = await fetcher.tarball()
ct.equal(manifest._test, true, 'Underscores are preserved')
ct.match(tarball, abbrevTGZ)
})

Expand Down

0 comments on commit 116b277

Please sign in to comment.