Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Jan 16, 2024
1 parent eefb5d8 commit 33d830e
Show file tree
Hide file tree
Showing 19 changed files with 3,352 additions and 2,171 deletions.
5,140 changes: 3,153 additions & 1,987 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"fix:js": "npm run lint:js -- --fix",
"fix:prettier": "npm run lint:prettier -- --write",
"fix": "npm-run-all -l fix:js fix:prettier",
"test:only": "cross-env NODE_ENV=test jest",
"test:only": "cross-env NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"pretest": "npm run lint",
Expand Down Expand Up @@ -69,19 +69,19 @@
}
},
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.19",
"@jridgewell/trace-mapping": "^0.3.21",
"cssnano": "^6.0.3",
"jest-worker": "^29.7.0",
"postcss": "^8.4.32",
"postcss": "^8.4.33",
"schema-utils": "^4.2.0",
"serialize-javascript": "^6.0.1"
"serialize-javascript": "^6.0.2"
},
"devDependencies": {
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.7",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@babel/preset-env": "^7.23.8",
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@parcel/css": "^1.8.3",
"@swc/css": "^0.0.20",
"@types/clean-css": "^4.2.11",
Expand All @@ -91,29 +91,29 @@
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^29.7.0",
"clean-css": "^5.3.3",
"copy-webpack-plugin": "^9.1.0",
"copy-webpack-plugin": "^12.0.1",
"cross-env": "^7.0.3",
"cspell": "^6.27.0",
"css-loader": "^6.8.1",
"cspell": "^8.3.2",
"css-loader": "^6.9.0",
"cssnano-preset-simple": "^4.0.0",
"csso": "^5.0.3",
"del": "^6.1.0",
"del-cli": "^5.1.0",
"esbuild": "^0.17.19",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lightningcss": "^1.22.1",
"lint-staged": "^13.2.2",
"memfs": "^3.5.1",
"mini-css-extract-plugin": "^2.7.6",
"lightningcss": "^1.23.0",
"lint-staged": "^15.2.0",
"memfs": "^4.6.0",
"mini-css-extract-plugin": "^2.7.7",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"prettier": "^3.2.2",
"sass": "^1.69.7",
"sass-loader": "^13.3.3",
"source-map": "^0.6.1",
"sass-loader": "^14.0.0",
"source-map": "^0.7.4",
"standard-version": "^9.5.0",
"sugarss": "^4.0.1",
"typescript": "^5.3.3",
Expand Down
52 changes: 26 additions & 26 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ const warningRegex = /\s.+:+([0-9]+):+([0-9]+)/;

const getSerializeJavascript = memoize(() =>
// eslint-disable-next-line global-require
require("serialize-javascript")
require("serialize-javascript"),
);
const getTraceMapping = memoize(() =>
// eslint-disable-next-line global-require
require("@jridgewell/trace-mapping")
require("@jridgewell/trace-mapping"),
);

/**
Expand Down Expand Up @@ -214,7 +214,7 @@ class CssMinimizerPlugin {
input.version &&
input.sources &&
Array.isArray(input.sources) &&
typeof input.mappings === "string"
typeof input.mappings === "string",
);
}

Expand All @@ -232,7 +232,7 @@ class CssMinimizerPlugin {
file,
warningsFilter,
sourceMap,
requestShortener
requestShortener,
) {
let warningMessage =
typeof warning === "string"
Expand Down Expand Up @@ -292,7 +292,7 @@ class CssMinimizerPlugin {
const builtWarning = new Error(
`${file} from Css Minimizer plugin\n${warningMessage}${
locationMessage ? ` ${locationMessage}` : ""
}`
}`,
);

builtWarning.name = "Warning";
Expand Down Expand Up @@ -345,7 +345,7 @@ class CssMinimizerPlugin {
error.stack
? `\n${error.stack.split("\n").slice(1).join("\n")}`
: ""
}`
}`,
);
builtError.file = file;

Expand All @@ -357,7 +357,7 @@ class CssMinimizerPlugin {
error.message
} [${file}:${line},${column}]${
error.stack ? `\n${error.stack.split("\n").slice(1).join("\n")}` : ""
}`
}`,
);
builtError.file = file;

Expand All @@ -366,15 +366,15 @@ class CssMinimizerPlugin {

if (error.stack) {
builtError = new Error(
`${file} from Css Minimizer plugin\n${error.stack}`
`${file} from Css Minimizer plugin\n${error.stack}`,
);
builtError.file = file;

return builtError;
}

builtError = new Error(
`${file} from Css Minimizer plugin\n${error.message}`
`${file} from Css Minimizer plugin\n${error.message}`,
);
builtError.file = file;

Expand Down Expand Up @@ -423,7 +423,7 @@ class CssMinimizerPlugin {
!compiler.webpack.ModuleFilenameHelpers.matchObject.bind(
// eslint-disable-next-line no-undefined
undefined,
this.options
this.options,
)(name)
) {
return false;
Expand All @@ -445,7 +445,7 @@ class CssMinimizerPlugin {
}

return { name, info, inputSource: source, output, cacheItem };
})
}),
);

if (assetsForMinify.length === 0) {
Expand All @@ -463,7 +463,7 @@ class CssMinimizerPlugin {
// Do not create unnecessary workers when the number of files is less than the available cores, it saves memory
numberOfWorkers = Math.min(
numberOfAssetsForMinify,
optimizeOptions.availableNumberOfCores
optimizeOptions.availableNumberOfCores,
);

getWorker = () => {
Expand Down Expand Up @@ -521,7 +521,7 @@ class CssMinimizerPlugin {
compilation.warnings.push(
/** @type {WebpackError} */ (
new Error(`${name} contains invalid source map`)
)
),
);
} else {
inputSourceMap = /** @type {RawSourceMap} */ (map);
Expand Down Expand Up @@ -562,14 +562,14 @@ class CssMinimizerPlugin {
name,
hasSourceMap
? new (getTraceMapping().TraceMap)(
/** @type {RawSourceMap} */ (inputSourceMap)
/** @type {RawSourceMap} */ (inputSourceMap),
)
: // eslint-disable-next-line no-undefined
undefined,
// eslint-disable-next-line no-undefined
hasSourceMap ? compilation.requestShortener : undefined
hasSourceMap ? compilation.requestShortener : undefined,
)
)
),
);

