Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 7, 2024
1 parent c7c923c commit 7f4b30b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ jobs:
fail-fast: false
matrix:
node-version:
- 20
- 18
- 16
- 14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
4 changes: 2 additions & 2 deletions core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Buffer} from 'node:buffer';
import * as Token from 'token-types';
import * as strtok3 from 'strtok3/core'; // eslint-disable-line n/file-extension-in-import
import * as strtok3 from 'strtok3/core';
import {
stringToBytes,
tarHeaderChecksumMatches,
Expand Down Expand Up @@ -794,7 +794,7 @@ export class FileTypeParser {
const element = await readElement();
if (element.id === 0x42_82) {
const rawValue = await tokenizer.readToken(new Token.StringType(element.len, 'utf-8'));
return rawValue.replace(/\00.*$/g, ''); // Return DocType
return rawValue.replaceAll(/\00.*$/g, ''); // Return DocType
}

await tokenizer.ignore(element.len); // ignore payload
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"sideEffects": false,
"engines": {
"node": ">=14.16"
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd"
Expand Down Expand Up @@ -216,18 +216,21 @@
},
"devDependencies": {
"@tokenizer/token": "^0.3.0",
"@types/node": "^20.1.2",
"ava": "^5.2.0",
"@types/node": "^20.10.7",
"ava": "^6.0.1",
"commonmark": "^0.30.0",
"noop-stream": "^1.0.0",
"tsd": "^0.28.1",
"xo": "^0.54.2"
"tsd": "^0.30.3",
"xo": "^0.56.0"
},
"xo": {
"envs": [
"node",
"browser"
],
"ignores": [
"fixture"
],
"rules": {
"no-inner-declarations": "warn",
"no-await-in-loop": "warn",
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import process from 'node:process';
import {Buffer, Blob} from 'node:buffer';
import {Buffer} from 'node:buffer';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import fs from 'node:fs';
import stream from 'node:stream';
import test from 'ava';
import {readableNoopStream} from 'noop-stream';
import {Parser as ReadmeParser} from 'commonmark';
import * as strtok3 from 'strtok3/core'; // eslint-disable-line n/file-extension-in-import
import * as strtok3 from 'strtok3/core';
import {
fileTypeFromBuffer,
fileTypeFromStream,
Expand Down

0 comments on commit 7f4b30b

Please sign in to comment.