Skip to content

Commit

Permalink
fix: vocabularies exported
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Apr 8, 2024
1 parent e813dd5 commit 89aca40
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-crabs-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hydrofoil/vocabularies": patch
---

Exporting all prefixes caused all to be added to `vocabularies`
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import './register.js'

export { default as prefixes } from './prefixes.js'
export { vocabularies, loadFile } from './vocabularies.js'
17 changes: 1 addition & 16 deletions src/prefixes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import prefixes from '@zazuko/prefixes'

const morePrefixes = {
const prefixes = {
code: 'https://code.described.at/',
'hydra-box': 'http://hydra-box.org/schema/',
'hyper-auth': 'https://hypermedia.app/auth#',
Expand All @@ -11,17 +9,4 @@ const morePrefixes = {
hex: 'https://w3id.org/hydra/extension#',
}

Object.entries(morePrefixes)
.forEach(([prefix, namespace]) => {
prefixes[prefix] = namespace
})

type LocalPrefixes = typeof morePrefixes

declare module '@zazuko/prefixes/prefixes.js' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Prefixes extends LocalPrefixes {
}
}

export default prefixes
15 changes: 15 additions & 0 deletions src/register.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import prefixes from '@zazuko/prefixes'
import morePrefixes from './prefixes.js'

Object.entries(morePrefixes)
.forEach(([prefix, namespace]) => {
prefixes[prefix] = namespace
})

type LocalPrefixes = typeof morePrefixes

declare module '@zazuko/prefixes/prefixes.js' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Prefixes extends LocalPrefixes {
}
}

0 comments on commit 89aca40

Please sign in to comment.