@pinia/colada-plugin-debug
Advanced tools
| import * as pinia from "pinia"; | ||
| import * as vue from "vue"; | ||
| import { PiniaColadaPlugin, UseQueryEntry } from "@pinia/colada"; | ||
| //#region src/debug.d.ts | ||
| declare const useDebugData: pinia.StoreDefinition<"pinia-colada-debug", Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "refetchingEntries" | "totalErrors" | "totalSuccess" | "totalRefetches">, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, never>, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "addRefetchingEntry" | "removeRefetchingEntry">>; | ||
| declare function PiniaColadaDebugPlugin(): PiniaColadaPlugin; | ||
| type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'; | ||
| /** | ||
| * Creates a union type that still allows autocompletion for strings. | ||
| *@internal | ||
| */ | ||
| type _LiteralStringUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>); | ||
| declare function showMessage(type: _LiteralStringUnion<LogeMessageType>, title: string, subtitle: string, ...messages: any[]): void; | ||
| //#endregion | ||
| export { LogeMessageType, PiniaColadaDebugPlugin, showMessage, useDebugData }; | ||
| //# sourceMappingURL=index.d.mts.map |
+130
| import { defineStore } from "pinia"; | ||
| import { ref, shallowReactive } from "vue"; | ||
| //#region src/debug.ts | ||
| const tick = () => new Promise((r) => setTimeout(r, 0)); | ||
| const useDebugData = defineStore("pinia-colada-debug", () => { | ||
| const totalRefetches = ref(0); | ||
| const refetchingEntries = shallowReactive(/* @__PURE__ */ new Set()); | ||
| const totalErrors = ref(0); | ||
| const totalSuccess = ref(0); | ||
| function addRefetchingEntry(entry) { | ||
| refetchingEntries.add(entry); | ||
| totalRefetches.value++; | ||
| } | ||
| function removeRefetchingEntry(entry) { | ||
| refetchingEntries.delete(entry); | ||
| } | ||
| return { | ||
| refetchingEntries, | ||
| totalErrors, | ||
| totalSuccess, | ||
| totalRefetches, | ||
| addRefetchingEntry, | ||
| removeRefetchingEntry | ||
| }; | ||
| }); | ||
| function PiniaColadaDebugPlugin() { | ||
| return ({ queryCache, pinia }) => { | ||
| const debugData = useDebugData(pinia); | ||
| queryCache.$onAction(async ({ name, onError, after, args }) => { | ||
| if (name === "fetch" || name === "refresh") { | ||
| const [entry] = args; | ||
| await tick(); | ||
| if (entry.asyncStatus.value === "loading" || entry.state.value.status === "pending") { | ||
| debugData.addRefetchingEntry(entry); | ||
| showMessage("đ", "refetch", `[${entry.key.join(", ")}]`, entry); | ||
| after(() => { | ||
| debugData.removeRefetchingEntry(entry); | ||
| if (entry.state.value.status === "error") { | ||
| debugData.totalErrors++; | ||
| showMessage("error", "refetch failed", `[${entry.key.join(", ")}]`, entry.state.value.error); | ||
| } else { | ||
| debugData.totalSuccess++; | ||
| showMessage("â ", "refetch", `[${entry.key.join(", ")}]`, entry.state.value.data); | ||
| } | ||
| }); | ||
| onError((error) => { | ||
| showMessage("error", "Unexpected Error", `[${entry.key.join(", ")}]`, error); | ||
| }); | ||
| } | ||
| } else if (name === "setQueryData") { | ||
| const [key, data] = args; | ||
| showMessage("log", "setQueryData", `[${key.join(", ")}]`, data); | ||
| } else if (name === "invalidate") { | ||
| const [entry] = args; | ||
| showMessage("đī¸", "invalidateEntry", `[${entry.key.join(", ")}]`); | ||
| } | ||
| }); | ||
| }; | ||
| } | ||
| const LOG_MESSAGES_COLOR = { | ||
| info: "background: #bfdbfe; color: #1e1e1e", | ||
| log: "background: #f9fafb; color: #1e1e1e", | ||
| warn: "background: #f97316; color: #0b0b0b", | ||
| error: "background: #ff5e56; color: #2e2e2e", | ||
| debug: "background: #212a2b; color: #fefefe", | ||
| trace: "background: #000; color: #fff" | ||
| }; | ||
| const LABELS_FOR_TYPE = { | ||
| info: "âšī¸", | ||
| log: "đ", | ||
| warn: "đ§", | ||
| error: "âī¸", | ||
| debug: "đ", | ||
| trace: "đ" | ||
| }; | ||
| const MD_BOLD_RE = /\*\*(.*?)\*\*/g; | ||
| const MD_CODE_RE = /`(.*?)`/g; | ||
| /** | ||
| * Applies italic and bold style to markdown text. | ||
| * @param text - The text to apply styles to | ||
| */ | ||
| function applyTextStyles(text) { | ||
| const styles = []; | ||
| return [text.replace(MD_BOLD_RE, (_m, text, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-weight: bold;", "font-weight: normal;"] | ||
| }); | ||
| return `%c${text}%c`; | ||
| }).replace(MD_CODE_RE, (_m, text, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-family: monospace;", "font-family: inherit;"] | ||
| }); | ||
| return `%c\`${text}\`%c`; | ||
| }), ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]; | ||
| } | ||
| function showMessage(type, title, subtitle, ...messages) { | ||
| if (process.env.NODE_ENV !== "development" && type !== "error" && type !== "warn") return; | ||
| const isGroup = messages.length > 0; | ||
| const label = LABELS_FOR_TYPE[type] ?? type; | ||
| const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info; | ||
| const method = isGroup ? "groupCollapsed" : "log"; | ||
| console[method](`%c ${label} %c ${title} %c ${subtitle}`, `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`, `background:#171717; color: #e2e8f0; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`, "background: transparent; color: inherit; font-weight: normal; font-size: 1em;"); | ||
| let activeStyle = ""; | ||
| messages.forEach((m) => { | ||
| let tempStyle = ""; | ||
| let mdStyles = []; | ||
| if (m instanceof Error) console.error(m); | ||
| else if (m !== void 0) { | ||
| if (typeof m !== "string") { | ||
| console.log(m); | ||
| return; | ||
| } | ||
| if (m.startsWith("```")) { | ||
| activeStyle = `font-family: monospace;`; | ||
| tempStyle += `color: gray; padding: 1px; border-radius: ${m === "```" ? "0 0 3px 3px" : "3px 3px 0 0"};`; | ||
| } else if (typeof m === "string" && !m.includes("http")) [m, ...mdStyles] = applyTextStyles(m); | ||
| if (activeStyle || tempStyle) console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles); | ||
| else console.log(m, ...mdStyles); | ||
| if (m === "```") activeStyle = ""; | ||
| else if (m.startsWith("```")) activeStyle += "background-color: black; color: palegreen; padding: 0.5em; width: 100%;"; | ||
| } | ||
| }); | ||
| if (isGroup) console.groupEnd(); | ||
| } | ||
| //#endregion | ||
| export { PiniaColadaDebugPlugin, showMessage, useDebugData }; | ||
| //# sourceMappingURL=index.mjs.map |
| {"version":3,"file":"index.mjs","names":[],"sources":["../src/debug.ts"],"sourcesContent":["import { defineStore } from 'pinia'\nimport { ref, shallowReactive } from 'vue'\nimport type { PiniaColadaPlugin, UseQueryEntry } from '@pinia/colada'\n\nconst tick = () => new Promise((r) => setTimeout(r, 0))\n\nexport const useDebugData = defineStore('pinia-colada-debug', () => {\n const totalRefetches = ref(0)\n const refetchingEntries = shallowReactive(new Set<UseQueryEntry>())\n const totalErrors = ref(0)\n const totalSuccess = ref(0)\n\n function addRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.add(entry)\n totalRefetches.value++\n }\n\n function removeRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.delete(entry)\n }\n\n return {\n refetchingEntries,\n totalErrors,\n totalSuccess,\n totalRefetches,\n addRefetchingEntry,\n removeRefetchingEntry,\n }\n})\n\nexport function PiniaColadaDebugPlugin(): PiniaColadaPlugin {\n return ({ queryCache, pinia }) => {\n const debugData = useDebugData(pinia)\n\n queryCache.$onAction(async ({ name, onError, after, args }) => {\n if (name === 'fetch' || name === 'refresh') {\n const [entry] = args\n await tick()\n if (entry.asyncStatus.value === 'loading' || entry.state.value.status === 'pending') {\n debugData.addRefetchingEntry(entry)\n showMessage('đ', 'refetch', `[${entry.key.join(', ')}]`, entry)\n\n after(() => {\n debugData.removeRefetchingEntry(entry)\n if (entry.state.value.status === 'error') {\n debugData.totalErrors++\n showMessage(\n 'error',\n 'refetch failed',\n `[${entry.key.join(', ')}]`,\n entry.state.value.error,\n )\n } else {\n debugData.totalSuccess++\n showMessage('â ', 'refetch', `[${entry.key.join(', ')}]`, entry.state.value.data)\n }\n })\n\n onError((error) => {\n showMessage('error', 'Unexpected Error', `[${entry.key.join(', ')}]`, error)\n })\n }\n } else if (name === 'setQueryData') {\n const [key, data] = args\n showMessage('log', 'setQueryData', `[${key.join(', ')}]`, data)\n } else if (name === 'invalidate') {\n const [entry] = args\n showMessage('đī¸', 'invalidateEntry', `[${entry.key.join(', ')}]`)\n }\n })\n }\n}\n\nexport type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'\n\nconst LOG_MESSAGES_COLOR: Partial<Record<string, string>> = {\n info: 'background: #bfdbfe; color: #1e1e1e',\n log: 'background: #f9fafb; color: #1e1e1e',\n warn: 'background: #f97316; color: #0b0b0b',\n error: 'background: #ff5e56; color: #2e2e2e',\n debug: 'background: #212a2b; color: #fefefe',\n trace: 'background: #000; color: #fff',\n}\n\nconst LABELS_FOR_TYPE: Partial<Record<string, string>> = {\n info: 'âšī¸',\n log: 'đ',\n // warn: 'â ī¸', // NOTE: doesn't show well in Chromium browsers\n warn: 'đ§',\n error: 'âī¸',\n debug: 'đ',\n trace: 'đ',\n}\n\nconst MD_BOLD_RE = /\\*\\*(.*?)\\*\\*/g\n// Underscores appear to often to deal with them with just a regexp\n// const MD_ITALIC_RE = /_(.*?)_/g\nconst MD_CODE_RE = /`(.*?)`/g\n\n/**\n * Applies italic and bold style to markdown text.\n * @param text - The text to apply styles to\n */\nfunction applyTextStyles(text: string) {\n const styles: Array<{ pos: number; style: [string, string] }> = []\n\n const newText = text\n .replace(MD_BOLD_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-weight: bold;', 'font-weight: normal;'],\n })\n return `%c${text}%c`\n })\n // .replace(MD_ITALIC_RE, (_m, text, pos) => {\n // styles.push({\n // pos,\n // style: ['font-style: italic;', 'font-style: normal;'],\n // })\n // return `%c${text}%c`\n // })\n .replace(MD_CODE_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-family: monospace;', 'font-family: inherit;'],\n })\n return `%c\\`${text}\\`%c`\n })\n return [newText, ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]\n}\n\n/**\n * Creates a union type that still allows autocompletion for strings.\n *@internal\n */\ntype _LiteralStringUnion<LiteralType, BaseType extends string = string> =\n | LiteralType\n | (BaseType & Record<never, never>)\n\nexport function showMessage(\n type: _LiteralStringUnion<LogeMessageType>,\n title: string,\n subtitle: string,\n ...messages: any[]\n) {\n // only keep errors and warns in tests\n if (process.env.NODE_ENV !== 'development' && type !== 'error' && type !== 'warn') {\n return\n }\n\n const isGroup = messages.length > 0\n const label = LABELS_FOR_TYPE[type] ?? type\n const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info!\n\n const collapsed = true\n\n const method = isGroup ? (collapsed ? 'groupCollapsed' : 'group') : 'log'\n // const logMethod = type === LogMessageType.error ? 'error' : type === LogMessageType.warn ? 'warn' : 'log'\n\n const color = '#e2e8f0'\n const bgColor = '#171717'\n\n console[method](\n `%c ${label} %c ${title} %c ${subtitle}`,\n `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`,\n `background:${bgColor}; color: ${color}; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`,\n // reset styles\n 'background: transparent; color: inherit; font-weight: normal; font-size: 1em;',\n )\n\n let activeStyle = ''\n\n messages.forEach((m) => {\n let tempStyle = ''\n let mdStyles: string[] = []\n if (m instanceof Error) {\n console.error(m)\n } else if (m !== undefined) {\n if (typeof m !== 'string') {\n console.log(m)\n return\n }\n\n if (m.startsWith('```')) {\n activeStyle = `font-family: monospace;`\n tempStyle += `color: gray; padding: 1px; border-radius: ${m === '```' ? '0 0 3px 3px' : '3px 3px 0 0'};`\n } else if (typeof m === 'string' && !m.includes('http')) {\n ;[m, ...mdStyles] = applyTextStyles(m)\n }\n\n if (activeStyle || tempStyle) {\n console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles)\n } else {\n console.log(m, ...mdStyles)\n }\n if (m === '```') {\n activeStyle = ''\n } else if (m.startsWith('```')) {\n activeStyle += 'background-color: black; color: palegreen; padding: 0.5em; width: 100%;'\n }\n }\n })\n\n if (isGroup) console.groupEnd()\n}\n"],"mappings":";;;AAIA,MAAM,aAAa,IAAI,SAAS,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvD,MAAa,eAAe,YAAY,4BAA4B;CAClE,MAAM,iBAAiB,IAAI,EAAE;CAC7B,MAAM,oBAAoB,gCAAgB,IAAI,KAAoB,CAAC;CACnE,MAAM,cAAc,IAAI,EAAE;CAC1B,MAAM,eAAe,IAAI,EAAE;CAE3B,SAAS,mBAAmB,OAAsB;AAChD,oBAAkB,IAAI,MAAM;AAC5B,iBAAe;;CAGjB,SAAS,sBAAsB,OAAsB;AACnD,oBAAkB,OAAO,MAAM;;AAGjC,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD;EACD;AAEF,SAAgB,yBAA4C;AAC1D,SAAQ,EAAE,YAAY,YAAY;EAChC,MAAM,YAAY,aAAa,MAAM;AAErC,a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I,MAAM,MACR,eAAc;YACL,EAAE,WAAW,MAAM,CAC5B,gBAAe;;GAGnB;AAEF,KAAI,QAAS,SAAQ,UAAU"} |
+9
-22
@@ -7,3 +7,3 @@ { | ||
| }, | ||
| "version": "0.0.6", | ||
| "version": "0.0.8", | ||
| "description": "Debug plugin for Pinia Colada", | ||
@@ -16,7 +16,4 @@ "author": { | ||
| "funding": "https://github.com/sponsors/posva", | ||
| "homepage": "https://github.com/posva/pinia-colada/plugins/retry#readme", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/posva/pinia-colada.git" | ||
| }, | ||
| "homepage": "https://github.com/posva/pinia-colada/blob/main/plugins/debug/README.md", | ||
| "repository": "posva/pinia-colada", | ||
| "bugs": { | ||
@@ -32,15 +29,5 @@ "url": "https://github.com/posva/pinia-colada/issues" | ||
| "sideEffects": false, | ||
| "exports": { | ||
| ".": { | ||
| "types": { | ||
| "import": "./dist/index.d.ts", | ||
| "require": "./dist/index.d.cts" | ||
| }, | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "main": "./dist/index.cjs", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": "./dist/index.mjs", | ||
| "main": "./dist/index.mjs", | ||
| "types": "./dist/index.d.mts", | ||
| "typesVersions": { | ||
@@ -60,9 +47,9 @@ "*": { | ||
| "peerDependencies": { | ||
| "@pinia/colada": ">=0.17.7" | ||
| "@pinia/colada": ">=1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@pinia/colada": "^0.17.7" | ||
| "@pinia/colada": "^1.0.0" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "build": "tsdown", | ||
| "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . -l @pinia/colada-plugin-debug -r 1", | ||
@@ -69,0 +56,0 @@ "test": "vitest --ui" |
-184
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| PiniaColadaDebugPlugin: () => PiniaColadaDebugPlugin, | ||
| showMessage: () => showMessage, | ||
| useDebugData: () => useDebugData | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| // src/debug.ts | ||
| var import_pinia = require("pinia"); | ||
| var import_vue = require("vue"); | ||
| var tick = () => new Promise((r) => setTimeout(r, 0)); | ||
| var useDebugData = (0, import_pinia.defineStore)("pinia-colada-debug", () => { | ||
| const totalRefetches = (0, import_vue.ref)(0); | ||
| const refetchingEntries = (0, import_vue.shallowReactive)(/* @__PURE__ */ new Set()); | ||
| const totalErrors = (0, import_vue.ref)(0); | ||
| const totalSuccess = (0, import_vue.ref)(0); | ||
| function addRefetchingEntry(entry) { | ||
| refetchingEntries.add(entry); | ||
| totalRefetches.value++; | ||
| } | ||
| function removeRefetchingEntry(entry) { | ||
| refetchingEntries.delete(entry); | ||
| } | ||
| return { | ||
| refetchingEntries, | ||
| totalErrors, | ||
| totalSuccess, | ||
| totalRefetches, | ||
| addRefetchingEntry, | ||
| removeRefetchingEntry | ||
| }; | ||
| }); | ||
| function PiniaColadaDebugPlugin() { | ||
| return ({ queryCache, pinia }) => { | ||
| const debugData = useDebugData(pinia); | ||
| queryCache.$onAction(async ({ name, onError, after, args }) => { | ||
| if (name === "fetch" || name === "refresh") { | ||
| const [entry] = args; | ||
| await tick(); | ||
| if (entry.asyncStatus.value === "loading" || entry.state.value.status === "pending") { | ||
| debugData.addRefetchingEntry(entry); | ||
| showMessage("\u{1F504}", "refetch", `[${entry.key.join(", ")}]`, entry); | ||
| after(() => { | ||
| debugData.removeRefetchingEntry(entry); | ||
| if (entry.state.value.status === "error") { | ||
| debugData.totalErrors++; | ||
| showMessage( | ||
| "error", | ||
| "refetch failed", | ||
| `[${entry.key.join(", ")}]`, | ||
| entry.state.value.error | ||
| ); | ||
| } else { | ||
| debugData.totalSuccess++; | ||
| showMessage("\u2705", "refetch", `[${entry.key.join(", ")}]`, entry.state.value.data); | ||
| } | ||
| }); | ||
| onError((error) => { | ||
| showMessage("error", "Unexpected Error", `[${entry.key.join(", ")}]`, error); | ||
| }); | ||
| } | ||
| } else if (name === "setQueryData") { | ||
| const [key, data] = args; | ||
| showMessage("log", "setQueryData", `[${key.join(", ")}]`, data); | ||
| } else if (name === "invalidate") { | ||
| const [entry] = args; | ||
| showMessage("\u{1F5D1}\uFE0F", "invalidateEntry", `[${entry.key.join(", ")}]`); | ||
| } | ||
| }); | ||
| }; | ||
| } | ||
| var LOG_MESSAGES_COLOR = { | ||
| info: "background: #bfdbfe; color: #1e1e1e", | ||
| log: "background: #f9fafb; color: #1e1e1e", | ||
| warn: "background: #f97316; color: #0b0b0b", | ||
| error: "background: #ff5e56; color: #2e2e2e", | ||
| debug: "background: #212a2b; color: #fefefe", | ||
| trace: "background: #000; color: #fff" | ||
| }; | ||
| var LABELS_FOR_TYPE = { | ||
| info: "\u2139\uFE0F", | ||
| log: "\u{1F4DD}", | ||
| // warn: 'â ī¸', // NOTE: doesn't show well in Chromium browsers | ||
| warn: "\u{1F6A7}", | ||
| error: "\u26D4\uFE0F", | ||
| debug: "\u{1F41E}", | ||
| trace: "\u{1F50D}" | ||
| }; | ||
| var MD_BOLD_RE = /\*\*(.*?)\*\*/g; | ||
| var MD_CODE_RE = /`(.*?)`/g; | ||
| function applyTextStyles(text) { | ||
| const styles = []; | ||
| const newText = text.replace(MD_BOLD_RE, (_m, text2, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-weight: bold;", "font-weight: normal;"] | ||
| }); | ||
| return `%c${text2}%c`; | ||
| }).replace(MD_CODE_RE, (_m, text2, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-family: monospace;", "font-family: inherit;"] | ||
| }); | ||
| return `%c\`${text2}\`%c`; | ||
| }); | ||
| return [newText, ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]; | ||
| } | ||
| function showMessage(type, title, subtitle, ...messages) { | ||
| if (process.env.NODE_ENV !== "development" && type !== "error" && type !== "warn") { | ||
| return; | ||
| } | ||
| const isGroup = messages.length > 0; | ||
| const label = LABELS_FOR_TYPE[type] ?? type; | ||
| const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info; | ||
| const collapsed = true; | ||
| const method = isGroup ? collapsed ? "groupCollapsed" : "group" : "log"; | ||
| const color = "#e2e8f0"; | ||
| const bgColor = "#171717"; | ||
| console[method]( | ||
| `%c ${label} %c ${title} %c ${subtitle}`, | ||
| `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`, | ||
| `background:${bgColor}; color: ${color}; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`, | ||
| // reset styles | ||
| "background: transparent; color: inherit; font-weight: normal; font-size: 1em;" | ||
| ); | ||
| let activeStyle = ""; | ||
| messages.forEach((m) => { | ||
| let tempStyle = ""; | ||
| let mdStyles = []; | ||
| if (m instanceof Error) { | ||
| console.error(m); | ||
| } else if (m !== void 0) { | ||
| if (typeof m !== "string") { | ||
| console.log(m); | ||
| return; | ||
| } | ||
| if (m.startsWith("```")) { | ||
| activeStyle = `font-family: monospace;`; | ||
| tempStyle += `color: gray; padding: 1px; border-radius: ${m === "```" ? "0 0 3px 3px" : "3px 3px 0 0"};`; | ||
| } else if (typeof m === "string" && !m.includes("http")) { | ||
| ; | ||
| [m, ...mdStyles] = applyTextStyles(m); | ||
| } | ||
| if (activeStyle || tempStyle) { | ||
| console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles); | ||
| } else { | ||
| console.log(m, ...mdStyles); | ||
| } | ||
| if (m === "```") { | ||
| activeStyle = ""; | ||
| } else if (m.startsWith("```")) { | ||
| activeStyle += "background-color: black; color: palegreen; padding: 0.5em; width: 100%;"; | ||
| } | ||
| } | ||
| }); | ||
| if (isGroup) console.groupEnd(); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| PiniaColadaDebugPlugin, | ||
| showMessage, | ||
| useDebugData | ||
| }); | ||
| //# sourceMappingURL=index.cjs.map |
| {"version":3,"sources":["../src/index.ts","../src/debug.ts"],"sourcesContent":["export * from './debug'\n","import { defineStore } from 'pinia'\nimport { ref, shallowReactive } from 'vue'\nimport type { PiniaColadaPlugin, UseQueryEntry } from '@pinia/colada'\n\nconst tick = () => new Promise((r) => setTimeout(r, 0))\n\nexport const useDebugData = defineStore('pinia-colada-debug', () => {\n const totalRefetches = ref(0)\n const refetchingEntries = shallowReactive(new Set<UseQueryEntry>())\n const totalErrors = ref(0)\n const totalSuccess = ref(0)\n\n function addRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.add(entry)\n totalRefetches.value++\n }\n\n function removeRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.delete(entry)\n }\n\n return {\n refetchingEntries,\n totalErrors,\n totalSuccess,\n totalRefetches,\n addRefetchingEntry,\n removeRefetchingEntry,\n }\n})\n\nexport function PiniaColadaDebugPlugin(): PiniaColadaPlugin {\n return ({ queryCache, pinia }) => {\n const debugData = useDebugData(pinia)\n\n queryCache.$onAction(async ({ name, onError, after, args }) => {\n if (name === 'fetch' || name === 'refresh') {\n const [entry] = args\n await tick()\n if (entry.asyncStatus.value === 'loading' || entry.state.value.status === 'pending') {\n debugData.addRefetchingEntry(entry)\n showMessage('đ', 'refetch', `[${entry.key.join(', ')}]`, entry)\n\n after(() => {\n debugData.removeRefetchingEntry(entry)\n if (entry.state.value.status === 'error') {\n debugData.totalErrors++\n showMessage(\n 'error',\n 'refetch failed',\n `[${entry.key.join(', ')}]`,\n entry.state.value.error,\n )\n } else {\n debugData.totalSuccess++\n showMessage('â ', 'refetch', `[${entry.key.join(', ')}]`, entry.state.value.data)\n }\n })\n\n onError((error) => {\n showMessage('error', 'Unexpected Error', `[${entry.key.join(', ')}]`, error)\n })\n }\n } else if (name === 'setQueryData') {\n const [key, data] = args\n showMessage('log', 'setQueryData', `[${key.join(', ')}]`, data)\n } else if (name === 'invalidate') {\n const [entry] = args\n showMessage('đī¸', 'invalidateEntry', `[${entry.key.join(', ')}]`)\n }\n })\n }\n}\n\nexport type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'\n\nconst LOG_MESSAGES_COLOR: Partial<Record<string, string>> = {\n info: 'background: #bfdbfe; color: #1e1e1e',\n log: 'background: #f9fafb; color: #1e1e1e',\n warn: 'background: #f97316; color: #0b0b0b',\n error: 'background: #ff5e56; color: #2e2e2e',\n debug: 'background: #212a2b; color: #fefefe',\n trace: 'background: #000; color: #fff',\n}\n\nconst LABELS_FOR_TYPE: Partial<Record<string, string>> = {\n info: 'âšī¸',\n log: 'đ',\n // warn: 'â ī¸', // NOTE: doesn't show well in Chromium browsers\n warn: 'đ§',\n error: 'âī¸',\n debug: 'đ',\n trace: 'đ',\n}\n\nconst MD_BOLD_RE = /\\*\\*(.*?)\\*\\*/g\n// Underscores appear to often to deal with them with just a regexp\n// const MD_ITALIC_RE = /_(.*?)_/g\nconst MD_CODE_RE = /`(.*?)`/g\n\n/**\n * Applies italic and bold style to markdown text.\n * @param text - The text to apply styles to\n */\nfunction applyTextStyles(text: string) {\n const styles: Array<{ pos: number; style: [string, string] }> = []\n\n const newText = text\n .replace(MD_BOLD_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-weight: bold;', 'font-weight: normal;'],\n })\n return `%c${text}%c`\n })\n // .replace(MD_ITALIC_RE, (_m, text, pos) => {\n // styles.push({\n // pos,\n // style: ['font-style: italic;', 'font-style: normal;'],\n // })\n // return `%c${text}%c`\n // })\n .replace(MD_CODE_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-family: monospace;', 'font-family: inherit;'],\n })\n return `%c\\`${text}\\`%c`\n })\n return [newText, ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]\n}\n\n/**\n * Creates a union type that still allows autocompletion for strings.\n *@internal\n */\ntype _LiteralStringUnion<LiteralType, BaseType extends string = string> =\n | LiteralType\n | (BaseType & Record<never, never>)\n\nexport function showMessage(\n type: _LiteralStringUnion<LogeMessageType>,\n title: string,\n subtitle: string,\n ...messages: any[]\n) {\n // only keep errors and warns in tests\n if (process.env.NODE_ENV !== 'development' && type !== 'error' && type !== 'warn') {\n return\n }\n\n const isGroup = messages.length > 0\n const label = LABELS_FOR_TYPE[type] ?? type\n const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info!\n\n const collapsed = true\n\n const method = isGroup ? (collapsed ? 'groupCollapsed' : 'group') : 'log'\n // const logMethod = type === LogMessageType.error ? 'error' : type === LogMessageType.warn ? 'warn' : 'log'\n\n const color = '#e2e8f0'\n const bgColor = '#171717'\n\n console[method](\n `%c ${label} %c ${title} %c ${subtitle}`,\n `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`,\n `background:${bgColor}; color: ${color}; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`,\n // reset styles\n 'background: transparent; color: inherit; font-weight: normal; font-size: 1em;',\n )\n\n let activeStyle = ''\n\n messages.forEach((m) => {\n let tempStyle = ''\n let mdStyles: string[] = []\n if (m instanceof Error) {\n console.error(m)\n } else if (m !== undefined) {\n if (typeof m !== 'string') {\n console.log(m)\n return\n }\n\n if (m.startsWith('```')) {\n activeStyle = `font-family: monospace;`\n tempStyle += `color: gray; padding: 1px; border-radius: ${m === '```' ? '0 0 3px 3px' : '3px 3px 0 0'};`\n } else if (typeof m === 'string' && !m.includes('http')) {\n ;[m, ...mdStyles] = applyTextStyles(m)\n }\n\n if (activeStyle || tempStyle) {\n console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles)\n } else {\n console.log(m, ...mdStyles)\n }\n if (m === '```') {\n activeStyle = ''\n } else if (m.startsWith('```')) {\n activeStyle += 'background-color: black; color: palegreen; padding: 0.5em; width: 100%;'\n }\n }\n })\n\n if (isGroup) console.groupEnd()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4B;AAC5B,iBAAqC;AAGrC,IAAM,OAAO,MAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE/C,IAAM,mBAAe,0BAAY,sBAAsB,MAAM;AAClE,QAAM,qBAAiB,gBAAI,CAAC;AAC5B,QAAM,wBAAoB,4BAAgB,oBAAI,IAAmB,CAAC;AAClE,QAAM,kBAAc,gBAAI,CAAC;AACzB,QAAM,mBAAe,gBAAI,CAAC;AAE1B,WAAS,mBAAmB,OAAsB;AAChD,sBAAkB,IAAI,KAAK;AAC3B,mBAAe;AAAA,EACjB;AAEA,WAAS,sBAAsB,OAAsB;AACnD,sBAAkB,OAAO,KAAK;AAAA,EAChC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,CAAC;AAEM,SAAS,yBAA4C;AAC1D,SAAO,CAAC,EAAE,YAAY,MAAM,MAAM;AAChC,UAAM,YAAY,aAAa,KAAK;AAEpC,eAAW,UAAU,OAAO,EAAE,MAAM,SAAS,OAAO,KAAK,MAAM;AAC7D,UAAI,SAAS,WAAW,SAAS,W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AAqB,CAAC;AAC1B,QAAI,aAAa,OAAO;AACtB,cAAQ,MAAM,CAAC;AAAA,IACjB,WAAW,MAAM,QAAW;AAC1B,UAAI,OAAO,MAAM,UAAU;AACzB,gBAAQ,IAAI,CAAC;AACb;AAAA,MACF;AAEA,UAAI,EAAE,WAAW,KAAK,GAAG;AACvB,sBAAc;AACd,qBAAa,6CAA6C,MAAM,QAAQ,gBAAgB,aAAa;AAAA,MACvG,WAAW,OAAO,MAAM,YAAY,CAAC,EAAE,SAAS,MAAM,GAAG;AACvD;AAAC,SAAC,GAAG,GAAG,QAAQ,IAAI,gBAAgB,CAAC;AAAA,MACvC;AAEA,UAAI,eAAe,WAAW;AAC5B,gBAAQ,IAAI,KAAK,CAAC,IAAI,cAAc,WAAW,GAAG,QAAQ;AAAA,MAC5D,OAAO;AACL,gBAAQ,IAAI,GAAG,GAAG,QAAQ;AAAA,MAC5B;AACA,UAAI,MAAM,OAAO;AACf,sBAAc;AAAA,MAChB,WAAW,EAAE,WAAW,KAAK,GAAG;AAC9B,uBAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,QAAS,SAAQ,SAAS;AAChC;","names":["text"]} |
| import * as pinia from 'pinia'; | ||
| import * as vue from 'vue'; | ||
| import { UseQueryEntry, PiniaColadaPlugin } from '@pinia/colada'; | ||
| declare const useDebugData: pinia.StoreDefinition<"pinia-colada-debug", Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "refetchingEntries" | "totalErrors" | "totalSuccess" | "totalRefetches">, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, never>, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "addRefetchingEntry" | "removeRefetchingEntry">>; | ||
| declare function PiniaColadaDebugPlugin(): PiniaColadaPlugin; | ||
| type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'; | ||
| /** | ||
| * Creates a union type that still allows autocompletion for strings. | ||
| *@internal | ||
| */ | ||
| type _LiteralStringUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>); | ||
| declare function showMessage(type: _LiteralStringUnion<LogeMessageType>, title: string, subtitle: string, ...messages: any[]): void; | ||
| export { type LogeMessageType, PiniaColadaDebugPlugin, showMessage, useDebugData }; |
| import * as pinia from 'pinia'; | ||
| import * as vue from 'vue'; | ||
| import { UseQueryEntry, PiniaColadaPlugin } from '@pinia/colada'; | ||
| declare const useDebugData: pinia.StoreDefinition<"pinia-colada-debug", Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "refetchingEntries" | "totalErrors" | "totalSuccess" | "totalRefetches">, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, never>, Pick<{ | ||
| refetchingEntries: vue.ShallowReactive<Set<UseQueryEntry<unknown, unknown, unknown>>>; | ||
| totalErrors: vue.Ref<number, number>; | ||
| totalSuccess: vue.Ref<number, number>; | ||
| totalRefetches: vue.Ref<number, number>; | ||
| addRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| removeRefetchingEntry: (entry: UseQueryEntry) => void; | ||
| }, "addRefetchingEntry" | "removeRefetchingEntry">>; | ||
| declare function PiniaColadaDebugPlugin(): PiniaColadaPlugin; | ||
| type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'; | ||
| /** | ||
| * Creates a union type that still allows autocompletion for strings. | ||
| *@internal | ||
| */ | ||
| type _LiteralStringUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>); | ||
| declare function showMessage(type: _LiteralStringUnion<LogeMessageType>, title: string, subtitle: string, ...messages: any[]): void; | ||
| export { type LogeMessageType, PiniaColadaDebugPlugin, showMessage, useDebugData }; |
-156
| // src/debug.ts | ||
| import { defineStore } from "pinia"; | ||
| import { ref, shallowReactive } from "vue"; | ||
| var tick = () => new Promise((r) => setTimeout(r, 0)); | ||
| var useDebugData = defineStore("pinia-colada-debug", () => { | ||
| const totalRefetches = ref(0); | ||
| const refetchingEntries = shallowReactive(/* @__PURE__ */ new Set()); | ||
| const totalErrors = ref(0); | ||
| const totalSuccess = ref(0); | ||
| function addRefetchingEntry(entry) { | ||
| refetchingEntries.add(entry); | ||
| totalRefetches.value++; | ||
| } | ||
| function removeRefetchingEntry(entry) { | ||
| refetchingEntries.delete(entry); | ||
| } | ||
| return { | ||
| refetchingEntries, | ||
| totalErrors, | ||
| totalSuccess, | ||
| totalRefetches, | ||
| addRefetchingEntry, | ||
| removeRefetchingEntry | ||
| }; | ||
| }); | ||
| function PiniaColadaDebugPlugin() { | ||
| return ({ queryCache, pinia }) => { | ||
| const debugData = useDebugData(pinia); | ||
| queryCache.$onAction(async ({ name, onError, after, args }) => { | ||
| if (name === "fetch" || name === "refresh") { | ||
| const [entry] = args; | ||
| await tick(); | ||
| if (entry.asyncStatus.value === "loading" || entry.state.value.status === "pending") { | ||
| debugData.addRefetchingEntry(entry); | ||
| showMessage("\u{1F504}", "refetch", `[${entry.key.join(", ")}]`, entry); | ||
| after(() => { | ||
| debugData.removeRefetchingEntry(entry); | ||
| if (entry.state.value.status === "error") { | ||
| debugData.totalErrors++; | ||
| showMessage( | ||
| "error", | ||
| "refetch failed", | ||
| `[${entry.key.join(", ")}]`, | ||
| entry.state.value.error | ||
| ); | ||
| } else { | ||
| debugData.totalSuccess++; | ||
| showMessage("\u2705", "refetch", `[${entry.key.join(", ")}]`, entry.state.value.data); | ||
| } | ||
| }); | ||
| onError((error) => { | ||
| showMessage("error", "Unexpected Error", `[${entry.key.join(", ")}]`, error); | ||
| }); | ||
| } | ||
| } else if (name === "setQueryData") { | ||
| const [key, data] = args; | ||
| showMessage("log", "setQueryData", `[${key.join(", ")}]`, data); | ||
| } else if (name === "invalidate") { | ||
| const [entry] = args; | ||
| showMessage("\u{1F5D1}\uFE0F", "invalidateEntry", `[${entry.key.join(", ")}]`); | ||
| } | ||
| }); | ||
| }; | ||
| } | ||
| var LOG_MESSAGES_COLOR = { | ||
| info: "background: #bfdbfe; color: #1e1e1e", | ||
| log: "background: #f9fafb; color: #1e1e1e", | ||
| warn: "background: #f97316; color: #0b0b0b", | ||
| error: "background: #ff5e56; color: #2e2e2e", | ||
| debug: "background: #212a2b; color: #fefefe", | ||
| trace: "background: #000; color: #fff" | ||
| }; | ||
| var LABELS_FOR_TYPE = { | ||
| info: "\u2139\uFE0F", | ||
| log: "\u{1F4DD}", | ||
| // warn: 'â ī¸', // NOTE: doesn't show well in Chromium browsers | ||
| warn: "\u{1F6A7}", | ||
| error: "\u26D4\uFE0F", | ||
| debug: "\u{1F41E}", | ||
| trace: "\u{1F50D}" | ||
| }; | ||
| var MD_BOLD_RE = /\*\*(.*?)\*\*/g; | ||
| var MD_CODE_RE = /`(.*?)`/g; | ||
| function applyTextStyles(text) { | ||
| const styles = []; | ||
| const newText = text.replace(MD_BOLD_RE, (_m, text2, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-weight: bold;", "font-weight: normal;"] | ||
| }); | ||
| return `%c${text2}%c`; | ||
| }).replace(MD_CODE_RE, (_m, text2, pos) => { | ||
| styles.push({ | ||
| pos, | ||
| style: ["font-family: monospace;", "font-family: inherit;"] | ||
| }); | ||
| return `%c\`${text2}\`%c`; | ||
| }); | ||
| return [newText, ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]; | ||
| } | ||
| function showMessage(type, title, subtitle, ...messages) { | ||
| if (process.env.NODE_ENV !== "development" && type !== "error" && type !== "warn") { | ||
| return; | ||
| } | ||
| const isGroup = messages.length > 0; | ||
| const label = LABELS_FOR_TYPE[type] ?? type; | ||
| const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info; | ||
| const collapsed = true; | ||
| const method = isGroup ? collapsed ? "groupCollapsed" : "group" : "log"; | ||
| const color = "#e2e8f0"; | ||
| const bgColor = "#171717"; | ||
| console[method]( | ||
| `%c ${label} %c ${title} %c ${subtitle}`, | ||
| `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`, | ||
| `background:${bgColor}; color: ${color}; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`, | ||
| // reset styles | ||
| "background: transparent; color: inherit; font-weight: normal; font-size: 1em;" | ||
| ); | ||
| let activeStyle = ""; | ||
| messages.forEach((m) => { | ||
| let tempStyle = ""; | ||
| let mdStyles = []; | ||
| if (m instanceof Error) { | ||
| console.error(m); | ||
| } else if (m !== void 0) { | ||
| if (typeof m !== "string") { | ||
| console.log(m); | ||
| return; | ||
| } | ||
| if (m.startsWith("```")) { | ||
| activeStyle = `font-family: monospace;`; | ||
| tempStyle += `color: gray; padding: 1px; border-radius: ${m === "```" ? "0 0 3px 3px" : "3px 3px 0 0"};`; | ||
| } else if (typeof m === "string" && !m.includes("http")) { | ||
| ; | ||
| [m, ...mdStyles] = applyTextStyles(m); | ||
| } | ||
| if (activeStyle || tempStyle) { | ||
| console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles); | ||
| } else { | ||
| console.log(m, ...mdStyles); | ||
| } | ||
| if (m === "```") { | ||
| activeStyle = ""; | ||
| } else if (m.startsWith("```")) { | ||
| activeStyle += "background-color: black; color: palegreen; padding: 0.5em; width: 100%;"; | ||
| } | ||
| } | ||
| }); | ||
| if (isGroup) console.groupEnd(); | ||
| } | ||
| export { | ||
| PiniaColadaDebugPlugin, | ||
| showMessage, | ||
| useDebugData | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"sources":["../src/debug.ts"],"sourcesContent":["import { defineStore } from 'pinia'\nimport { ref, shallowReactive } from 'vue'\nimport type { PiniaColadaPlugin, UseQueryEntry } from '@pinia/colada'\n\nconst tick = () => new Promise((r) => setTimeout(r, 0))\n\nexport const useDebugData = defineStore('pinia-colada-debug', () => {\n const totalRefetches = ref(0)\n const refetchingEntries = shallowReactive(new Set<UseQueryEntry>())\n const totalErrors = ref(0)\n const totalSuccess = ref(0)\n\n function addRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.add(entry)\n totalRefetches.value++\n }\n\n function removeRefetchingEntry(entry: UseQueryEntry) {\n refetchingEntries.delete(entry)\n }\n\n return {\n refetchingEntries,\n totalErrors,\n totalSuccess,\n totalRefetches,\n addRefetchingEntry,\n removeRefetchingEntry,\n }\n})\n\nexport function PiniaColadaDebugPlugin(): PiniaColadaPlugin {\n return ({ queryCache, pinia }) => {\n const debugData = useDebugData(pinia)\n\n queryCache.$onAction(async ({ name, onError, after, args }) => {\n if (name === 'fetch' || name === 'refresh') {\n const [entry] = args\n await tick()\n if (entry.asyncStatus.value === 'loading' || entry.state.value.status === 'pending') {\n debugData.addRefetchingEntry(entry)\n showMessage('đ', 'refetch', `[${entry.key.join(', ')}]`, entry)\n\n after(() => {\n debugData.removeRefetchingEntry(entry)\n if (entry.state.value.status === 'error') {\n debugData.totalErrors++\n showMessage(\n 'error',\n 'refetch failed',\n `[${entry.key.join(', ')}]`,\n entry.state.value.error,\n )\n } else {\n debugData.totalSuccess++\n showMessage('â ', 'refetch', `[${entry.key.join(', ')}]`, entry.state.value.data)\n }\n })\n\n onError((error) => {\n showMessage('error', 'Unexpected Error', `[${entry.key.join(', ')}]`, error)\n })\n }\n } else if (name === 'setQueryData') {\n const [key, data] = args\n showMessage('log', 'setQueryData', `[${key.join(', ')}]`, data)\n } else if (name === 'invalidate') {\n const [entry] = args\n showMessage('đī¸', 'invalidateEntry', `[${entry.key.join(', ')}]`)\n }\n })\n }\n}\n\nexport type LogeMessageType = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'log'\n\nconst LOG_MESSAGES_COLOR: Partial<Record<string, string>> = {\n info: 'background: #bfdbfe; color: #1e1e1e',\n log: 'background: #f9fafb; color: #1e1e1e',\n warn: 'background: #f97316; color: #0b0b0b',\n error: 'background: #ff5e56; color: #2e2e2e',\n debug: 'background: #212a2b; color: #fefefe',\n trace: 'background: #000; color: #fff',\n}\n\nconst LABELS_FOR_TYPE: Partial<Record<string, string>> = {\n info: 'âšī¸',\n log: 'đ',\n // warn: 'â ī¸', // NOTE: doesn't show well in Chromium browsers\n warn: 'đ§',\n error: 'âī¸',\n debug: 'đ',\n trace: 'đ',\n}\n\nconst MD_BOLD_RE = /\\*\\*(.*?)\\*\\*/g\n// Underscores appear to often to deal with them with just a regexp\n// const MD_ITALIC_RE = /_(.*?)_/g\nconst MD_CODE_RE = /`(.*?)`/g\n\n/**\n * Applies italic and bold style to markdown text.\n * @param text - The text to apply styles to\n */\nfunction applyTextStyles(text: string) {\n const styles: Array<{ pos: number; style: [string, string] }> = []\n\n const newText = text\n .replace(MD_BOLD_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-weight: bold;', 'font-weight: normal;'],\n })\n return `%c${text}%c`\n })\n // .replace(MD_ITALIC_RE, (_m, text, pos) => {\n // styles.push({\n // pos,\n // style: ['font-style: italic;', 'font-style: normal;'],\n // })\n // return `%c${text}%c`\n // })\n .replace(MD_CODE_RE, (_m, text, pos) => {\n styles.push({\n pos,\n style: ['font-family: monospace;', 'font-family: inherit;'],\n })\n return `%c\\`${text}\\`%c`\n })\n return [newText, ...styles.sort((a, b) => a.pos - b.pos).flatMap((s) => s.style)]\n}\n\n/**\n * Creates a union type that still allows autocompletion for strings.\n *@internal\n */\ntype _LiteralStringUnion<LiteralType, BaseType extends string = string> =\n | LiteralType\n | (BaseType & Record<never, never>)\n\nexport function showMessage(\n type: _LiteralStringUnion<LogeMessageType>,\n title: string,\n subtitle: string,\n ...messages: any[]\n) {\n // only keep errors and warns in tests\n if (process.env.NODE_ENV !== 'development' && type !== 'error' && type !== 'warn') {\n return\n }\n\n const isGroup = messages.length > 0\n const label = LABELS_FOR_TYPE[type] ?? type\n const labelStyle = LOG_MESSAGES_COLOR[type] ?? LOG_MESSAGES_COLOR.info!\n\n const collapsed = true\n\n const method = isGroup ? (collapsed ? 'groupCollapsed' : 'group') : 'log'\n // const logMethod = type === LogMessageType.error ? 'error' : type === LogMessageType.warn ? 'warn' : 'log'\n\n const color = '#e2e8f0'\n const bgColor = '#171717'\n\n console[method](\n `%c ${label} %c ${title} %c ${subtitle}`,\n `${labelStyle}; padding: 1px; border-radius: 0.3em 0 0 0.3em; font-size: 1em;`,\n `background:${bgColor}; color: ${color}; padding: 1px; border-radius: 0 0.3em 0.3em 0; font-size: 1em;`,\n // reset styles\n 'background: transparent; color: inherit; font-weight: normal; font-size: 1em;',\n )\n\n let activeStyle = ''\n\n messages.forEach((m) => {\n let tempStyle = ''\n let mdStyles: string[] = []\n if (m instanceof Error) {\n console.error(m)\n } else if (m !== undefined) {\n if (typeof m !== 'string') {\n console.log(m)\n return\n }\n\n if (m.startsWith('```')) {\n activeStyle = `font-family: monospace;`\n tempStyle += `color: gray; padding: 1px; border-radius: ${m === '```' ? '0 0 3px 3px' : '3px 3px 0 0'};`\n } else if (typeof m === 'string' && !m.includes('http')) {\n ;[m, ...mdStyles] = applyTextStyles(m)\n }\n\n if (activeStyle || tempStyle) {\n console.log(`%c${m}`, activeStyle + tempStyle, ...mdStyles)\n } else {\n console.log(m, ...mdStyles)\n }\n if (m === '```') {\n activeStyle = ''\n } else if (m.startsWith('```')) {\n activeStyle += 'background-color: black; color: palegreen; padding: 0.5em; width: 100%;'\n }\n }\n })\n\n if (isGroup) console.groupEnd()\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,KAAK,uBAAuB;AAGrC,IAAM,OAAO,MAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE/C,IAAM,eAAe,YAAY,sBAAsB,MAAM;AAClE,QAAM,iBAAiB,IAAI,CAAC;AAC5B,QAAM,oBAAoB,gBAAgB,oBAAI,IAAmB,CAAC;AAClE,QAAM,cAAc,IAAI,CAAC;AACzB,QAAM,eAAe,IAAI,CAAC;AAE1B,WAAS,mBAAmB,OAAsB;AAChD,sBAAkB,IAAI,KAAK;AAC3B,mBAAe;AAAA,EACjB;AAEA,WAAS,sBAAsB,OAAsB;AACnD,sBAAkB,OAAO,KAAK;AAAA,EAChC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,CAAC;AAEM,SAAS,yBAA4C;AAC1D,SAAO,CAAC,EAAE,YAAY,MAAM,MAAM;AAChC,UAAM,YAAY,aAAa,KAAK;AAEpC,eAAW,UAAU,OAAO,EAAE,MAAM,SAAS,OAAO,KAAK,MAAM;AA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ACtB,QAAI,YAAY;AAChB,QAAI,WAAqB,CAAC;AAC1B,QAAI,aAAa,OAAO;AACtB,cAAQ,MAAM,CAAC;AAAA,IACjB,WAAW,MAAM,QAAW;AAC1B,UAAI,OAAO,MAAM,UAAU;AACzB,gBAAQ,IAAI,CAAC;AACb;AAAA,MACF;AAEA,UAAI,EAAE,WAAW,KAAK,GAAG;AACvB,sBAAc;AACd,qBAAa,6CAA6C,MAAM,QAAQ,gBAAgB,aAAa;AAAA,MACvG,WAAW,OAAO,MAAM,YAAY,CAAC,EAAE,SAAS,MAAM,GAAG;AACvD;AAAC,SAAC,GAAG,GAAG,QAAQ,IAAI,gBAAgB,CAAC;AAAA,MACvC;AAEA,UAAI,eAAe,WAAW;AAC5B,gBAAQ,IAAI,KAAK,CAAC,IAAI,cAAc,WAAW,GAAG,QAAQ;AAAA,MAC5D,OAAO;AACL,gBAAQ,IAAI,GAAG,GAAG,QAAQ;AAAA,MAC5B;AACA,UAAI,MAAM,OAAO;AACf,sBAAc;AAAA,MAChB,WAAW,EAAE,WAAW,KAAK,GAAG;AAC9B,uBAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,QAAS,SAAQ,SAAS;AAChC;","names":["text"]} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
-50%19045
-51.51%6
-33.33%129
-65.14%