Skip to content

Commit af3b0ec

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

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

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)