ng-cache-loader
Advanced tools
Comparing version 0.0.23 to 0.0.24
29
index.js
@@ -59,3 +59,3 @@ /* | ||
}; | ||
var minimizeOpts = this.query.match(/&?minimizeOptions[\s\n]*=[\s\n]*([^&]*)/); | ||
var minimizeOpts; | ||
var moduleId = 'ng'; | ||
@@ -71,14 +71,23 @@ var result = []; | ||
// Remove minimizeOptions from query string because JSON is not suitable for query parameter | ||
if (minimizeOpts) { | ||
this.query = this.query.replace(minimizeOpts[0], ''); | ||
// webpack1 or webpack2 with legacy query format | ||
if (typeof this.query === 'string') { | ||
// minimizeOpts is JSON inside query string | ||
minimizeOpts = this.query.match(/&?minimizeOptions[\s\n]*=[\s\n]*([^&]*)/); | ||
if (minimizeOpts) { | ||
this.query = this.query.replace(minimizeOpts[0], ''); | ||
} | ||
try { | ||
minimizeOpts = minimizeOpts && JSON.parse(minimizeOpts[1]); | ||
} catch (e) { | ||
throw new Error('Invalid value of query parameter minimizeOptions'); | ||
} | ||
} | ||
try { | ||
minimizeOpts = minimizeOpts && JSON.parse(minimizeOpts[1]); | ||
} catch (e) { | ||
throw new Error('Invalid value of query parameter minimizeOptions'); | ||
} | ||
// Parse query and append minimize options | ||
extend(opts, minimizeOpts, loaderUtils.parseQuery(this.query)); | ||
var options = loaderUtils.getOptions ? | ||
loaderUtils.getOptions(this) : | ||
loaderUtils.parseQuery(this.query); | ||
extend(opts, minimizeOpts, options); | ||
@@ -85,0 +94,0 @@ if (opts.minimize) { |
@@ -17,3 +17,5 @@ /* | ||
var query = loaderUtils.parseQuery(this.query); | ||
var query = loaderUtils.getOptions ? | ||
loaderUtils.getOptions(this) : | ||
loaderUtils.parseQuery(this.query); | ||
var moduleId = query.module || defaultName; | ||
@@ -20,0 +22,0 @@ var newTemplateId = templateId; |
@@ -68,3 +68,5 @@ /* | ||
var query = loaderUtils.parseQuery(this.query); | ||
var query = loaderUtils.getOptions ? | ||
loaderUtils.getOptions(this) : | ||
loaderUtils.parseQuery(this.query); | ||
var pref = query.prefix || ''; | ||
@@ -71,0 +73,0 @@ var path = this.resource; |
{ | ||
"name": "ng-cache-loader", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"description": "Puts HTML partials in the Angular's $templateCache.", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"mocha": "^2.3.0", | ||
"webpack": "^1.4.3" | ||
"webpack": "^2.4.1" | ||
}, | ||
@@ -34,3 +34,3 @@ "dependencies": { | ||
"html-minifier": "^3.0.2", | ||
"loader-utils": "^0.2.4" | ||
"loader-utils": "^1.1.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "directories": { |
@@ -31,5 +31,5 @@ /** | ||
if (prefix !== undefined) { | ||
params.query = '?prefix=' + prefix; | ||
} | ||
params.query = prefix !== undefined ? | ||
'?prefix=' + prefix : | ||
'?'; | ||
return lib.call(params); | ||
@@ -36,0 +36,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
var path = require('path'); | ||
var minimizeOptions = JSON.stringify({ | ||
@@ -12,5 +14,6 @@ removeComments: true, | ||
module.exports = { | ||
entry: './test/entry.js', | ||
context: __dirname, | ||
entry: path.resolve(__dirname, 'entry.js'), | ||
output: { | ||
path: './test/out', | ||
path: path.resolve(__dirname, 'out'), | ||
filename: '[name].out.js', | ||
@@ -17,0 +20,0 @@ }, |
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
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
43736
16
897
+ Addedbig.js@5.2.2(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedminimist@1.2.8(transitive)
- Removedbig.js@3.2.0(transitive)
- Removedemojis-list@2.1.0(transitive)
- Removedjson5@0.5.1(transitive)
- Removedloader-utils@0.2.17(transitive)
- Removedobject-assign@4.1.1(transitive)
Updatedloader-utils@^1.1.0