Skip to content

Commit

Permalink
Require Node.js 18 and move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 30, 2024
1 parent 25def7b commit 3b93d6b
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 202 deletions.
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 10
- 8
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
276 changes: 152 additions & 124 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,136 +1,164 @@
declare namespace htmlTags {
export type htmlTags =
| 'a'
| 'abbr'
| 'address'
| 'area'
| 'article'
| 'aside'
| 'audio'
| 'b'
| 'base'
| 'bdi'
| 'bdo'
| 'blockquote'
| 'body'
| 'br'
| 'button'
| 'canvas'
| 'caption'
| 'cite'
| 'code'
| 'col'
| 'colgroup'
| 'data'
| 'datalist'
| 'dd'
| 'del'
| 'details'
| 'dfn'
| 'dialog'
| 'div'
| 'dl'
| 'dt'
| 'em'
| 'embed'
| 'fieldset'
| 'figcaption'
| 'figure'
| 'footer'
| 'form'
| 'h1'
| 'h2'
| 'h3'
| 'h4'
| 'h5'
| 'h6'
| 'head'
| 'header'
| 'hgroup'
| 'hr'
| 'html'
| 'i'
| 'iframe'
| 'img'
| 'input'
| 'ins'
| 'kbd'
| 'label'
| 'legend'
| 'li'
| 'link'
| 'main'
| 'map'
| 'mark'
| 'math'
| 'menu'
| 'menuitem'
| 'meta'
| 'meter'
| 'nav'
| 'noscript'
| 'object'
| 'ol'
| 'optgroup'
| 'option'
| 'output'
| 'p'
| 'param'
| 'picture'
| 'pre'
| 'progress'
| 'q'
| 'rb'
| 'rp'
| 'rt'
| 'rtc'
| 'ruby'
| 's'
| 'samp'
| 'script'
| 'search'
| 'section'
| 'select'
| 'slot'
| 'small'
| 'source'
| 'span'
| 'strong'
| 'style'
| 'sub'
| 'summary'
| 'sup'
| 'svg'
| 'table'
| 'tbody'
| 'td'
| 'template'
| 'textarea'
| 'tfoot'
| 'th'
| 'thead'
| 'time'
| 'title'
| 'tr'
| 'track'
| 'u'
| 'ul'
| 'var'
| 'video'
| 'wbr'
}
export type HtmlTags =
| 'a'
| 'abbr'
| 'address'
| 'area'
| 'article'
| 'aside'
| 'audio'
| 'b'
| 'base'
| 'bdi'
| 'bdo'
| 'blockquote'
| 'body'
| 'br'
| 'button'
| 'canvas'
| 'caption'
| 'cite'
| 'code'
| 'col'
| 'colgroup'
| 'data'
| 'datalist'
| 'dd'
| 'del'
| 'details'
| 'dfn'
| 'dialog'
| 'div'
| 'dl'
| 'dt'
| 'em'
| 'embed'
| 'fieldset'
| 'figcaption'
| 'figure'
| 'footer'
| 'form'
| 'h1'
| 'h2'
| 'h3'
| 'h4'
| 'h5'
| 'h6'
| 'head'
| 'header'
| 'hgroup'
| 'hr'
| 'html'
| 'i'
| 'iframe'
| 'img'
| 'input'
| 'ins'
| 'kbd'
| 'label'
| 'legend'
| 'li'
| 'link'
| 'main'
| 'map'
| 'mark'
| 'math'
| 'menu'
| 'menuitem'
| 'meta'
| 'meter'
| 'nav'
| 'noscript'
| 'object'
| 'ol'
| 'optgroup'
| 'option'
| 'output'
| 'p'
| 'param'
| 'picture'
| 'pre'
| 'progress'
| 'q'
| 'rb'
| 'rp'
| 'rt'
| 'rtc'
| 'ruby'
| 's'
| 'samp'
| 'script'
| 'search'
| 'section'
| 'select'
| 'slot'
| 'small'
| 'source'
| 'span'
| 'strong'
| 'style'
| 'sub'
| 'summary'
| 'sup'
| 'svg'
| 'table'
| 'tbody'
| 'td'
| 'template'
| 'textarea'
| 'tfoot'
| 'th'
| 'thead'
| 'time'
| 'title'
| 'tr'
| 'track'
| 'u'
| 'ul'
| 'var'
| 'video'
| 'wbr';

export type VoidHtmlTags =
| 'area'
| 'base'
| 'br'
| 'col'
| 'embed'
| 'hr'
| 'img'
| 'input'
| 'link'
| 'menuitem'
| 'meta'
| 'param'
| 'source'
| 'track'
| 'wbr';

/**
List of standard HTML tags.
@example
```
import htmlTags = require('html-tags');
import htmlTags from 'html-tags';
console.log(htmlTags);
//=> ['a', 'abbr', 'acronym', …]
```
*/
declare const htmlTags: readonly htmlTags.htmlTags[];
declare const htmlTags: readonly HtmlTags[];

export default htmlTags;

export = htmlTags;
/**
List of standard, self-closing HTML tags.
@example
```
import {voidHtmlTags} from 'html-tags';
console.log(voidHtmlTags);
//=> ['area', 'base', 'br', …]
```
*/
export const voidHtmlTags: readonly VoidHtmlTags[];
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
'use strict';
module.exports = require('./html-tags.json');
import htmlTags from './html-tags.json' with {type: 'json'};
import voidHtmlTags from './html-tags-void.json' with {type: 'json'};

export default htmlTags;
export {voidHtmlTags};
11 changes: 0 additions & 11 deletions index.test-d.ts

This file was deleted.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@
"email": "[email protected]",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=8"
"node": ">=18.20"
},
"scripts": {
"test": "xo && ava && tsd"
"//test": "xo && ava",
"test": "ava"
},
"files": [
"index.js",
"index.d.ts",
"void.js",
"void.d.ts",
"html-tags.json",
"html-tags-void.json"
],
Expand All @@ -36,13 +41,7 @@
"self-closing"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"xo": {
"rules": {
"import/extensions": "off"
}
"ava": "^6.1.2",
"xo": "^0.58.0"
}
}
Loading

0 comments on commit 3b93d6b

Please sign in to comment.