Skip to content

Commit

Permalink
feat(types): Browser
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Dec 1, 2022
1 parent 9035563 commit fe8409e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/types/__tests__/browser.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @file Unit Tests - Browser
* @module pkg-types/types/tests/Browser
*/

import type TestSubject from '../browser'

describe('unit:types/Browser', () => {
it('should allow dependency map', () => {
assertType<TestSubject>({
fs: false,
path: './dist/browser-shims/path.mjs'
})
})

it('should allow empty object', () => {
assertType<TestSubject>({})
})

it('should allow path to file', () => {
assertType<TestSubject>('./dist/browser.mjs')
})
})
17 changes: 17 additions & 0 deletions src/types/browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @file Type Definitions - Browser
* @module pkg-types/types/Browser
*/

import type DependencyMap from './dependency-map'

/**
* Hint to JavaScript bundlers or component tools when packaging modules for
* client side use.
*
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#browser
* @see https://yarnpkg.com/configuration/manifest#publishConfig.browser
*/
type Browser = DependencyMap<string | false> | string

export type { Browser as default }
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export type { default as Access } from './access'
export type { default as Bin } from './bin'
export type { default as Browser } from './browser'
export type { default as CPU } from './cpu'
export type { default as DependencyMap } from './dependency-map'
export type { default as Engine } from './engine'
Expand Down

0 comments on commit fe8409e

Please sign in to comment.