@studyportals/bob-manifest-generator
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
{ | ||
"name": "@studyportals/bob-manifest-generator", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "A Webpack plugin that generates a manifest file for your microservice.", | ||
@@ -5,0 +5,0 @@ "main": "src/main.js", |
@@ -28,4 +28,5 @@ const path = require('path'); | ||
const assets = compilation.getAssets(); | ||
this.validateOptions(compilation); | ||
this.gatherAssets(compilation.assets, compilation.chunks); | ||
this.gatherAssets(assets, compilation.chunks); | ||
this.emitManifest(compilation); | ||
@@ -116,26 +117,30 @@ | ||
chunks.forEach(chunk => { | ||
if(chunk.entryModule) return; | ||
chunk.files.forEach(file => { | ||
if (this.isFileMainChunk(file)) { | ||
return; | ||
} | ||
chunk.files.forEach(file => chunkFiles.push(file)); | ||
}) | ||
chunkFiles.push(file); | ||
}); | ||
}); | ||
for(let file in files) { | ||
files.forEach(file => { | ||
if (chunkFiles.includes(file.name)) { | ||
return; | ||
} | ||
// Skip files that belong to dynamically imported chunks | ||
if(chunkFiles.includes(file)) { continue; } | ||
if(this.shouldProcessExtension(file, 'js')) { | ||
if (this.shouldProcessExtension(file.name, 'js')) { | ||
this.manifest.assets.js.push({ | ||
url: this.baseURL + '/' + file, | ||
async: this.matchFile(file, this.async) | ||
url: this.baseURL + '/' + file.name, | ||
async: this.matchFile(file.name, this.async) | ||
}); | ||
} | ||
if(this.shouldProcessExtension(file, 'css')) { | ||
if (this.shouldProcessExtension(file.name, 'css')) { | ||
this.manifest.assets.css.push({ | ||
url: this.baseURL + '/' + file, | ||
defer: this.matchFile(file, this.defer) | ||
url: this.baseURL + '/' + file.name, | ||
defer: this.matchFile(file.name, this.defer) | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -163,3 +168,3 @@ | ||
fileType(file) { | ||
const parts = file.split('.'); | ||
@@ -171,5 +176,12 @@ const extension = parts[parts.length - 1]; | ||
isFileMainChunk(file) { | ||
const parts = file.split('.'); | ||
const firstPartAsNumber = parseInt(parts[0]); | ||
return isNaN(firstPartAsNumber); | ||
} | ||
matchFile(file, namesToMatch) { | ||
if(namesToMatch === true) return true; | ||
if (namesToMatch === true) return true; | ||
@@ -182,4 +194,3 @@ let matched = false; | ||
if(filename === name | ||
|| file === name) { | ||
if (filename === name || file === name) { | ||
@@ -186,0 +197,0 @@ matched = true; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16815
278
0