Skip to content
Closed
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Finally, run `webpack` using the method you normally use (e.g., via CLI or an np

Type:

<!-- eslint-skip -->

```ts
type stylusOptions =
| {
Expand Down Expand Up @@ -334,6 +336,8 @@ module.exports = {

Type:

<!-- eslint-skip -->

```ts
type additionalData =
| string
Expand Down Expand Up @@ -454,6 +458,8 @@ module.exports = {

Type:

<!-- eslint-skip -->
Copy link
Member

Choose a reason for hiding this comment

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

Don't use skip, fix types, we need to fix it in other repos too

Copy link
Contributor Author

@ersachin3112 ersachin3112 Aug 2, 2025

Choose a reason for hiding this comment

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

i used this for README.md file only because eslint is reading it as JS file resulting code-block lint fail.


```ts
type implementation = Function | string;
```
Expand Down
2 changes: 1 addition & 1 deletion bench/fixtures/imports/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
context: __dirname,
entry: "./index.js",
output: {
path: `${__dirname}/tmp`,
path: require("node:path").join(__dirname, "tmp"),
filename: "bundle.js",
},
module: {
Expand Down
100 changes: 48 additions & 52 deletions bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ const path = require("node:path");

const Benchmark = require("benchmark");

// eslint-disable-next-line import/no-unresolved
const MemoryFileSystem = require("memory-fs");
const stylus = require("stylus");
const webpack = require("webpack");

const importWebpackConfig = require("./fixtures/imports/webpack.config");

function resolveOnComplete(fn) {
return () => {
return (...args) => {
const _this = this;
const args = arguments;

return new Promise((resolve) => {
const result = fn.apply(_this, args);
Expand All @@ -31,57 +31,53 @@ const styl = stylus(source);
const compiler = webpack(importWebpackConfig);
compiler.outputFileSystem = new MemoryFileSystem();

Promise.resolve()
.then(
resolveOnComplete(() => {
const suite = new Benchmark.Suite();
suite
.add("Native stylus", {
defer: true,
fn(deferred) {
styl
.set("filename", sourceFile)
// eslint-disable-next-line no-unused-vars
.render((error, css) => {
if (error) {
throw error;
}
await resolveOnComplete(() => {
const suite = new Benchmark.Suite();
suite
.add("Native stylus", {
defer: true,
fn(deferred) {
styl
.set("filename", sourceFile)
// eslint-disable-next-line no-unused-vars
.render((error, css) => {
if (error) {
throw error;
}

deferred.resolve();
});
},
})
.on("cycle", (event) => {
// eslint-disable-next-line no-console
console.log(String(event.target));
})
.run({ async: true });
deferred.resolve();
});
},
})
.on("cycle", (event) => {
// eslint-disable-next-line no-console
console.log(String(event.target));
})
.run({ async: true });

return suite;
}),
)
.then(
resolveOnComplete(() => {
const suite = new Benchmark.Suite();
suite
.add("Stylus loader", {
defer: true,
fn(deferred) {
compiler.run((error, stats) => {
if (error) {
throw error;
}
return suite;
})();

deferred.resolve();
});
},
})
.on("cycle", (event) => {
// eslint-disable-next-line no-console
console.log(String(event.target));
})
.run({ async: true });
await resolveOnComplete(() => {
const suite = new Benchmark.Suite();
suite
.add("Stylus loader", {
defer: true,
fn(deferred) {
compiler.run((error, _stats) => {
if (error) {
throw error;
}

return suite;
}),
);
deferred.resolve();
});
},
})
.on("cycle", (event) => {
// eslint-disable-next-line no-console
console.log(String(event.target));
})
.run({ async: true });

return suite;
})();
Loading
Loading