# webextensions-schema

> Programmatically consume the WebExtensions Schema JSON files

Latest version **0.5.1** (published 2020-01-29) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install webextensions-schema
pnpm add webextensions-schema
yarn add webextensions-schema
bun add webextensions-schema
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2020-01-29 |
| First published | 2019-11-16 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 3 |
| Unpacked size | 2.9 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | stoically |
| Maintainers | stoically |
| Keywords | webextensions, schemas |

## Links

- npm: https://www.npmjs.com/package/webextensions-schema
- Repository: https://github.com/stoically/webextensions-schema
- Issues: https://github.com/stoically/webextensions-schema/issues
- npm.io page: https://npm.io/package/webextensions-schema

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.88.0
- [unzipper](https://npm.io/package/unzipper.md) ^0.10.5
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) ^3.0.1

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 0.5.1 (latest) — 2020-01-29
- 0.5.0 — 2019-11-21
- 0.4.0 — 2019-11-21
- 0.3.0 — 2019-11-21
- 0.2.0 — 2019-11-18
- 0.1.9 — 2019-11-18
- 0.1.8 — 2019-11-17
- 0.1.7 — 2019-11-17
- 0.1.6 — 2019-11-17
- 0.1.5 — 2019-11-17
- 0.1.4 — 2019-11-16
- 0.1.3 — 2019-11-16
- 0.1.2 — 2019-11-16
- 0.1.1 — 2019-11-16
- 0.1.0 — 2019-11-16

## README

# WebExtensions Schema

Programmatically consume the WebExtensions Schema JSON files. Defaults to the latest stable ones.

## Install

```
npm i webextensions-schema
```

## Usage

```ts
import webExtensionsSchema from 'webextensions-schema';

(async () => {
  const schema = await webExtensionsSchema();
  // do something with `schema`
})();
```

## API

### webExtensionsSchema([options])

- Arguments
  - `{Object}` options
    - `tag` Any tag, except `tip`, [from mozilla-unified](https://hg.mozilla.org/mozilla-unified/tags) is valid. Default: Automatically fetches the latest stable release tag from `download.mozilla.org`.

Schema files for a tag that don't exist in the [`.schemas`
directory](https://github.com/stoically/webextensions-schema/tree/master/.schemas)
are downloaded once and saved there for future calls. Already ships with some
schema files (feel free to PR to add newer ones).

Returns a `Promise` resolving to the `schema` instance.

### schema.raw()

Returns an `Object` with schema filename as key and parsed JSON as value.

Sample:

```js
{
  'tabs.json': [
    { namespace: 'manifest', types: [Array] },
    {
      namespace: 'tabs',
      ...
    }
  ]
}
```

### schema.namespaces()

Returns an `Object` with namespace name as key and an `Array` of namespaces as value.

Sample:

```js
{
  manifest: [
    { namespace: 'manifest', types: [Array] },
    { namespace: 'manifest', types: [Array] },
    ...
  ],
  tabs: [
    {
      namespace: 'tabs',
      functions: [
        [Object], [Object], [Object],
        ...
      ]
    }
  ]
}
```

### schema.tag()

Returns a `string` with tag name that was used for the `schema` instance.

---
_Source: https://npm.io/package/webextensions-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
