<file_sep>const commonjs = require('rollup-plugin-commonjs');

module.exports = {
  // Input is created by webpack in previous build step, in CommonJS format.
  input: 'dist/context.js',
  output: {
    file: 'dist/context.esm.js',
    format: 'esm'
  },
  plugins: [
    commonjs({
      // explicitly list exports otherwise only have 'default'
      namedExports: {
        'dist/context.js': [
          'contexts', 'constants', 'CONTEXT', 'CONTEXT_URL', 'CONTEXT_URL_V1',
          'DID_CONTEXT_URL'
        ]
      }
    })
  ]
};
<file_sep>'use strict';

const context = require('./context');
const constants = require('./constants');
const {CONTEXT_URL, DID_CONTEXT_URL} = constants;

const contexts = new Map();
contexts.set(CONTEXT_URL, context);

module.exports = {
  constants,
  contexts,
  DID_CONTEXT_URL,
  CONTEXT_URL,
  CONTEXT_URL_V1: CONTEXT_URL,
  CONTEXT: context
};
<file_sep># did-context ChangeLog

## 3.1.1 - 2021-09-14

### Fixed
- Fix rollup export.

## 3.1.0 - 2021-09-14

### Changed
- Refactor to use current context repo template (generate the `.jsonld` during
  build).

## 3.0.1 - 2021-04-14

### Fixed
- Remove `"@container": "@set"` properties from `alsoKnownAs` and `service`
  terms, to match the DID Registries definition.

## 3.0.0 - 2021-03-30

### Changed
- **BREAKING**: Remove non-DID Core properties.
- **BREAKING**: Enable term protection.
- **BREAKING**: Change context url from `https://w3id.org/did/v0.11` to
  `https://www.w3.org/ns/did/v1`.

## 2.0.0 - 2019-07-02

### Added
- Add terms:
  - `EcdsaSecp256k1Signature2019`
  - `EcdsaSecp256k1VerificationKey2019`
  - `SchnorrSecp256k1Signature2019`
  - `SchnorrSecp256k1VerificationKey2019`
  - `keyAgreement`

### Changed
- New repository for packaging.  Previously mixed in with the [did-spec][]
  repository.
- **BREAKING**: Implement a new module structure.
- Build and distribute static browser version with all contexts.
- Export a `contexts` Map associating context URIs to contexts.
- Export a `constants` Object associating short ids to contexts URIs.

## 1.0.0 - 2019-01-03

See git history of [did-spec][] for changes previous to this release.

[did-spec]: https://github.com/w3c-ccg/did-spec
<file_sep># DID Context _(did-context)_

[![NPM Version](https://img.shields.io/npm/v/did-context.svg?style=flat-square)](https://npm.im/did-context)
<!--[![Build Status](https://travis-ci.org/digitalbazaar/did-context.png?branch=master)](https://travis-ci.org/digitalbazaar/did-context)-->

> A [DID][did-spec] (Decentralized Identifier) context library for JavaScript

This project packages the DID Context from the [DID specification][did-spec]
for use with [Node.js][Node.js] and web apps.

## Table of Contents

- [Security](#security)
- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [Commercial Support](#commercial-support)
- [License](#license)

## Security

TBD

## Background

See also (related specs):

* [Decentralized Identifiers (DIDs) - Data Model and Syntaxes][did-spec]
* [Decentralized Identifier Resolution](https://w3c-ccg.github.io/did-resolution/)

## Install

Requires [Node.js][] 8.3+

To install via [NPM][]:

```
npm install did-context
```

## Usage

```js
import didContext from 'did-context';
// or
const didContext = require('did-context');

// use URL in a JSON-LD context
const obj = {
  "@context": [
    didContext.CONTEXT_URL_V1,
    // ...
  ],
  // ...
};

// get context data for a specific context
const data = didContext.CONTEXT;
// ...
```

This package can be used with bundlers, such as [webpack][], in browser
applications.

## API

The library exports two properties:
- `constants`: A Object that maps constants to well-known context URLs. The
  main constant `DID_CONTEXT_URL` may be updated from time to time to the
  latest context location.
- `contexts`: A `Map` that maps URLs to full context data.

## Contribute

Code and packaging development is at the [did-context][] project. The contexts
themselves are developed in the [did-spec][] project.

Contexts in this package are updated manually from the [did-spec][] contexts.
Please file an issue if this package is not synced with [did-spec][] changes in
a timely manner.

Small note: If editing the Readme, please conform to the
[standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## Commercial Support

Commercial support for this library is available upon request from
Digital Bazaar: <EMAIL>

## License

- Code: BSD 3-Clause © Digital Bazaar
- Contexts: W3C Software and Document License
- See the [LICENSE](./LICENSE.md) file for details.

[did-context]: https://github.com/digitalbazaar/did-context
[did-spec]: https://www.w3.org/TR/did-core/
[NPM]: https://www.npmjs.com/
[Node.js]: https://nodejs.org/
[webpack]: https://webpack.js.org/
<file_sep>'use strict';

const DID_CONTEXT_URL = 'https://www.w3.org/ns/did/v1';

module.exports = {
  CONTEXT_FILENAME: 'did-v1.jsonld',
  DID_CONTEXT_URL,
  CONTEXT_URL: DID_CONTEXT_URL,
  CONTEXT_URL_V1: DID_CONTEXT_URL
};
<file_sep>module.exports = function(config) {
  const bundler = process.env.BUNDLER || 'webpack';
  const frameworks = ['mocha', 'chai'];

  const files = ['*.spec.js'];

  // browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  // browsers: ['ChromeHeadless', 'Chrome', 'Firefox', 'Safari'],
  const browsers = ['ChromeHeadless'];

  const reporters = ['mocha'];
  const client = {
    mocha: {
      timeout: 10000, // 10 sec
      reporter: 'html'
      //delay: true
    }
  };

  // main bundle preprocessors
  const preprocessors = [];
  preprocessors.push(bundler);
  preprocessors.push('sourcemap');

  return config.set({
    frameworks,
    files,
    reporters,
    basePath: '',
    port: 9876,
    colors: true,
    browsers,
    client,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR ||
    //   config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    singleRun: true,

    // enable / disable watching file and executing test whenever any
    // file changes
    autoWatch: false,

    // preprocess matching files before serving them to the browser
    // available preprocessors:
    // https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      '*.spec.js': preprocessors,
    },

    webpack: {
      devtool: 'inline-source-map',
      mode: 'development',
    }
  });
};
