Skip to content

Commit

Permalink
chore(deps): drop html-tags (#1867)
Browse files Browse the repository at this point in the history

Co-authored-by: Farnabaz <[email protected]>
  • Loading branch information
Tahul and farnabaz authored Jan 30, 2023
1 parent 0c91a38 commit 6775a1f
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version: '16'
cache: yarn
- run: yarn install
- run: yarn dev:prepare
- run: yarn prepare
- run: yarn lint
- run: yarn build
- run: yarn test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Nuxt 2 is supported with Content v1, documentation is on https://content.nuxtjs.

- Clone repository
- Install dependencies using `yarn install`
- Prepare using `yarn dev:prepare`
- Prepare using `yarn prepare`
- Try playground using `yarn dev`

## License
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"scripts": {
"dev": "./scripts/playground.sh",
"dev:build": "nuxi build playground/basic",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground/basic",
"prepare": "nuxt-module-build --stub && nuxi prepare playground/basic",
"dev:fixtures": "./scripts/fixture.sh",
"build": "nuxt-module-build && yarn build:web-types",
"build:docs": "(cd docs && nuxi build)",
Expand All @@ -48,7 +48,6 @@
"defu": "^6.1.2",
"destr": "^1.2.2",
"detab": "^3.0.2",
"html-tags": "^3.2.0",
"json5": "^2.2.3",
"knitwork": "^1.0.0",
"listhen": "^1.0.2",
Expand Down
3 changes: 3 additions & 0 deletions playground/basic/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ export default defineNuxtConfig({
base: resolve(__dirname, 'content-fa')
}
}
},
typescript: {
includeWorkspace: true
}
})
5 changes: 2 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@nuxt/kit'
import { genImport, genSafeVariableName } from 'knitwork'
import type { ListenOptions } from 'listhen'
// eslint-disable-next-line import/no-named-as-default
import defu from 'defu'
import { hash } from 'ohash'
import { join, relative } from 'pathe'
Expand Down Expand Up @@ -307,9 +308,7 @@ export default defineNuxtModule<ModuleOptions>({

config.optimizeDeps = config.optimizeDeps || {}
config.optimizeDeps.include = config.optimizeDeps.include || []
config.optimizeDeps.include.push(
'html-tags', 'slugify'
)
config.optimizeDeps.include.push('slugify')
})

nuxt.hook('nitro:config', (nitroConfig) => {
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/components/ContentRendererMarkdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { h, resolveComponent, Text, defineComponent } from 'vue'
import destr from 'destr'
import { pascalCase } from 'scule'
import { find, html } from 'property-information'
// eslint-disable-next-line import/no-named-as-default
import htmlTags from 'html-tags'
import type { VNode, ConcreteComponent } from 'vue'
import { useRuntimeConfig, useRoute } from '#app'
import htmlTags from '../utils/html-tags'
import type { MarkdownNode, ParsedContentMeta } from '../types'
type CreateElement = typeof h
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/markdown-parser/handler/paragraph.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { H } from 'mdast-util-to-hast'
import { all } from 'mdast-util-to-hast'
// eslint-disable-next-line import/no-named-as-default
import htmlTags from 'html-tags'
import { kebabCase } from 'scule'
import htmlTags from '../../utils/html-tags'
import { getTagName } from './utils'

export default function paragraph (h: H, node: any) {
Expand Down
1 change: 1 addition & 0 deletions src/runtime/markdown-parser/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-named-as-default
import defu from 'defu'
import remarkEmoji from 'remark-emoji'
import rehypeSlug from 'rehype-slug'
Expand Down
1 change: 1 addition & 0 deletions src/runtime/server/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { prefixStorage } from 'unstorage'
import { joinURL, withLeadingSlash, withoutTrailingSlash } from 'ufo'
import { hash as ohash } from 'ohash'
import type { H3Event } from 'h3'
// eslint-disable-next-line import/no-named-as-default
import defu from 'defu'
import type { QueryBuilderParams, ParsedContent, QueryBuilder, ContentTransformer } from '../types'
import { createQuery } from '../query/query'
Expand Down
120 changes: 120 additions & 0 deletions src/runtime/utils/html-tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Ref https://github.com/sindresorhus/html-tags/blob/v3.2.0/html-tags.json
export default [
'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',
'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'
]
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4340,7 +4340,7 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==

html-tags@^3.1.0, html-tags@^3.2.0:
html-tags@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.2.0.tgz#dbb3518d20b726524e4dd43de397eb0a95726961"
integrity sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==
Expand Down

0 comments on commit 6775a1f

Please sign in to comment.