return;
Expand Down Expand Up @@ -597,7 +597,7 @@ class CssMinimizerPlugin {
item.map,
originalSource,
innerSourceMap,
true
true,
);
} else {
output.source = new RawSource(item.code);
Expand All @@ -615,13 +615,13 @@ class CssMinimizerPlugin {
name,
hasSourceMap
? new (getTraceMapping().TraceMap)(
/** @type {RawSourceMap} */ (inputSourceMap)
/** @type {RawSourceMap} */ (inputSourceMap),
)
: // eslint-disable-next-line no-undefined
undefined,
// eslint-disable-next-line no-undefined
hasSourceMap ? compilation.requestShortener : undefined
)
hasSourceMap ? compilation.requestShortener : undefined,
),
);
}
}
Expand All @@ -637,12 +637,12 @@ class CssMinimizerPlugin {
this.options.warningsFilter,
hasSourceMap
? new (getTraceMapping().TraceMap)(
/** @type {RawSourceMap} */ (inputSourceMap)
/** @type {RawSourceMap} */ (inputSourceMap),
)
: // eslint-disable-next-line no-undefined
undefined,
// eslint-disable-next-line no-undefined
hasSourceMap ? compilation.requestShortener : undefined
hasSourceMap ? compilation.requestShortener : undefined,
);

