Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions .github/workflows/main.yml → .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
name: Node.js CI
name: Main CI

on: [push]
on:
push:
branches:
- 'main'
pull_request:
branches:
- '**'

permissions: {}

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [18.x]
node-version: [24.x]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand All @@ -23,11 +33,13 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x, 22.x]
node-version: [18.x, 20.x, 22.x, 24.x]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install
Expand All @@ -41,12 +53,14 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [16.x]
node-version: [24.x]
bundler: [webpack, browserify]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install
Expand All @@ -62,11 +76,13 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [16.x]
node-version: [24.x]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand All @@ -78,11 +94,13 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [18.x]
node-version: [24.x]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install
Expand All @@ -92,7 +110,7 @@ jobs:
- name: Generate coverage report
run: npm run coverage-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: ./coverage/lcov.info
fail_ci_if_error: true
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# jsonld ChangeLog

## 9.0.0 - 2025-xx-xx

### Changed
- **BREAKING**: Drop support for Node.js < 18.
- **BREAKING**: Upgrade dependencies.
- `@digitalbazaar/http-client@4`.
- `canonicalize@2`.
- `rdf-canonize@5`: See the [rdf-canonize][] 4.x and 5.x changelog for
**important** changes and upgrade notes. Of note:
- The `URDNA2015` default algorithm has been changed to `RDFC-1.0` from
[rdf-canon][].
- Complexity control defaults `maxWorkFactor` or `maxDeepIterations` may
need to be adjusted to process graphs with certain blank node constructs.
- A `signal` option is available to use an `AbortSignal` to limit resource
usage.
- The internal digest algorithm can be changed.
- Support for [rdf-canonize-native][] was removed.
- **BREAKING**: Only the JavaScript implementation of [rdf-canon][] from
[rdf-canonize][] is supported. The API here can be updated to allow
implementation switching if support for native or other [rdf-canon][]
implementations is needed.
- Update development dependencies.
- Update karma testing.
- Remove older fixes in favor of more default behavior.
- Update bundle build.
- Use newer corejs version.
- Build with modern browserslist defaults and no IE support.
- Support for older browsers requires a custom build.
- Refactor test framework.
- Test runtime loads test files from a web server.
- Allows testing of manifests on remote web servers.
- Trading off some performance to align node and browser testing.
- Moves some test setup code into config data and manifest.

### Removed
- **BREAKING**: Remove `application/nquads` alias for `application/n-quads`.

## 8.3.3 - 2024-12-21

### Added
Expand Down
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jsonld.js
=========

