@studyportals/bob-manifest-generator
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
{ | ||
"name": "@studyportals/bob-manifest-generator", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "A Webpack plugin that generates a manifest file for your microservice.", | ||
@@ -5,0 +5,0 @@ "main": "src/main.js", |
const fs = require('fs'); | ||
const GenericManifestGenerator = require("./generic-manifest-generator"); | ||
@@ -20,7 +21,8 @@ class DllManifestGenerator { | ||
const compilationHook = (compilation, callback) => { | ||
this.gatherPackageInfo(compilation); | ||
this.gatherAssets(compilation.assets); | ||
this.emitManifest(compilation); | ||
const assets = compilation.getAssets(); | ||
this.gatherPackageInfo(assets); | ||
this.gatherAssets(assets); | ||
GenericManifestGenerator.emitFile(assets, 'manifest.json', this.manifest); | ||
callback(); | ||
@@ -45,3 +47,3 @@ }; | ||
gatherPackageInfo(compilation) { | ||
gatherPackageInfo(assets) { | ||
@@ -68,4 +70,4 @@ let packageFile; | ||
this.emitStylesheet(compilation, packageFile.style); | ||
this.emitSourcemap(compilation, packageFile.style); | ||
this.emitStylesheet(assets, packageFile.style); | ||
this.emitSourcemap(assets, packageFile.style); | ||
@@ -79,29 +81,16 @@ this.manifest.assets.css.push({ | ||
gatherAssets(files) { | ||
for(let file in files) { | ||
if(this.shouldProcessExtension(file, 'js')) { | ||
this.manifest.assets.js.push({ | ||
url: file.replace(".min", "") | ||
}); | ||
files.forEach(file => { | ||
if (!this.shouldProcessExtension(file.name, 'js')) { | ||
return; | ||
} | ||
} | ||
this.manifest.assets.js.push({ | ||
url: file.name.replace(".min", "") | ||
}); | ||
}); | ||
} | ||
emitManifest(compilation) { | ||
emitStylesheet(assets, file) { | ||
compilation.assets['manifest.json'] = { | ||
source: () => { | ||
return JSON.stringify(this.manifest); | ||
}, | ||
size: () => { | ||
return JSON.stringify(this.manifest).length; | ||
} | ||
} | ||
} | ||
emitStylesheet(compilation, file) { | ||
try { | ||
@@ -114,12 +103,3 @@ | ||
compilation.assets[file] = { | ||
source: () => { | ||
return stylesheet.toString(); | ||
}, | ||
size: () => { | ||
return stylesheet.toString().length; | ||
} | ||
} | ||
GenericManifestGenerator.emitFile(assets, file, stylesheet); | ||
} catch(e) { | ||
@@ -131,3 +111,3 @@ | ||
emitSourcemap(compilation, file) { | ||
emitSourcemap(assets, file) { | ||
@@ -141,12 +121,3 @@ try { | ||
compilation.assets[file + ".map"] = { | ||
source: () => { | ||
return sourcemap.toString(); | ||
}, | ||
size: () => { | ||
return sourcemap.toString().length; | ||
} | ||
} | ||
GenericManifestGenerator.emitFile(assets, file, sourcemap); | ||
} catch(e) { | ||
@@ -153,0 +124,0 @@ |
const path = require('path'); | ||
const fs = require('fs'); | ||
const DllReferencePlugin = require('./dll-reference-plugin'); | ||
const GenericManifestGenerator = require("./generic-manifest-generator"); | ||
@@ -31,3 +32,3 @@ class ManifestGenerator { | ||
this.gatherAssets(assets, compilation.chunks); | ||
this.emitManifest(compilation); | ||
GenericManifestGenerator.emitFile(assets, 'manifest.json', this.manifest); | ||
@@ -133,3 +134,3 @@ callback(); | ||
this.manifest.assets.js.push({ | ||
url: this.baseURL + '/' + file.name, | ||
url: `${this.baseURL}/${file.name}`, | ||
async: this.matchFile(file.name, this.async) | ||
@@ -141,3 +142,3 @@ }); | ||
this.manifest.assets.css.push({ | ||
url: this.baseURL + '/' + file.name, | ||
url: `${this.baseURL}/${file.name}`, | ||
defer: this.matchFile(file.name, this.defer) | ||
@@ -154,16 +155,2 @@ }); | ||
emitManifest(compilation) { | ||
compilation.assets['manifest.json'] = { | ||
source: () => { | ||
return JSON.stringify(this.manifest); | ||
}, | ||
size: () => { | ||
return JSON.stringify(this.manifest).length; | ||
} | ||
} | ||
} | ||
fileType(file) { | ||
@@ -170,0 +157,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
14822
7
263