@bundle-stats/plugin-webpack-filter 4.2.3-beta.0 → 4.2.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # plugin-webpack-filter
2
+
3
+ Webpack filter plugin for [bundle-stats](https://github.com/relative-ci/bundle-stats#README)
4
+
5
+ ## Related projects
6
+
7
+ ### :cyclone: [relative-ci.com](https://relative-ci.com?utm_medium=bundle-stats-plugin-filter)
8
+
9
+ #### Optimize your web app's performance with automated bundle stats analysis and monitoring.
10
+
11
+ - :crystal_ball: In-depth bundle stats analysis for every build
12
+ - :chart_with_upwards_trend: Monitor bundle stats changes and identify opportunities for optimizations
13
+ - :bell: [Rule based automated review flow](https://relative-ci.com/documentation/setup/configure/integrations/github-commit-status-review?utm_medium=bundle-stats-plugin-filter), or get notified via [GitHub Pull Request comments](https://relative-ci.com/documentation/setup/configure/integrations/github-pull-request-comment?utm_medium=bundle-stats-plugin-filter), [GitHub check reports](https://relative-ci.com/documentation/setup/configure/integrations/github-check-report?utm_medium=bundle-stats-plugin-filter) and [Slack messages](https://relative-ci.com/documentation/setup/configure/integrations/slack-notification?utm_medium=bundle-stats-plugin-filter)
14
+ - :wrench: Support for **webpack** and beta support for **Vite**/**Rollup**
15
+ - :hammer: Support for all major CI services(CircleCI, GitHub Actions, Gitlab CI, Jenkins, Travis CI)
16
+ - :nut_and_bolt: Support for **npm**, **yarn** and **pnpm**; support for monorepos
17
+ - :two_hearts: **Always free** for **Open Source**
18
+
19
+ [:rocket: Get started](https://relative-ci.com?utm_medium=bundle-stats-plugin-filter)
20
+
21
+ ### :first_quarter_moon: [relative-ci/compare](https://compare.relative-ci.com)
22
+
23
+ Standalone web application to compare Webpack/Lighthouse/Browsertime stats.
24
+
25
+ [Compare bundle stats](https://compare.relative-ci.com)
26
+
27
+ ### :zap: [bundle-stats-action](https://github.com/vio/bundle-stats-action)
28
+
29
+ Github Action that generates [bundle-stats](https://github.com/relative-ci/bundle-stats) reports.
30
+
31
+ ## Packages
32
+
33
+ ### [`bundle-stats`](https://github.com/relative-ci/bundle-stats/tree/master/packages/cli)
34
+
35
+ [![npm](https://img.shields.io/npm/v/bundle-stats)](https://www.npmjs.com/package/bundle-stats) [![npm](https://img.shields.io/npm/dm/bundle-stats)](https://www.npmjs.com/package/bundle-stats)
36
+
37
+ CLI to generate bundle stats report.
38
+
39
+ ### [`bundle-stats-webpack-plugin`](https://github.com/relative-ci/bundle-stats/tree/master/packages/webpack-plugin)
40
+
41
+ [![npm](https://img.shields.io/npm/v/bundle-stats-webpack-plugin)](https://www.npmjs.com/package/bundle-stats-webpack-plugin) [![npm](https://img.shields.io/npm/dm/bundle-stats-webpack-plugin)](https://www.npmjs.com/package/bundle-stats-webpack-plugin)
42
+
43
+ Webpack plugin to generate bundle stats report for webpack/rspack.
44
+
45
+ ### [`gatsby-plugin-bundle-stats`](https://github.com/relative-ci/bundle-stats/tree/master/packages/gatsby-plugin)
46
+
47
+ [![npm](https://img.shields.io/npm/v/gatsby-plugin-bundle-stats)](https://www.npmjs.com/package/gatsby-plugin-bundle-stats) [![npm](https://img.shields.io/npm/dm/gatsby-plugin-bundle-stats)](https://www.npmjs.com/package/gatsby-plugin-bundle-stats)
48
+
49
+ [Gatsby](https://www.gatsbyjs.org) plugin for [bundle-stats](https://github.com/relative-ci/bundle-stats/tree/master/packages/webpack-plugin).
50
+
51
+ ### [`next-plugin-bundle-stats`](https://github.com/relative-ci/bundle-stats/tree/master/packages/next-plugin)
52
+
53
+ [![npm](https://img.shields.io/npm/v/next-plugin-bundle-stats)](https://www.npmjs.com/package/next-plugin-bundle-stats) [![npm](https://img.shields.io/npm/dm/next-plugin-bundle-stats)](https://www.npmjs.com/package/next-plugin-bundle-stats)
54
+
55
+ [Next.js](https://nextjs.org) plugin for [bundle-stats](https://github.com/relative-ci/bundle-stats/tree/master/packages/webpack-plugin).
56
+
57
+ ### [`rollup-plugin-bundle-stats`](https://github.com/relative-ci/bundle-stats/tree/master/packages/rollup-plugin)
58
+
59
+ [![npm](https://img.shields.io/npm/v/rollup-plugin-bundle-stats)](https://www.npmjs.com/package/rollup-plugin-bundle-stats) [![npm](https://img.shields.io/npm/dm/rollup-plugin-bundle-stats)](https://www.npmjs.com/package/rollup-plugin-bundle-stats)
60
+
61
+ Rollup plugin to generate bundle stats report for vite/rolldown/rollup.
@@ -1,9 +1,10 @@
1
+ 'use strict';
2
+
1
3
  const PATH_IGNORE_PATTERN = '.map$';
2
- export default (source, options = {}) => {
3
- var _a, _b, _c;
4
+ var index = (source, options = {}) => {
4
5
  const pathIgnorePattern = new RegExp(options.pathIgnorePattern || PATH_IGNORE_PATTERN);
5
6
  const { builtAt, hash } = source;
6
- const assets = ((_a = source.assets) === null || _a === void 0 ? void 0 : _a.reduce((agg, asset) => {
7
+ const assets = source.assets?.reduce((agg, asset) => {
7
8
  if (!asset.name || pathIgnorePattern.test(asset.name)) {
8
9
  return agg;
9
10
  }
@@ -12,8 +13,8 @@ export default (source, options = {}) => {
12
13
  size: asset.size,
13
14
  });
14
15
  return agg;
15
- }, [])) || [];
16
- const chunks = ((_b = source.chunks) === null || _b === void 0 ? void 0 : _b.reduce((agg, chunk) => {
16
+ }, []) || [];
17
+ const chunks = source.chunks?.reduce((agg, chunk) => {
17
18
  if (typeof chunk.id === 'undefined' || chunk.id === null) {
18
19
  return agg;
19
20
  }
@@ -25,14 +26,16 @@ export default (source, options = {}) => {
25
26
  names: chunk.names,
26
27
  });
27
28
  return agg;
28
- }, [])) || [];
29
- const modules = ((_c = source.modules) === null || _c === void 0 ? void 0 : _c.reduce((agg, moduleStats) => {
30
- var _a, _b;
29
+ }, []) || [];
30
+ const modules = source.modules?.reduce((agg, moduleStats) => {
31
31
  if (!moduleStats.name) {
32
32
  return agg;
33
33
  }
34
- const moduleChunks = ((_a = moduleStats.chunks) === null || _a === void 0 ? void 0 : _a.filter((chunkId) => chunkId !== null && typeof chunkId !== 'undefined')) || [];
35
- const concatenatedModules = (_b = moduleStats.modules) === null || _b === void 0 ? void 0 : _b.reduce((aggConcatenatedModules, concatenatedModule) => {
34
+ const moduleChunks = moduleStats.chunks?.filter((chunkId) => chunkId !== null && typeof chunkId !== 'undefined') || [];
35
+ if (moduleChunks.length === 0) {
36
+ return agg;
37
+ }
38
+ const concatenatedModules = moduleStats.modules?.reduce((aggConcatenatedModules, concatenatedModule) => {
36
39
  if (!concatenatedModule.name) {
37
40
  return aggConcatenatedModules;
38
41
  }
@@ -49,7 +52,7 @@ export default (source, options = {}) => {
49
52
  ...(concatenatedModules && { modules: concatenatedModules }),
50
53
  });
51
54
  return agg;
52
- }, [])) || [];
55
+ }, []) || [];
53
56
  return {
54
57
  builtAt,
55
58
  hash,
@@ -58,4 +61,6 @@ export default (source, options = {}) => {
58
61
  modules,
59
62
  };
60
63
  };
61
- //# sourceMappingURL=index.js.map
64
+
65
+ module.exports = index;
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA,MAAM,mBAAmB,GAAG,OAAO;AA6CnC,YAAe,CACb,MAAwB,EACxB,OAAA,GAA8B,EAAE,KACR;IACxB,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,mBAAmB,CAAC;AAGtF,IAAA,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM;AAGhC,IAAA,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,KAAI;AAEnC,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;AACrD,YAAA,OAAO,GAAG;;QAGZ,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,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,CAAC;gBAC1B,IAAI,EAAE,kBAAkB,CAAC,IAAI;gBAC7B,IAAI,EAAE,kBAAkB,CAAC,IAAI;AAC9B,aAAA,CAAC;AAEF,YAAA,OAAO,sBAAsB;SAC9B,EACD,EAAmD,CACpD;QAED,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,YAAA,MAAM,EAAE,YAAY;YACpB,IAAI,mBAAmB,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC7D,SAAA,CAAC;AAEF,QAAA,OAAO,GAAG;AACZ,KAAC,EAAE,EAA2C,CAAC,IAAI,EAAE;IAEvD,OAAO;QACL,OAAO;QACP,IAAI;QACJ,MAAM;QACN,MAAM;QACN,OAAO;KACR;AACH,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const PATH_IGNORE_PATTERN = '.map$';
4
- exports.default = (source, options = {}) => {
2
+ var index = (source, options = {}) => {
5
3
  const pathIgnorePattern = new RegExp(options.pathIgnorePattern || PATH_IGNORE_PATTERN);
6
4
  const { builtAt, hash } = source;
7
5
  const assets = source.assets?.reduce((agg, asset) => {
@@ -32,6 +30,9 @@ exports.default = (source, options = {}) => {
32
30
  return agg;
33
31
  }
34
32
  const moduleChunks = moduleStats.chunks?.filter((chunkId) => chunkId !== null && typeof chunkId !== 'undefined') || [];
33
+ if (moduleChunks.length === 0) {
34
+ return agg;
35
+ }
35
36
  const concatenatedModules = moduleStats.modules?.reduce((aggConcatenatedModules, concatenatedModule) => {
36
37
  if (!concatenatedModule.name) {
37
38
  return aggConcatenatedModules;
@@ -58,4 +59,6 @@ exports.default = (source, options = {}) => {
58
59
  modules,
59
60
  };
60
61
  };
61
- //# sourceMappingURL=index.js.map
62
+
63
+ export { index as default };
64
+ //# sourceMappingURL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
1
  {
2
2
  "name": "@bundle-stats/plugin-webpack-filter",
3
- "version": "4.2.3-beta.0",
3
+ "version": "4.2.3-beta.1",
4
4
  "description": "BundleStats webpack filter plugin",
5
- "main": "lib/index.js",
6
- "module": "lib-esm/index.js",
7
- "types": "types/index.d.ts",
5
+ "main": "lib/cjs/index.js",
6
+ "module": "lib/esm/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./lib/cjs/index.js",
11
+ "import": "./lib/esm/index.js",
12
+ "types": "./lib/types/index.d.ts"
13
+ }
14
+ },
8
15
  "sideEffects": false,
9
16
  "engines": {
10
17
  "node": ">= 14.0"
@@ -13,17 +20,17 @@
13
20
  "lib": "lib"
14
21
  },
15
22
  "scripts": {
16
- "build": "npm run build-lib && npm run build-esm",
17
- "build-lib": "rm -fr ./lib && ../../node_modules/.bin/tsc --rootDir ./src --project tsconfig.lib.json --outDir ./lib",
18
- "build-esm": "rm -fr ./lib-esm && rm -fr ./types && ../../node_modules/.bin/tsc --rootDir ./src --project tsconfig.esm.json --outDir ./lib-esm",
19
- "lint": "../../node_modules/.bin/eslint . --ext .js,.ts --resolve-plugins-relative-to ../../",
23
+ "build": "npm run clean && rollup -c && npm run build-type",
24
+ "build-type": "echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
25
+ "clean": "rimraf ./lib",
26
+ "lint": "eslint",
20
27
  "test": "TZ=UTC jest src --maxWorkers=4"
21
28
  },
22
29
  "keywords": [],
23
30
  "author": {
24
31
  "name": "Viorel Cojocaru",
25
- "email": "vio@beanon.com",
26
- "url": "https://beanon.com"
32
+ "email": "vio@relative-ci.com",
33
+ "url": "https://relative-ci.com"
27
34
  },
28
35
  "license": "MIT",
29
36
  "repository": {
@@ -35,18 +42,26 @@
35
42
  },
36
43
  "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter#readme",
37
44
  "devDependencies": {
38
- "@types/jest": "29.4.0",
39
- "@types/webpack": "5.28.0",
40
- "core-js": "3.28.0",
41
- "jest": "29.4.3",
42
- "jest-cli": "29.4.3",
43
- "jest-date-mock": "1.0.8",
44
- "regenerator-runtime": "0.13.11",
45
- "ts-jest": "29.0.5",
46
- "typescript": "4.9.5"
45
+ "@rollup/plugin-commonjs": "28.0.6",
46
+ "@rollup/plugin-node-resolve": "16.0.1",
47
+ "@rollup/plugin-typescript": "12.1.3",
48
+ "@types/jest": "29.5.14",
49
+ "@types/webpack": "5.28.5",
50
+ "core-js": "3.43.0",
51
+ "jest": "29.7.0",
52
+ "jest-cli": "29.7.0",
53
+ "jest-date-mock": "1.0.10",
54
+ "regenerator-runtime": "0.14.1",
55
+ "rimraf": "6.0.1",
56
+ "rollup": "4.44.0",
57
+ "ts-jest": "29.4.0",
58
+ "typescript": "5.8.3"
59
+ },
60
+ "dependencies": {
61
+ "tslib": "2.8.1"
47
62
  },
48
63
  "peerDependencies": {
49
64
  "core-js": "^3.0.0"
50
65
  },
51
- "gitHead": "a4664a4c6318b73774aae3666f5ae6c778025ea1"
66
+ "gitHead": "18734a4f1ce353ca150d7e0a40212f44a90c621e"
52
67
  }
@@ -0,0 +1,65 @@
1
+ import path from 'node:path';
2
+ import { defineConfig } from 'rollup';
3
+
4
+ import commonjsPlugin from '@rollup/plugin-commonjs';
5
+ import nodeResolvePlugin from '@rollup/plugin-node-resolve';
6
+ import typescriptPlugin from '@rollup/plugin-typescript';
7
+
8
+ const CONTEXT = path.join(process.cwd(), './src');
9
+ const OUTPUT_DIR = 'lib';
10
+
11
+ export default defineConfig([
12
+ {
13
+ context: CONTEXT,
14
+ input: './src/index.ts',
15
+ output: {
16
+ dir: OUTPUT_DIR,
17
+ format: 'cjs',
18
+ entryFileNames: 'cjs/[name].js',
19
+ sourcemap: true,
20
+ preserveModules: true,
21
+ preserveModulesRoot: CONTEXT,
22
+ interop: 'auto',
23
+ },
24
+ external: /node_modules/,
25
+ plugins: [
26
+ nodeResolvePlugin({
27
+ extensions: ['.js', '.cjs', '.json'],
28
+ }),
29
+ commonjsPlugin({
30
+ defaultIsModuleExports: 'auto',
31
+ }),
32
+ typescriptPlugin({
33
+ tsconfig: './tsconfig.cjs.json',
34
+ exclude: /\.test.ts/,
35
+ }),
36
+ ],
37
+ },
38
+ {
39
+ context: CONTEXT,
40
+ input: './src/index.ts',
41
+ output: {
42
+ dir: OUTPUT_DIR,
43
+ format: 'esm',
44
+ entryFileNames: 'esm/[name].js',
45
+ sourcemap: true,
46
+ preserveModules: true,
47
+ preserveModulesRoot: CONTEXT,
48
+ interop: 'auto',
49
+ },
50
+ external: /node_modules/,
51
+ plugins: [
52
+ nodeResolvePlugin({
53
+ extensions: ['.js', '.mjs', '.cjs', '.json'],
54
+ }),
55
+ commonjsPlugin({
56
+ // defaultIsModuleExports: 'auto',
57
+ // transformMixedEsModules: true,
58
+ }),
59
+ typescriptPlugin({
60
+ tsconfig: './tsconfig.esm.json',
61
+ exclude: /\.test.ts/,
62
+ }),
63
+ ],
64
+ },
65
+ ]);
package/CHANGELOG.md DELETED
@@ -1,75 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [3.2.8](https://github.com/relative-ci/bundle-stats/compare/v3.2.7...v3.2.8) (2022-03-10)
7
-
8
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
9
-
10
-
11
-
12
-
13
-
14
- ## [3.2.6](https://github.com/relative-ci/bundle-stats/compare/v3.2.5...v3.2.6) (2022-03-04)
15
-
16
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
17
-
18
-
19
-
20
-
21
-
22
- ## [3.2.5](https://github.com/relative-ci/bundle-stats/compare/v3.2.4...v3.2.5) (2022-02-15)
23
-
24
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
25
-
26
-
27
-
28
-
29
-
30
- ## [3.2.4](https://github.com/relative-ci/bundle-stats/compare/v3.2.3...v3.2.4) (2022-01-17)
31
-
32
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
33
-
34
-
35
-
36
-
37
-
38
- ## [3.2.3](https://github.com/relative-ci/bundle-stats/compare/v3.2.2...v3.2.3) (2022-01-10)
39
-
40
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
41
-
42
-
43
-
44
-
45
-
46
- ## [3.2.2](https://github.com/relative-ci/bundle-stats/compare/v3.2.1...v3.2.2) (2021-12-08)
47
-
48
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
49
-
50
-
51
-
52
-
53
-
54
- ## [3.2.1](https://github.com/relative-ci/bundle-stats/compare/v3.2.0...v3.2.1) (2021-11-23)
55
-
56
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
57
-
58
-
59
-
60
-
61
-
62
- # [3.2.0](https://github.com/relative-ci/bundle-stats/compare/v3.1.3...v3.2.0) (2021-10-13)
63
-
64
-
65
- ### Bug Fixes
66
-
67
- * Consistent dependency versions across packages ([cceebb7](https://github.com/relative-ci/bundle-stats/commit/cceebb7724670a7c40c156c395449fc65d183690))
68
-
69
-
70
-
71
-
72
-
73
- # [3.1.0](https://github.com/relative-ci/bundle-stats/compare/v3.0.1...v3.1.0) (2021-07-28)
74
-
75
- **Note:** Version bump only for package @bundle-stats/plugin-webpack-filter
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,MAAM,mBAAmB,GAAG,OAAO,CAAC;AA6CpC,kBAAe,CACb,MAAwB,EACxB,UAA8B,EAAE,EACV,EAAE;IACxB,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;IAGvF,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAGjC,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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sB,EAAE,kBAAkB,EAAE,EAAE;YAC7C,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE;gBAC5B,OAAO,sBAAsB,CAAC;aAC/B;YAED,sBAAsB,CAAC,IAAI,CAAC;gBAC1B,IAAI,EAAE,kBAAkB,CAAC,IAAI;gBAC7B,IAAI,EAAE,kBAAkB,CAAC,IAAI;aAC9B,CAAC,CAAC;YAEH,OAAO,sBAAsB,CAAC;QAChC,CAAC,EACD,EAAmD,CACpD,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,MAAM,EAAE,YAAY;YACpB,GAAG,CAAC,mBAAmB,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;SAC7D,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAA2C,CAAC,KAAI,EAAE,CAAC;IAExD,OAAO;QACL,OAAO;QACP,IAAI;QACJ,MAAM;QACN,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC,CAAC"}
package/src/index.test.ts DELETED
@@ -1,33 +0,0 @@
1
- import filter from './index';
2
-
3
- /* eslint-disable import/no-relative-packages */
4
- import webpackStats from '../../utils/__fixtures__/webpack-stats-1';
5
- import webpackStatsExtracted from '../../utils/__fixtures__/webpack-stats-1.extracted';
6
- import webpackStatsConcatenatedModules from '../../utils/__fixtures__/webpack-stats-3';
7
- import webpackStatsConcatenatedModulesExtracted from '../../utils/__fixtures__/webpack-stats-3.extracted';
8
- /* eslint-enable import/no-relative-packages */
9
-
10
- describe('Webpack filter', () => {
11
- test('should return empty meta', () => {
12
- const actual = filter({
13
- ...webpackStats,
14
- builtAt: undefined,
15
- hash: undefined,
16
- } as any);
17
- expect({
18
- ...webpackStatsExtracted,
19
- builtAt: undefined,
20
- hash: undefined,
21
- }).toEqual(actual);
22
- });
23
-
24
- test('should return meta', () => {
25
- const actual = filter(webpackStats as any);
26
- expect(webpackStatsExtracted).toEqual(actual);
27
- });
28
-
29
- test('should filter concatenated modules', () => {
30
- const actual = filter(webpackStatsConcatenatedModules as any);
31
- expect(webpackStatsConcatenatedModulesExtracted).toEqual(actual);
32
- });
33
- });
package/src/index.ts DELETED
@@ -1,137 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies
2
- import { StatsCompilation } from 'webpack';
3
-
4
- const PATH_IGNORE_PATTERN = '.map$';
5
-
6
- interface BundleStatsOptions {
7
- pathIgnorePattern?: string;
8
- }
9
-
10
- export interface WebpackStatsFilteredAsset {
11
- name: string;
12
- size?: number;
13
- }
14
-
15
- export interface WebpackStatsFilteredChunk {
16
- entry: boolean;
17
- id: number | string;
18
- initial: boolean;
19
- files?: Array<string>;
20
- names?: Array<string>;
21
- }
22
-
23
- export interface WebpackStatsFilteredModule {
24
- name: string;
25
- size?: number;
26
- chunks: Array<string | number>;
27
- }
28
-
29
- export interface WebpackStatsFilteredConcatenatedModule {
30
- name: string;
31
- size?: number;
32
- }
33
-
34
- export interface WebpackStatsFilteredRootModule extends WebpackStatsFilteredModule {
35
- modules?: Array<WebpackStatsFilteredConcatenatedModule>;
36
- }
37
-
38
- export interface WebpackStatsFiltered {
39
- builtAt?: number;
40
- hash?: string;
41
- assets?: Array<WebpackStatsFilteredAsset>;
42
- chunks?: Array<WebpackStatsFilteredChunk>;
43
- modules?: Array<WebpackStatsFilteredRootModule>;
44
- }
45
-
46
- /**
47
- * Filter webpack stats data
48
- */
49
- export default (
50
- source: StatsCompilation,
51
- options: BundleStatsOptions = {},
52
- ): WebpackStatsFiltered => {
53
- const pathIgnorePattern = new RegExp(options.pathIgnorePattern || PATH_IGNORE_PATTERN);
54
-
55
- // meta
56
- const { builtAt, hash } = source;
57
-
58
- // rawData
59
- const assets =
60
- source.assets?.reduce((agg, asset) => {
61
- // Skip assets with empty name or ignore pattern
62
- if (!asset.name || pathIgnorePattern.test(asset.name)) {
63
- return agg;
64
- }
65
-
66
- agg.push({
67
- name: asset.name,
68
- size: asset.size,
69
- });
70
-
71
- return agg;
72
- }, [] as Array<WebpackStatsFilteredAsset>) || [];
73
-
74
- const chunks =
75
- source.chunks?.reduce((agg, chunk) => {
76
- // Skip chunks with empty ids
77
- if (typeof chunk.id === 'undefined' || chunk.id === null) {
78
- return agg;
79
- }
80
-
81
- agg.push({
82
- id: chunk.id,
83
- entry: chunk.entry,
84
- initial: chunk.initial,
85
- files: chunk.files,
86
- names: chunk.names,
87
- });
88
-
89
- return agg;
90
- }, [] as Array<WebpackStatsFilteredChunk>) || [];
91
-
92
- const modules =
93
- source.modules?.reduce((agg, moduleStats) => {
94
- // Skip modules without name
95
- if (!moduleStats.name) {
96
- return agg;
97
- }
98
-
99
- const moduleChunks =
100
- moduleStats.chunks?.filter(
101
- (chunkId) => chunkId !== null && typeof chunkId !== 'undefined',
102
- ) || [];
103
-
104
- const concatenatedModules = moduleStats.modules?.reduce(
105
- (aggConcatenatedModules, concatenatedModule) => {
106
- if (!concatenatedModule.name) {
107
- return aggConcatenatedModules;
108
- }
109
-
110
- aggConcatenatedModules.push({
111
- name: concatenatedModule.name,
112
- size: concatenatedModule.size,
113
- });
114
-
115
- return aggConcatenatedModules;
116
- },
117
- [] as Array<WebpackStatsFilteredConcatenatedModule>,
118
- );
119
-
120
- agg.push({
121
- name: moduleStats.name,
122
- size: moduleStats.size,
123
- chunks: moduleChunks,
124
- ...(concatenatedModules && { modules: concatenatedModules }),
125
- });
126
-
127
- return agg;
128
- }, [] as Array<WebpackStatsFilteredRootModule>) || [];
129
-
130
- return {
131
- builtAt,
132
- hash,
133
- assets,
134
- chunks,
135
- modules,
136
- };
137
- };
File without changes