From d574bbc16037a3788f5c9e508bd0da43fdf007c2 Mon Sep 17 00:00:00 2001 From: Novout Date: Sat, 17 Jun 2023 12:23:14 -0300 Subject: [PATCH] refactor: some improvements --- demo/src/main.ts | 9 +- packages/pdfeasy/package.json | 168 ++++++------ packages/pdfeasy/src/content/image.ts | 68 ----- .../src/{pipe/emitter.ts => events.ts} | 2 +- .../pdfeasy/src/{utils/request.ts => http.ts} | 28 ++ packages/pdfeasy/src/index.ts | 5 +- packages/pdfeasy/src/pipe/setter.ts | 34 --- packages/pdfeasy/src/pipe/transform.ts | 28 -- .../src/{plugins/page.ts => plugins.ts} | 60 +++- packages/pdfeasy/src/plugins/background.ts | 16 -- .../src/{pipe/factory.ts => resolvers.ts} | 121 ++++++++- .../src/{runner/pdfeasy.ts => runner.ts} | 37 ++- .../src/{schema/color.ts => schemas.ts} | 2 +- packages/pdfeasy/src/types.ts | 140 +++++----- .../src/{utils/defines.ts => utils.ts} | 3 + packages/pdfeasy/src/utils/index.ts | 1 - packages/pdfeasy/src/utils/populate.ts | 43 --- packages/pdfeasy/src/{font => }/vfs.ts | 50 ++-- packages/pdfeasy/test/contents.test.ts | 238 ++++++++-------- packages/pdfeasy/test/fonts.test.ts | 187 +++++++------ packages/pdfeasy/test/page.test.ts | 68 ++--- packages/pdfeasy/test/pdfeasy.bundle.test.ts | 85 ------ packages/pdfeasy/vitest.config.ts | 21 +- pnpm-lock.yaml | 256 +++++++++++------- 24 files changed, 803 insertions(+), 867 deletions(-) delete mode 100644 packages/pdfeasy/src/content/image.ts rename packages/pdfeasy/src/{pipe/emitter.ts => events.ts} (71%) rename packages/pdfeasy/src/{utils/request.ts => http.ts} (61%) delete mode 100644 packages/pdfeasy/src/pipe/setter.ts delete mode 100644 packages/pdfeasy/src/pipe/transform.ts rename packages/pdfeasy/src/{plugins/page.ts => plugins.ts} (67%) delete mode 100644 packages/pdfeasy/src/plugins/background.ts rename packages/pdfeasy/src/{pipe/factory.ts => resolvers.ts} (71%) rename packages/pdfeasy/src/{runner/pdfeasy.ts => runner.ts} (87%) rename packages/pdfeasy/src/{schema/color.ts => schemas.ts} (92%) rename packages/pdfeasy/src/{utils/defines.ts => utils.ts} (92%) delete mode 100644 packages/pdfeasy/src/utils/index.ts delete mode 100644 packages/pdfeasy/src/utils/populate.ts rename packages/pdfeasy/src/{font => }/vfs.ts (52%) delete mode 100644 packages/pdfeasy/test/pdfeasy.bundle.test.ts diff --git a/demo/src/main.ts b/demo/src/main.ts index 7d8d945..04c94e8 100644 --- a/demo/src/main.ts +++ b/demo/src/main.ts @@ -1,4 +1,4 @@ -import pdfeasy, { Utils } from 'pdfeasy' +import pdfeasy from 'pdfeasy' import './style.css' const app = document.querySelector('#app')! @@ -19,20 +19,15 @@ pdfeasy.new({ }) pdfeasy.add([ - { raw: 'A simple pdf', text: {}}, + { raw: 'A simple pdf', text: { font: 'Roboto' }}, { lineBreak: {} }, { raw: 'using...', text: { position: { x: 250, y: 0 }} }, { raw: 'hm...', text: {} }, { pageBreak: {} }, { raw: 'pdfeasy!', text: {} }, - ...Utils.content(), - ...Utils.content(), - ...Utils.content(), { raw: 'a first in list...', list: { style: 'counter' } }, { raw: 'a second in list...', list: { style: 'counter' } }, { raw: 'a third in list...', list: { style: 'counter' } }, - ...Utils.content(), - ...Utils.content(), { raw: 'a list with circle...', list: { style: 'circle' } }, { table: { body: { diff --git a/packages/pdfeasy/package.json b/packages/pdfeasy/package.json index c269422..026d8d7 100644 --- a/packages/pdfeasy/package.json +++ b/packages/pdfeasy/package.json @@ -1,83 +1,85 @@ -{ - "name": "pdfeasy", - "version": "1.2.2", - "description": "Client/Server Side PDF-Creator based in PDFKit", - "author": "Novout ", - "license": "MIT", - "repository": "https://github.com/betterwrite/pdfeasy", - "bugs": { - "url": "https://github.com/betterwrite/pdfeasy/issues" - }, - "keywords": [ - "pdfkit", - "pdf", - "typescript", - "javascript", - "printing", - "layout" - ], - "browser": { - "path": "path-browserify", - "crypto": "crypto-browserify", - "stream": "stream-browserify" - }, - "exports": { - ".": { - "import": "./dist/client.esm.js", - "require": "./dist/client.cjs.js", - "node": "./dist/node.esm.js", - "types": "./dist/index.d.ts" - } - }, - "main": "./dist/client.cjs.js", - "module": "./dist/client.esm.js", - "node": "./dist/node.esm.js", - "types": "./dist/index.d.ts", - "scripts": { - "format": "prettier src/**/*.ts scripts/**/*.js --write", - "build": "rimraf dist && cross-env NODE_ENV=development node scripts/build.js && pnpm run normalizeDts", - "build:prod": "rimraf dist && cross-env NODE_ENV=production node scripts/build.js && pnpm run normalizeDts", - "normalizeDts": "tsup ./src/index.ts --dts && rimraf dist/index.js", - "test": "pnpm build:prod && vitest run --coverage", - "node:script": "node -r esm ./scripts/generate/run-node.js", - "demo": "vite --port 3000" - }, - "files": [ - "dist/**/*", - "LICENSE", - "README.md" - ], - "engines": { - "node": ">=14.0" - }, - "dependencies": { - "blob-stream": "0.1.3", - "file-saver": "2.0.5", - "fontkit-next": "1.8.3", - "mitt": "3.0.0", - "ohmyfetch": "0.4.21", - "pdfkit": "0.13.0", - "pdfkit-table": "^0.1.99" - }, - "devDependencies": { - "@types/blob-stream": "0.1.30", - "@types/file-saver": "2.0.5", - "@types/node": "20.1.2", - "@types/pdfkit": "0.12.9", - "@vitest/coverage-c8": "0.31.0", - "cross-env": "7.0.3", - "esbuild": "0.17.18", - "esbuild-plugin-alias": "0.2.1", - "esbuild-plugin-fileloc": "0.0.6", - "esbuild-plugin-replace": "1.3.0", - "esbuild-plugin-resolve": "1.0.3", - "esm": "3.2.25", - "node-stdlib-browser": "1.2.0", - "prettier": "2.8.8", - "rimraf": "5.0.0", - "tsup": "6.7.0", - "typescript": "5.0.4", - "vite": "4.3.5", - "vitest": "0.31.0" - } -} +{ + "name": "pdfeasy", + "version": "1.2.2", + "description": "Client/Server Side PDF-Creator based in PDFKit", + "author": "Novout ", + "license": "MIT", + "repository": "https://github.com/betterwrite/pdfeasy", + "bugs": { + "url": "https://github.com/betterwrite/pdfeasy/issues" + }, + "keywords": [ + "pdfkit", + "pdf", + "typescript", + "javascript", + "printing", + "layout" + ], + "browser": { + "path": "path-browserify", + "crypto": "crypto-browserify", + "stream": "stream-browserify" + }, + "exports": { + ".": { + "import": "./dist/client.esm.js", + "require": "./dist/client.cjs.js", + "node": "./dist/node.esm.js", + "types": "./dist/index.d.ts" + } + }, + "main": "./dist/client.cjs.js", + "module": "./dist/client.esm.js", + "node": "./dist/node.esm.js", + "types": "./dist/index.d.ts", + "scripts": { + "format": "prettier src/**/*.ts scripts/**/*.js --write", + "build": "rimraf dist && cross-env NODE_ENV=development node scripts/build.js && pnpm run normalizeDts", + "build:prod": "rimraf dist && cross-env NODE_ENV=production node scripts/build.js && pnpm run normalizeDts", + "normalizeDts": "tsup ./src/index.ts --dts && rimraf dist/index.js", + "test": "pnpm build:prod && vitest run --coverage", + "node:script": "node -r esm ./scripts/generate/run-node.js", + "demo": "vite --port 3000" + }, + "files": [ + "dist/**/*", + "LICENSE", + "README.md" + ], + "engines": { + "node": ">=14.0" + }, + "dependencies": { + "blob-stream": "0.1.3", + "defu": "6.1.2", + "file-saver": "2.0.5", + "fontkit-next": "1.8.3", + "mitt": "3.0.0", + "ohmyfetch": "0.4.21", + "pdfkit": "0.13.0", + "pdfkit-table": "^0.1.99" + }, + "devDependencies": { + "@types/blob-stream": "0.1.30", + "@types/file-saver": "2.0.5", + "@types/node": "20.1.2", + "@types/pdfkit": "0.12.9", + "@vitest/coverage-c8": "0.31.0", + "cross-env": "7.0.3", + "esbuild": "0.17.18", + "esbuild-plugin-alias": "0.2.1", + "esbuild-plugin-fileloc": "0.0.6", + "esbuild-plugin-replace": "1.3.0", + "esbuild-plugin-resolve": "1.0.3", + "esm": "3.2.25", + "happy-dom": "9.20.3", + "node-stdlib-browser": "1.2.0", + "prettier": "2.8.8", + "rimraf": "5.0.0", + "tsup": "6.7.0", + "typescript": "5.0.4", + "vite": "4.3.5", + "vitest": "0.31.0" + } +} diff --git a/packages/pdfeasy/src/content/image.ts b/packages/pdfeasy/src/content/image.ts deleted file mode 100644 index e8f412f..0000000 --- a/packages/pdfeasy/src/content/image.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { ImageRaw } from 'src/types' -import { regex } from '../utils/defines' -import { getDataUri } from '../utils/request' - -export const SvgToPNG = (raw: string): Promise<{ raw: string }> => { - return new Promise((res, rej) => { - const set = !raw.includes(' { - const canvas = document.createElement('canvas') - - canvas.width = 2000 - canvas.height = 2000 - - const context = canvas.getContext('2d') as CanvasRenderingContext2D - - context.drawImage(image, 0, 0, 2000, 2000) - - const url = canvas.toDataURL('image/png') - - res({ raw: url }) - } - image.onerror = () => { - rej() - } - - // TODO: other blob performatic method - image.src = blobURL - }) -} - -export const getImageRaw = (raw: string): Promise => { - return new Promise(async (res) => { - if (regex().base64(raw)) { - res({ - raw, - type: 'base64', - }) - } - - if (regex().http(raw)) { - await getDataUri(raw).then((data: string) => { - res({ - raw: data, - type: 'http', - }) - }) - } - - // TODO: getDataUri type - res({ - raw, - type: 'base64', - }) - }) -} diff --git a/packages/pdfeasy/src/pipe/emitter.ts b/packages/pdfeasy/src/events.ts similarity index 71% rename from packages/pdfeasy/src/pipe/emitter.ts rename to packages/pdfeasy/src/events.ts index 3546097..d9405c7 100644 --- a/packages/pdfeasy/src/pipe/emitter.ts +++ b/packages/pdfeasy/src/events.ts @@ -1,4 +1,4 @@ -import { PDFEasy } from '../runner/pdfeasy' +import { PDFEasy } from './runner' export const onPageAdded = (instance: PDFEasy, cb: any) => { instance.pdfkit?.on('pageAdded', () => { diff --git a/packages/pdfeasy/src/utils/request.ts b/packages/pdfeasy/src/http.ts similarity index 61% rename from packages/pdfeasy/src/utils/request.ts rename to packages/pdfeasy/src/http.ts index 76684ce..c510305 100644 --- a/packages/pdfeasy/src/utils/request.ts +++ b/packages/pdfeasy/src/http.ts @@ -1,4 +1,6 @@ import { $fetch } from 'ohmyfetch' +import { regex } from './utils' +import { ImageRaw } from './types' export const getBase64ByURL = ( data: string, @@ -41,3 +43,29 @@ export const getDataUri = (url: string): Promise => { image.src = url }) } + +export const getRequestImageRaw = (raw: string): Promise => { + return new Promise(async (res) => { + if (regex().base64(raw)) { + res({ + raw, + type: 'base64', + }) + } + + if (regex().http(raw)) { + await getDataUri(raw).then((data: string) => { + res({ + raw: data, + type: 'http', + }) + }) + } + + // TODO: getDataUri type + res({ + raw, + type: 'base64', + }) + }) +} diff --git a/packages/pdfeasy/src/index.ts b/packages/pdfeasy/src/index.ts index a94cc54..f28ee1b 100644 --- a/packages/pdfeasy/src/index.ts +++ b/packages/pdfeasy/src/index.ts @@ -1,7 +1,6 @@ -import { PDFEasy } from './runner/pdfeasy' +import { PDFEasy } from './runner' export default new PDFEasy() -export * from './runner/pdfeasy' +export * from './runner' -export * as Utils from './utils' export * as Types from './types' diff --git a/packages/pdfeasy/src/pipe/setter.ts b/packages/pdfeasy/src/pipe/setter.ts deleted file mode 100644 index a8ef139..0000000 --- a/packages/pdfeasy/src/pipe/setter.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { getImageRaw } from '../content/image' -import { regex } from '../utils/defines' -import { PDFEasy } from '../runner/pdfeasy' - -export const setBackground = async (instance: PDFEasy, str: string) => { - if (!instance.pdfkit) return - - const kit = instance.pdfkit - - if (regex().hex(str)) { - kit.rect(0, 0, kit.page.width, kit.page.height).fill(str) - - return - } - - const backgroundPurge = instance.options?.advanced?.backgroundPurge - const globalRaw = instance.globals.PLUGIN.__BACKGROUND_RAW__ - - const { raw, type } = await getImageRaw( - backgroundPurge ? globalRaw || str : str - ) - - kit.image(raw, 0, 0, { width: kit.page.width, height: kit.page.height }) - - if (backgroundPurge) { - // define base64 instead http request - instance.options?.plugins?.map((plugin) => { - if (!globalRaw && type !== 'base64') - instance.globals.PLUGIN.__BACKGROUND_RAW__ = raw - - return plugin - }) - } -} diff --git a/packages/pdfeasy/src/pipe/transform.ts b/packages/pdfeasy/src/pipe/transform.ts deleted file mode 100644 index df3cca6..0000000 --- a/packages/pdfeasy/src/pipe/transform.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Fonts, ContentText } from '../types' - -export const getCorrectFontFamily = ( - font: Fonts, - options?: ContentText -): Fonts => { - if (font === 'Symbol' || font === 'ZapfDingbats') return font - - if (options?.italic && options?.bold) { - if (font === 'Times-Roman') return 'Times-BoldItalic' - - return (font + '-BoldOblique') as Fonts - } - - if (options?.italic) { - if (font === 'Times-Roman') return 'Times-Italic' - - return (font + '-Oblique') as Fonts - } - - if (options?.bold) { - if (font === 'Times-Roman') return 'Times-Bold' - - return (font + '-Bold') as Fonts - } - - return font -} diff --git a/packages/pdfeasy/src/plugins/page.ts b/packages/pdfeasy/src/plugins.ts similarity index 67% rename from packages/pdfeasy/src/plugins/page.ts rename to packages/pdfeasy/src/plugins.ts index 4d6782a..6c836d6 100644 --- a/packages/pdfeasy/src/plugins/page.ts +++ b/packages/pdfeasy/src/plugins.ts @@ -1,13 +1,28 @@ -import { PDFEasy } from '../runner/pdfeasy' -import { getCorrectFontFamily } from '../pipe/transform' -import { getImageRaw } from '../content/image' +import { PDFEasy } from './runner' import { ContentImage, ContentText, PluginPageImageOptions, PluginGenerate, PluginPageTextOptions, -} from 'src/types' +} from './types' +import { regex } from './utils' +import { resolveFontFamily } from './resolvers' +import { getRequestImageRaw } from './http' + +export const runPluginBackground = async (instance: PDFEasy) => { + if (instance.options?.plugins) { + for (const plugin of instance.options.plugins) { + if (plugin.background && instance.globals.__NEW_PAGE__) { + const res = plugin.background(instance.pdfkit!.page) + + if (res) await setBackground(instance, res) + } + } + } + + instance.globals.__NEW_PAGE__ = false +} export const generate = (instance: PDFEasy): PluginGenerate => { const kit = instance.pdfkit as PDFKit.PDFDocument @@ -33,7 +48,6 @@ export const generate = (instance: PDFEasy): PluginGenerate => { _anchorTextWidth = 0 break default: - // default is center _anchorTextWidth = kit.widthOfString(text) / 2 break } @@ -49,13 +63,12 @@ export const generate = (instance: PDFEasy): PluginGenerate => { _anchorTextHeight = 0 break default: - // default is center _anchorTextHeight = kit.heightOfString(text) / 2 break } kit - .font(getCorrectFontFamily(style.font || defaults.text.font, style)) + .font(resolveFontFamily(style.font || defaults.text.font, style)) .fontSize(style.fontSize || defaults.text.fontSize) .fillColor(style.color || defaults.text.color) .fillOpacity(style.opacity || defaults.text.opacity) @@ -82,7 +95,7 @@ export const generate = (instance: PDFEasy): PluginGenerate => { ): Promise => { if (!str) return - const { raw } = await getImageRaw(str) + const { raw } = await getRequestImageRaw(str) kit.image( raw, @@ -101,6 +114,37 @@ export const generate = (instance: PDFEasy): PluginGenerate => { return { Text, Image } } +export const setBackground = async (instance: PDFEasy, str: string) => { + if (!instance.pdfkit) return + + const kit = instance.pdfkit + + if (regex().hex(str)) { + kit.rect(0, 0, kit.page.width, kit.page.height).fill(str) + + return + } + + const backgroundPurge = instance.options?.advanced?.backgroundPurge + const globalRaw = instance.globals.PLUGIN.__BACKGROUND_RAW__ + + const { raw, type } = await getRequestImageRaw( + backgroundPurge ? globalRaw || str : str + ) + + kit.image(raw, 0, 0, { width: kit.page.width, height: kit.page.height }) + + if (backgroundPurge) { + // define base64 instead http request + instance.options?.plugins?.map((plugin) => { + if (!globalRaw && type !== 'base64') + instance.globals.PLUGIN.__BACKGROUND_RAW__ = raw + + return plugin + }) + } +} + export const pageHandler = (instance: PDFEasy): Promise => { return new Promise(async (response, reject) => { const doc = instance.pdfkit diff --git a/packages/pdfeasy/src/plugins/background.ts b/packages/pdfeasy/src/plugins/background.ts deleted file mode 100644 index 607f7e2..0000000 --- a/packages/pdfeasy/src/plugins/background.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { setBackground } from '../pipe/setter' -import { PDFEasy } from '../runner/pdfeasy' - -export const runPluginBackground = async (instance: PDFEasy) => { - if (instance.options?.plugins) { - for (const plugin of instance.options.plugins) { - if (plugin.background && instance.globals.__NEW_PAGE__) { - const res = plugin.background(instance.pdfkit!.page) - - if (res) await setBackground(instance, res) - } - } - } - - instance.globals.__NEW_PAGE__ = false -} diff --git a/packages/pdfeasy/src/pipe/factory.ts b/packages/pdfeasy/src/resolvers.ts similarity index 71% rename from packages/pdfeasy/src/pipe/factory.ts rename to packages/pdfeasy/src/resolvers.ts index 26558a8..4a94f3a 100644 --- a/packages/pdfeasy/src/pipe/factory.ts +++ b/packages/pdfeasy/src/resolvers.ts @@ -1,3 +1,5 @@ +import { RunOptions } from './types' +import { isBrowser } from './utils' import type { Content, ContentText, @@ -6,18 +8,30 @@ import type { InternalGlobals, RunOptionsBase, Color, -} from '../types' -import { getCorrectFontFamily } from './transform' -import { getImageRaw, SvgToPNG } from '../content/image' -import { HEXToCMYK } from 'src/schema/color' + Fonts, +} from './types' import type PDFDocumentWithTables from 'pdfkit-table' +import { HEXToCMYK } from './schemas' +import { getRequestImageRaw } from './http' + +export const resolveRunnerOptions = ( + options: Partial +): RunOptions => { + return { + type: options.type || isBrowser ? 'client' : 'server', + clientEmit: options.clientEmit || isBrowser ? 'blob' : 'none', + serverPath: options.serverPath || '/', + colorSchema: options.colorSchema || 'RGB', + cwd: options?.cwd || !isBrowser ? process.cwd() : '/', + } +} export const resolveColor = (color: Color, run: RunOptionsBase) => { return run?.colorSchema === 'CMYK' ? HEXToCMYK(color) : color } export const resolveCover = async (app: PDFKit.PDFDocument, based: string) => { - const { raw } = await getImageRaw(based) + const { raw } = await getRequestImageRaw(based) app.image(raw, 0, 0, { height: app.page.height, @@ -44,10 +58,7 @@ export const resolveContent = async ( app .font( - getCorrectFontFamily( - entity.text.font || defaults.text.font, - entity.text - ) + resolveFontFamily(entity.text.font || defaults.text.font, entity.text) ) .fontSize(entity.text.fontSize || defaults.text.fontSize) .fillColor(resolveColor(entity.text.color || defaults.text.color, run)) @@ -83,7 +94,7 @@ export const resolveContent = async ( } await app - .font(getCorrectFontFamily(style?.font || defaults.text.font, style)) + .font(resolveFontFamily(style?.font || defaults.text.font, style)) .fontSize(style?.fontSize || defaults.text.fontSize) .fillColor(resolveColor(style?.color || defaults.text.color, run)) .fillOpacity(style?.opacity || defaults.text.opacity) @@ -101,7 +112,7 @@ export const resolveContent = async ( if (!content.raw) return await app - .font(getCorrectFontFamily(defaults.text.font, {})) + .font(resolveFontFamily(defaults.text.font, {})) .fontSize(defaults.text.fontSize) .fillColor(resolveColor(defaults.text.color, run)) .fillOpacity(defaults.text.opacity) @@ -121,8 +132,8 @@ export const resolveContent = async ( if (!content.raw) return const { raw } = content.svg - ? await SvgToPNG(content.raw) - : await getImageRaw(content.raw) + ? await resolveSvgToPNG(content.raw) + : await getRequestImageRaw(content.raw) app.image( raw, @@ -306,3 +317,87 @@ export const resolveContent = async ( if (content.table) await addTable() if (content.form) await addFormulary() } + +export const resolveFontFamily = ( + font: Fonts, + options?: ContentText +): Fonts => { + if (font === 'Symbol' || font === 'ZapfDingbats') return font + + if (options?.italic && options?.bold) { + if (font === 'Times-Roman') return 'Times-BoldItalic' + + return (font + '-BoldOblique') as Fonts + } + + if (options?.italic) { + if (font === 'Times-Roman') return 'Times-Italic' + + return (font + '-Oblique') as Fonts + } + + if (options?.bold) { + if (font === 'Times-Roman') return 'Times-Bold' + + return (font + '-Bold') as Fonts + } + + return font +} + +export const resolveFontName = ( + name: string, + type: 'normal' | 'italic' | 'bold' | 'bolditalic' +) => { + switch (type) { + case 'normal': + return name + case 'italic': + return name + '-Oblique' + case 'bold': + return name + '-Bold' + case 'bolditalic': + return name + '-BoldOblique' + default: + return name + } +} + +export const resolveSvgToPNG = (raw: string): Promise<{ raw: string }> => { + return new Promise((res, rej) => { + const set = !raw.includes(' { + const canvas = document.createElement('canvas') + + canvas.width = 2000 + canvas.height = 2000 + + const context = canvas.getContext('2d') as CanvasRenderingContext2D + + context.drawImage(image, 0, 0, 2000, 2000) + + const url = canvas.toDataURL('image/png') + + res({ raw: url }) + } + image.onerror = () => { + rej() + } + + // TODO: other blob performatic method + image.src = blobURL + }) +} diff --git a/packages/pdfeasy/src/runner/pdfeasy.ts b/packages/pdfeasy/src/runner.ts similarity index 87% rename from packages/pdfeasy/src/runner/pdfeasy.ts rename to packages/pdfeasy/src/runner.ts index 7ab55f0..8e78b8b 100644 --- a/packages/pdfeasy/src/runner/pdfeasy.ts +++ b/packages/pdfeasy/src/runner.ts @@ -2,8 +2,8 @@ import PDFDocumentWithTables from 'pdfkit-table' import blobStream from 'blob-stream' import mitt from 'mitt' import { saveAs } from 'file-saver' -import { resolveContent, resolveCover } from '../pipe/factory' -import { pdfDefaults } from '../utils/defines' +import { resolveContent, resolveCover } from './resolvers' +import { pdfDefaults } from './utils' import { Content, DocBase, @@ -15,14 +15,14 @@ import { PDFEasyDefaults, InternalGlobals, ItemType, -} from '../types' -import { setExternalFonts } from '../font/vfs' +} from './types' +import { setExternalFonts } from './vfs' import { createWriteStream } from 'fs' import path from 'path' -import { pageHandler } from '../plugins/page' -import { RunnerOptions, RunOptions } from '../types' -import { onPageAdded } from '../pipe/emitter' -import { runPluginBackground } from '../plugins/background' +import { RunnerOptions, RunOptions } from './types' +import { onPageAdded } from './events' +import { resolveRunnerOptions } from 'src/resolvers' +import { pageHandler, runPluginBackground } from './plugins' /** * A Base PDFEasy Runner @@ -61,7 +61,7 @@ export class PDFEasy { * * @public */ - public optionsRun: RunOptionsBase = null + public runOptions: RunOptionsBase = null /** * {@link PDFKit} document options @@ -151,7 +151,7 @@ export class PDFEasy { this.def, content, this.globals, - this.optionsRun + this.runOptions ) this.posUpdateContent(content) @@ -168,7 +168,7 @@ export class PDFEasy { this.contents = [] this.def = pdfDefaults() - this.optionsRun = null + this.runOptions = null this.fonts = [] @@ -296,12 +296,10 @@ export class PDFEasy { * * @param emit - {@link PDFRunEmitOption} */ - public run = (options?: RunOptions): Promise => { - this.optionsRun = options || {} + public run = (options?: Partial): Promise => { + this.runOptions = resolveRunnerOptions(options || {}) this.globals.__LAST_CONTENT__ = this.contents[0] - const runType = options?.type || 'client' - this.options?.plugins?.forEach(({ onBefore }) => onBefore && onBefore()) return new Promise(async (res, rej) => { @@ -320,11 +318,12 @@ export class PDFEasy { this.globals.__NEW_PAGE__ = true }) - if (runType && options?.serverPath) { + if (this.runOptions?.type === 'server') { this.pdfkit?.pipe( createWriteStream( - path.resolve((options?.cwd || process.cwd()) + options.serverPath) + - `/${this.options?.exports?.name || 'New PDF'}.pdf` + path.resolve( + (options?.cwd || process.cwd()) + this.runOptions.serverPath + ) + `/${this.options?.exports?.name || 'New PDF'}.pdf` ) ) @@ -349,7 +348,7 @@ export class PDFEasy { return } - if (runType === 'client') { + if (this.runOptions?.type === 'client') { const stream = this.pdfkit.pipe(blobStream()) this.pipeline() diff --git a/packages/pdfeasy/src/schema/color.ts b/packages/pdfeasy/src/schemas.ts similarity index 92% rename from packages/pdfeasy/src/schema/color.ts rename to packages/pdfeasy/src/schemas.ts index 4433fd5..bb13172 100644 --- a/packages/pdfeasy/src/schema/color.ts +++ b/packages/pdfeasy/src/schemas.ts @@ -1,4 +1,4 @@ -import { Color } from 'src/types' +import { Color } from './types' export const HEXToCMYK = (color: Color): Color => { if (Array.isArray(color)) return color diff --git a/packages/pdfeasy/src/types.ts b/packages/pdfeasy/src/types.ts index 7763269..dae68b4 100644 --- a/packages/pdfeasy/src/types.ts +++ b/packages/pdfeasy/src/types.ts @@ -2,23 +2,23 @@ import type PDFDocumentWithTables from 'pdfkit-table' /* pdfkit-table */ interface TableRect { - x: number; - y: number; - width: number; - height: number; + x: number + y: number + width: number + height: number } interface TableHeader { - label?: string; - property?: string; - width?: number; - align?: string; //default 'left' - valign?: string; - headerColor?: string; //default '#BEBEBE' - headerOpacity?: number; //default '0.5' - headerAlign?: string; //default 'left' - columnColor?: string; - columnOpacity?: number; + label?: string + property?: string + width?: number + align?: string //default 'left' + valign?: string + headerColor?: string //default '#BEBEBE' + headerOpacity?: number //default '0.5' + headerAlign?: string //default 'left' + columnColor?: string + columnOpacity?: number renderer?: ( value: any, indexColumn?: number, @@ -26,67 +26,66 @@ interface TableHeader { row?: number, rectRow?: TableRect, rectCell?: TableRect - ) => string; + ) => string } interface TableDataOptions { - fontSize: number; - fontFamily: string; - separation: boolean; + fontSize: number + fontFamily: string + separation: boolean } interface TableData { - [key: string]: string | { label: string; options?: TableDataOptions }; + [key: string]: string | { label: string; options?: TableDataOptions } } interface TableBody { - title?: string; - subtitle?: string; - headers?: (string | TableHeader)[]; - datas?: TableData[]; - rows?: string[][]; + title?: string + subtitle?: string + headers?: (string | TableHeader)[] + datas?: TableData[] + rows?: string[][] } interface TableDividerOptions { - disabled?: boolean; - width?: number; - opacity?: number; + disabled?: boolean + width?: number + opacity?: number } interface TableDivider { - header?: TableDividerOptions; - horizontal?: TableDividerOptions; + header?: TableDividerOptions + horizontal?: TableDividerOptions } -interface TableTitle -{ - label: string; - fontSize?: number; - fontFamily?: string; - color?: string; +interface TableTitle { + label: string + fontSize?: number + fontFamily?: string + color?: string } interface TableOptions { - title?: string | TableTitle ; - subtitle?: string | TableTitle; - width?: number; - x?: number; //default doc.x - y?: number; //default doc.y - divider?: TableDivider; - columnsSize?: number[]; - columnSpacing?: number; //default 5 - padding?: number[]; - addPage?: boolean; //default false - hideHeader?: boolean; - minRowHeight?: number; - prepareHeader?: () => PDFDocumentWithTables; + title?: string | TableTitle + subtitle?: string | TableTitle + width?: number + x?: number //default doc.x + y?: number //default doc.y + divider?: TableDivider + columnsSize?: number[] + columnSpacing?: number //default 5 + padding?: number[] + addPage?: boolean //default false + hideHeader?: boolean + minRowHeight?: number + prepareHeader?: () => PDFDocumentWithTables prepareRow?: ( row?: any, indexColumn?: number, indexRow?: number, rectRow?: TableRect, rectCell?: TableRect - ) => PDFDocumentWithTables; + ) => PDFDocumentWithTables } export interface FormularyCommonOptions { @@ -97,7 +96,7 @@ export interface FormularyCommonOptions { defaultValue?: number | string width?: number height?: number - backgroundColor?: Color, + backgroundColor?: Color borderColor?: Color } @@ -146,7 +145,16 @@ export type LocalFonts = export type Fonts = LocalFonts | T -export type ItemType = 'paragraph' | 'image' | 'list' | 'checkbox' | 'table' | 'svg' | 'line-break' | 'page-break' | 'form' +export type ItemType = + | 'paragraph' + | 'image' + | 'list' + | 'checkbox' + | 'table' + | 'svg' + | 'line-break' + | 'page-break' + | 'form' export type PDFRunEmitOption = 'save' | 'blob' | 'none' @@ -161,10 +169,10 @@ export type Color = HexColor | [number, number, number, number] export type EmitterType = {} export interface InternalGlobals { - __NEW_PAGE__: boolean, + __NEW_PAGE__: boolean PLUGIN: { - __BACKGROUND_RAW__: string, - }, + __BACKGROUND_RAW__: string + } __LAST_TYPE__: [ItemType, number] __LAST_CONTENT__: Record } @@ -197,7 +205,7 @@ export interface DefaultsText { go: string | undefined bold: boolean italic: boolean - position: { x: number, y: number } + position: { x: number; y: number } } export interface ContentImage { @@ -264,11 +272,13 @@ export type ContentFormularyType = 'text' | 'button' | 'combo' | 'list' export interface ContentFormulary { name: string type: T - options?: T extends 'text' ? - FormularyTextOptions : T extends 'button' ? - FormularyButtonOptions : T extends 'combo' | 'list' ? - FormularyComboAndListOptions : - never + options?: T extends 'text' + ? FormularyTextOptions + : T extends 'button' + ? FormularyButtonOptions + : T extends 'combo' | 'list' + ? FormularyComboAndListOptions + : never } export interface Content { @@ -420,28 +430,28 @@ export interface RunOptions { * Type runner * @default 'client' */ - type?: 'client' | 'server' + type: 'client' | 'server' | 'auto' /** * Client type format emitter * @default 'blob' */ - clientEmit?: PDFRunEmitOption + clientEmit: PDFRunEmitOption /** * Server file destination * * Required in {@link RunOptions} type: server */ - serverPath?: string + serverPath: string /** * Server file destination * * @default 'rgb' */ - colorSchema?: ColorSchema + colorSchema: ColorSchema /** * CWD for Server-Side Setup * * @default 'process.cwd()' */ - cwd?: ColorSchema + cwd: string } diff --git a/packages/pdfeasy/src/utils/defines.ts b/packages/pdfeasy/src/utils.ts similarity index 92% rename from packages/pdfeasy/src/utils/defines.ts rename to packages/pdfeasy/src/utils.ts index 78cdbe3..56e5b92 100644 --- a/packages/pdfeasy/src/utils/defines.ts +++ b/packages/pdfeasy/src/utils.ts @@ -1,3 +1,6 @@ +export const isBrowser = + typeof window === 'object' && typeof document === 'object' + import { PDFEasyDefaults } from 'src/types' export const pdfDefaults = (): PDFEasyDefaults => { diff --git a/packages/pdfeasy/src/utils/index.ts b/packages/pdfeasy/src/utils/index.ts deleted file mode 100644 index 870ecfd..0000000 --- a/packages/pdfeasy/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './populate' diff --git a/packages/pdfeasy/src/utils/populate.ts b/packages/pdfeasy/src/utils/populate.ts deleted file mode 100644 index 54c6cbe..0000000 --- a/packages/pdfeasy/src/utils/populate.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Content } from 'src/types' - -export const loremIpsum = () => { - const paragraph = () => { - const arr = [ - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at odio elit. Vivamus imperdiet id enim a ullamcorper. Sed blandit sem sit amet mauris volutpat, et fermentum urna placerat. Proin pretium rhoncus lobortis. Aenean ullamcorper posuere odio a elementum. Praesent placerat vestibulum elementum. Proin ultricies tellus id convallis hendrerit. Ut convallis pretium lectus, posuere venenatis eros rhoncus sed. Cras venenatis tempor turpis interdum consequat. Suspendisse at viverra lacus. Phasellus malesuada ut est ut pretium. Nullam lorem odio, interdum a neque non, pulvinar luctus leo.', - 'In non iaculis erat. Aliquam euismod nunc augue, eget fermentum orci vulputate id. Suspendisse placerat dui id rutrum aliquam. Etiam quis ultricies tellus, at fermentum est. Fusce non cursus nisl. Donec pulvinar feugiat augue. Nulla arcu sapien, aliquet in consequat sed, placerat in metus. Praesent gravida ligula quis orci laoreet sodales. Aenean id turpis ac velit dictum lacinia.', - 'Morbi posuere ultricies dolor eget condimentum. Pellentesque eu ligula massa. Nam facilisis vestibulum lacus et pellentesque. In nec pharetra orci. Duis congue nibh ex, vel sagittis ex venenatis ac. Praesent consequat enim sit amet leo iaculis sodales. Praesent eu nibh tortor. Maecenas eu quam ut leo condimentum ullamcorper. Sed ultrices luctus diam in finibus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Nullam laoreet pellentesque dui, eu dictum nisi finibus hendrerit.', - 'Aliquam lobortis quis felis sed mollis. Nulla non venenatis odio, eu semper velit. Maecenas convallis diam diam, a pellentesque odio mattis condimentum. Phasellus pulvinar quam lectus, sit amet sodales odio venenatis at. Fusce vitae scelerisque magna. Quisque molestie lacus a tortor sagittis sagittis. Aliquam erat volutpat. Vestibulum et dolor vitae ex imperdiet elementum. Sed facilisis vel erat finibus faucibus. Donec cursus mi id euismod suscipit. Cras laoreet laoreet rutrum. Proin posuere luctus neque, a varius tellus posuere non. Aliquam placerat massa scelerisque nisl iaculis porttitor. Mauris id magna tempor, sollicitudin libero eget, bibendum felis. Aenean sodales mauris odio, quis ullamcorper elit vestibulum sit amet. Vestibulum sed enim eleifend, ullamcorper diam at, pharetra augue.', - 'Aliquam faucibus tortor vel sollicitudin fermentum. Nam a augue ac odio accumsan pellentesque id quis odio. Maecenas imperdiet urna vitae risus aliquet, ac aliquam ligula porta. Nunc neque dui, posuere vitae malesuada sit amet, convallis vel enim. Ut malesuada ornare sapien commodo luctus. Curabitur varius ac justo id egestas. Sed non gravida nisi. Donec semper quam sapien, in ornare orci cursus et. Proin aliquet est fermentum justo vehicula, at lacinia nulla facilisis.', - ] - - return arr[Math.floor(Math.random() * arr.length)] - } - - const title = () => { - const arr = [ - 'Lorem ipsum', - 'In non iaculis erat', - 'Morbi posuere', - 'Aliquam lobortis', - 'Aliquam faucibus', - ] - - return arr[Math.floor(Math.random() * arr.length)] - } - - return { paragraph, title } -} - -export const content = (): Content[] => { - return [ - { raw: loremIpsum().title() }, - { raw: loremIpsum().paragraph(), text: {} }, - { - stack: [ - { raw: loremIpsum().paragraph(), text: {} }, - { raw: loremIpsum().paragraph(), text: {} }, - ], - }, - { raw: loremIpsum().paragraph(), text: {} }, - ] -} diff --git a/packages/pdfeasy/src/font/vfs.ts b/packages/pdfeasy/src/vfs.ts similarity index 52% rename from packages/pdfeasy/src/font/vfs.ts rename to packages/pdfeasy/src/vfs.ts index 516fb8b..bb0723a 100644 --- a/packages/pdfeasy/src/font/vfs.ts +++ b/packages/pdfeasy/src/vfs.ts @@ -1,31 +1,13 @@ -import { PDFEasy } from '../runner/pdfeasy' +import { getBase64ByURL } from './http' +import { PDFEasy } from './runner' import path from 'path' -import { getBase64ByURL } from '../utils/request' -import { regex } from '../utils/defines' - -export const getFontCorrectName = ( - name: string, - type: 'normal' | 'italic' | 'bold' | 'bolditalic' -) => { - switch (type) { - case 'normal': - return name - case 'italic': - return name + '-Oblique' - case 'bold': - return name + '-Bold' - case 'bolditalic': - return name + '-BoldOblique' - default: - return name - } -} - -export const setServerPath = (p: string) => { - return path.join(process.cwd() + `/${p}`) -} +import { regex } from './utils' +import { resolveFontName } from './resolvers' export const setExternalFonts = async (instance: PDFEasy) => { + const fontTarget = (str: string) => + path.resolve(instance.runOptions?.cwd + `/${str}`) + if (instance.options?.advanced?.fontsPurge) { const allContentFonts: string[] = [] @@ -45,42 +27,42 @@ export const setExternalFonts = async (instance: PDFEasy) => { } const isLocalServer = (font: string) => - instance.optionsRun?.type === 'server' && !regex().http(font) + instance.runOptions?.type === 'server' && !regex().http(font) for (const font of instance.fonts) { const normal = await getBase64ByURL( - isLocalServer(font.normal) ? setServerPath(font.normal) : font.normal, + isLocalServer(font.normal) ? fontTarget(font.normal) : font.normal, 'arraybuffer' ) const italic = await getBase64ByURL( - isLocalServer(font.italic) ? setServerPath(font.italic) : font.italic, + isLocalServer(font.italic) ? fontTarget(font.italic) : font.italic, 'arraybuffer' ) const bold = await getBase64ByURL( - isLocalServer(font.bold) ? setServerPath(font.bold) : font.bold, + isLocalServer(font.bold) ? fontTarget(font.bold) : font.bold, 'arraybuffer' ) const bolditalic = await getBase64ByURL( isLocalServer(font.bolditalic) - ? setServerPath(font.bolditalic) + ? fontTarget(font.bolditalic) : font.bolditalic, 'arraybuffer' ) await instance.pdfkit?.registerFont( - getFontCorrectName(font.name, 'normal'), + resolveFontName(font.name, 'normal'), normal ) await instance.pdfkit?.registerFont( - getFontCorrectName(font.name, 'italic'), + resolveFontName(font.name, 'italic'), italic ) await instance.pdfkit?.registerFont( - getFontCorrectName(font.name, 'bold'), + resolveFontName(font.name, 'bold'), bold ) await instance.pdfkit?.registerFont( - getFontCorrectName(font.name, 'bolditalic'), + resolveFontName(font.name, 'bolditalic'), bolditalic ) } diff --git a/packages/pdfeasy/test/contents.test.ts b/packages/pdfeasy/test/contents.test.ts index fe96285..cc7e321 100644 --- a/packages/pdfeasy/test/contents.test.ts +++ b/packages/pdfeasy/test/contents.test.ts @@ -1,120 +1,120 @@ -import { describe, expect, it } from "vitest"; -import pdfeasy, { Utils } from "../src/index"; - -describe('Contents - text', () => { - it('should run simple text', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it('should run simple text without text object', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph() } - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it('should run multiple text', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().title(), text: {} }, - { raw: Utils.loremIpsum().paragraph(), text: {} }, - { raw: Utils.loremIpsum().paragraph(), text: {} }, - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it('should run multiple types text', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().title(), text: {} }, - { raw: Utils.loremIpsum().paragraph(), text: { italic: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { bold: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { italic: true, bold: true } }, - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it('should run multiple fonts text', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().title(), text: { font: 'Helvetica' } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Times-Roman', bold: true, italic: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Courier', bold: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Courier', italic: true, bold: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Helvetica'} }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Helvetica', italic: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Times-Roman', bold: true } }, - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Times-Roman', italic: true } }, - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) -}) - -describe('Contents - stack', () => { - it('should create multiple stacks', () => { - pdfeasy.new() - - pdfeasy.add([ - { stack: [ { raw: Utils.loremIpsum().paragraph(), text: {}}]}, - { raw: Utils.loremIpsum().paragraph(), text: {}}, - { stack: [ { raw: Utils.loremIpsum().paragraph(), text: {}}]} - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) -}) - -describe('Contents - image', () => { - it('should render base64 png', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=', image: {} }, - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it('should render base64 png with custom options', () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=', image: { size: { width: 200, height: 200, scale: 0.} } }, - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) +import { describe, expect, it } from "vitest"; +import pdfeasy from "../src/index"; + +describe('Contents - text', () => { + it('should run simple text', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO', text: {} } + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) + + it('should run simple text without text object', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO' } + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) + + it('should run multiple text', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO Title', text: {} }, + { raw: 'XPTO', text: {} }, + { raw: 'XPTO', text: {} }, + { raw: 'XPTO', text: {} } + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) + + it('should run multiple types text', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO Title', text: {} }, + { raw: 'XPTO', text: { italic: true } }, + { raw: 'XPTO', text: { bold: true } }, + { raw: 'XPTO', text: { italic: true, bold: true } }, + { raw: 'XPTO', text: {} } + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) + + it('should run multiple fonts text', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO Title', text: { font: 'Helvetica' } }, + { raw: 'XPTO', text: { font: 'Times-Roman', bold: true, italic: true } }, + { raw: 'XPTO', text: { font: 'Courier', bold: true } }, + { raw: 'XPTO', text: { font: 'Courier', italic: true, bold: true } }, + { raw: 'XPTO', text: { font: 'Helvetica'} }, + { raw: 'XPTO', text: { font: 'Helvetica', italic: true } }, + { raw: 'XPTO', text: { font: 'Times-Roman', bold: true } }, + { raw: 'XPTO', text: { font: 'Times-Roman', italic: true } }, + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) +}) + +describe('Contents - stack', () => { + it('should create multiple stacks', () => { + pdfeasy.new() + + pdfeasy.add([ + { stack: [ { raw: 'XPTO', text: {}}]}, + { raw: 'XPTO', text: {}}, + { stack: [ { raw: 'XPTO', text: {}}]} + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) +}) + +describe('Contents - image', () => { + it('should render base64 png', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=', image: {} }, + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) + + it('should render base64 png with custom options', () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=', image: { size: { width: 200, height: 200, scale: 0.} } }, + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) }) \ No newline at end of file diff --git a/packages/pdfeasy/test/fonts.test.ts b/packages/pdfeasy/test/fonts.test.ts index e56cc70..8883abe 100644 --- a/packages/pdfeasy/test/fonts.test.ts +++ b/packages/pdfeasy/test/fonts.test.ts @@ -1,95 +1,94 @@ -import { describe, expect, it } from "vitest"; -import pdfeasy, { Utils } from "../src/index"; - - -describe('Fonts - fontsPurge option', () => { - it('should not inject fonts', async () => { - pdfeasy.new({ - advanced: { - fontsPurge: true - } - }) - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - await pdfeasy.run({ - clientEmit: 'none' - }) - - expect(pdfeasy.fonts.length).toBe(0) - }) - - it('should not inject fonts in stack', async () => { - pdfeasy.new({ - advanced: { - fontsPurge: true - } - }) - - pdfeasy.add(Utils.content()) - - await pdfeasy.run({ - clientEmit: 'none' - }) - - expect(pdfeasy.fonts.length).toBe(0) - }) - - it('should not use inject font', async () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - pdfeasy.addFonts([ - { - name: 'Roboto', - normal: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - bold: 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - italic: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - bolditalic: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - }, - ]) - - await pdfeasy.run({ - clientEmit: 'none' - }) - - expect(pdfeasy.fonts.length).toBe(0) - }) -}) - -describe('Fonts - Register', () => { - it('should use url fonts', async () => { - pdfeasy.new() - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph(), text: { font: 'Roboto' } } - ]) - - pdfeasy.addFonts([ - { - name: 'Roboto', - normal: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - bold: 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - italic: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - bolditalic: - 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', - }, - ]) - - await pdfeasy.run({ - clientEmit: 'none' - }) - - expect(pdfeasy.fonts.length).toBe(1) - }) +import { describe, expect, it } from "vitest"; +import pdfeasy from "../src/index"; + +describe('Fonts - fontsPurge option', () => { + it('should not inject fonts', async () => { + pdfeasy.new({ + advanced: { + fontsPurge: true + } + }) + + pdfeasy.add([ + { raw: 'XPTO', text: {} } + ]) + + await pdfeasy.run({ + clientEmit: 'none' + }) + + expect(pdfeasy.fonts.length).toBe(0) + }) + + it('should not inject fonts in stack', async () => { + pdfeasy.new({ + advanced: { + fontsPurge: true + } + }) + + pdfeasy.add([{ raw: 'XPTO' }]) + + await pdfeasy.run({ + clientEmit: 'none' + }) + + expect(pdfeasy.fonts.length).toBe(0) + }) + + it('should not use inject font', async () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO', text: {} } + ]) + + pdfeasy.addFonts([ + { + name: 'Roboto', + normal: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + bold: 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + italic: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + bolditalic: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + }, + ]) + + await pdfeasy.run({ + clientEmit: 'none' + }) + + expect(pdfeasy.fonts.length).toBe(0) + }) +}) + +describe('Fonts - Register', () => { + it('should use url fonts', async () => { + pdfeasy.new() + + pdfeasy.add([ + { raw: 'XPTO', text: { font: 'Roboto' } } + ]) + + pdfeasy.addFonts([ + { + name: 'Roboto', + normal: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + bold: 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + italic: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + bolditalic: + 'https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxPKTU1Kg.ttf', + }, + ]) + + await pdfeasy.run({ + clientEmit: 'none' + }) + + expect(pdfeasy.fonts.length).toBe(1) + }) }) \ No newline at end of file diff --git a/packages/pdfeasy/test/page.test.ts b/packages/pdfeasy/test/page.test.ts index 4eb60bc..1d893ce 100644 --- a/packages/pdfeasy/test/page.test.ts +++ b/packages/pdfeasy/test/page.test.ts @@ -1,35 +1,35 @@ -import { describe, expect, it } from "vitest" -import pdfeasy, { Utils } from "../src/index"; - -describe('Page - Text', () => { - it('should run a simple footer and header callback', () => { - pdfeasy.new({ - plugins: [ - { - page: [ - ({ Text }, context, current, total) => { - Text(`${current}/${total}`, {}, { - x: context.width / 2, - y: context.height - context.margins.bottom - }) - }, - ({ Text }, context, current, total) => { - Text('A Simple Header', {}, { - x: context.width / 2, - y: context.margins.top - 20 - }) - } - ] - } - ] - }) - - pdfeasy.add([ - { raw: Utils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(pdfeasy.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) +import { describe, expect, it } from "vitest" +import pdfeasy from "../src/index"; + +describe('Page - Text', () => { + it('should run a simple footer and header callback', () => { + pdfeasy.new({ + plugins: [ + { + page: [ + ({ Text }, context, current, total) => { + Text(`${current}/${total}`, {}, { + x: context.width / 2, + y: context.height - context.margins.bottom + }) + }, + ({ Text }, context, current, total) => { + Text('A Simple Header', {}, { + x: context.width / 2, + y: context.margins.top - 20 + }) + } + ] + } + ] + }) + + pdfeasy.add([ + { raw: 'XPTO', text: {} } + ]) + + return expect(pdfeasy.run({ + clientEmit: 'none' + })).resolves.toBeTruthy() + }) }) \ No newline at end of file diff --git a/packages/pdfeasy/test/pdfeasy.bundle.test.ts b/packages/pdfeasy/test/pdfeasy.bundle.test.ts deleted file mode 100644 index df7ce43..0000000 --- a/packages/pdfeasy/test/pdfeasy.bundle.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { it, expect, describe } from 'vitest'; -import client, { Utils as ClientUtils } from '../dist/client.esm' -// import server, { Utils as ServerUtils } from '../dist/node.esm' - -describe("PDFEasy Bundle - Client", () => { - it("should pdfeasy exists", () => { - // for validade polyfills and global settings - expect(client).toBeTruthy() - }); - - it("should execute common flow", () => { - client.new() - - client.add([ - { raw: ClientUtils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(client.run({ - clientEmit: 'none' - })).resolves.toBeTruthy() - }) - - it("should not execute common flow in empty contents", () => { - client.new() - - client.add([]) - - expect(client.contents.length).toBe(0) - - return expect(client.run({ - clientEmit: 'none' - })).rejects.toBeTruthy() - }) -}); - -/* See https://github.com/vitest-dev/vitest/issues/1988 -describe("PDFEasy Bundle - Server", () => { - beforeEach(() => { - vi.mock('node:fs', () => { - return { - writeFile: vi.fn().mockImplementation((a: any, b: any) => {}), - writeFileSync: vi.fn().mockImplementation((a: any, b: any) => {}), - existsSync: vi.fn().mockImplementation((a: any, b: any) => {}), - }; - }); - }) - - afterEach(() => { - vi.restoreAllMocks() - }) - - it("should pdfeasy exists", () => { - // for validade global settings - expect(server).toBeTruthy() - }); - - it("should execute common flow", () => { - server.new({ - document: { - displayTitle: true - } - }) - - server.add([ - { raw: ServerUtils.loremIpsum().paragraph(), text: {} } - ]) - - return expect(server.run({ server: { - path: '/' - }})).resolves.toBeTruthy() - }) - - it("should not execute common flow in empty contents", () => { - server.new() - - server.add([]) - - expect(server.contents.length).toBe(0) - - return expect(server.run({ server: { - path: '/' - }})).rejects.toBeTruthy() - }) -}); -*/ \ No newline at end of file diff --git a/packages/pdfeasy/vitest.config.ts b/packages/pdfeasy/vitest.config.ts index d9f6096..2f9bf1f 100644 --- a/packages/pdfeasy/vitest.config.ts +++ b/packages/pdfeasy/vitest.config.ts @@ -1,11 +1,12 @@ -/// -import { defineConfig } from 'vite' - -export default defineConfig({ - test: { - coverage: { - include: ['src'], - exclude: ['examples', 'dist', 'scripts', 'node_modules'] - } - }, +/// +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + environment: 'happy-dom', + coverage: { + include: ['src'], + exclude: ['examples', 'dist', 'scripts', 'node_modules'] + } + }, }) \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce922b3..9c5253b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,7 +28,7 @@ importers: version: 3.5.3(rollup@3.21.6) '@nuxtjs/eslint-config-typescript': specifier: ^12.0.0 - version: 12.0.0(eslint@8.42.0)(typescript@4.9.5) + version: 12.0.0(eslint@8.42.0)(typescript@5.1.3) '@types/node': specifier: ^18.11.9 version: 18.11.9 @@ -37,13 +37,16 @@ importers: version: 8.42.0 nuxt: specifier: ^3.5.3 - version: 3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@4.9.5) + version: 3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@5.1.3) packages/pdfeasy: dependencies: blob-stream: specifier: 0.1.3 version: 0.1.3 + defu: + specifier: 6.1.2 + version: 6.1.2 file-saver: specifier: 2.0.5 version: 2.0.5 @@ -99,6 +102,9 @@ importers: esm: specifier: 3.2.25 version: 3.2.25 + happy-dom: + specifier: 9.20.3 + version: 9.20.3 node-stdlib-browser: specifier: 1.2.0 version: 1.2.0 @@ -119,7 +125,7 @@ importers: version: 4.3.5(@types/node@20.1.2) vitest: specifier: 0.31.0 - version: 0.31.0 + version: 0.31.0(happy-dom@9.20.3) packages/vue: dependencies: @@ -1229,7 +1235,7 @@ packages: p-reduce: 2.1.0 pacote: 15.1.1 pify: 5.0.0 - semver: 7.5.1 + semver: 7.5.2 slash: 3.0.0 validate-npm-package-license: 3.0.4 validate-npm-package-name: 4.0.0 @@ -1377,7 +1383,7 @@ packages: json-parse-even-better-errors: 3.0.0 json-stringify-nice: 1.1.4 minimatch: 6.2.0 - nopt: 7.1.0 + nopt: 7.2.0 npm-install-checks: 6.1.1 npm-package-arg: 10.1.0 npm-pick-manifest: 8.0.1 @@ -1389,7 +1395,7 @@ packages: promise-all-reject-late: 1.0.1 promise-call-limit: 1.0.2 read-package-json-fast: 3.0.2 - semver: 7.5.1 + semver: 7.5.2 ssri: 10.0.4 treeverse: 3.0.0 walk-up-path: 1.0.0 @@ -1403,14 +1409,14 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: '@gar/promisify': 1.1.3 - semver: 7.5.1 + semver: 7.5.2 dev: true /@npmcli/fs@3.1.0: resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: - semver: 7.5.1 + semver: 7.5.2 dev: true /@npmcli/git@4.1.0: @@ -1423,7 +1429,7 @@ packages: proc-log: 3.0.0 promise-inflight: 1.0.1 promise-retry: 2.0.1 - semver: 7.5.1 + semver: 7.5.2 which: 3.0.1 transitivePeerDependencies: - bluebird @@ -1455,7 +1461,7 @@ packages: cacache: 17.1.3 json-parse-even-better-errors: 3.0.0 pacote: 15.1.1 - semver: 7.5.1 + semver: 7.5.2 transitivePeerDependencies: - bluebird - supports-color @@ -1526,11 +1532,10 @@ packages: dependencies: '@npmcli/node-gyp': 2.0.0 '@npmcli/promise-spawn': 3.0.0 - node-gyp: 9.3.1 + node-gyp: 9.4.0 read-package-json-fast: 2.0.3 which: 2.0.2 transitivePeerDependencies: - - bluebird - supports-color dev: true @@ -1540,11 +1545,10 @@ packages: dependencies: '@npmcli/node-gyp': 3.0.0 '@npmcli/promise-spawn': 6.0.2 - node-gyp: 9.3.1 + node-gyp: 9.4.0 read-package-json-fast: 3.0.2 which: 3.0.1 transitivePeerDependencies: - - bluebird - supports-color dev: true @@ -1761,7 +1765,7 @@ packages: resolution: {integrity: sha512-PjVETP7+iZXAs5Q8O4ivl4t6qjWZMZqwiTVogUXHoHGZZcw7GZW3u3tzfYfE1HbzyYJfr236IXqQ02MeR8Fz2w==} dev: true - /@nuxt/vite-builder@3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@4.9.5)(vue@3.3.4): + /@nuxt/vite-builder@3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@5.1.3)(vue@3.3.4): resolution: {integrity: sha512-7zEKpGh3iWGRDwbWUa8eRxdLMxZtPzetelmdmXPjtYKGwUebZOcBhpeJ+VgJKOIf4OEj9E7BZS+it/Ji9UG9qw==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: @@ -1800,7 +1804,7 @@ packages: unplugin: 1.3.1 vite: 4.3.9(@types/node@18.11.9) vite-node: 0.31.4(@types/node@18.11.9) - vite-plugin-checker: 0.6.0(eslint@8.42.0)(typescript@4.9.5)(vite@4.3.9) + vite-plugin-checker: 0.6.0(eslint@8.42.0)(typescript@5.1.3)(vite@4.3.9) vue: 3.3.4 vue-bundle-renderer: 1.0.3 transitivePeerDependencies: @@ -1822,14 +1826,14 @@ packages: - vue-tsc dev: true - /@nuxtjs/eslint-config-typescript@12.0.0(eslint@8.42.0)(typescript@4.9.5): + /@nuxtjs/eslint-config-typescript@12.0.0(eslint@8.42.0)(typescript@5.1.3): resolution: {integrity: sha512-HJR0ho5MYuOCFjkL+eMX/VXbUwy36J12DUMVy+dj3Qz1GYHwX92Saxap3urFzr8oPkzzFiuOknDivfCeRBWakg==} peerDependencies: eslint: ^8.23.0 dependencies: '@nuxtjs/eslint-config': 12.0.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.42.0) - '@typescript-eslint/eslint-plugin': 5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.42.0)(typescript@4.9.5) - '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/eslint-plugin': 5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.42.0)(typescript@5.1.3) + '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@5.1.3) eslint: 8.42.0 eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.5)(eslint-plugin-import@2.27.5)(eslint@8.42.0) eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.42.0) @@ -1867,26 +1871,26 @@ packages: engines: {node: '>= 14'} dev: true - /@octokit/core@4.2.1: - resolution: {integrity: sha512-tEDxFx8E38zF3gT7sSMDrT1tGumDgsw5yPG6BBh/X+5ClIQfMH/Yqocxz1PnHx6CHyF6pxmovUTOfZAUvQ0Lvw==} + /@octokit/core@4.2.4: + resolution: {integrity: sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==} engines: {node: '>= 14'} dependencies: '@octokit/auth-token': 3.0.4 '@octokit/graphql': 5.0.6 - '@octokit/request': 6.2.5 + '@octokit/request': 6.2.8 '@octokit/request-error': 3.0.3 - '@octokit/types': 9.2.3 + '@octokit/types': 9.3.2 before-after-hook: 2.2.3 universal-user-agent: 6.0.0 transitivePeerDependencies: - encoding dev: true - /@octokit/endpoint@7.0.5: - resolution: {integrity: sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==} + /@octokit/endpoint@7.0.6: + resolution: {integrity: sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==} engines: {node: '>= 14'} dependencies: - '@octokit/types': 9.2.3 + '@octokit/types': 9.3.2 is-plain-object: 5.0.0 universal-user-agent: 6.0.0 dev: true @@ -1895,8 +1899,8 @@ packages: resolution: {integrity: sha512-Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw==} engines: {node: '>= 14'} dependencies: - '@octokit/request': 6.2.5 - '@octokit/types': 9.2.3 + '@octokit/request': 6.2.8 + '@octokit/types': 9.3.2 universal-user-agent: 6.0.0 transitivePeerDependencies: - encoding @@ -1910,39 +1914,39 @@ packages: resolution: {integrity: sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw==} dev: true - /@octokit/openapi-types@17.2.0: - resolution: {integrity: sha512-MazrFNx4plbLsGl+LFesMo96eIXkFgEtaKbnNpdh4aQ0VM10aoylFsTYP1AEjkeoRNZiiPe3T6Gl2Hr8dJWdlQ==} + /@octokit/openapi-types@18.0.0: + resolution: {integrity: sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==} dev: true /@octokit/plugin-enterprise-rest@6.0.1: resolution: {integrity: sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw==} dev: true - /@octokit/plugin-paginate-rest@3.1.0(@octokit/core@4.2.1): + /@octokit/plugin-paginate-rest@3.1.0(@octokit/core@4.2.4): resolution: {integrity: sha512-+cfc40pMzWcLkoDcLb1KXqjX0jTGYXjKuQdFQDc6UAknISJHnZTiBqld6HDwRJvD4DsouDKrWXNbNV0lE/3AXA==} engines: {node: '>= 14'} peerDependencies: '@octokit/core': '>=4' dependencies: - '@octokit/core': 4.2.1 + '@octokit/core': 4.2.4 '@octokit/types': 6.41.0 dev: true - /@octokit/plugin-request-log@1.0.4(@octokit/core@4.2.1): + /@octokit/plugin-request-log@1.0.4(@octokit/core@4.2.4): resolution: {integrity: sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==} peerDependencies: '@octokit/core': '>=3' dependencies: - '@octokit/core': 4.2.1 + '@octokit/core': 4.2.4 dev: true - /@octokit/plugin-rest-endpoint-methods@6.8.1(@octokit/core@4.2.1): + /@octokit/plugin-rest-endpoint-methods@6.8.1(@octokit/core@4.2.4): resolution: {integrity: sha512-QrlaTm8Lyc/TbU7BL/8bO49vp+RZ6W3McxxmmQTgYxf2sWkO8ZKuj4dLhPNJD6VCUW1hetCmeIM0m6FTVpDiEg==} engines: {node: '>= 14'} peerDependencies: '@octokit/core': '>=3' dependencies: - '@octokit/core': 4.2.1 + '@octokit/core': 4.2.4 '@octokit/types': 8.2.1 deprecation: 2.3.1 dev: true @@ -1951,18 +1955,18 @@ packages: resolution: {integrity: sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==} engines: {node: '>= 14'} dependencies: - '@octokit/types': 9.2.3 + '@octokit/types': 9.3.2 deprecation: 2.3.1 once: 1.4.0 dev: true - /@octokit/request@6.2.5: - resolution: {integrity: sha512-z83E8UIlPNaJUsXpjD8E0V5o/5f+vJJNbNcBwVZsX3/vC650U41cOkTLjq4PKk9BYonQGOnx7N17gvLyNjgGcQ==} + /@octokit/request@6.2.8: + resolution: {integrity: sha512-ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw==} engines: {node: '>= 14'} dependencies: - '@octokit/endpoint': 7.0.5 + '@octokit/endpoint': 7.0.6 '@octokit/request-error': 3.0.3 - '@octokit/types': 9.2.3 + '@octokit/types': 9.3.2 is-plain-object: 5.0.0 node-fetch: 2.6.7 universal-user-agent: 6.0.0 @@ -1974,10 +1978,10 @@ packages: resolution: {integrity: sha512-5arkTsnnRT7/sbI4fqgSJ35KiFaN7zQm0uQiQtivNQLI8RQx8EHwJCajcTUwmaCMNDg7tdCvqAnc7uvHHPxrtQ==} engines: {node: '>= 14'} dependencies: - '@octokit/core': 4.2.1 - '@octokit/plugin-paginate-rest': 3.1.0(@octokit/core@4.2.1) - '@octokit/plugin-request-log': 1.0.4(@octokit/core@4.2.1) - '@octokit/plugin-rest-endpoint-methods': 6.8.1(@octokit/core@4.2.1) + '@octokit/core': 4.2.4 + '@octokit/plugin-paginate-rest': 3.1.0(@octokit/core@4.2.4) + '@octokit/plugin-request-log': 1.0.4(@octokit/core@4.2.4) + '@octokit/plugin-rest-endpoint-methods': 6.8.1(@octokit/core@4.2.4) transitivePeerDependencies: - encoding dev: true @@ -1994,10 +1998,10 @@ packages: '@octokit/openapi-types': 14.0.0 dev: true - /@octokit/types@9.2.3: - resolution: {integrity: sha512-MMeLdHyFIALioycq+LFcA71v0S2xpQUX2cw6pPbHQjaibcHYwLnmK/kMZaWuGfGfjBJZ3wRUq+dOaWsvrPJVvA==} + /@octokit/types@9.3.2: + resolution: {integrity: sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA==} dependencies: - '@octokit/openapi-types': 17.2.0 + '@octokit/openapi-types': 18.0.0 dev: true /@parcel/watcher@2.0.4: @@ -2270,7 +2274,7 @@ packages: dependencies: '@sigstore/protobuf-specs': 0.1.0 make-fetch-happen: 11.1.1 - tuf-js: 1.1.6 + tuf-js: 1.1.7 transitivePeerDependencies: - supports-color dev: true @@ -2411,7 +2415,7 @@ packages: resolution: {integrity: sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==} dev: true - /@typescript-eslint/eslint-plugin@5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.42.0)(typescript@4.9.5): + /@typescript-eslint/eslint-plugin@5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.42.0)(typescript@5.1.3): resolution: {integrity: sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2423,23 +2427,23 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@5.1.3) '@typescript-eslint/scope-manager': 5.59.5 - '@typescript-eslint/type-utils': 5.59.5(eslint@8.42.0)(typescript@4.9.5) - '@typescript-eslint/utils': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/type-utils': 5.59.5(eslint@8.42.0)(typescript@5.1.3) + '@typescript-eslint/utils': 5.59.5(eslint@8.42.0)(typescript@5.1.3) debug: 4.3.4 eslint: 8.42.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.0 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + tsutils: 3.21.0(typescript@5.1.3) + typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.59.5(eslint@8.42.0)(typescript@4.9.5): + /@typescript-eslint/parser@5.59.5(eslint@8.42.0)(typescript@5.1.3): resolution: {integrity: sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2451,10 +2455,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.59.5 '@typescript-eslint/types': 5.59.5 - '@typescript-eslint/typescript-estree': 5.59.5(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.1.3) debug: 4.3.4 eslint: 8.42.0 - typescript: 4.9.5 + typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true @@ -2467,7 +2471,7 @@ packages: '@typescript-eslint/visitor-keys': 5.59.5 dev: true - /@typescript-eslint/type-utils@5.59.5(eslint@8.42.0)(typescript@4.9.5): + /@typescript-eslint/type-utils@5.59.5(eslint@8.42.0)(typescript@5.1.3): resolution: {integrity: sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2477,12 +2481,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.5(typescript@4.9.5) - '@typescript-eslint/utils': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.1.3) + '@typescript-eslint/utils': 5.59.5(eslint@8.42.0)(typescript@5.1.3) debug: 4.3.4 eslint: 8.42.0 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + tsutils: 3.21.0(typescript@5.1.3) + typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true @@ -2492,7 +2496,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.59.5(typescript@4.9.5): + /@typescript-eslint/typescript-estree@5.59.5(typescript@5.1.3): resolution: {integrity: sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2507,13 +2511,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.0 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + tsutils: 3.21.0(typescript@5.1.3) + typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.59.5(eslint@8.42.0)(typescript@4.9.5): + /@typescript-eslint/utils@5.59.5(eslint@8.42.0)(typescript@5.1.3): resolution: {integrity: sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2524,7 +2528,7 @@ packages: '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 5.59.5 '@typescript-eslint/types': 5.59.5 - '@typescript-eslint/typescript-estree': 5.59.5(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.1.3) eslint: 8.42.0 eslint-scope: 5.1.1 semver: 7.5.0 @@ -2649,7 +2653,7 @@ packages: magic-string: 0.30.0 picocolors: 1.0.0 std-env: 3.3.3 - vitest: 0.31.0 + vitest: 0.31.0(happy-dom@9.20.3) dev: true /@vitest/expect@0.31.0: @@ -4214,6 +4218,10 @@ packages: engines: {node: '>= 6'} dev: true + /css.escape@1.5.1: + resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} + dev: true + /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} @@ -5016,7 +5024,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@5.1.3) debug: 3.2.7 eslint: 8.42.0 eslint-import-resolver-node: 0.3.7 @@ -5057,7 +5065,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.59.5(eslint@8.42.0)(typescript@5.1.3) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -5386,6 +5394,10 @@ packages: strip-final-newline: 3.0.0 dev: true + /exponential-backoff@3.1.1: + resolution: {integrity: sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==} + dev: true + /external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} @@ -5930,7 +5942,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.1.2 + minimatch: 3.0.5 once: 1.4.0 path-is-absolute: 1.0.1 dev: true @@ -6078,6 +6090,17 @@ packages: uglify-js: 3.17.4 dev: true + /happy-dom@9.20.3: + resolution: {integrity: sha512-eBsgauT435fXFvQDNcmm5QbGtYzxEzOaX35Ia+h6yP/wwa4xSWZh1CfP+mGby8Hk6Xu59mTkpyf72rUXHNxY7A==} + dependencies: + css.escape: 1.5.1 + entities: 4.5.0 + iconv-lite: 0.6.3 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + dev: true + /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} @@ -6280,7 +6303,6 @@ packages: dependencies: safer-buffer: 2.1.2 dev: true - optional: true /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -6357,7 +6379,7 @@ packages: promzard: 0.3.0 read: 1.0.7 read-package-json: 5.0.1 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-license: 3.0.4 validate-npm-package-name: 4.0.0 dev: true @@ -7028,7 +7050,7 @@ packages: read-package-json: 5.0.1 resolve-from: 5.0.0 rimraf: 4.4.1 - semver: 7.5.1 + semver: 7.5.2 signal-exit: 3.0.7 slash: 3.0.0 ssri: 9.0.1 @@ -7083,7 +7105,7 @@ packages: npm-package-arg: 10.1.0 npm-registry-fetch: 14.0.5 proc-log: 3.0.0 - semver: 7.5.1 + semver: 7.5.2 sigstore: 1.6.0 ssri: 10.0.4 transitivePeerDependencies: @@ -7917,23 +7939,23 @@ packages: hasBin: true dev: true - /node-gyp@9.3.1: - resolution: {integrity: sha512-4Q16ZCqq3g8awk6UplT7AuxQ35XN4R/yf/+wSAwcBUAjg7l58RTactWaP8fIDTi0FzI7YcVLujwExakZlfWkXg==} + /node-gyp@9.4.0: + resolution: {integrity: sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==} engines: {node: ^12.13 || ^14.13 || >=16} hasBin: true dependencies: env-paths: 2.2.1 + exponential-backoff: 3.1.1 glob: 7.2.3 graceful-fs: 4.2.10 - make-fetch-happen: 10.2.1 + make-fetch-happen: 11.1.1 nopt: 6.0.0 npmlog: 6.0.2 rimraf: 3.0.2 - semver: 7.5.1 + semver: 7.5.2 tar: 6.1.11 which: 2.0.2 transitivePeerDependencies: - - bluebird - supports-color dev: true @@ -7989,8 +8011,8 @@ packages: abbrev: 1.1.1 dev: true - /nopt@7.1.0: - resolution: {integrity: sha512-ZFPLe9Iu0tnx7oWhFxAo4s7QTn8+NNDDxYNaKLjE7Dp0tbakQ3M1QhQzsnzXHQBTUO3K9BmwaxnyO8Ayn2I95Q==} + /nopt@7.2.0: + resolution: {integrity: sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} hasBin: true dependencies: @@ -8012,7 +8034,7 @@ packages: dependencies: hosted-git-info: 4.1.0 is-core-module: 2.12.1 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-license: 3.0.4 dev: true @@ -8022,7 +8044,7 @@ packages: dependencies: hosted-git-info: 5.2.1 is-core-module: 2.12.1 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-license: 3.0.4 dev: true @@ -8032,7 +8054,7 @@ packages: dependencies: hosted-git-info: 6.1.1 is-core-module: 2.12.1 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-license: 3.0.4 dev: true @@ -8062,7 +8084,7 @@ packages: resolution: {integrity: sha512-dH3GmQL4vsPtld59cOn8uY0iOqRmqKvV+DLGwNXV/Q7MDgD2QfOADWd/mFXcIE5LVhYYGjA3baz6W9JneqnuCw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: - semver: 7.5.1 + semver: 7.5.2 dev: true /npm-normalize-package-bin@1.0.1: @@ -8080,7 +8102,7 @@ packages: dependencies: hosted-git-info: 6.1.1 proc-log: 3.0.0 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-name: 5.0.0 dev: true @@ -8089,7 +8111,7 @@ packages: engines: {node: '>=10'} dependencies: hosted-git-info: 3.0.8 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-name: 3.0.0 dev: true @@ -8099,7 +8121,7 @@ packages: dependencies: hosted-git-info: 5.2.1 proc-log: 2.0.1 - semver: 7.5.1 + semver: 7.5.2 validate-npm-package-name: 4.0.0 dev: true @@ -8128,7 +8150,7 @@ packages: npm-install-checks: 6.1.1 npm-normalize-package-bin: 3.0.1 npm-package-arg: 10.1.0 - semver: 7.5.1 + semver: 7.5.2 dev: true /npm-registry-fetch@13.3.1: @@ -8234,7 +8256,7 @@ packages: fsevents: 2.3.2 dev: true - /nuxt@3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@4.9.5): + /nuxt@3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@5.1.3): resolution: {integrity: sha512-fG39BZ5N5ATtmx2vuxN8APQPSlSsCDpfkJ0k581gMc7eFztqrBzPncZX5w3RQLW7AiGBE2yYEfqiwC6AVODBBg==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -8250,7 +8272,7 @@ packages: '@nuxt/schema': 3.5.3(rollup@3.21.6) '@nuxt/telemetry': 2.2.0(rollup@3.21.6) '@nuxt/ui-templates': 1.1.1 - '@nuxt/vite-builder': 3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@4.9.5)(vue@3.3.4) + '@nuxt/vite-builder': 3.5.3(@types/node@18.11.9)(eslint@8.42.0)(rollup@3.21.6)(typescript@5.1.3)(vue@3.3.4) '@types/node': 18.11.9 '@unhead/ssr': 1.1.27 '@unhead/vue': 1.1.27(vue@3.3.4) @@ -9906,6 +9928,14 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.5.2: + resolution: {integrity: sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -10018,7 +10048,7 @@ packages: '@sigstore/protobuf-specs': 0.1.0 '@sigstore/tuf': 1.0.0 make-fetch-happen: 11.1.1 - tuf-js: 1.1.6 + tuf-js: 1.1.7 transitivePeerDependencies: - supports-color dev: true @@ -10719,22 +10749,22 @@ packages: - ts-node dev: true - /tsutils@3.21.0(typescript@4.9.5): + /tsutils@3.21.0(typescript@5.1.3): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.9.5 + typescript: 5.1.3 dev: true /tty-browserify@0.0.1: resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==} dev: true - /tuf-js@1.1.6: - resolution: {integrity: sha512-CXwFVIsXGbVY4vFiWF7TJKWmlKJAT8TWkH4RmiohJRcDJInix++F0dznDmoVbtJNzZ8yLprKUG4YrDIhv3nBMg==} + /tuf-js@1.1.7: + resolution: {integrity: sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: '@tufjs/models': 1.0.4 @@ -10820,6 +10850,12 @@ packages: hasBin: true dev: true + /typescript@5.1.3: + resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /ufo@0.8.6: resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==} dev: false @@ -11248,7 +11284,7 @@ packages: - terser dev: true - /vite-plugin-checker@0.6.0(eslint@8.42.0)(typescript@4.9.5)(vite@4.3.9): + /vite-plugin-checker@0.6.0(eslint@8.42.0)(typescript@5.1.3)(vite@4.3.9): resolution: {integrity: sha512-DWZ9Hv2TkpjviPxAelNUt4Q3IhSGrx7xrwdM64NI+Q4dt8PaMWJJh4qGNtSrfEuiuIzWWo00Ksvh5It4Y3L9xQ==} engines: {node: '>=14.16'} peerDependencies: @@ -11293,7 +11329,7 @@ packages: semver: 7.5.1 strip-ansi: 6.0.1 tiny-invariant: 1.3.1 - typescript: 4.9.5 + typescript: 5.1.3 vite: 4.3.9(@types/node@18.11.9) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 @@ -11434,7 +11470,7 @@ packages: fsevents: 2.3.2 dev: true - /vitest@0.31.0: + /vitest@0.31.0(happy-dom@9.20.3): resolution: {integrity: sha512-JwWJS9p3GU9GxkG7eBSmr4Q4x4bvVBSswaCFf1PBNHiPx00obfhHRJfgHcnI0ffn+NMlIh9QGvG75FlaIBdKGA==} engines: {node: '>=v14.18.0'} hasBin: true @@ -11479,6 +11515,7 @@ packages: chai: 4.3.7 concordance: 5.0.4 debug: 4.3.4 + happy-dom: 9.20.3 local-pkg: 0.4.3 magic-string: 0.30.0 pathe: 1.1.0 @@ -11638,6 +11675,11 @@ packages: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} dev: true + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: true + /webpack-sources@3.2.3: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} @@ -11650,6 +11692,18 @@ packages: engines: {node: '>=6'} dev: true + /whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + dependencies: + iconv-lite: 0.6.3 + dev: true + + /whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + dev: true + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: