Skip to content

Commit 3cdbdf4

Browse files
authored
Merge branch 'master' into master
2 parents a41068e + bf36fe8 commit 3cdbdf4

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

package-lock.json

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"chromedriver": "^130.0.0",
5959
"cli-progress": "^3.12.0",
6060
"colors": "^1.4.0",
61+
"compression-webpack-plugin": "^11.1.0",
6162
"copy-webpack-plugin": "^12.0.2",
6263
"core-js": "^3.37.1",
6364
"css-loader": "7.1.2",

src/core/operations/AddLineNumbers.mjs

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ class AddLineNumbers extends Operation {
2222
this.description = "Adds line numbers to the output.";
2323
this.inputType = "string";
2424
this.outputType = "string";
25-
this.args = [];
25+
this.args = [
26+
{
27+
"name": "Offset",
28+
"type": "number",
29+
"value": 0
30+
}
31+
];
2632
}
2733

2834
/**
@@ -33,10 +39,11 @@ class AddLineNumbers extends Operation {
3339
run(input, args) {
3440
const lines = input.split("\n"),
3541
width = lines.length.toString().length;
42+
const offset = args[0] ? parseInt(args[0], 10) : 0;
3643
let output = "";
3744

3845
for (let n = 0; n < lines.length; n++) {
39-
output += (n+1).toString().padStart(width, " ") + " " + lines[n] + "\n";
46+
output += (n+1+offset).toString().padStart(width, " ") + " " + lines[n] + "\n";
4047
}
4148
return output.slice(0, output.length-1);
4249
}

webpack.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const webpack = require("webpack");
22
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3+
const CompressionPlugin = require("compression-webpack-plugin");
34
const CopyWebpackPlugin = require("copy-webpack-plugin");
45
const { ModifySourcePlugin, ReplaceOperation } = require("modify-source-webpack-plugin");
56
const path = require("path");
7+
const zlib = require("zlib");
68

79
/**
810
* Webpack configuration details for use with Grunt.
@@ -64,6 +66,21 @@ module.exports = {
6466
new MiniCssExtractPlugin({
6567
filename: "assets/[name].css"
6668
}),
69+
new CompressionPlugin({
70+
filename: "[path][base].gz",
71+
algorithm: "gzip",
72+
test: /\.(js|css|html)$/,
73+
}),
74+
new CompressionPlugin({
75+
filename: "[path][base].br",
76+
algorithm: "brotliCompress",
77+
test: /\.(js|css|html)$/,
78+
compressionOptions: {
79+
params: {
80+
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
81+
},
82+
},
83+
}),
6784
new CopyWebpackPlugin({
6885
patterns: [
6986
{

0 commit comments

Comments
 (0)