🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

json-schema-loader

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-loader - npm Package Compare versions

Comparing version

to
1.0.0

yarn.lock

7

lib/loader.js

@@ -0,1 +1,2 @@

var loaderUtils = require('loader-utils');
var _ = require('lodash');

@@ -5,2 +6,4 @@ var RefParser = require('json-schema-ref-parser');

module.exports = function(source) {
var query = loaderUtils.parseQuery(this.query);
var callback = this.async();

@@ -10,3 +13,3 @@ var parser = new RefParser();

parser.dereference(this.resourcePath)
parser.dereference(query.useSource ? JSON.parse(source) : this.resourcePath)
.then(handleResolveSuccess.bind(this))

@@ -19,4 +22,4 @@ .catch(callback);

_.map(parser.$refs.paths(), this.addDependency);
callback(null, 'module.exports = ' + json + ';');
callback(null, 'module.exports = ' + json + ';', schema);
}
}
{
"name": "json-schema-loader",
"version": "0.0.3",
"version": "1.0.0",
"description": "Webpack loader that resolves Json Schema references.",

@@ -14,5 +14,6 @@ "license": "BSD-3-Clause",

"dependencies": {
"lodash": "^4.10.0",
"json-schema-ref-parser": "^3.0.2"
"json-schema-ref-parser": "^3.0.2",
"loader-utils": "^0.2.16",
"lodash": "^4.10.0"
}
}
# Json Schema Loader
This package is part of the [doca](https://github.com/cloudflare/doca) suite. Please file any issues at the [doca repository](https://github.com/cloudflare/doca/issues)
## Installation

@@ -33,1 +35,7 @@

```
### Options
#### `useSource: boolean`
This loader normally passes the RefParser the `resourcePath`, not the source. If you want to chain loaders, make sure to set `useSource=true`.