New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-spec-tags

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-spec-tags - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

configs/dep-cruiser.config.cts

15

dist/all-tags.d.ts

@@ -1,5 +0,5 @@

import { PropertyValueType } from '@augment-vir/common';
import { HtmlSpecTagName, htmlSpecConstructorsByTagName } from './html';
import { MathmlSpecTagName, mathmlSpecConstructorsByTagName } from './mathml';
import { SvgSpecTagName, svgSpecConstructorsByTagName } from './svg';
import { type Values } from '@augment-vir/common';
import { HtmlSpecTagName, htmlSpecConstructorsByTagName } from './html.js';
import { MathmlSpecTagName, mathmlSpecConstructorsByTagName } from './mathml.js';
import { SvgSpecTagName, svgSpecConstructorsByTagName } from './svg.js';
/** All possible spec tag names in a single array. */

@@ -10,3 +10,3 @@ export declare const allSpecTagNames: ReadonlyArray<SpecTagName>;

/** Any of the possible spec tag name constructors. */
export type SpecTagNameConstructor = PropertyValueType<typeof htmlSpecConstructorsByTagName> | PropertyValueType<typeof mathmlSpecConstructorsByTagName> | PropertyValueType<typeof svgSpecConstructorsByTagName>;
export type SpecTagNameConstructor = Values<typeof htmlSpecConstructorsByTagName> | Values<typeof mathmlSpecConstructorsByTagName> | Values<typeof svgSpecConstructorsByTagName>;
/**

@@ -31,6 +31,1 @@ * Get the constructor for the given tag name. Since there are some duplicate tag names, the

export declare function ensureSpecTagName(input: unknown): SpecTagName;
/**
* Get a spec tag name from the given constructor. Note that some constructors match multiple tags
* so you might get an unexpected output here.
*/
export declare function getSpecTagNameFromConstructor(constructor: SpecTagNameConstructor): SpecTagName;

@@ -1,7 +0,6 @@

import { isTruthy, typedArrayIncludes, wrapInTry } from '@augment-vir/common';
import { AssertionError, assertRunTimeType, isRunTimeType } from 'run-time-assertions';
import { allHtmlSpecTagNames, htmlSpecConstructorsByTagName } from './html';
import { allMathmlSpecTagNames, mathmlSpecConstructorsByTagName } from './mathml';
import { allSvgSpecTagNames, svgSpecConstructorsByTagName } from './svg';
import { specTagNameByConstructor } from './tag-name-by-constructor';
import { AssertionError, assert, check } from '@augment-vir/assert';
import { wrapInTry } from '@augment-vir/common';
import { allHtmlSpecTagNames, htmlSpecConstructorsByTagName } from './html.js';
import { allMathmlSpecTagNames, mathmlSpecConstructorsByTagName, } from './mathml.js';
import { allSvgSpecTagNames, svgSpecConstructorsByTagName } from './svg.js';
/** All possible spec tag names in a single array. */

