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: 2 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"minifier",
"filebase",
"toplevel",
"commitlint"
"commitlint",
"tapable"
],

"ignorePaths": [
"CHANGELOG.md",
"package.json",
Expand Down
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions .eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ jobs:
architecture: ${{ steps.calculate_architecture.outputs.result }}
cache: "npm"

- name: Install dependencies (old)
run: |
npm install -D typescript@4 --force
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' || matrix.node-version == '18.x'

- name: Install dependencies
run: npm ci
if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' && matrix.node-version != '18.x'

- name: Install webpack ${{ matrix.webpack-version }}
if: matrix.webpack-version != 'latest'
Expand Down
70 changes: 30 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Using supported `devtool` values enable source map generation.
Type:

```ts
type test = string | RegExp | Array<string | RegExp>;
type test = string | RegExp | (string | RegExp)[];
```

Default: `/\.m?js(\?.*)?$/i`
Expand All @@ -109,7 +109,7 @@ module.exports = {
Type:

```ts
type include = string | RegExp | Array<string | RegExp>;
type include = string | RegExp | (string | RegExp)[];
```

Default: `undefined`
Expand All @@ -136,7 +136,7 @@ module.exports = {
Type:

```ts
type exclude = string | RegExp | Array<string | RegExp>;
type exclude = string | RegExp | (string | RegExp)[];
```

Default: `undefined`
Expand Down Expand Up @@ -224,9 +224,7 @@ Type:

```ts
type minify = (
input: {
[file: string]: string;
},
input: Record<string, string>,
sourceMap: import("@jridgewell/trace-mapping").SourceMapInput | undefined,
minifyOptions: {
module?: boolean | undefined;
Expand All @@ -245,7 +243,7 @@ type minify = (
pos: number;
line: number;
col: number;
}
},
) => boolean)
| {
condition?:
Expand All @@ -261,7 +259,7 @@ type minify = (
pos: number;
line: number;
col: number;
}
},
) => boolean)
| undefined;
filename?: string | ((fileData: any) => string) | undefined;
Expand All @@ -271,7 +269,7 @@ type minify = (
| ((commentsFile: string) => string)
| undefined;
}
| undefined
| undefined,
) => Promise<{
code: string;
map?: import("@jridgewell/trace-mapping").SourceMapInput | undefined;
Expand Down Expand Up @@ -316,7 +314,6 @@ minify.getMinimizerVersion = () => {
let packageJson;

try {
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
packageJson = require("uglify-module/package.json");
} catch (error) {
// Ignore
Expand Down Expand Up @@ -345,7 +342,7 @@ module.exports = {
Type:

```ts
type terserOptions = {
interface terserOptions {
compress?: boolean | CompressOptions;
ecma?: ECMA;
enclose?: boolean | string;
Expand All @@ -362,7 +359,7 @@ type terserOptions = {
safari10?: boolean;
sourceMap?: boolean | SourceMapOptions;
toplevel?: boolean;
};
}
```

Default: [default](https://github.com/terser/terser#minify-options)
Expand Down Expand Up @@ -416,7 +413,7 @@ type extractComments =
pos: number;
line: number;
col: number;
}
},
) => boolean)
| {
condition?:
Expand All @@ -432,7 +429,7 @@ type extractComments =
pos: number;
line: number;
col: number;
}
},
) => boolean)
| undefined;
filename?: string | ((fileData: any) => string) | undefined;
Expand Down Expand Up @@ -550,13 +547,11 @@ module.exports = {
new TerserPlugin({
extractComments: {
condition: /^\**!|@preserve|@license|@cc_on/i,
filename: (fileData) => {
filename: (fileData) =>
// The "fileData" argument contains object with "filename", "basename", "query" and "hash"
return `${fileData.filename}.LICENSE.txt${fileData.query}`;
},
banner: (licenseFile) => {
return `License information can be found in ${licenseFile}`;
},
`${fileData.filename}.LICENSE.txt${fileData.query}`,
banner: (licenseFile) =>
`License information can be found in ${licenseFile}`,
},
}),
],
Expand All @@ -582,7 +577,7 @@ type condition =
pos: number;
line: number;
col: number;
}
},
) => boolean)
| undefined;
```
Expand All @@ -599,13 +594,11 @@ module.exports = {
new TerserPlugin({
extractComments: {
condition: "some",
filename: (fileData) => {
filename: (fileData) =>
// The "fileData" argument contains object with "filename", "basename", "query" and "hash"
return `${fileData.filename}.LICENSE.txt${fileData.query}`;
},
banner: (licenseFile) => {
return `License information can be found in ${licenseFile}`;
},
`${fileData.filename}.LICENSE.txt${fileData.query}`,
banner: (licenseFile) =>
`License information can be found in ${licenseFile}`,
},
}),
],
Expand Down Expand Up @@ -644,9 +637,8 @@ module.exports = {
extractComments: {
condition: /^\**!|@preserve|@license|@cc_on/i,
filename: "extracted-comments.js",
banner: (licenseFile) => {
return `License information can be found in ${licenseFile}`;
},
banner: (licenseFile) =>
`License information can be found in ${licenseFile}`,
},
}),
],
Expand Down Expand Up @@ -680,13 +672,11 @@ module.exports = {
new TerserPlugin({
extractComments: {
condition: true,
filename: (fileData) => {
filename: (fileData) =>
// The "fileData" argument contains object with "filename", "basename", "query" and "hash"
return `${fileData.filename}.LICENSE.txt${fileData.query}`;
},
banner: (commentsFile) => {
return `My custom banner about license information ${commentsFile}`;
},
`${fileData.filename}.LICENSE.txt${fileData.query}`,
banner: (commentsFile) =>
`My custom banner about license information ${commentsFile}`,
},
}),
],
Expand Down Expand Up @@ -879,10 +869,10 @@ module.exports = {
With built-in minify functions:

```ts
import type { JsMinifyOptions as SwcOptions } from "@swc/core";
import type { MinifyOptions as UglifyJSOptions } from "uglify-js";
import type { TransformOptions as EsbuildOptions } from "esbuild";
import type { MinifyOptions as TerserOptions } from "terser";
import { type JsMinifyOptions as SwcOptions } from "@swc/core";
import { type TransformOptions as EsbuildOptions } from "esbuild";
import { type MinifyOptions as TerserOptions } from "terser";
import { type MinifyOptions as UglifyJSOptions } from "uglify-js";

module.exports = {
optimization: {
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "eslint/config";
import configs from "eslint-config-webpack/configs.js";

export default defineConfig([
{
extends: [configs["recommended-dirty"]],
},
]);
Loading
Loading