Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Copy Markdown
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
173 changes: 50 additions & 123 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,20 @@
"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
54 changes: 40 additions & 14 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
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 @@ -95,19 +122,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
4 changes: 2 additions & 2 deletions test/statsUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require("path");
const { readFileSync } = require("fs");
const globby = require("globby");
const { globSync } = require("tinyglobby");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

tinyglobby has less deps


const { StatsSerializeStream } = require("../lib/statsUtils");

Expand Down Expand Up @@ -56,7 +56,7 @@ describe("StatsSerializeStream", () => {
});
});

globby.sync("stats/**/*.json", { cwd: __dirname }).forEach((filepath) => {
globSync("stats/**/*.json", { cwd: __dirname }).forEach((filepath) => {
it(`should properly stringify JSON from "${filepath}"`, function () {
const content = readFileSync(path.resolve(__dirname, filepath), "utf8");
const json = JSON.parse(content);
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ module.exports = {
options: {
postcssOptions: {
plugins: [
require("postcss-icss-values"),
require("autoprefixer"),
...(!isDev ? [require("cssnano")()] : []),
],
Expand Down