@@ -36,7 +35,6 @@ export const allSpecTagNames = Array.from(new Set([

export function isSpecTagName(input) {
return wrapInTry({
callback() {
assertSpecTagName(input);
return true;
},
return wrapInTry(() => {
assertSpecTagName(input);
return true;
}, {
fallbackValue: false,

@@ -47,10 +45,5 @@ });

export function assertSpecTagName(input, failureMessage) {
assertRunTimeType(input, 'string', failureMessage);
if (!typedArrayIncludes(allSpecTagNames, input)) {
throw new AssertionError([
`'${input}' is not tag name`,
failureMessage,
]
.filter(isTruthy)
.join(': '));
assert.isString(input, failureMessage);
if (!check.hasValue(allSpecTagNames, input)) {
throw new AssertionError(`'${input}' is not tag name`, failureMessage);
}

@@ -63,19 +56,8 @@ }

}
else if (!isRunTimeType(input, 'string')) {
throw new Error(`'${JSON.stringify(input)}' is not a string, it cannot be a valid tag name.`);
else if (check.isString(input)) {
throw new TypeError(`'${input}' is not a valid tag name.`);
}
else {
throw new Error(`'${input}' is not a valid tag name.`);
throw new TypeError(`'${JSON.stringify(input)}' is not a string, it cannot be a valid tag name.`);
}
}
/**
* Get a spec tag name from the given constructor. Note that some constructors match multiple tags
* so you might get an unexpected output here.
*/
export function getSpecTagNameFromConstructor(constructor) {
const tagName = specTagNameByConstructor.get(constructor);
if (!tagName) {
throw new TypeError(`'${constructor.name}' is not a valid spec tag name constructor.`);
}
return tagName;
}
import { Constructor } from 'type-fest';
import { htmlSpecConstructorsByTagName } from './html';
import { mathmlSpecConstructorsByTagName } from './mathml';
import { svgSpecConstructorsByTagName } from './svg';
import { htmlSpecConstructorsByTagName } from './html.js';
import { mathmlSpecConstructorsByTagName } from './mathml.js';
import { svgSpecConstructorsByTagName } from './svg.js';
type SpecAsserter<ConstructorMap extends Readonly<Record<string, Constructor<Element>>>> = (input: unknown, failureMessage?: string | undefined) => asserts input is keyof ConstructorMap;

@@ -11,3 +11,3 @@ /** Type guards the input as a valid SVG spec tag name. */

/** Passes the input through if it's a valid SVG spec tag name. Throws an error if not. */
export declare const ensureSvgSpecTagName: (input: unknown) => "symbol" | "a" | "script" | "style" | "title" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view";
export declare const ensureSvgSpecTagName: (this: void, input: unknown) => "symbol" | "a" | "script" | "style" | "title" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view";
/** Type guards the input as a valid SVG spec tag name. */

@@ -18,3 +18,3 @@ export declare const isHtmlSpecTagName: (input: unknown) => input is "object" | "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" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "search" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr";

/** Passes the input through if it's a valid HTML spec tag name. Throws an error if not. */
export declare const ensureHtmlSpecTagName: (input: unknown) => "object" | "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" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "search" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr";
export declare const ensureHtmlSpecTagName: (this: void, input: unknown) => "object" | "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" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "search" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr";
/** Type guards the input as a valid MathML spec tag name. */

@@ -25,3 +25,3 @@ export declare const isMathmlSpecTagName: (input: unknown) => input is "annotation" | "annotation-xml" | "maction" | "math" | "merror" | "mfrac" | "mi" | "mmultiscripts" | "mn" | "mo" | "mover" | "mpadded" | "mphantom" | "mprescripts" | "mroot" | "mrow" | "ms" | "mspace" | "msqrt" | "mstyle" | "msub" | "msubsup" | "msup" | "mtable" | "mtd" | "mtext" | "mtr" | "munder" | "munderover" | "semantics";

/** Passes the input through if it's a valid MathML spec tag name. Throws an error if not. */
export declare const ensureMathmlSpecTagName: (input: unknown) => "annotation" | "annotation-xml" | "maction" | "math" | "merror" | "mfrac" | "mi" | "mmultiscripts" | "mn" | "mo" | "mover" | "mpadded" | "mphantom" | "mprescripts" | "mroot" | "mrow" | "ms" | "mspace" | "msqrt" | "mstyle" | "msub" | "msubsup" | "msup" | "mtable" | "mtd" | "mtext" | "mtr" | "munder" | "munderover" | "semantics";
export declare const ensureMathmlSpecTagName: (this: void, input: unknown) => "annotation" | "annotation-xml" | "maction" | "math" | "merror" | "mfrac" | "mi" | "mmultiscripts" | "mn" | "mo" | "mover" | "mpadded" | "mphantom" | "mprescripts" | "mroot" | "mrow" | "ms" | "mspace" | "msqrt" | "mstyle" | "msub" | "msubsup" | "msup" | "mtable" | "mtd" | "mtext" | "mtr" | "munder" | "munderover" | "semantics";
export {};

@@ -1,24 +0,18 @@

import { isTruthy, wrapInTry } from '@augment-vir/common';
import { AssertionError, assertRunTimeType, isRunTimeType } from 'run-time-assertions';
import { htmlSpecConstructorsByTagName } from './html';
import { mathmlSpecConstructorsByTagName } from './mathml';
import { svgSpecConstructorsByTagName } from './svg';
import { assert, AssertionError, check } from '@augment-vir/assert';
import { wrapInTry } from '@augment-vir/common';
import { htmlSpecConstructorsByTagName } from './html.js';
import { mathmlSpecConstructorsByTagName } from './mathml.js';
import { svgSpecConstructorsByTagName } from './svg.js';
function createAsserters(constructorMap, name) {
function assertTypeGuard(input, failureMessage) {
assertRunTimeType(input, 'string', failureMessage);
assert.isString(input, failureMessage);
if (!(input in constructorMap)) {
throw new AssertionError([
`'${input}' is not a ${name} element tag name`,
failureMessage,
]
.filter(isTruthy)
.join(': '));
throw new AssertionError(`'${input}' is not a ${name} element tag name`, failureMessage);
}
}
function typeGuard(input) {
return wrapInTry({
callback() {
assertTypeGuard(input);
return true;
},
return wrapInTry(() => {
assertTypeGuard(input);
return true;
}, {
fallbackValue: false,

@@ -34,7 +28,7 @@ });

}
else if (!isRunTimeType(input, 'string')) {
throw new Error(`'${JSON.stringify(input)}' is not a string, it cannot be a valid ${name} tag name.`);
else if (check.isString(input)) {
throw new TypeError(`'${input}' is not a valid ${name} tag name.`);
}
else {
throw new Error(`'${input}' is not a valid ${name} tag name.`);
throw new TypeError(`'${JSON.stringify(input)}' is not a string, it cannot be a valid ${name} tag name.`);
}

@@ -41,0 +35,0 @@ },

@@ -1,5 +0,5 @@

export * from './all-tags';
export * from './assertions';
export * from './html';
export * from './mathml';
export * from './svg';
export * from './all-tags.js';
export * from './assertions.js';
export * from './html.js';
export * from './mathml.js';
export * from './svg.js';

@@ -1,5 +0,5 @@

export * from './all-tags';
export * from './assertions';
export * from './html';
export * from './mathml';
export * from './svg';
export * from './all-tags.js';
export * from './assertions.js';
export * from './html.js';
export * from './mathml.js';
export * from './svg.js';

@@ -1,2 +0,7 @@

import { SpecTagName, SpecTagNameConstructor } from './all-tags';
import { SpecTagName, SpecTagNameConstructor } from './all-tags.js';
export declare const specTagNameByConstructor: Map<SpecTagNameConstructor, SpecTagName>;
/**
* Get a spec tag name from the given constructor. Note that some constructors match multiple tags
* so you might get an unexpected output here.
*/
export declare function getSpecTagNameFromConstructor(constructor: SpecTagNameConstructor): SpecTagName;
import { getObjectTypedEntries } from '@augment-vir/common';
import { htmlSpecConstructorsByTagName } from './html';
import { mathmlSpecConstructorsByTagName } from './mathml';
import { svgSpecConstructorsByTagName } from './svg';
import { htmlSpecConstructorsByTagName } from './html.js';
import { mathmlSpecConstructorsByTagName } from './mathml.js';
import { svgSpecConstructorsByTagName } from './svg.js';
const constructorEntries = [

@@ -26,1 +26,12 @@ getObjectTypedEntries(htmlSpecConstructorsByTagName).map(([tagName, constructor,]) => {

export const specTagNameByConstructor = new Map(constructorEntries);
/**
* Get a spec tag name from the given constructor. Note that some constructors match multiple tags
* so you might get an unexpected output here.
*/
export function getSpecTagNameFromConstructor(constructor) {
const tagName = specTagNameByConstructor.get(constructor);
if (!tagName) {
throw new TypeError(`'${constructor.name}' is not a valid spec tag name constructor.`);
}
return tagName;
}
{
"name": "html-spec-tags",
"version": "2.2.0",
"version": "2.2.1",
"description": "All HTML tags supported by the current spec. With types!",

@@ -19,3 +19,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/electrovir/html-spec-tags"
"url": "git+https://github.com/electrovir/html-spec-tags.git"
},

@@ -27,3 +27,5 @@ "license": "(MIT or CC0 1.0)",

},
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",

@@ -34,43 +36,61 @@ "scripts": {

"format": "virmator format",
"publish": "virmator publish \"npm run compile && npm run test:all\"",
"test": "virmator test-web",
"test:all": "concurrently --colors --kill-others-on-fail -c auto --names types,tests,spelling,format,docs \"npm run test:types\" \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\"",
"lint": "virmator lint fix",
"publish": "virmator publish npm run test:all",
"test": "virmator test web",
"test:all": "npm run compile && concurrently --colors --kill-others-on-fail -c auto --names tests,spelling,format,docs,deps,lint \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\" \"npm run test:deps\" \"npm run test:lint\"",
"test:coverage": "npm run test coverage",
"test:deps": "virmator deps check",
"test:docs": "virmator docs check",
"test:format": "virmator format check",
"test:spelling": "virmator spellcheck",
"test:types": "tsc --noEmit"
"test:lint": "virmator lint",
"test:spelling": "virmator spellcheck"
},
"dependencies": {
"@augment-vir/common": "^23.4.0",
"run-time-assertions": "^1.0.0"
"@augment-vir/assert": "^30.0.3",
"@augment-vir/common": "^30.0.3"
},
"devDependencies": {
"@augment-vir/browser-testing": "^23.4.0",
"@open-wc/testing": "^4.0.0",
"@types/mocha": "^10.0.6",
"@augment-vir/test": "^30.0.4",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.10.0",
"@stylistic/eslint-plugin": "^2.8.0",
"@stylistic/eslint-plugin-ts": "^2.8.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@web/dev-server-esbuild": "^1.0.2",
"@web/test-runner": "^0.18.0",
"@web/test-runner": "^0.19.0",
"@web/test-runner-commands": "^0.9.0",
"@web/test-runner-playwright": "^0.11.0",
"@web/test-runner-visual-regression": "^0.9.0",
"cspell": "^8.4.1",
"dependency-cruiser": "^16.2.1",
"esbuild": "^0.20.1",
"@web/test-runner-visual-regression": "^0.10.0",
"cspell": "^8.14.2",
"dependency-cruiser": "^16.4.1",
"esbuild": "^0.23.1",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^50.2.3",
"eslint-plugin-monorepo-cop": "^1.0.2",
"eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-sonarjs": "^2.0.2",
"eslint-plugin-unicorn": "^55.0.0",
"istanbul-smart-text-reporter": "^1.1.4",
"markdown-code-example-inserter": "^1.0.0",
"npm-check-updates": "~16.12.3",
"prettier": "^3.2.5",
"markdown-code-example-inserter": "^2.0.3",
"npm-check-updates": "^17.1.1",
"prettier": "^3.3.3",
"prettier-plugin-interpolated-html-tags": "^1.0.5",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-multiline-arrays": "^3.0.4",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-packagejson": "^2.4.12",
"prettier-plugin-sort-json": "^3.1.0",
"prettier-plugin-multiline-arrays": "^3.0.6",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-packagejson": "^2.5.2",
"prettier-plugin-sort-json": "^4.0.0",
"prettier-plugin-toml": "^2.0.1",
"type-fest": "^4.10.3",
"typedoc": "^0.25.8",
"typescript": "^5.3.3",
"virmator": "^11.4.0"
"type-fest": "^4.26.1",
"typedoc": "^0.26.7",
"typescript": "^5.6.2",
"typescript-eslint": "^8.5.0",
"virmator": "^13.3.14"
},
"engines": {
"node": ">=22"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc