Skip to content

Commit 813ddb3

Browse files
feat!: ESM only, Node 20+ (#311)
* feat!: ESM only, Node 20+\n\n- Migrate package to ESM-only (type: module, exports map)\n- Update engines to >=20.19.0 and .nvmrc to 20.19.0\n- TypeScript: NodeNext module with ES2022 target, verbatimModuleSyntax\n- Update internal imports to .js extensions for ESM\n- Switch tests from Ava to Vitest (TypeScript) with ava-compat shim\n- Add vitest.config.ts with .snapshots dir; port tests and skip flaky watch-mode\n- Remove Ava/NYC/Codecov and coverage tooling\n- Update CI workflows to Node 20.19.0 and use vitest run\n- Update README for new requirements and ESM usage\n- Rename config files to .cjs for ESM-compat (eslint/prettier/commitlint)\n * chore(ci): add eslint devDependency so `pnpm lint:js` works in CI * chore(eslint): configure NodeNext TS resolver; drop inline suppressions test: remove unused 'compiler' assignments in skipped watch-mode tests - Add eslint-import-resolver-typescript and resolver settings - Remove per-line import/no-unresolved disables in src/{index,hooks}.ts - Update watch-mode and import-update tests to not assign to undeclared 'compiler' * ci(workflows): avoid duplicate runs on PR pushes; bump actions; move Windows to windows-2022\n\n- Limit push triggers to master; run PR workflows on pull_request only\n- Add concurrency with cancel-in-progress to dedupe per PR/branch\n- Checkout@v4 + fetch-depth: 0 for reliable origin/master refs\n- Setup-node@v4; Windows runner from 2019 -> 2022 * chore(eslint): configure NodeNext resolver; test(ts): allow TS extension imports via tsconfig.eslint - ESLint: add typescript + node resolvers; remove per-line suppressions in src - Style: use node: protocol for built-in modules in src - Tests: declare watch-mode `compiler` handles and add teardown; keep tests skipped - TS: move "allowImportingTsExtensions" to tsconfig.eslint.json (avoid build error) - deps(dev): add eslint-import-resolver-typescript so import/no-unresolved resolves .js<->.ts under NodeNext * Resolve rebase conflicts for ESLint resolver settings and lockfile (eslint-import-resolver-typescript ^4.4.4) * chore(eslint): configure TypeScript resolver for NodeNext; remove inline import/no-unresolved disables\n\n- Add eslint-import-resolver-typescript and resolver settings to .eslintrc.cjs\n- Drop per-line import/no-unresolved suppressions in src/index.ts and src/hooks.ts\n\ntest: use .js import specifiers throughout and fix skipped watch tests\n\n- Switch tests to import emitted .js (NodeNext-friendly) instead of .ts\n- Remove assignments to undeclared 'compiler' in skipped watch tests\n\nBuild/lint/test all green locally * chore(eslint): broaden node resolver extensions for ESM/CJS/TS variants\n\nstyle(node): use -prefixed core module specifiers in src/\n\nVerification: lint OK (0 errors, 1 warning); build OK; tests: 44 passed, 5 skipped * fix: resolve rebase conflicts\n\n- Finalize ESLint resolver settings (NodeNext + TS, broad extensions)\n- Bump eslint-import-resolver-typescript to ^4.4.4; fix duplicate key\n- Normalize pnpm-lock.yaml to HEAD variants * chore(eslint): include root JS configs in tsconfig.eslint.json (./*.{js,cjs,mjs}) * chore(lint): expand lint-staged to include TS; dedupe eslint --cache flag - lint-staged: run eslint on *.{js,ts,tsx,cjs,mjs} - scripts: remove duplicate --cache in lint:js - lockfile: sync after install * test(integration): save watcher handle to close in teardown; fix lints config - import-update.ts/watch-mode.ts: assign result of watch(...) to compiler so test.after can close it - package.json: de-dupe --cache; expand lint-staged to include TS/JS variants - tsconfig.eslint.json: use explicit include globs for js/cjs/mjs (no brace expansion) Verification: lint OK (0 errors, 1 warning); build OK; vitest: 44 passed, 5 skipped # Conflicts: # tsconfig.eslint.json * docs(readme): remove CJS dynamic import note per Node 20.19.0 review --------- Co-authored-by: CharlieHelps <[email protected]>
1 parent b87cabc commit 813ddb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2369
-2418
lines changed

.eslintrc.cjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
extends: ["shellscape/typescript"],
3+
parserOptions: {
4+
project: ["./tsconfig.eslint.json"],
5+
tsconfigRootDir: __dirname,
6+
},
7+
settings: {
8+
// Ensure import/no-unresolved can resolve NodeNext + TS paths where source files
9+
// use .js specifiers that map to .ts during authoring.
10+
'import/resolver': {
11+
typescript: {
12+
// Use the ESLint tsconfig which includes tests
13+
project: './tsconfig.eslint.json',
14+
alwaysTryTypes: true
15+
},
16+
node: {
17+
extensions: ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts', '.d.ts']
18+
}
19+
}
20+
}
21+
};

.eslintrc.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/node-windows.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
11
name: Windows
22

33
on:
4+
# Run on all PRs (regardless of base branch)
45
pull_request:
56
types:
6-
- edited
77
- opened
88
- synchronize
9+
- reopened
10+
- ready_for_review
11+
# Run on direct pushes to the default branch only (avoid duplicate runs for PR branches)
912
push:
1013
branches:
11-
- '*'
14+
- master
1215

1316
jobs:
1417
build:
15-
runs-on: windows-2019
18+
runs-on: windows-2022
19+
20+
# Ensure only one run per PR/branch is active; cancel superseded runs on new pushes
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref_name }}
23+
cancel-in-progress: true
1624

1725
strategy:
1826
matrix:
19-
node: ['18']
27+
node: ['20.19.0']
2028

2129
name: Node v${{ matrix.node }}
2230
steps:
2331
- name: Configure git line-breaks
2432
run: git config --global core.autocrlf false
2533

2634
- name: Checkout Commit
27-
uses: actions/checkout@v1
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
2838

2939
- name: Checkout Master
3040
run: git branch -f master origin/master
3141

3242
- name: Setup Node
33-
uses: actions/setup-node@v1
43+
uses: actions/setup-node@v4
3444
with:
3545
node-version: ${{ matrix.node }}
3646

.github/workflows/validate.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
name: Validate
22

33
on:
4+
# Run on all PRs (regardless of base branch)
45
pull_request:
56
types:
6-
- edited
77
- opened
88
- synchronize
9+
- reopened
10+
- ready_for_review
11+
# Run on direct pushes to the default branch only (avoid duplicate runs for PR branches)
912
push:
1013
branches:
11-
- '*'
14+
- master
1215

1316
jobs:
1417
build:
1518
runs-on: ubuntu-latest
1619

20+
# Ensure only one run per PR/branch is active; cancel superseded runs on new pushes
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref_name }}
23+
cancel-in-progress: true
24+
1725
strategy:
1826
matrix:
19-
node: ['20', '18', '16']
27+
node: ['20.19.0']
2028

2129
name: Node v${{ matrix.node }}
2230

2331
steps:
2432
- name: Checkout Commit
25-
uses: actions/checkout@v1
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
2636

2737
- name: Setup Node
28-
uses: actions/setup-node@v1
38+
uses: actions/setup-node@v4
2939
with:
3040
node-version: ${{ matrix.node }}
3141

@@ -54,4 +64,4 @@ jobs:
5464
run: pnpm lint:js
5565

5666
- name: Run Tests
57-
run: pnpm ci:coverage
67+
run: pnpm ci:test

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20.19.0

.prettierrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('eslint-config-shellscape/prettier');

.prettierrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
[tests]: https://img.shields.io/circleci/project/github/shellscape/webpack-manifest-plugin.svg
2-
[tests-url]: https://circleci.com/gh/shellscape/webpack-manifest-plugin
3-
[cover]: https://codecov.io/gh/shellscape/webpack-manifest-plugin/branch/master/graph/badge.svg
4-
[cover-url]: https://codecov.io/gh/shellscape/webpack-manifest-plugin
51
[size]: https://packagephobia.now.sh/badge?p=webpack-manifest-plugin
62
[size-url]: https://packagephobia.now.sh/result?p=webpack-manifest-plugin
73

84
<div align="center">
95
<img width="256" src="https://raw.githubusercontent.com/shellscape/webpack-manifest-plugin/master/assets/manifest.svg?sanitize=true" alt="webpack-manfiest-plugin"><br/><br/>
106
</div>
117

12-
[![tests][tests]][tests-url]
13-
[![cover][cover]][cover-url]
148
[![size][size]][size-url]
159
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)
1610

@@ -24,7 +18,7 @@ A Webpack plugin for generating an asset manifest.
2418

2519
`webpack-manifest-plugin` is an [evergreen 🌲](./.github/FAQ.md#what-does-evergreen-mean) module.
2620

27-
This module requires an [Active LTS](https://github.com/nodejs/Release) Node version (v12.0.0+) and Webpack v5.0.0.
21+
This module now requires Node.js v20.19.0 or newer and Webpack v5.0.0.
2822

2923
## Contributing
3024

@@ -48,19 +42,16 @@ _Note: We recommend using [webpack-nano](https://github.com/shellscape/webpack-n
4842

4943
## Usage
5044

51-
Create a `webpack.config.js` file:
45+
Create a `webpack.config.js` or `webpack.config.mjs` file (ESM):
5246

5347
```js
54-
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
55-
const options = { ... };
56-
57-
module.exports = {
58-
// an example entry definition
59-
entry: [ 'app.js' ],
60-
...
61-
plugins: [
62-
new WebpackManifestPlugin(options)
63-
]
48+
import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
49+
50+
export default {
51+
// an example entry definition
52+
entry: ['app.js'],
53+
// ...
54+
plugins: [new WebpackManifestPlugin(/* options */)]
6455
};
6556
```
6657

codecov.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

commitlint.config.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)