Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions client/components/Sidebar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@value toggleTime: 200ms;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use postcss-icss-values for the only one value, if we want in future to have variables, better to use CSS custom properties


.container {
background: var(--bg-primary);
border: none;
Expand All @@ -21,7 +19,7 @@
bottom: 0;
position: absolute;
top: 0;
transition: transform toggleTime ease;
transition: transform 200ms ease;
}

.container.pinned {
Expand Down
208 changes: 50 additions & 158 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"autoprefixer": "10.2.5",
"babel-eslint": "10.1.0",
"babel-loader": "9.2.1",
"babel-plugin-lodash": "3.3.4",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use lodash at all right now, so we don't need outdated plugin

"classnames": "2.3.1",
"core-js": "3.12.1",
"css-loader": "5.2.5",
Expand All @@ -81,21 +80,17 @@
"eslint-config-th0r-react": "2.0.1",
"eslint-plugin-react": "7.23.2",
"filesize": "^6.3.0",
"globby": "11.0.3",
"jest": "^30.2.0",
"lodash.memoize": "^4.1.2",
"lodash.merge": "^4.6.2",
"lodash.partial": "^4.2.1",
"mobx": "5.15.7",
"mobx-react": "6.3.1",
"postcss": "8.3.0",
"postcss-icss-values": "2.0.2",
"postcss-loader": "5.3.0",
"preact": "10.5.13",
"prettier": "^3.8.0",
"puppeteer": "^24.30.0",
"style-loader": "2.0.0",
"terser-webpack-plugin": "5.1.2",
"tinyglobby": "^0.2.15",
"webpack": "5.98.0",
"webpack-cli": "6.0.1",
"webpack-dev-server": "5.2.0"
Expand Down
57 changes: 41 additions & 16 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
const { readdirSync } = require("fs");
const webpack = require("webpack");
const memoize = require("lodash.memoize");
const partial = require("lodash.partial");
const merge = require("lodash.merge");

global.webpackCompile = webpackCompile;
global.makeWebpackConfig = makeWebpackConfig;
global.forEachWebpackVersion = forEachWebpackVersion;

const BundleAnalyzerPlugin = require("../lib/BundleAnalyzerPlugin");

/**
* @template T
* @typedef {() => T} FunctionReturning
*/

/**
* @template T
* @param {FunctionReturning<T>} fn memorized function
* @returns {FunctionReturning<T>} new function
*/
const memoize = (fn) => {
let cache = false;
/** @type {T | undefined} */
let result;
return () => {
if (cache) {
return /** @type {T} */ (result);
}

result = fn();
cache = true;
// Allow to clean up memory for fn
// and all dependent resources
/** @type {FunctionReturning<T> | undefined} */
(fn) = undefined;
return /** @type {T} */ (result);
};
};

const getAvailableWebpackVersions = memoize(() =>
readdirSync(`${__dirname}/webpack-versions`, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
Expand Down Expand Up @@ -51,7 +77,7 @@ function forEachWebpackVersion(versions, cb) {
cb({
it: itFn,
version,
webpackCompile: partial(webpackCompile, partial.placeholder, version),
webpackCompile: (config) => webpackCompile(config, version),
});
}
}
Expand Down Expand Up @@ -95,19 +121,18 @@ async function webpackCompile(config, version) {
await wait(1);
}

function makeWebpackConfig(opts) {
opts = merge(
{
analyzerOpts: {
analyzerMode: "static",
openAnalyzer: false,
logLevel: "error",
},
minify: false,
multipleChunks: false,
function makeWebpackConfig(opts = {}) {
opts = {
...opts,
minify: false,
multipleChunks: false,
analyzerOpts: {
analyzerMode: "static",
openAnalyzer: false,
logLevel: "error",
...(opts.analyzerOpts || {}),
},
opts,
);
};

return {
context: __dirname,
Expand Down
Loading