Skip to content

Commit 420f837

Browse files
committed
feat: support node 14
reverts 5b3c6e5
1 parent a8b4bd2 commit 420f837

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [ubuntu-latest, macos-latest, windows-latest]
36-
node: [16, 18, 20]
36+
node: [14, 16, 18, 20]
3737
fail-fast: false
3838

3939
steps:
@@ -55,13 +55,13 @@ jobs:
5555

5656
- name: Install Webpack 4
5757
run: pnpm i webpack@4
58-
if: ${{ matrix.node == 16 }}
58+
if: ${{ matrix.node == 14 || matrix.node == 16 }}
5959
env:
6060
IS_WEBPACK_4: 'true'
6161

6262
- name: Test with Webpack 4
6363
run: pnpm run test
64-
if: ${{ matrix.node == 16 }}
64+
if: ${{ matrix.node == 14 || matrix.node == 16 }}
6565
env:
6666
IS_WEBPACK_4: 'true'
6767
SKIP_RSPACK: 'true'

eslint.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ module.exports = antfu(
2020
'unicorn/prefer-node-protocol': 'off',
2121
},
2222
},
23+
{
24+
files: ['**/src/**/*.ts'],
25+
rules: {
26+
'node/no-unsupported-features/node-builtins': 'error',
27+
'node/no-unsupported-features/es-builtins': 'error',
28+
},
29+
},
2330
)

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"files": [
2525
"dist"
2626
],
27+
"engines": {
28+
"node": ">=14.0.0"
29+
},
2730
"scripts": {
2831
"build": "tsup",
2932
"dev": "tsup --watch src",

src/esbuild/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(
6868
loader.onLoadCb = callback
6969
},
7070
onTransform(_options, callback) {
71-
loader.options = loader.options || _options
71+
loader.options ||= _options
7272
loader.onTransformCb = callback
7373
},
7474
} as EsbuildPluginBuild)
@@ -100,11 +100,11 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(
100100
continue
101101

102102
if (onTransformCb) {
103-
result = result || {}
103+
result ||= {}
104104
// caution: 'utf8' assumes the input file is not in binary.
105105
// if you want your plugin handle binary files, make sure to
106106
// `plugin.load()` them first.
107-
result.contents = result.contents || await fs.promises.readFile(args.path, 'utf8')
107+
result.contents ||= await fs.promises.readFile(args.path, 'utf8')
108108

109109
const _result = await onTransformCb({
110110
...result,

tsup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const tsup: Options = {
55
sourcemap: false,
66
clean: true,
77
format: ['cjs', 'esm'],
8-
target: 'node16.14',
8+
target: 'node14',
99
dts: true,
1010
shims: true,
1111
entry: [

0 commit comments

Comments
 (0)