[![Build status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/jsonld.js/main.yml)](https://github.com/digitalbazaar/jsonld.js/actions/workflows/main.yml)
[![Build status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/jsonld.js/main.yaml)](https://github.com/digitalbazaar/jsonld.js/actions/workflows/main.yaml)
[![Coverage status](https://img.shields.io/codecov/c/github/digitalbazaar/jsonld.js)](https://codecov.io/gh/digitalbazaar/jsonld.js)
[![npm](https://img.shields.io/npm/v/jsonld)](https://npm.im/jsonld)

Expand Down Expand Up @@ -175,20 +175,6 @@ import {promises} from 'jsonld';
import {JsonLdProcessor} from 'jsonld';
```

### Node.js native canonize bindings

For specialized use cases there is an optional [rdf-canonize-native][] package
available which provides a native implementation for `canonize()`. It is used
by installing the package and setting the `useNative` option of `canonize()` to
`true`. Before using this mode it is **highly recommended** to run benchmarks
since the JavaScript implementation is often faster and the bindings add
toolchain complexity.

```
npm install jsonld
npm install rdf-canonize-native
```

Examples
--------

Expand Down Expand Up @@ -519,7 +505,6 @@ Commercial support for this library is available upon request from
[jsonld-cli]: https://github.com/digitalbazaar/jsonld-cli
[jsonld-request]: https://github.com/digitalbazaar/jsonld-request
[rdf]: https://rubygems.org/gems/rdf
[rdf-canonize-native]: https://github.com/digitalbazaar/rdf-canonize-native
[test runner]: https://github.com/digitalbazaar/jsonld.js/blob/master/tests/test-common.js
[test suite]: https://github.com/json-ld/json-ld.org/tree/master/test-suite
[webpack]: https://webpack.js.org/
104 changes: 60 additions & 44 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,40 @@
*/
const os = require('os');
const webpack = require('webpack');
const {TestServer} = require('./tests/test-server.js');

// karma test server proxy details
const _proxyTestsPrefix = '/tests';

let testServer;

// shutdown test server "reporter" hook
function ShutdownTestServer(baseReporterDecorator) {
baseReporterDecorator(this);

this.onRunComplete = async function() {
await testServer.close();
};
}

// Inject the base reporter
ShutdownTestServer.$inject = ['baseReporterDecorator', 'config'];

// local "reporter" plugin
const shutdownTestServer = {
'reporter:shutdown-test-server': ['type', ShutdownTestServer]
};

module.exports = async function(config) {
testServer = new TestServer({
earlFilename: process.env.EARL
});
await testServer.start();

module.exports = function(config) {
// bundler to test: webpack, browserify
const bundler = process.env.BUNDLER || 'webpack';

const frameworks = ['mocha', 'server-side'];
const frameworks = ['mocha'];
// main bundle preprocessors
const preprocessors = ['babel'];

Expand Down Expand Up @@ -66,7 +94,8 @@ module.exports = function(config) {
'process.env.EARL': JSON.stringify(process.env.EARL),
'process.env.TESTS': JSON.stringify(process.env.TESTS),
'process.env.TEST_ENV': JSON.stringify(process.env.TEST_ENV),
'process.env.TEST_ROOT_DIR': JSON.stringify(__dirname),
'process.env.TEST_SERVER_URL': JSON.stringify(_proxyTestsPrefix),
'process.env.AUTH_TOKEN': JSON.stringify(testServer.authToken),
'process.env.VERBOSE_SKIP': JSON.stringify(process.env.VERBOSE_SKIP),
// for 'auto' test env
'process.env._TEST_ENV_ARCH': JSON.stringify(process.arch),
Expand All @@ -81,18 +110,11 @@ module.exports = function(config) {
rules: [
{
test: /\.js$/,
include: [{
// exclude node_modules by default
exclude: /(node_modules)/
}, {
// include specific packages
include: [
/(node_modules\/canonicalize)/,
/(node_modules\/lru-cache)/,
/(node_modules\/rdf-canonize)/,
/(node_modules\/yallist)/
]
}],
// avoid processing core-js
include: {
and: [/node_modules/],
not: [/core-js/]
},
use: {
loader: 'babel-loader',
options: {
Expand All @@ -101,38 +123,31 @@ module.exports = function(config) {
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: '3.9',
corejs: '3.47',
bugfixes: true,
//debug: true,
targets: {
// test with slightly looser browserslist defaults
browsers: 'defaults, > 0.25%'
browsers: 'defaults, > 0.25%, not IE 11'
}
}
]
],
plugins: [
[
'@babel/plugin-proposal-object-rest-spread',
{useBuiltIns: true}
],
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-transform-runtime'
]
}
}
}
],
noParse: [
// avoid munging internal benchmark script magic
/benchmark/
]
//noParse: [
// // avoid munging internal benchmark script magic
// /benchmark/
//]
},
node: {
Buffer: false,
process: false,
crypto: false,
setImmediate: false
output: {
globalObject: 'this'
}
},

Expand All @@ -147,7 +162,8 @@ module.exports = function(config) {
EARL: process.env.EARL,
TESTS: process.env.TESTS,
TEST_ENV: process.env.TEST_ENV,
TEST_ROOT_DIR: __dirname,
TEST_SERVER_URL: _proxyTestsPrefix,
AUTH_TOKEN: testServer.authToken,
VERBOSE_SKIP: process.env.VERBOSE_SKIP,
// for 'auto' test env
_TEST_ENV_ARCH: process.arch,
Expand All @@ -165,11 +181,20 @@ module.exports = function(config) {
]
},

// local server shutdown plugin
plugins: [
'karma-*',
shutdownTestServer
],

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
//reporters: ['progress'],
reporters: ['mocha'],
reporters: [
'mocha',
'shutdown-test-server'
],

// web server port
port: 9876,
Expand All @@ -192,17 +217,6 @@ module.exports = function(config) {
//browsers: ['ChromeHeadless', 'Chrome', 'Firefox', 'Safari'],
browsers: ['ChromeHeadless'],

customLaunchers: {
IE9: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE9'
},
IE8: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE8'
}
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
Expand All @@ -222,6 +236,8 @@ module.exports = function(config) {
},

// Proxied paths
proxies: {}
proxies: {
'/tests': testServer.url
}
});
};
Loading
Loading