From d6fbc38595f510a2331fb6e8d10628e0fb90402c Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Thu, 11 May 2023 17:23:40 +0300 Subject: [PATCH] Fix memory leak in SSR docs (#3386) * chore: add serve node module to docs * chore: fix generate build command * chore: fix ts build * chore: fix ts build issues and sync all deps * chore: fix i18n build error * fix(docs): markdownit build error * fix: types build and update ts to ^5.0 * raw new markdown * fix(docs): memory leaks in ssr * fix(build): typo * fix(docs): show old props with vue-component-meta * raw markdown plugins * fix(docs): external links * fix(docs): update node to 18 * docs(chore): remove markdown-it * fix(deps): remove hardcoded deps * chore(deps): update ts to 5 * chore(deps): update eslint to ^7 --- .eslintignore | 1 - .nvmrc | 2 +- package.json | 9 +- packages/deploy/package.json | 6 +- packages/docs/i18n.config.ts | 7 - packages/docs/modules/markdown/index.ts | 11 +- .../docs/modules/markdown/runtime/plugin.ts | 35 - .../runtime/plugins/external-links.spec.ts | 13 + .../runtime/plugins/external-links.ts | 24 + .../runtime/plugins/localized-links.ts | 30 + .../set-class-attribute-to-external-links.ts | 23 - .../set-origin-location-to-relative-links.ts | 53 - .../modules/markdown/runtime/useMarkdown.ts | 29 + .../modules/markdown/runtime/useMarkdownIt.ts | 5 - .../blocks/api/component-parser/index.ts | 45 +- .../page-config/blocks/api/transform.ts | 20 +- .../page-config/blocks/markdown/index.vue | 1 + .../blocks/shared/markdown/MarkdownView.vue | 57 +- .../page-config/runtime/usePageConfig.ts | 2 +- packages/docs/package.json | 13 +- packages/nuxt/package.json | 4 +- packages/sandbox/package.json | 12 +- packages/ui/package.json | 14 +- .../components/va-accordion/VaAccordion.vue | 2 +- .../ui/src/components/va-alert/VaAlert.vue | 2 +- .../va-avatar-group/VaAvatarGroup.vue | 1 - .../src/components/va-carousel/VaCarousel.vue | 2 +- .../va-color-indicator/VaColorIndicator.vue | 2 +- .../va-color-input/VaColorInput.vue | 2 +- .../va-color-palette/VaColorPalette.vue | 2 +- .../src/components/va-dropdown/VaDropdown.vue | 4 +- .../src/components/va-form/VaForm-reset.vue | 54 +- .../ui/src/components/va-hover/VaHover.vue | 2 +- .../va-infinite-scroll/VaInfiniteScroll.vue | 2 +- .../va-option-list/VaOptionList.vue | 2 +- .../components/va-pagination/VaPagination.vue | 2 +- .../va-skeleton/tests/VaSkeleton.spec.ts | 9 +- .../ui/src/components/va-split/VaSplit.vue | 4 +- .../va-time-picker/VaTimePicker.vue | 2 +- .../VaTimePickerColumn/VaTimePickerColumn.vue | 2 +- .../composables/tests/createTestComposable.ts | 8 +- packages/ui/src/composables/useCache.ts | 12 +- packages/ui/src/composables/useClearable.ts | 2 +- packages/ui/src/composables/useColors.ts | 2 +- .../useElementBackground.ts | 6 +- packages/ui/src/composables/useFocus.ts | 2 +- .../ui/src/composables/useGlobalConfig.ts | 16 +- .../ui/src/composables/useMaxSelections.ts | 2 +- packages/ui/src/composables/useParsable.ts | 4 +- packages/ui/src/composables/useStateful.ts | 3 +- packages/ui/src/composables/useSyncProp.ts | 7 +- packages/ui/src/composables/useValidation.ts | 2 +- .../ui/src/services/cache/plugin/index.ts | 2 + packages/ui/src/services/cache/types.ts | 5 +- packages/ui/src/services/color/utils.ts | 4 +- .../services/colors-classes/config/default.ts | 2 + .../services/colors-classes/plugin/index.ts | 6 +- .../ui/src/services/component-config/types.ts | 2 +- .../services/global-config/global-config.ts | 23 +- .../vue-plugin/utils/global-properties.ts | 2 +- .../extract-component-options.ts | 1 - .../ui/src/utils/component-options/types.ts | 38 +- .../TempMap.ts => utils/temp-map.ts} | 0 packages/ui/tsconfig.json | 3 +- postcss.config.js | 5 - tsconfig.json | 38 - yarn.lock | 9178 +++++++---------- 67 files changed, 4300 insertions(+), 5587 deletions(-) delete mode 100644 .eslintignore delete mode 100644 packages/docs/i18n.config.ts delete mode 100644 packages/docs/modules/markdown/runtime/plugin.ts create mode 100644 packages/docs/modules/markdown/runtime/plugins/external-links.spec.ts create mode 100644 packages/docs/modules/markdown/runtime/plugins/external-links.ts create mode 100644 packages/docs/modules/markdown/runtime/plugins/localized-links.ts delete mode 100644 packages/docs/modules/markdown/runtime/rules/set-class-attribute-to-external-links.ts delete mode 100644 packages/docs/modules/markdown/runtime/rules/set-origin-location-to-relative-links.ts create mode 100644 packages/docs/modules/markdown/runtime/useMarkdown.ts delete mode 100644 packages/docs/modules/markdown/runtime/useMarkdownIt.ts rename packages/ui/src/{composables/useElementBackground/TempMap.ts => utils/temp-map.ts} (100%) delete mode 100644 postcss.config.js delete mode 100644 tsconfig.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e362b0bc57..0000000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -packages/docs/page-config/* \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index 990aa30c7a..ef8cc4cc7a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.16.0 +v18.14.0 diff --git a/package.json b/package.json index bbd93e76ff..60e44bd63b 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "repository": "https://github.com/epicmaxco/vuestic-ui", "devDependencies": { "lerna": "^3.20.2", + "syncpack": "^9.8.6", "yorkie": "^2.0.0" }, "private": true, @@ -17,6 +18,7 @@ "build:book": "yarn workspace vuestic-ui build:book", "build:types": "yarn workspace vuestic-ui build:types", "test:unit": "yarn workspace vuestic-ui test:unit", + "test:bundlers": "yarn workspace bundler-test test", "lint:style": "yarn workspace vuestic-ui lint:style", "serve:docs": "yarn workspace docs serve", "build:docs": "yarn workspace docs build", @@ -39,12 +41,5 @@ }, "gitHooks": { "pre-commit": "lerna run --concurrency 1 --stream precommit --since HEAD" - }, - "resolutions": { - "nuxt": "3.1.1", - "vue": "3.2.37", - "vite": "^4", - "vue-router": "4.1.6", - "@nuxt/schema": "3.0.0" } } diff --git a/packages/deploy/package.json b/packages/deploy/package.json index 21eb5cd3d4..b7d988f530 100644 --- a/packages/deploy/package.json +++ b/packages/deploy/package.json @@ -6,10 +6,10 @@ "release": "tsx release-script/release-script.ts" }, "devDependencies": { - "tsx": "^3.5.0", + "tsx": "^3.12.1", "inquirer": "^9.0.0", - "typescript": "^4.3.2", - "chalk": "^5.0.1" + "typescript": "^5", + "chalk": "^5.2.0" }, "exports": { "./execute": "./execute/index.ts" diff --git a/packages/docs/i18n.config.ts b/packages/docs/i18n.config.ts deleted file mode 100644 index 69eb8d43c9..0000000000 --- a/packages/docs/i18n.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default defineI18nConfig(nuxt => ({ - fallbackLocale: 'en', - silentTranslationWarn: true, - silentFallbackWarn: true, - warnHtmlInMessage: 'off', - escapeParameterHtml: true, -})) \ No newline at end of file diff --git a/packages/docs/modules/markdown/index.ts b/packages/docs/modules/markdown/index.ts index ba5b3db2a5..6a3a055d42 100644 --- a/packages/docs/modules/markdown/index.ts +++ b/packages/docs/modules/markdown/index.ts @@ -6,14 +6,11 @@ export default defineNuxtModule({ mame: 'vuestic:markdown', }, - setup(_, nuxt) { - nuxt.options.plugins.push(resolve(__dirname, 'runtime/plugin.ts')) - - + setup() { addImports({ - name: 'useMarkdownIt', - as: 'useMarkdownIt', - from: resolve(__dirname, './runtime/useMarkdownIt'), + name: 'useMarkdown', + as: 'useMarkdown', + from: resolve(__dirname, './runtime/useMarkdown'), }) } }) \ No newline at end of file diff --git a/packages/docs/modules/markdown/runtime/plugin.ts b/packages/docs/modules/markdown/runtime/plugin.ts deleted file mode 100644 index 6945492c0f..0000000000 --- a/packages/docs/modules/markdown/runtime/plugin.ts +++ /dev/null @@ -1,35 +0,0 @@ -// @ts-ignore -import MarkdownIt from 'markdown-it' -// @ts-ignore -import markdownItAttrs from 'markdown-it-attrs' -import { - setOriginLocationToRelativeLinks, -} from './rules/set-origin-location-to-relative-links' -import { setClassAttributeToExternalLinks, AttributesOptions } from './rules/set-class-attribute-to-external-links' -import { useMarkdownProvideKey } from './useMarkdownIt'; - -const md = new MarkdownIt({ - breaks: true, - typographer: true, - html: true, -}) - -export const attributesOptions: AttributesOptions = { - className: '', -} - -export default defineNuxtPlugin((nuxtApp) => { - const localeOptions = { - // Reactive access to locale - get currentLocale() { return nuxtApp.vueApp.config.globalProperties.$i18n.locale } - } - - md.use(setOriginLocationToRelativeLinks, localeOptions) - .use(setClassAttributeToExternalLinks, attributesOptions) - .use(markdownItAttrs, { - leftDelimiter: '[[', - rightDelimiter: ']]', - }) - - nuxtApp.vueApp.provide(useMarkdownProvideKey, md) -}) \ No newline at end of file diff --git a/packages/docs/modules/markdown/runtime/plugins/external-links.spec.ts b/packages/docs/modules/markdown/runtime/plugins/external-links.spec.ts new file mode 100644 index 0000000000..7625d6c520 --- /dev/null +++ b/packages/docs/modules/markdown/runtime/plugins/external-links.spec.ts @@ -0,0 +1,13 @@ +import { it, describe, expect } from 'vitest'; +import { marked } from 'marked'; +import { fixTargetLinks } from './external-links'; + +describe('externalLinkMarkedPlugin', () => { + it('targetBlankPlugin: adds target="_blank" to links', () => { + const markdown = `[vue-press](https://vuepress.vuejs.org/)[[target=_blank]]`; + const html = fixTargetLinks(marked(markdown)); + + expect(/target="_blank"/.test(html)).toBeTruthy(); + }); +}) + diff --git a/packages/docs/modules/markdown/runtime/plugins/external-links.ts b/packages/docs/modules/markdown/runtime/plugins/external-links.ts new file mode 100644 index 0000000000..a973a5d016 --- /dev/null +++ b/packages/docs/modules/markdown/runtime/plugins/external-links.ts @@ -0,0 +1,24 @@ +const addAttrToLink = (str: string, attr: string) => { + const [start, end] = str.split(' { + const targetRegex = /\[\[(.*?)\]\]/g; // Search for the [[target="_blank"]] in the markdown. + const linkRegexPattern = /]*>.*<\/a>\[\[(.*)\]\]/g; // Searching for all tags + + let matchedTarget; + + while ((matchedTarget = linkRegexPattern.exec(textToRender)) !== null) { + let target = matchedTarget[1].trim().replaceAll('"', '"') + if (target === 'target=_blank') { + target = 'target="_blank"'; + } + const [link] = matchedTarget + + textToRender = addAttrToLink(textToRender + .replace(link, link.replace(targetRegex, '')), target) + } + + return textToRender; +} diff --git a/packages/docs/modules/markdown/runtime/plugins/localized-links.ts b/packages/docs/modules/markdown/runtime/plugins/localized-links.ts new file mode 100644 index 0000000000..95c2534b07 --- /dev/null +++ b/packages/docs/modules/markdown/runtime/plugins/localized-links.ts @@ -0,0 +1,30 @@ +import { Renderer, Parser } from 'marked' +import { Ref } from 'vue' +export const externalLinkStartWith = ['http://', 'https://'] + +export function localizedLinkMarkedPlugin(locale: Ref) { + const renderer = new Renderer(); + const originalRenderer = renderer.link; + + renderer.link = function (href, title, text) { + const isExternalLink = externalLinkStartWith.some((item) => href?.startsWith(item)) + + if (isExternalLink) { + return originalRenderer.call(renderer, href, title, text); + } + + const normalizedHref = href?.startsWith('/') + ? href.substring(1) + : href + + const localePrefix = `${locale.value}/` + + if (normalizedHref?.startsWith(localePrefix)) { + return originalRenderer.call(renderer, href, title, text); + } + + return originalRenderer.call(renderer, '/' + localePrefix + href, title, text); + } + + return { renderer }; +} \ No newline at end of file diff --git a/packages/docs/modules/markdown/runtime/rules/set-class-attribute-to-external-links.ts b/packages/docs/modules/markdown/runtime/rules/set-class-attribute-to-external-links.ts deleted file mode 100644 index eca566a124..0000000000 --- a/packages/docs/modules/markdown/runtime/rules/set-class-attribute-to-external-links.ts +++ /dev/null @@ -1,23 +0,0 @@ -export type AttributesOptions = { - className: string, -} - -export const setClassAttributeToExternalLinks = (md: any, attributesOptions: AttributesOptions): void => { - const defaultRender = md.renderer.rules.link_open || function (tokens: any, idx: number, options: any, env: any, self: any) { - return self.renderToken(tokens, idx, options) - } - - md.renderer.rules.link_open = function (tokens: any, idx: number, options: any, env: any, self: any) { - const token = tokens[idx] - - if (token.attrIndex('target') >= 0) { - const isExternalLink = (token.attrGet('target') === '_blank') - - if (isExternalLink) { - token.attrJoin('class', attributesOptions.className) - } - } - - return defaultRender(tokens, idx, options, env, self) - } -} diff --git a/packages/docs/modules/markdown/runtime/rules/set-origin-location-to-relative-links.ts b/packages/docs/modules/markdown/runtime/rules/set-origin-location-to-relative-links.ts deleted file mode 100644 index 478e9da3db..0000000000 --- a/packages/docs/modules/markdown/runtime/rules/set-origin-location-to-relative-links.ts +++ /dev/null @@ -1,53 +0,0 @@ -export const externalLinkStartWith = ['http://', 'https://'] - -export type LocaleOptions = { - currentLocale: string; -}; - -export const setOriginLocationToRelativeLinks = ( - md: any, - localeOptions: LocaleOptions, -): void => { - const defaultRender = - md.renderer.rules.link_open || - function (tokens: any, idx: number, options: any, env: any, self: any) { - return self.renderToken(tokens, idx, options) - } - - md.renderer.rules.link_open = function ( - tokens: any, - idx: number, - options: any, - env: any, - self: any, - ) { - const token = tokens[idx] - - if (token.attrIndex('href') < 0) { - return defaultRender(tokens, idx, options, env, self) - } - - const hrefAttrValue: string = token.attrGet('href') - - if (hrefAttrValue.startsWith(`/${localeOptions.currentLocale}/`)) { - return defaultRender(tokens, idx, options, env, self) - } - - const isExternalLink = externalLinkStartWith.some((item) => hrefAttrValue.startsWith(item)) - - if (isExternalLink) { - return defaultRender(tokens, idx, options, env, self) - } - - const normalizedHref = hrefAttrValue.startsWith('/') - ? hrefAttrValue.substring(1) - : hrefAttrValue - - token.attrSet( - 'href', - `/${localeOptions.currentLocale}/${normalizedHref}`, - ) - - return defaultRender(tokens, idx, options, env, self) - } -} diff --git a/packages/docs/modules/markdown/runtime/useMarkdown.ts b/packages/docs/modules/markdown/runtime/useMarkdown.ts new file mode 100644 index 0000000000..ba6f7b271d --- /dev/null +++ b/packages/docs/modules/markdown/runtime/useMarkdown.ts @@ -0,0 +1,29 @@ +import { InjectionKey } from "vue" +import { marked } from 'marked'; +import { fixTargetLinks } from "./plugins/external-links"; +import { localizedLinkMarkedPlugin } from './plugins/localized-links' + +let localizePlugin: null | ReturnType = null + +export const useMarkdownProvideKey = 'vuestic:markdown' as unknown as InjectionKey> + +export const useMarkdown = () => { + const { locale } = useI18n() + + if (!localizePlugin) { + localizePlugin = localizedLinkMarkedPlugin(locale) + marked.use(localizePlugin) + } else { + marked.use(localizePlugin) + } + + const parse = (markdown: string) => { + return fixTargetLinks((marked.parse(markdown)).toString()) + } + + const parseInline = (markdown: string) => { + return fixTargetLinks((marked.parseInline(markdown)).toString()) + } + + return { parse, parseInline } +} \ No newline at end of file diff --git a/packages/docs/modules/markdown/runtime/useMarkdownIt.ts b/packages/docs/modules/markdown/runtime/useMarkdownIt.ts deleted file mode 100644 index 6053024dbc..0000000000 --- a/packages/docs/modules/markdown/runtime/useMarkdownIt.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const useMarkdownProvideKey = 'vuestic:markdown' - -export const useMarkdownIt = () => { - return inject(useMarkdownProvideKey) -} \ No newline at end of file diff --git a/packages/docs/modules/page-config/blocks/api/component-parser/index.ts b/packages/docs/modules/page-config/blocks/api/component-parser/index.ts index d109bd4cd1..64c8c6b452 100644 --- a/packages/docs/modules/page-config/blocks/api/component-parser/index.ts +++ b/packages/docs/modules/page-config/blocks/api/component-parser/index.ts @@ -1,5 +1,7 @@ import type { DefineComponent, ComponentOptions } from "vue" import { isArray, isObject, isFunction, kebabCase } from 'lodash' +import * as components from 'vuestic-ui' +import { EventMeta, PropertyMeta } from "vue-component-meta" function getComponentOptions (component: DefineComponent): ComponentOptions { if (component.options) { @@ -10,7 +12,7 @@ function getComponentOptions (component: DefineComponent): ComponentOptions { return { ...component.__vccOpts, ...component.__b } } - return component + return component as ComponentOptions } /** @@ -58,8 +60,8 @@ export type EventOptionsCompiled = Record & { } export type CompiledComponentOptions = { - props: Record, - emits: Record, + props: PropertyMeta[], + emits: EventMeta[], } /** @@ -95,14 +97,17 @@ function getDefaultValue (propOptions: Record, types: Array return defaultValue + '' } -function convertComponentPropToApiDocs (propName: T, propOptionsRecord: Record): PropOptionsCompiled { +function convertComponentPropToApiDocs (propName: T, propOptionsRecord: Record): PropertyMeta { const types = getTypes(propOptionsRecord[propName]) return { - types, + name: propName, + global: false, + description: '', + type: types.join(' | '), required: !!propOptionsRecord[propName].required, default: getDefaultValue(propOptionsRecord[propName], types), - } + } as any } function normalizeProps (props: any) { @@ -146,24 +151,30 @@ export function resolveProps (options: ComponentOptions, optionsType = 'props') } export type ResolvedEvent = { types: 'any' } -export function resolveEmits (options: ComponentOptions): Record { +export function resolveEmits (options: ComponentOptions): EventMeta[] { if (!options.emits) { - return {} + return [] } return (options.emits as string[]) - .reduce((acc: Record, event: string) => { - acc[event] = { types: 'any' } - return acc - }, {}) + .map((e) => ({ + name: kebabCase(e), + description: '', + arguments: [], + type: 'any', + }) as any) + // .reduce((acc: Record, event: string) => { + // acc[event] = { types: 'any' } + // return acc + // }, {}) } export function compileComponentOptions (componentOptions: ComponentOptions): CompiledComponentOptions { const resolvedProps = resolveProps(componentOptions) - const props: any = {} + const props: PropertyMeta[] = [] for (const propName in resolvedProps) { - props[kebabCase(propName)] = convertComponentPropToApiDocs(propName, resolvedProps) + props.push(convertComponentPropToApiDocs(propName, resolvedProps)) } const emits = resolveEmits(componentOptions) @@ -171,7 +182,11 @@ export function compileComponentOptions (componentOptions: ComponentOptions): Co return { props, emits } } -export const parseComponent = (component: DefineComponent) => { +export const parseComponent = (component: DefineComponent | string) => { + if (typeof component === 'string') { + component = components[component as keyof typeof components] as unknown as DefineComponent + } + const options = getComponentOptions(component) return compileComponentOptions(options) diff --git a/packages/docs/modules/page-config/blocks/api/transform.ts b/packages/docs/modules/page-config/blocks/api/transform.ts index 1ce3828903..d6a4c5031c 100644 --- a/packages/docs/modules/page-config/blocks/api/transform.ts +++ b/packages/docs/modules/page-config/blocks/api/transform.ts @@ -3,7 +3,8 @@ import { readFile } from 'fs/promises'; import { defineBlockTransform } from "../../compiler/define-block-transform"; import { CssVariables } from "./types"; import { checker } from './component-parser/meta' -import { ComponentMeta } from 'vue-component-meta'; +import { parseComponent } from './component-parser/index' +import { type ComponentMeta } from 'vue-component-meta'; const parseCssComment = (line: string) => (line.match(/\/\/(.*)|\/\*(.*)\*\//) || []).slice(1).filter((s) => Boolean(s)).join('').trim() @@ -80,6 +81,21 @@ export default defineBlockTransform(async function (block) { const cssVariablesFile = await readCssVariables(cssVariablesPath) const cssVariables = JSON.stringify(parseCssVariables(cssVariablesFile)) - const meta = checker.getComponentMeta(importPath, importName) + let meta = checker.getComponentMeta(importPath, importName) + // TODO: Remove this when vue-component-meta will be able to parse our components + const parsed = parseComponent(importName) + + meta = { + ...meta, + props: [ + ...parsed.props, + ...meta.props, + ], + events: [ + ...parsed.emits, + ...meta.events, + ], + } + return block.replaceArgCode(0, `'${importName}', ${importComponent}, ${cssVariables}, ${stringifyMeta(meta)}`) }) diff --git a/packages/docs/modules/page-config/blocks/markdown/index.vue b/packages/docs/modules/page-config/blocks/markdown/index.vue index 8fca6f7da5..0e4b7c519e 100644 --- a/packages/docs/modules/page-config/blocks/markdown/index.vue +++ b/packages/docs/modules/page-config/blocks/markdown/index.vue @@ -8,6 +8,7 @@ defineProps({ text: { type: String, + required: true, } }) diff --git a/packages/docs/modules/page-config/blocks/shared/markdown/MarkdownView.vue b/packages/docs/modules/page-config/blocks/shared/markdown/MarkdownView.vue index 2e1a71b427..286b173a72 100644 --- a/packages/docs/modules/page-config/blocks/shared/markdown/MarkdownView.vue +++ b/packages/docs/modules/page-config/blocks/shared/markdown/MarkdownView.vue @@ -8,7 +8,7 @@ diff --git a/packages/docs/modules/page-config/runtime/usePageConfig.ts b/packages/docs/modules/page-config/runtime/usePageConfig.ts index 84cf370fd2..4b73008822 100644 --- a/packages/docs/modules/page-config/runtime/usePageConfig.ts +++ b/packages/docs/modules/page-config/runtime/usePageConfig.ts @@ -39,7 +39,7 @@ export const usePageConfigs = () => files export const usePageConfig = async (name: Ref) => { try { - const config = ref(await getConfig(unref(name))) + const config = ref(await getConfig(unref(name))) as Ref watch(name, async () => { try { diff --git a/packages/docs/package.json b/packages/docs/package.json index 8ac10a13fb..0640354dac 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -7,7 +7,7 @@ "build:ci": "yarn build:analysis && nuxt build --max_old_space_size=4096", "build:analysis": "yarn workspace sandbox build:analysis ../docs/page-config/getting-started/tree-shaking", "serve": "yarn build:analysis --use-cache && nuxt dev", - "generate": "nuxt generate", + "generate": "yarn build:analysis && nuxt generate --max_old_space_size=4096", "preview": "npx serve ./.output/public", "test": "vitest", "lint": "eslint --ext .js,.ts,.vue .", @@ -20,22 +20,24 @@ "@nuxtjs/i18n": "^8.0.0-beta.11", "@nuxtjs/tailwindcss": "^6.3.0", "@types/escodegen": "^0.0.7", + "@types/marked": "^4.3.0", "@types/estree": "^1.0.0", "acorn": "^8.8.1", "acorn-walk": "^8.2.0", "autoprefixer": "^10.4.13", "escodegen": "^2.0.0", - "eslint": "7", + "eslint": "^7", "nuxt": "^3.1.1", - "postcss": "^7", + "postcss": "^8.2.1", "postcss-custom-properties": "^13.1.1", + "serve": "^14.2.0", "stylelint": "^13.13.1", "stylelint-config-standard": "^22.0.0", "vitest": "^0.18.1", "vue-component-meta": "^1.2.0", "vue-i18n": "^9.2.2", "vue-router": "^4.1.6", - "vue-tsc": "^1.0.24" + "vue-tsc": "^1.2.0" }, "dependencies": { "@docsearch/js": "^3.2.1", @@ -44,7 +46,6 @@ "acorn": "^8.8.1", "codesandbox": "^2.2.3", "highlight.js": "^11.7.0", - "markdown-it": "^12.3.2", - "markdown-it-attrs": "^4.0.0" + "marked": "^4.3.0" } } diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index fc50f036ed..434ae50221 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -29,7 +29,7 @@ "dependencies": { "@nuxt/kit": "^3.0.0", "chokidar": "*", - "nuxt": "^3.0.0", + "nuxt": "^3.1.1", "pathe": "^0.3.5", "vuestic-ui": "^1.4.10" }, @@ -38,6 +38,6 @@ "@nuxt/schema": "latest", "@nuxt/vite-builder": "latest", "@nuxtjs/eslint-config-typescript": "latest", - "eslint": "latest" + "eslint": "^7" } } diff --git a/packages/sandbox/package.json b/packages/sandbox/package.json index 13e9f0e355..a7e3cef586 100644 --- a/packages/sandbox/package.json +++ b/packages/sandbox/package.json @@ -31,21 +31,21 @@ "vue": "*" }, "devDependencies": { - "@vitejs/plugin-vue": "^1.3.0", + "@vitejs/plugin-vue": "^4.1.0", "@vue/test-utils": "^2.0.2", "lodash": "^4.17.21", - "nuxt": "3.0.0", + "nuxt": "^3.1.1", "rollup-plugin-analyzer": "^4.0.0", - "sass": "^1.54.4", - "serve": "^12.0.0", + "sass": "^1.57.1", + "serve": "^14.2.0", "ts-loader": "^9.3.0", "ts-node": "^10.8.1", - "typescript": "^4.3.2", + "typescript": "^5", "vite": "^4.2.1", "vitest": "*", "vue-bundle-renderer": "0.4.1", "vue-tsc": "^1.2.0", - "webpack": "5", + "webpack": "^5.4.1", "webpack-cli": "^4.9.2", "when-dependencies-installed": "^1.0.1" }, diff --git a/packages/ui/package.json b/packages/ui/package.json index 3177aaa568..41f718f05d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -80,7 +80,7 @@ "core-js": "^3.8.2", "cross-env": "^7.0.2", "css-minimizer-webpack-plugin": "^3.0.0", - "eslint": "^7.17.0", + "eslint": "^7", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.2.1", @@ -96,20 +96,20 @@ "postcss": "^8.2.1", "postcss-import": "^14.0.2", "postcss-loader": "^4.1.0", - "rollup": "^2.53.1", + "rollup": "^3.15.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-postcss": "^4.0.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.30.0", "rollup-plugin-vue": "^6.0.0", - "sass": "^1.26.5", + "sass": "^1.57.1", "sass-loader": "^10.1.0", "semver": "^7.3.5", "style-loader": "^2.0.0", "stylelint": "^13.13.1", "stylelint-config-standard": "^22.0.0", - "ts-loader": "^8.0.14", - "typescript": "4.7.4", + "ts-loader": "^9.3.0", + "typescript": "^5", "vite": "^4.2.1", "vite-plugin-chunk-split": "^0.4.7", "vitest": "^0.18.1", @@ -120,7 +120,7 @@ "vuelidate": "^0.7.5", "webpack": "^5.4.1", "webpack-bundle-analyzer": "^4.1.0", - "webpack-cli": "^4.4.0", + "webpack-cli": "^4.9.2", "webpack-merge": "^5.5.0", "yargs": "^17.5.1" }, @@ -170,4 +170,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/ui/src/components/va-accordion/VaAccordion.vue b/packages/ui/src/components/va-accordion/VaAccordion.vue index 2010199655..12c4732d7c 100644 --- a/packages/ui/src/components/va-accordion/VaAccordion.vue +++ b/packages/ui/src/components/va-accordion/VaAccordion.vue @@ -12,7 +12,7 @@ import { useAccordion } from './hooks/useAccordion' export default defineComponent({ name: 'VaAccordion', - emits: useStatefulEmits, + emits: [...useStatefulEmits], props: { ...useStatefulProps, ...useComponentPresetProp, diff --git a/packages/ui/src/components/va-alert/VaAlert.vue b/packages/ui/src/components/va-alert/VaAlert.vue index af9b75e08c..a820d2cb22 100644 --- a/packages/ui/src/components/va-alert/VaAlert.vue +++ b/packages/ui/src/components/va-alert/VaAlert.vue @@ -95,7 +95,7 @@ import { VaIcon } from '../va-icon' export default defineComponent({ name: 'VaAlert', components: { VaIcon }, - emits: useStatefulEmits, + emits: [...useStatefulEmits], props: { ...useStatefulProps, ...useComponentPresetProp, diff --git a/packages/ui/src/components/va-avatar-group/VaAvatarGroup.vue b/packages/ui/src/components/va-avatar-group/VaAvatarGroup.vue index 27636671df..6fe917234e 100644 --- a/packages/ui/src/components/va-avatar-group/VaAvatarGroup.vue +++ b/packages/ui/src/components/va-avatar-group/VaAvatarGroup.vue @@ -13,7 +13,6 @@ /> diff --git a/packages/ui/src/components/va-carousel/VaCarousel.vue b/packages/ui/src/components/va-carousel/VaCarousel.vue index ed78edc0bd..9bca66bf6c 100644 --- a/packages/ui/src/components/va-carousel/VaCarousel.vue +++ b/packages/ui/src/components/va-carousel/VaCarousel.vue @@ -162,7 +162,7 @@ export default defineComponent({ ariaSlideOfLabel: { type: String, default: '$t:slideOf' }, }, - emits: useStatefulEmits, + emits: [...useStatefulEmits], setup (props, { emit }) { const { valueComputed: currentSlide } = useStateful(props, emit, 'modelValue', { defaultValue: 0 }) diff --git a/packages/ui/src/components/va-color-indicator/VaColorIndicator.vue b/packages/ui/src/components/va-color-indicator/VaColorIndicator.vue index fcc7b0064f..c2240a83d5 100644 --- a/packages/ui/src/components/va-color-indicator/VaColorIndicator.vue +++ b/packages/ui/src/components/va-color-indicator/VaColorIndicator.vue @@ -29,7 +29,7 @@ import { export default defineComponent({ name: 'VaColorIndicator', - emits: useStatefulEmits, + emits: [...useStatefulEmits], props: { ...useStatefulProps, ...useComponentPresetProp, diff --git a/packages/ui/src/components/va-color-input/VaColorInput.vue b/packages/ui/src/components/va-color-input/VaColorInput.vue index 55f4b64ba8..2e09088b5e 100644 --- a/packages/ui/src/components/va-color-input/VaColorInput.vue +++ b/packages/ui/src/components/va-color-input/VaColorInput.vue @@ -46,7 +46,7 @@ export default defineComponent({ VaInput, VaColorIndicator, }, - emits: useStatefulEmits, + emits: [...useStatefulEmits], props: { ...useStatefulProps, ...useComponentPresetProp, diff --git a/packages/ui/src/components/va-color-palette/VaColorPalette.vue b/packages/ui/src/components/va-color-palette/VaColorPalette.vue index 541afbeb71..f7b75cb793 100644 --- a/packages/ui/src/components/va-color-palette/VaColorPalette.vue +++ b/packages/ui/src/components/va-color-palette/VaColorPalette.vue @@ -29,7 +29,7 @@ import { VaColorIndicator } from '../va-color-indicator' export default defineComponent({ name: 'VaColorPalette', components: { VaColorIndicator }, - emits: useStatefulEmits, + emits: [...useStatefulEmits], props: { ...useStatefulProps, ...useComponentPresetProp, diff --git a/packages/ui/src/components/va-dropdown/VaDropdown.vue b/packages/ui/src/components/va-dropdown/VaDropdown.vue index 64fc0c1df2..ac16759e84 100644 --- a/packages/ui/src/components/va-dropdown/VaDropdown.vue +++ b/packages/ui/src/components/va-dropdown/VaDropdown.vue @@ -78,7 +78,7 @@ export default defineComponent({ ariaLabel: { type: String, default: '$t:toggleDropdown' }, }, - emits: [...useStatefulEmits, 'anchor-click', 'anchor-right-click', 'content-click', 'click-outside', 'close', 'open'], + emits: [...useStatefulEmits, 'anchor-click', 'anchor-right-click', 'content-click', 'click-outside', 'close', 'open', 'anchor-dblclick'], setup (props, { emit, slots, attrs }) { const contentRef = shallowRef() @@ -119,7 +119,7 @@ export default defineComponent({ cancelHoverDebounce() } - const emitAndClose = (eventName: string, close?: boolean, e?: Event) => { + const emitAndClose = (eventName: Parameters[0], close?: boolean, e?: Event) => { emit(eventName, e) if (close && props.trigger !== 'none') { valueComputed.value = false } } diff --git a/packages/ui/src/components/va-form/VaForm-reset.vue b/packages/ui/src/components/va-form/VaForm-reset.vue index d3ab2fbc13..cba5914c4e 100644 --- a/packages/ui/src/components/va-form/VaForm-reset.vue +++ b/packages/ui/src/components/va-form/VaForm-reset.vue @@ -10,13 +10,13 @@
{{ form }}
- - Reset form + Reset form - diff --git a/packages/ui/src/components/va-hover/VaHover.vue b/packages/ui/src/components/va-hover/VaHover.vue index 566396a4e6..ed3cb5b740 100644 --- a/packages/ui/src/components/va-hover/VaHover.vue +++ b/packages/ui/src/components/va-hover/VaHover.vue @@ -23,7 +23,7 @@ export default defineComponent({ modelValue: { type: Boolean, default: false }, }, - emits: useStatefulEmits, + emits: [...useStatefulEmits], setup (props, { emit }) { const { valueComputed } = useStateful(props, emit) diff --git a/packages/ui/src/components/va-infinite-scroll/VaInfiniteScroll.vue b/packages/ui/src/components/va-infinite-scroll/VaInfiniteScroll.vue index f0c24cb1c5..22a2f60c1d 100644 --- a/packages/ui/src/components/va-infinite-scroll/VaInfiniteScroll.vue +++ b/packages/ui/src/components/va-infinite-scroll/VaInfiniteScroll.vue @@ -1,6 +1,6 @@