Skip to content

Commit

Permalink
Implement bundle include/exclude across backend and frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Bardadym committed Dec 27, 2022
1 parent 6c75b6a commit 9abebe7
Show file tree
Hide file tree
Showing 34 changed files with 761 additions and 722 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Not released

* Add `include` and `exclude` options used default `@rollup/pluginutils` `createFilter`
* Add `include` and `exclude` options allowing to filter bundles, and files in separate or together
* Fix possible bug with not correctly cutting prefix when `projectRoot` is a string
* Use glob patterns via `picomatch` in include and exclude
* Use glob patterns via `picomatch` in include and exclude allowing to filter both bundles and files

## 5.8.3

Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ Output yml file with all the data, could be good idea to commit this file to tra

`projectRoot` (string | RegExp, default `process.cwd()`) - This is some common root(s) path to your files. This is used to cut absolute files paths out.

`include` (string | string[] | RegExp | RegExp[], default `undefined`) - Valid picomatch pattern for inclusion
`include` (Filter | Filter[], default `undefined`) - Filter for inclusion

`exclude` (string | string[] | RegExp | RegExp[], default `undefined`) - Valid picomatch pattern for exclusion
`exclude` (Filter | Filter[], default `undefined`) - Filter for exclusion

`Filter` type is `{ bundle?: picomatchPattern, file?: picomatchPattern }`

**Note about `include` and `exclude`** - If options.include is omitted or has zero length, filter will return true by default. Otherwise, an ID must match one or more of the picomatch patterns, and must not match any of the options.exclude patterns. This entries will not be included in stats at all.

Expand Down Expand Up @@ -172,3 +174,11 @@ This statistical information can contain:
## Upgrades

See CHANGELOG.md.

## Versioning

* Plugin backend (one appears in configs) are strictly follows SemVer
* Plugin frontend (generated file):
* `network`, `treemap`, `sunburst` can change does not matter of version (colors, texts, visual structure etc)
* `raw-data` format follows own `version` property
* `list` follows semver
2 changes: 1 addition & 1 deletion bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { renderTemplate } from "../plugin/render-template";
import TEMPLATE, { TemplateType } from "../plugin/template-types";
import { warn } from "../plugin/warn";
import { version } from "../plugin/version";
import { ModuleMeta, ModulePart, ModuleTree, ModuleUID, VisualizerData } from "../types/types";
import { ModuleMeta, ModulePart, ModuleTree, ModuleUID, VisualizerData } from "../shared/types";

const argv = yargs(hideBin(process.argv))
.option("filename", {
Expand Down
10 changes: 4 additions & 6 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { rollup } = require("rollup");
const commonJs = require("@rollup/plugin-commonjs");
const resolve = require("@rollup/plugin-node-resolve").default;
const typescript = require("@rollup/plugin-typescript");
const alias = require('@rollup/plugin-alias');
const alias = require("@rollup/plugin-alias");
const postcss = require("rollup-plugin-postcss");
const postcssUrl = require("postcss-url");

Expand Down Expand Up @@ -71,9 +71,7 @@ const COMMON_PLUGINS = () =>
[
typescript({ tsconfig: "./src/tsconfig.json", noEmitOnError: true }),
alias({
entries: [
{ find: 'picomatch', replacement: 'picomatch-browser' },
]
entries: [{ find: "picomatch", replacement: "picomatch-browser" }],
}),
resolve({ mainFields: ["module", "main"] }),
commonJs({
Expand Down Expand Up @@ -299,7 +297,7 @@ const runBuildTest_filter = async (template) => {
title: "test filter",
filename: `stats.filter${chooseExt(template)}`,
template,
exclude: ['**/node_modules/**'],
exclude: [{ file: "**/node_modules/**" }],
...simpleOptions,
}),
],
Expand Down Expand Up @@ -330,7 +328,7 @@ const run = async () => {
await buildAll(runBuildTest_gh59);
await buildAll(runBuildTest_gh69);
await buildAll(runBuildTest_gh93);
await buildAll(runBuildTest_filter)
await buildAll(runBuildTest_filter);
}
};

Expand Down
Loading

0 comments on commit 9abebe7

Please sign in to comment.