path-loader
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
export function load(location: string, options?: LoadOptions): Promise<any>; | ||
export function load(location: string, options?: module:path-loader.LoadOptions): Promise<any>; | ||
@@ -29,7 +29,7 @@ /** | ||
*/ | ||
prepareRequest?: PrepareRequestCallback; | ||
prepareRequest?: module:path-loader.PrepareRequestCallback; | ||
/** | ||
* The callback used to process the response | ||
*/ | ||
processContent?: ProcessResponseCallback; | ||
processContent?: module:path-loader.ProcessResponseCallback; | ||
} | ||
@@ -36,0 +36,0 @@ |
11
index.js
@@ -75,3 +75,3 @@ /* | ||
* @param {string} location - The location to the document | ||
* @param {module:path-loader~LoadOptions} [options] - The loader options | ||
* @param {module:path-loader.LoadOptions} [options] - The loader options | ||
* | ||
@@ -181,3 +181,10 @@ * @returns {Promise<*>} Always returns a promise even if there is a callback provided | ||
// string value being processed. | ||
options.processContent(typeof res === 'object' ? res : {text: res}, function (err, processed) { | ||
if (typeof res !== 'object') { | ||
res = {text: res}; | ||
} | ||
// Pass the path being loaded | ||
res.location = location; | ||
options.processContent(res, function (err, processed) { | ||
if (err) { | ||
@@ -184,0 +191,0 @@ reject(err); |
@@ -12,4 +12,4 @@ /** | ||
* @property {string} [method=get] - The HTTP method to use for the request *(HTTP loader only)* | ||
* @property {module:path-loader~PrepareRequestCallback} [prepareRequest] - The callback used to prepare the request *(HTTP loader only)* | ||
* @property {module:path-loader~ProcessResponseCallback} [processContent] - The callback used to process the response | ||
* @property {module:path-loader.PrepareRequestCallback} [prepareRequest] - The callback used to prepare the request *(HTTP loader only)* | ||
* @property {module:path-loader.ProcessResponseCallback} [processContent] - The callback used to process the response | ||
* | ||
@@ -38,3 +38,3 @@ * @memberof module:path-loader | ||
* object in that it will have a `text` property whose value is the raw string value being processed. This was done | ||
* for consistency.)* | ||
* for consistency. There will also be a `location` property containing the location of the path being loaded.)* | ||
* @param {function} callback - Error-first callback | ||
@@ -41,0 +41,0 @@ * |
{ | ||
"name": "path-loader", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Utility that provides a single API for loading the content of a path/URL.", | ||
@@ -18,6 +18,6 @@ "main": "index.js", | ||
"files": [ | ||
"dist", | ||
"index.d.ts", | ||
"index.js", | ||
"lib/**/*.js", | ||
"LICENSE" | ||
"lib/**/*.js" | ||
], | ||
@@ -38,5 +38,6 @@ "homepage": "https://github.com/whitlockjc/path-loader", | ||
"@otris/jsdoc-tsd": "^1.0.4", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^7.1.5", | ||
"babel-preset-es2015": "^6.24.1", | ||
"basic-auth": "^2.0.0", | ||
"brfs": "~1.4.3", | ||
"browserify": "~14.4.0", | ||
"connect": "^3.6.0", | ||
@@ -53,5 +54,5 @@ "del": "^3.0.0", | ||
"gulp-mocha": "~3.0.1", | ||
"gulp-nsp": "^2.4.2", | ||
"gulp-replace": "^1.0.0", | ||
"gulp-uglify": "^3.0.0", | ||
"jsdoc": "^3.5.5", | ||
"karma": "^1.6.0", | ||
@@ -61,8 +62,7 @@ "karma-mocha": "^1.3.0", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-webpack": "^4.0.0-rc.5", | ||
"mocha": "^4.0.1", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"run-sequence": "^2.2.0", | ||
"uglifyify": "~4.0.4", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "~1.1.0" | ||
"webpack": "^4.26.1" | ||
}, | ||
@@ -69,0 +69,0 @@ "dependencies": { |
@@ -31,17 +31,7 @@ # path-loader | ||
Installation for browser applications can be done via [Bower][bower] or by downloading a standalone binary. | ||
path-loader binaries for the browser are available in the `dist/` directory: | ||
#### Using Bower | ||
* [path-loader.js](https://raw.github.com/whitlockjc/path-loader/master/dist/path-loader.js): _288kb_, full source and source maps | ||
* [path-loader-min.js](https://raw.github.com/whitlockjc/path-loader/master/dist/path-loader-min.js): _32kb_, minified, compressed and no sourcemap | ||
``` | ||
bower install path-loader --save | ||
``` | ||
#### Standalone Binaries | ||
The standalone binaries come in two flavors: | ||
* [path-loader.js](https://raw.github.com/whitlockjc/path-loader/master/browser/path-loader.js): _112kb_, full source and source maps | ||
* [path-loader-min.js](https://raw.github.com/whitlockjc/path-loader/master/browser/path-loader-min.js): _16kb_, minified, compressed and no sourcemap | ||
### Node.js | ||
@@ -59,3 +49,15 @@ | ||
[bower]: http://bower.io/ | ||
[npm]: https://www.npmjs.com/ | ||
The path-loader project's API documentation can be found here: https://github.com/whitlockjc/path-loader/blob/master/docs/API.md | ||
## Dependencies | ||
Below is the list of projects being used by path-loader and the purpose(s) they are used for: | ||
* [native-promise-only][native-promise-only]: Used to shim in [Promises][promises] support | ||
* [superagent][superagent]: AJAX for the browser and Node.js | ||
[native-promise-only]: https://www.npmjs.com/package/native-promise-only | ||
[npm]: https://www.npmjs.org/ | ||
[promises]: https://www.promisejs.org/ | ||
[superagent]: https://github.com/visionmedia/superagent | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
346881
12
3528
62
1