rollup-plugin-webpack-stats
Advanced tools
Comparing version 0.0.4 to 0.1.0
@@ -55,9 +55,13 @@ 'use strict'; | ||
moduleInfo = _ref[1]; | ||
var relativeModulePath = path.relative(process.cwd(), modulePath.replace("\0", '')); | ||
var moduleEntry = moduleByFileName[relativeModulePath]; | ||
// Remove unexpected rollup null prefix | ||
var normalizedModulePath = modulePath.replace("\0", ''); | ||
var relativeModulePath = path.relative(process.cwd(), normalizedModulePath); | ||
// Match webpack output - add current directory prefix for child modules | ||
var relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./) ? relativeModulePath : "." + path.sep + relativeModulePath; | ||
var moduleEntry = moduleByFileName[relativeModulePathWithPrefix]; | ||
if (moduleEntry) { | ||
moduleEntry.chunks.push(chunkId); | ||
} else { | ||
moduleByFileName[relativeModulePath] = { | ||
name: relativeModulePath, | ||
moduleByFileName[relativeModulePathWithPrefix] = { | ||
name: relativeModulePathWithPrefix, | ||
size: options.moduleOriginalSize ? moduleInfo.originalLength : moduleInfo.renderedLength, | ||
@@ -75,3 +79,4 @@ chunks: [chunkId] | ||
}); | ||
var output = { | ||
return { | ||
builtAt: Date.now(), | ||
assets: assets, | ||
@@ -81,3 +86,2 @@ chunks: chunks, | ||
}; | ||
return output; | ||
}; | ||
@@ -84,0 +88,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("path"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var i=function(e){return"string"==typeof e?Buffer.from(e).length:(null==e?void 0:e.length)||0};exports.webpackStats=function(e){return void 0===e&&(e={}),{name:"webpackStats",generateBundle:function(r,a){var s,u=function(e,r){var a=n({moduleOriginalSize:!1},r),s=Object.values(e),u=[],o=[],l={};return s.forEach((function(e){if("chunk"===e.type){u.push({name:e.fileName,size:i(e.code)});var n=e.name;o.push({id:n,entry:e.isEntry,initial:!e.isDynamicEntry,files:[e.fileName],names:[e.name]}),Object.entries(e.modules).forEach((function(e){var i=e[0],r=e[1],s=t.relative(process.cwd(),i.replace("\0","")),u=l[s];u?u.chunks.push(n):l[s]={name:s,size:a.moduleOriginalSize?r.originalLength:r.renderedLength,chunks:[n]}}))}else"asset"===e.type&&u.push({name:e.fileName,size:i(e.source)})})),{assets:u,chunks:o,modules:Object.values(l)}}(a,e);this.emitFile({type:"asset",fileName:(null==(s=e)?void 0:s.fileName)||"webpack-stats.json",source:JSON.stringify(u)})}}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("path"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var i=function(e){return"string"==typeof e?Buffer.from(e).length:(null==e?void 0:e.length)||0};exports.webpackStats=function(e){return void 0===e&&(e={}),{name:"webpackStats",generateBundle:function(a,r){var s,u=function(e,a){var r=n({moduleOriginalSize:!1},a),s=Object.values(e),u=[],o=[],l={};return s.forEach((function(e){if("chunk"===e.type){u.push({name:e.fileName,size:i(e.code)});var n=e.name;o.push({id:n,entry:e.isEntry,initial:!e.isDynamicEntry,files:[e.fileName],names:[e.name]}),Object.entries(e.modules).forEach((function(e){var i=e[1],a=e[0].replace("\0",""),s=t.relative(process.cwd(),a),u=s.match(/^\.\./)?s:"."+t.sep+s,o=l[u];o?o.chunks.push(n):l[u]={name:u,size:r.moduleOriginalSize?i.originalLength:i.renderedLength,chunks:[n]}}))}else"asset"===e.type&&u.push({name:e.fileName,size:i(e.source)})})),{builtAt:Date.now(),assets:u,chunks:o,modules:Object.values(l)}}(r,e);this.emitFile({type:"asset",fileName:(null==(s=e)?void 0:s.fileName)||"webpack-stats.json",source:JSON.stringify(u)})}}}; | ||
//# sourceMappingURL=rollup-plugin-webpack-stats.cjs.production.min.js.map |
@@ -49,9 +49,13 @@ import path from 'path'; | ||
moduleInfo = _ref[1]; | ||
var relativeModulePath = path.relative(process.cwd(), modulePath.replace("\0", '')); | ||
var moduleEntry = moduleByFileName[relativeModulePath]; | ||
// Remove unexpected rollup null prefix | ||
var normalizedModulePath = modulePath.replace("\0", ''); | ||
var relativeModulePath = path.relative(process.cwd(), normalizedModulePath); | ||
// Match webpack output - add current directory prefix for child modules | ||
var relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./) ? relativeModulePath : "." + path.sep + relativeModulePath; | ||
var moduleEntry = moduleByFileName[relativeModulePathWithPrefix]; | ||
if (moduleEntry) { | ||
moduleEntry.chunks.push(chunkId); | ||
} else { | ||
moduleByFileName[relativeModulePath] = { | ||
name: relativeModulePath, | ||
moduleByFileName[relativeModulePathWithPrefix] = { | ||
name: relativeModulePathWithPrefix, | ||
size: options.moduleOriginalSize ? moduleInfo.originalLength : moduleInfo.renderedLength, | ||
@@ -69,3 +73,4 @@ chunks: [chunkId] | ||
}); | ||
var output = { | ||
return { | ||
builtAt: Date.now(), | ||
assets: assets, | ||
@@ -75,3 +80,2 @@ chunks: chunks, | ||
}; | ||
return output; | ||
}; | ||
@@ -78,0 +82,0 @@ |
{ | ||
"name": "rollup-plugin-webpack-stats", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"private": false, | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"author": { | ||
"name": "Viorel Cojocaru", | ||
"email": "vio@beanon.com", | ||
"url": "https://beanon.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vio/rollup-plugin-webpack-stats.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/vio/rollup-plugin-webpack-stats/issues" | ||
}, | ||
"homepage": "https://github.com/vio/rollup-plugin-webpack-stats/blob/master/#readme", | ||
"files": [ | ||
@@ -33,3 +47,2 @@ "dist", | ||
}, | ||
"author": "Vio", | ||
"module": "dist/rollup-plugin-webpack-stats.esm.js", | ||
@@ -39,3 +52,3 @@ "devDependencies": { | ||
"rollup": "^1.32.1", | ||
"size-limit": "^8.1.0", | ||
"size-limit": "^8.1.1", | ||
"tsdx": "^0.14.1", | ||
@@ -42,0 +55,0 @@ "tslib": "^2.4.1", |
@@ -37,1 +37,6 @@ # rollup-plugin-webpack-stats | ||
``` | ||
## Example setup with [@relative-ci/agent](https://github.com/relative-ci/agent) | ||
- [example-vite-github-action](https://github.com/relative-ci/example-vite-github-action) | ||
- [example-vite-cli-github-action](https://github.com/relative-ci/example-vite-cli-github-action) |
@@ -92,14 +92,22 @@ import path from 'path'; | ||
Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => { | ||
// Remove unexpected rollup null prefix | ||
const normalizedModulePath = modulePath.replace('\u0000', ''); | ||
const relativeModulePath = path.relative( | ||
process.cwd(), | ||
modulePath.replace('\u0000', '') | ||
normalizedModulePath | ||
); | ||
const moduleEntry = moduleByFileName[relativeModulePath]; | ||
// Match webpack output - add current directory prefix for child modules | ||
const relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./) | ||
? relativeModulePath | ||
: `.${path.sep}${relativeModulePath}`; | ||
const moduleEntry = moduleByFileName[relativeModulePathWithPrefix]; | ||
if (moduleEntry) { | ||
moduleEntry.chunks.push(chunkId); | ||
} else { | ||
moduleByFileName[relativeModulePath] = { | ||
name: relativeModulePath, | ||
moduleByFileName[relativeModulePathWithPrefix] = { | ||
name: relativeModulePathWithPrefix, | ||
size: options.moduleOriginalSize | ||
@@ -122,3 +130,4 @@ ? moduleInfo.originalLength | ||
const output = { | ||
return { | ||
builtAt: Date.now(), | ||
assets, | ||
@@ -128,4 +137,2 @@ chunks, | ||
}; | ||
return output; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
38650
392
0
2
42
1