From a5756b25b50bdcbc41d4267a4f7e2c28f0fa3e92 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 18:59:39 -0500 Subject: [PATCH 1/9] Start 0.5.0. --- bower.json | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 8d5921db..04be6cc1 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,5 @@ { "name": "jsonld", - "version": "0.4.12-dev", "description": "A JSON-LD Processor and API implementation in JavaScript.", "authors": [ "Digital Bazaar, Inc." diff --git a/package.json b/package.json index b351e4b7..f5ee3db7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsonld", - "version": "0.4.12-dev", + "version": "0.5.0-dev", "description": "A JSON-LD Processor and API implementation in JavaScript.", "homepage": "http://github.com/digitalbazaar/jsonld.js", "author": { From 21a8608ea4a340a9f9daaffdf5b7d73e55a492cc Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 19:06:21 -0500 Subject: [PATCH 2/9] Remove CHANGELOG links. - Links are too difficult to maintain by hand. --- CHANGELOG.md | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a6af6bc..8d6f5526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,33 @@ # jsonld ChangeLog -## [Unreleased] +## Unreleased -## [0.4.11] - 2016-04-24 +## 0.4.11 - 2016-04-24 ### Changed - Add optimization for finding best CURIE matches. -## [0.4.10] - 2016-04-24 +## 0.4.10 - 2016-04-24 ### Changed - Add optimization for compacting keywords. -## [0.4.9] - 2016-04-23 +## 0.4.9 - 2016-04-23 ### Changed -- Add optimizations for _compactIri. +- Add optimizations for \_compactIri. -## [0.4.8] - 2016-04-14 +## 0.4.8 - 2016-04-14 ### Fixed - Revert es6-promise dependency to 2.x to avoid auto-polyfill behavior. -## [0.4.7] - 2016-04-14 +## 0.4.7 - 2016-04-14 ### Fixed - Testing document loader. -## [0.4.6] - 2016-03-02 +## 0.4.6 - 2016-03-02 ### Added - Add `headers` and `request` option for node doc loader. @@ -35,24 +35,24 @@ ### Changed - Include local tests. -## [0.4.5] - 2016-01-19 +## 0.4.5 - 2016-01-19 ### Fixed - N-Quads comments pattern. - Local tests. -## [0.4.4] - 2016-01-08 +## 0.4.4 - 2016-01-08 ### Fixed - Document cache in default node document loader is broken; disable until HTTP caching is implemented. -## [0.4.3] - 2016-01-05 +## 0.4.3 - 2016-01-05 ### Fixed - N-Quads may contain comments. -## [0.4.2] - 2015-10-12 +## 0.4.2 - 2015-10-12 ### Added - Add inputFormat and algorithm options to normalize. @@ -65,12 +65,12 @@ ### Fixed - Ignore null values in language maps. -## [0.4.1] - 2015-09-12 +## 0.4.1 - 2015-09-12 ### Changed - Ignore jsonld-request and pkginfo for browserify. -## [0.4.0] - 2015-09-12 +## 0.4.0 - 2015-09-12 ### Breaking Changes - "request" extension moved to [jsonld-request][]. This was done to simplify @@ -82,7 +82,7 @@ core JSON-LD processing library and because it uses the [jsonld-request][] module. -## [0.3.26] - 2015-09-01 +## 0.3.26 - 2015-09-01 ## Before 0.3.26 @@ -90,18 +90,3 @@ [jsonld-cli]: https://github.com/digitalbazaar/jsonld-cli [jsonld-request]: https://github.com/digitalbazaar/jsonld-request - -[Unreleased]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.11...HEAD -[0.4.11]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.10...0.4.11 -[0.4.10]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.9...0.4.10 -[0.4.9]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.8...0.4.9 -[0.4.8]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.7...0.4.8 -[0.4.7]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.6...0.4.7 -[0.4.6]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.5...0.4.6 -[0.4.5]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.4...0.4.5 -[0.4.4]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.3...0.4.4 -[0.4.3]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.2...0.4.3 -[0.4.2]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.1...0.4.2 -[0.4.1]: https://github.com/digitalbazaar/jsonld.js/compare/0.4.0...0.4.1 -[0.4.0]: https://github.com/digitalbazaar/jsonld.js/compare/0.3.26...0.4.0 -[0.3.26]: https://github.com/digitalbazaar/jsonld.js/compare/0.3.25...0.3.26 From fbe9cf298f42ab38b0d0363c018c04f73ed4c916 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 19:07:13 -0500 Subject: [PATCH 3/9] Add .editorconfig support. --- .editorconfig | 17 +++++++++++++++++ CHANGELOG.md | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..1625e63a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{js,json,jsonld,yaml,yml}] +indent_style = space +indent_size = 2 + +[*.idl] +indent_style = space +indent_size = 4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6f5526..cdc788ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Added +- Add .editorconfig support. + ## 0.4.11 - 2016-04-24 ### Changed From 3b4345a646e396bb701028696398ab0a8a722cbe Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 19:13:18 -0500 Subject: [PATCH 4/9] Move js/jsonld.js to lib/jsonld.js. --- CHANGELOG.md | 3 +++ README.md | 2 +- bower.json | 2 +- {js => lib}/jsonld.js | 0 package.json | 6 +++--- test/node-document-loader-tests.js | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) rename {js => lib}/jsonld.js (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc788ba..8d96333f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Changed +- Move `js/jsonld.js` to `lib/jsonld.js`. + ### Added - Add .editorconfig support. diff --git a/README.md b/README.md index d006be32..1afa482d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ bower install jsonld ```js require.config({ paths: { - jsonld: 'bower_components/jsonld/js/jsonld' + jsonld: 'bower_components/jsonld/lib/jsonld' } }); define(['jsonld'], function(jsonld) { ... }); diff --git a/bower.json b/bower.json index 04be6cc1..095a86de 100644 --- a/bower.json +++ b/bower.json @@ -5,7 +5,7 @@ "Digital Bazaar, Inc." ], "license": "BSD", - "main": ["js/jsonld.js"], + "main": ["lib/jsonld.js"], "dependencies": { "es6-promise": "^2.0.0" }, diff --git a/js/jsonld.js b/lib/jsonld.js similarity index 100% rename from js/jsonld.js rename to lib/jsonld.js diff --git a/package.json b/package.json index f5ee3db7..fbef7d52 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "email": "support@digitalbazaar.com" }, "license": "BSD-3-Clause", - "main": "js/jsonld.js", + "main": "lib/jsonld.js", "dependencies": { "es6-promise": "^2.0.0", "pkginfo": "~0.4.0", @@ -59,8 +59,8 @@ "test-browser": "make test-browser", "test": "make test", "coverage": "make test-coverage", - "jscs": "jscs js/jsonld.js tests/*.js", - "jshint": "jshint js/jsonld.js tests/*.js" + "jscs": "jscs lib/jsonld.js tests/*.js", + "jshint": "jshint lib/jsonld.js tests/*.js" }, "browser": { "crypto": "./browser/ignore.js", diff --git a/test/node-document-loader-tests.js b/test/node-document-loader-tests.js index 41ff114e..3d0f7794 100644 --- a/test/node-document-loader-tests.js +++ b/test/node-document-loader-tests.js @@ -3,7 +3,7 @@ * * @author goofballLogic */ -var jsonld = require('../js/jsonld'); +var jsonld = require('..'); var assert = require('assert'); describe('For the node.js document loader', function() { From d6621a91b22cafdcaece6890b1f4c62d97a6ca21 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 19:14:56 -0500 Subject: [PATCH 5/9] Cleanup packaging files. --- bower.json | 17 +++++++++++++++-- package.json | 6 ++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 095a86de..cc5cff29 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,23 @@ { "name": "jsonld", "description": "A JSON-LD Processor and API implementation in JavaScript.", + "keywords": [ + "JSON", + "Linked Data", + "JSON-LD", + "RDF", + "Semantic Web", + "jsonld" + ], "authors": [ - "Digital Bazaar, Inc." + "Digital Bazaar, Inc. (http://digitalbazaar.com/)" ], - "license": "BSD", + "license": "BSD-3-Clause", + "homepage": "http://github.com/digitalbazaar/jsonld.js", + "repository": { + "type": "git", + "url": "http://github.com/digitalbazaar/jsonld.js" + }, "main": ["lib/jsonld.js"], "dependencies": { "es6-promise": "^2.0.0" diff --git a/package.json b/package.json index fbef7d52..25e3cfd6 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,8 @@ "url": "http://digitalbazaar.com/" }, "contributors": [ - { - "name": "Dave Longley", - "email": "dlongley@digitalbazaar.com" - } + "Dave Longley ", + "David I. Lehn " ], "repository": { "type": "git", From 710e477c86603eb19d2ba577d3e6bcb0e39602d7 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 19:20:53 -0500 Subject: [PATCH 6/9] Update .gitignore. --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aebca541..40233fb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,16 @@ -*.sw[op] +*.sw[nop] *~ +.bower.json +.cdtproject +.classpath .cproject .project *.sublime-project *.sublime-workspace .DS_Store .settings +TAGS coverage +dist node_modules v8.log From 8ab7afb95ee8e33ab7c281c41492752c43f65601 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 6 Jan 2017 21:07:05 -0500 Subject: [PATCH 7/9] Small testing updates. --- Makefile | 14 +++++++++++--- package.json | 2 +- test/node-document-loader-tests.js | 7 +++++-- tests/test.js | 6 +++--- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0c5cd9ae..44047b48 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ TESTS = tests/test.js +LOCAL_TESTS = test/*.js REPORTER = spec all: @@ -13,7 +14,7 @@ test-suite-node: exit 1; \ fi @if [ -d $(JSONLD_TEST_SUITE) ]; then \ - NODE_ENV=test ./node_modules/.bin/mocha -A -R $(REPORTER) $(TESTS); \ + NODE_ENV=test ./node_modules/.bin/mocha -t 30000 -A -R $(REPORTER) $(TESTS); \ else \ echo "Error: tests not found at $(JSONLD_TEST_SUITE)"; \ exit 1; \ @@ -51,10 +52,17 @@ test-normalization-browser: test-coverage: ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ - -u exports -R $(REPORTER) $(TESTS) + -t 30000 -u exports -R $(REPORTER) $(TESTS) + +test-coverage-lcov: + ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha \ + --report lcovonly -- -t 30000 -u exports -R $(REPORTER) $(TESTS) + +test-coverage-report: + ./node_modules/.bin/istanbul report test-local: - ./node_modules/.bin/mocha + ./node_modules/.bin/mocha -t 30000 -R $(REPORTER) $(LOCAL_TESTS) clean: rm -rf coverage diff --git a/package.json b/package.json index 25e3cfd6..14ee650b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "xmldom": "0.1.19" }, "devDependencies": { - "chai": "^3.4.1", "commander": "^2.8.0", "cors": "^2.7.1", "express": "^4.13.3", @@ -57,6 +56,7 @@ "test-browser": "make test-browser", "test": "make test", "coverage": "make test-coverage", + "coverage-report": "make test-coverage-report", "jscs": "jscs lib/jsonld.js tests/*.js", "jshint": "jshint lib/jsonld.js tests/*.js" }, diff --git a/test/node-document-loader-tests.js b/test/node-document-loader-tests.js index 3d0f7794..acb3ccf0 100644 --- a/test/node-document-loader-tests.js +++ b/test/node-document-loader-tests.js @@ -16,9 +16,12 @@ describe('For the node.js document loader', function() { describe('When built with no options specified', function() { var options = {}; - it('loading should work', function(callback) { + it('loading should work', function(done) { jsonld.useDocumentLoader(documentLoaderType); - jsonld.expand('http://schema.org/', callback); + jsonld.expand('http://schema.org/', function(err, expanded) { + assert.ifError(err); + done(); + }); }); }); diff --git a/tests/test.js b/tests/test.js index 6dc999a8..50bd15d4 100644 --- a/tests/test.js +++ b/tests/test.js @@ -14,7 +14,7 @@ var _nodejs = (typeof process !== 'undefined' && process.versions && process.versions.node); if(_nodejs) { - var _jsdir = getEnv().JSDIR || 'js'; + var _jsdir = getEnv().JSDIR || 'lib'; var fs = require('fs'); var path = require('path'); var jsonld = require('../' + _jsdir + '/jsonld')(); @@ -60,11 +60,11 @@ if(_nodejs) { var fs = require('fs'); var system = require('system'); require('./setImmediate'); - var _jsdir = getEnv().JSDIR || 'js'; + var _jsdir = getEnv().JSDIR || 'lib'; require('../' + _jsdir + '/jsonld'); jsonld = jsonldjs; window.Promise = require('es6-promise').Promise; - var assert = require('chai').assert; + var assert = require('assert'); require('mocha/mocha'); require('mocha-phantomjs/lib/mocha-phantomjs/core_extensions'); var program = {}; From c4d2979f512ee92f2cb2816ed6578e7cc8b85c94 Mon Sep 17 00:00:00 2001 From: Aria Stewart Date: Fri, 5 May 2017 22:04:19 -0400 Subject: [PATCH 8/9] Depend on test suite --- Makefile | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 44047b48..ea39c9e5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ TESTS = tests/test.js LOCAL_TESTS = test/*.js REPORTER = spec +JSONLD_TEST_SUITE=node_modules/json-ld-test-suite all: diff --git a/package.json b/package.json index 14ee650b..1c1246e2 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "main": "lib/jsonld.js", "dependencies": { "es6-promise": "^2.0.0", + "json-ld-test-suite": "^1.0.1", "pkginfo": "~0.4.0", "request": "^2.61.0", "xmldom": "0.1.19" From 24cc0da7a17a7d60203adc29916be8ee3dfa9b64 Mon Sep 17 00:00:00 2001 From: Aria Stewart Date: Fri, 5 May 2017 22:27:30 -0400 Subject: [PATCH 9/9] Version 1.1 if specified test, for conformance with tp003 and tp006 --- lib/jsonld.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jsonld.js b/lib/jsonld.js index 70758dbc..8f49e90e 100644 --- a/lib/jsonld.js +++ b/lib/jsonld.js @@ -5731,6 +5731,15 @@ function _createTermDefinition(activeCtx, localCtx, term, defined) { {code: 'keyword redefinition', context: localCtx, term: term}); } + if(term === '@version') { + if(value !== 1.1) { + throw new JsonLdError( + 'Invalid JSON-LD syntax; version must be 1.1 if specified', + 'jsonld.SyntaxError', + {code: 'invalid @version value', context: localCtx}); + } + } + if(term === '') { throw new JsonLdError( 'Invalid JSON-LD syntax; a term cannot be an empty string.',