From 9275d4eeb10291134ba8805859b57edb346b95d9 Mon Sep 17 00:00:00 2001 From: Titus Date: Tue, 1 Jun 2021 10:58:33 +0200 Subject: [PATCH 01/16] Use `pull_request_target` in bb --- .github/workflows/bb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bb.yml b/.github/workflows/bb.yml index 291ab09..0198fc3 100644 --- a/.github/workflows/bb.yml +++ b/.github/workflows/bb.yml @@ -2,7 +2,7 @@ name: bb on: issues: types: [opened, reopened, edited, closed, labeled, unlabeled] - pull_request: + pull_request_target: types: [opened, reopened, edited, closed, labeled, unlabeled] jobs: main: From 15362d126442682edf81d675bc72a52104f4c51e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 22 Jul 2021 15:54:03 +0200 Subject: [PATCH 02/16] Refactor code-style --- package.json | 6 +----- test.js | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8f06b17..af589e4 100644 --- a/package.json +++ b/package.json @@ -65,11 +65,7 @@ "trailingComma": "none" }, "xo": { - "prettier": true, - "rules": { - "no-var": "off", - "prefer-arrow-callback": "off" - } + "prettier": true }, "remarkConfig": { "plugins": [ diff --git a/test.js b/test.js index 76dfd94..a771f5d 100644 --- a/test.js +++ b/test.js @@ -1,7 +1,7 @@ import test from 'tape' import {scriptSupporting} from './index.js' -test('scriptSupporting', function (t) { +test('scriptSupporting', (t) => { t.equal(scriptSupporting(), false, 'should return `false` without node') t.equal(scriptSupporting(null), false, 'should return `false` with `null`') From 15f5255913d45ddf10191ada4c8768f97b2d3653 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 22 Jul 2021 15:54:32 +0200 Subject: [PATCH 03/16] Add `strict` to `tsconfig.json` --- index.js | 2 +- tsconfig.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 80e1b7b..0223639 100644 --- a/index.js +++ b/index.js @@ -9,5 +9,5 @@ import {convertElement} from 'hast-util-is-element' * Check if a node is a script-supporting element. * @type {AssertScriptOrTemplate} */ -// @ts-ignore Sure, the assertion matches. +// @ts-expect-error Sure, the assertion matches. export const scriptSupporting = convertElement(['script', 'template']) diff --git a/tsconfig.json b/tsconfig.json index be08abe..e31adf8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "declaration": true, "emitDeclarationOnly": true, "allowSyntheticDefaultImports": true, - "skipLibCheck": true + "skipLibCheck": true, + "strict": true } } From 664c488a233449bec66a0be1e6fdb86b280246a7 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 22 Jul 2021 15:54:52 +0200 Subject: [PATCH 04/16] Update `xo` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af589e4..05899fb 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.39.0" + "xo": "^0.42.0" }, "scripts": { "prepack": "npm run build && npm run format", From 26f65507b8b29c82d0218061ebbcaa999f7d6df0 Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Thu, 3 Mar 2022 11:01:42 -0700 Subject: [PATCH 05/16] Add `ignore-scripts` to `.npmrc` --- .npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmrc b/.npmrc index 43c97e7..9951b11 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ package-lock=false +ignore-scripts=true From 45634b4bb56f225d3ea3a775bb3f9b592963674d Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 27 May 2022 17:30:59 +0200 Subject: [PATCH 06/16] Update dev-dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 05899fb..1a0809f 100644 --- a/package.json +++ b/package.json @@ -40,13 +40,13 @@ "@types/tape": "^4.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", - "remark-cli": "^9.0.0", - "remark-preset-wooorm": "^8.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", "rimraf": "^3.0.0", "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.42.0" + "xo": "^0.49.0" }, "scripts": { "prepack": "npm run build && npm run format", From 146fc370317770de0c0cdab5f22b5a7d63ca5c3c Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 27 May 2022 17:33:17 +0200 Subject: [PATCH 07/16] Add improved docs --- readme.md | 100 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 17 deletions(-) diff --git a/readme.md b/readme.md index 192b797..a09a431 100644 --- a/readme.md +++ b/readme.md @@ -8,20 +8,56 @@ [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] -[**hast**][hast] utility to check if an [*element*][element] is -[*script-supporting*][spec]. +[hast][] utility to check if a node is [*script-supporting*][spec]. -## Install +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`scriptSupporting(node)`](#scriptsupportingnode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a small utility that checks if a node is script-supporting +according to HTML. -This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): -Node 12+ is needed to use it and it must be `import`ed instead of `require`d. +## When should I use this? + +This utility is super niche, if you’re here you probably know what you’re +looking for! + +## Install -[npm][]: +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: ```sh npm install hast-util-script-supporting ``` +In Deno with [`esm.sh`][esmsh]: + +```js +import {scriptSupporting} from 'https://esm.sh/hast-util-script-supporting@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + ## Use ```js @@ -43,13 +79,33 @@ scriptSupporting({ ## API -This package exports the following identifiers: `scriptSupporting`. +This package exports the identifier `scriptSupporting`. There is no default export. ### `scriptSupporting(node)` Check if the given value is a [*script-supporting*][spec] [*element*][element]. +###### Parameters + +* `node` ([`Node`][node]) — node to check + +###### Returns + +Whether the `value` is script-supporting (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with all maintained +versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. +Our projects sometimes work with older versions, but this is not guaranteed. + ## Security `hast-util-script-supporting` does not change the syntax tree so there are no @@ -61,13 +117,13 @@ openings for [cross-site scripting (XSS)][xss] attacks. — check if a node is a (certain) element * [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property) — check if a node has a property -* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-body-ok-link) +* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link) — check if a node is “Body OK” link element -* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment) +* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment) — check if a node is a conditional comment -* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-link) +* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link) — check if a node is a CSS link element -* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-style) +* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style) — check if a node is a CSS style element * [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded) — check if a node is an embedded element @@ -75,7 +131,7 @@ openings for [cross-site scripting (XSS)][xss] attacks. — check if a node is a heading element * [`hast-util-interactive`](https://github.com/syntax-tree/hast-util-interactive) — check if a node is interactive -* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-javascript) +* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript) — check if a node is a JavaScript script element * [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable) — check whether a node is labelable @@ -90,8 +146,8 @@ openings for [cross-site scripting (XSS)][xss] attacks. ## Contribute -See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get -started. +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. See [`support.md`][support] for ways to get help. This project has a [code of conduct][coc]. @@ -132,15 +188,23 @@ abide by its terms. [npm]: https://docs.npmjs.com/cli/install +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + [license]: license [author]: https://wooorm.com -[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md -[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md +[support]: https://github.com/syntax-tree/.github/blob/main/support.md -[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md [spec]: https://html.spec.whatwg.org/#script-supporting-elements @@ -148,4 +212,6 @@ abide by its terms. [element]: https://github.com/syntax-tree/hast#element +[node]: https://github.com/syntax-tree/hast#nodes + [xss]: https://en.wikipedia.org/wiki/Cross-site_scripting From f79fc034de4f7c39e61d785eb5e67a65f2b4027b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:27:12 +0100 Subject: [PATCH 08/16] Update dev-dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1a0809f..df597ac 100644 --- a/package.json +++ b/package.json @@ -40,13 +40,13 @@ "@types/tape": "^4.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", - "remark-cli": "^10.0.0", + "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", "rimraf": "^3.0.0", "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.49.0" + "xo": "^0.53.0" }, "scripts": { "prepack": "npm run build && npm run format", From b4bb236c19a0bdec3c0399b21c43854b60dd1cf1 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:27:27 +0100 Subject: [PATCH 09/16] Update Actions --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe284ad..89dc06c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,15 +7,15 @@ jobs: name: ${{matrix.node}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: dcodeIO/setup-node-nvm@master + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{matrix.node}} - run: npm install - run: npm test - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 strategy: matrix: node: - - lts/erbium + - lts/fermium - node From 8cba127530db8373f9f34620d6e24a4a379adcbd Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:27:45 +0100 Subject: [PATCH 10/16] Update `tsconfig.json` --- package.json | 7 +++---- tsconfig.json | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index df597ac..c45d5d0 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "prettier": "^2.0.0", "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", - "rimraf": "^3.0.0", "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", @@ -50,10 +49,10 @@ }, "scripts": { "prepack": "npm run build && npm run format", - "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", - "test-api": "node test.js", - "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { diff --git a/tsconfig.json b/tsconfig.json index e31adf8..1bc9e99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,17 @@ { - "include": ["*.js"], + "include": ["**/**.js"], + "exclude": ["coverage/", "node_modules/"], "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020"], - "module": "ES2020", - "moduleResolution": "node", - "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, - "allowSyntheticDefaultImports": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es2020"], + "module": "node16", + "newLine": "lf", "skipLibCheck": true, - "strict": true + "strict": true, + "target": "es2020" } } From 2208b4b96914017bb9fafbb4bc6644c9f9452a53 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:29:41 +0100 Subject: [PATCH 11/16] Refactor code-style * Add more docs to JSDoc --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0223639..e312395 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,21 @@ /** - * @typedef {import('hast').Element & {tagName: 'script'|'template'}} ScriptOrTemplate - * @typedef {import('hast-util-is-element').AssertPredicate} AssertScriptOrTemplate + * @typedef {import('hast').Element} Element + */ + +/** + * @typedef {import('hast-util-is-element').AssertPredicate} AssertScriptOrTemplate */ import {convertElement} from 'hast-util-is-element' /** * Check if a node is a script-supporting element. + * * @type {AssertScriptOrTemplate} + * @param value + * Thing to check (typically `Node`). + * @returns + * Whether `value` is a script-supporting element. */ // @ts-expect-error Sure, the assertion matches. export const scriptSupporting = convertElement(['script', 'template']) From 14376e706b794bc867dce0145bd1cfdd83869a90 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:30:28 +0100 Subject: [PATCH 12/16] Use Node test runner --- .github/workflows/main.yml | 2 +- package.json | 3 +-- test.js | 23 +++++++++++++---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89dc06c..ee318ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,5 +17,5 @@ jobs: strategy: matrix: node: - - lts/fermium + - lts/hydrogen - node diff --git a/package.json b/package.json index c45d5d0..8a09c5d 100644 --- a/package.json +++ b/package.json @@ -37,12 +37,11 @@ "hast-util-is-element": "^2.0.0" }, "devDependencies": { - "@types/tape": "^4.0.0", + "@types/node": "^18.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", - "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", "xo": "^0.53.0" diff --git a/test.js b/test.js index a771f5d..e068d24 100644 --- a/test.js +++ b/test.js @@ -1,24 +1,29 @@ -import test from 'tape' +import assert from 'node:assert/strict' +import test from 'node:test' import {scriptSupporting} from './index.js' -test('scriptSupporting', (t) => { - t.equal(scriptSupporting(), false, 'should return `false` without node') +test('scriptSupporting', () => { + assert.equal(scriptSupporting(), false, 'should return `false` without node') - t.equal(scriptSupporting(null), false, 'should return `false` with `null`') + assert.equal( + scriptSupporting(null), + false, + 'should return `false` with `null`' + ) - t.equal( + assert.equal( scriptSupporting({type: 'text'}), false, 'should return `false` when without `element`' ) - t.equal( + assert.equal( scriptSupporting({type: 'element'}), false, 'should return `false` when with invalid `element`' ) - t.equal( + assert.equal( scriptSupporting({ type: 'element', tagName: 'a', @@ -29,7 +34,7 @@ test('scriptSupporting', (t) => { 'should return `false` when without not script-supporting' ) - t.equal( + assert.equal( scriptSupporting({ type: 'element', tagName: 'template', @@ -38,6 +43,4 @@ test('scriptSupporting', (t) => { true, 'should return `true` when with script-supporting' ) - - t.end() }) From f651ac807b6e4924c49e6cd4b40cff89e480db1f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:31:08 +0100 Subject: [PATCH 13/16] Refactor to move implementation to `lib/` --- index.js | 22 +--------------------- lib/index.js | 21 +++++++++++++++++++++ package.json | 1 + 3 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 lib/index.js diff --git a/index.js b/index.js index e312395..32e2ef7 100644 --- a/index.js +++ b/index.js @@ -1,21 +1 @@ -/** - * @typedef {import('hast').Element} Element - */ - -/** - * @typedef {import('hast-util-is-element').AssertPredicate} AssertScriptOrTemplate - */ - -import {convertElement} from 'hast-util-is-element' - -/** - * Check if a node is a script-supporting element. - * - * @type {AssertScriptOrTemplate} - * @param value - * Thing to check (typically `Node`). - * @returns - * Whether `value` is a script-supporting element. - */ -// @ts-expect-error Sure, the assertion matches. -export const scriptSupporting = convertElement(['script', 'template']) +export {scriptSupporting} from './lib/index.js' diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..e312395 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,21 @@ +/** + * @typedef {import('hast').Element} Element + */ + +/** + * @typedef {import('hast-util-is-element').AssertPredicate} AssertScriptOrTemplate + */ + +import {convertElement} from 'hast-util-is-element' + +/** + * Check if a node is a script-supporting element. + * + * @type {AssertScriptOrTemplate} + * @param value + * Thing to check (typically `Node`). + * @returns + * Whether `value` is a script-supporting element. + */ +// @ts-expect-error Sure, the assertion matches. +export const scriptSupporting = convertElement(['script', 'template']) diff --git a/package.json b/package.json index 8a09c5d..dd6690c 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "main": "index.js", "types": "index.d.ts", "files": [ + "lib/", "index.d.ts", "index.js" ], From 7b9f9e141538a85128b22f5a184145d388d0b49c Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:31:21 +0100 Subject: [PATCH 14/16] Add tests for exposed identifiers --- test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test.js b/test.js index e068d24..f5ed3c2 100644 --- a/test.js +++ b/test.js @@ -1,8 +1,15 @@ import assert from 'node:assert/strict' import test from 'node:test' import {scriptSupporting} from './index.js' +import * as mod from './index.js' test('scriptSupporting', () => { + assert.deepEqual( + Object.keys(mod).sort(), + ['scriptSupporting'], + 'should expose the public api' + ) + assert.equal(scriptSupporting(), false, 'should return `false` without node') assert.equal( From cb9aed229b974ee7b4819e5a5eaf3b3ab14f0e4c Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:34:30 +0100 Subject: [PATCH 15/16] Add improved docs --- lib/index.js | 2 ++ readme.md | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/index.js b/lib/index.js index e312395..55d24b2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -16,6 +16,8 @@ import {convertElement} from 'hast-util-is-element' * Thing to check (typically `Node`). * @returns * Whether `value` is a script-supporting element. + * + * The elements `script` and `template` are script-supporting. */ // @ts-expect-error Sure, the assertion matches. export const scriptSupporting = convertElement(['script', 'template']) diff --git a/readme.md b/readme.md index a09a431..789e04d 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] -[hast][] utility to check if a node is [*script-supporting*][spec]. +[hast][] utility to check if a node is a [*script-supporting* element][spec]. ## Contents @@ -17,7 +17,7 @@ * [Install](#install) * [Use](#use) * [API](#api) - * [`scriptSupporting(node)`](#scriptsupportingnode) + * [`scriptSupporting(value)`](#scriptsupportingvalue) * [Types](#types) * [Compatibility](#compatibility) * [Security](#security) @@ -38,7 +38,7 @@ looking for! ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 14.14+ and 16.0+), install with [npm][]: ```sh npm install hast-util-script-supporting @@ -79,20 +79,22 @@ scriptSupporting({ ## API -This package exports the identifier `scriptSupporting`. +This package exports the identifier [`scriptSupporting`][scriptsupporting]. There is no default export. -### `scriptSupporting(node)` +### `scriptSupporting(value)` -Check if the given value is a [*script-supporting*][spec] [*element*][element]. +Check if the given value is a [*script-supporting* element][spec]. ###### Parameters -* `node` ([`Node`][node]) — node to check +* `value` (`unknown`) — thing to check (typically [`Node`][node]) ###### Returns -Whether the `value` is script-supporting (`boolean`). +Whether `value` is a script-supporting element (`boolean`). + +The elements `script` and `template` are script-supporting. ## Types @@ -103,7 +105,7 @@ It exports no additional types. Projects maintained by the unified collective are compatible with all maintained versions of Node.js. -As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. +As of now, that is Node.js 14.14+ and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed. ## Security @@ -206,12 +208,12 @@ abide by its terms. [coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md -[spec]: https://html.spec.whatwg.org/#script-supporting-elements +[spec]: https://html.spec.whatwg.org/multipage/dom.html#script-supporting-elements [hast]: https://github.com/syntax-tree/hast -[element]: https://github.com/syntax-tree/hast#element - [node]: https://github.com/syntax-tree/hast#nodes [xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[scriptsupporting]: #scriptsupportingvalue From ba71a5233771453c4cbd0b21dff548713d27f206 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 6 Jan 2023 14:36:10 +0100 Subject: [PATCH 16/16] 2.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd6690c..709d826 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hast-util-script-supporting", - "version": "2.0.0", + "version": "2.0.1", "description": "hast utility to check if a node is a script-supporting element", "license": "MIT", "keywords": [