if (buildWarning) {
Expand Down Expand Up @@ -696,7 +696,7 @@ class CssMinimizerPlugin {
apply(compiler) {
const pluginName = this.constructor.name;
const availableNumberOfCores = CssMinimizerPlugin.getAvailableNumberOfCores(
this.options.parallel
this.options.parallel,
);

compiler.hooks.compilation.tap(pluginName, (compilation) => {
Expand All @@ -710,7 +710,7 @@ class CssMinimizerPlugin {
(assets) =>
this.optimize(compiler, compilation, assets, {
availableNumberOfCores,
})
}),
);

compilation.hooks.statsPrinter.tap(pluginName, (stats) => {
Expand All @@ -722,9 +722,9 @@ class CssMinimizerPlugin {
// eslint-disable-next-line no-undefined
minimized
? /** @type {Function} */ (green)(
/** @type {Function} */ (formatFlag)("minimized")
/** @type {Function} */ (formatFlag)("minimized"),
)
: ""
: "",

Check warning on line 727 in src/index.js

View check run for this annotation

Codecov / codecov/patch

src/index.js#L727

Added line #L727 was not covered by tests
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const minify = async (options) => {
const minifyResult = await minifyFn(
{ [options.name]: code },
map,
minifyOptions
minifyOptions,
);

if (typeof minifyResult.code !== "string") {
throw new Error(
"minimizer function doesn't return the 'code' property or result is not a string value"
"minimizer function doesn't return the 'code' property or result is not a string value",
);
}

Expand Down Expand Up @@ -75,7 +75,7 @@ async function transform(options) {
"module",
"__filename",
"__dirname",
`'use strict'\nreturn ${options}`
`'use strict'\nreturn ${options}`,
)(exports, require, module, __filename, __dirname);

return minify(evaluatedOptions);
Expand Down
18 changes: 9 additions & 9 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const notSettled = Symbol(`not-settled`);
function throttleAll(limit, tasks) {
if (!Number.isInteger(limit) || limit < 1) {
throw new TypeError(
`Expected \`limit\` to be a finite number > 0, got \`${limit}\` (${typeof limit})`
`Expected \`limit\` to be a finite number > 0, got \`${limit}\` (${typeof limit})`,
);
}

Expand All @@ -31,7 +31,7 @@ function throttleAll(limit, tasks) {
!tasks.every((task) => typeof task === `function`)
) {
throw new TypeError(
`Expected \`tasks\` to be a list of functions returning a promise`
`Expected \`tasks\` to be a list of functions returning a promise`,
);
}

Expand Down Expand Up @@ -76,7 +76,7 @@ function throttleAll(limit, tasks) {
async function cssnanoMinify(
input,
sourceMap,
minimizerOptions = { preset: "default" }
minimizerOptions = { preset: "default" },
) {
/**
* @template T
Expand Down Expand Up @@ -129,7 +129,7 @@ async function cssnanoMinify(
throw new Error(
`Loading PostCSS "${postcssOptions.parser}" parser failed: ${
/** @type {Error} */ (error).message
}\n\n(@${name})`
}\n\n(@${name})`,
);
}
}
Expand All @@ -141,7 +141,7 @@ async function cssnanoMinify(
throw new Error(
`Loading PostCSS "${postcssOptions.stringifier}" stringifier failed: ${
/** @type {Error} */ (error).message
}\n\n(@${name})`
}\n\n(@${name})`,
);
}
}
Expand All @@ -153,7 +153,7 @@ async function cssnanoMinify(
throw new Error(
`Loading PostCSS "${postcssOptions.syntax}" syntax failed: ${
/** @type {Error} */ (error).message
}\n\n(@${name})`
}\n\n(@${name})`,
);
}
}
Expand All @@ -172,7 +172,7 @@ async function cssnanoMinify(
// Types are broken
const result = await postcss([cssnano(minimizerOptions)]).process(
code,
postcssOptions
postcssOptions,
);

return {
Expand Down Expand Up @@ -245,7 +245,7 @@ async function cleanCssMinify(input, sourceMap, minimizerOptions) {
* @param {string} item
* @returns {string}
*/
(item) => (isWindowsPathSep ? item.replace(/\\/g, "/") : item)
(item) => (isWindowsPathSep ? item.replace(/\\/g, "/") : item),
);
}

Expand Down Expand Up @@ -336,7 +336,7 @@ async function esbuildMinify(input, sourceMap, minimizerOptions) {
note.location
? `\nLine text:\n${note.location.lineText}\n`
: ""
}`
}`,
)
.join("\n")}`
: ""
Expand Down
Loading

0 comments on commit 33d830e

Please sign in to comment.