diff --git a/docs/package.json b/docs/package.json index 64132b9b..ac2b17b5 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,4 +1,7 @@ { "private": true, - "name": "docs" + "name": "docs", + "dependencies": { + "vue": "^3.2.37" + } } diff --git a/package.json b/package.json index b64067e6..613617d0 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "vite": "^2.7.13", "vite-plugin-checker": "workspace:*", "vitepress": "^1.0.0-alpha.4", - "vue": "^3.2.37", "ws": "^8.5.0", "zx": "^1.14.2" } diff --git a/packages/runtime/src/components/Diagnostic.svelte b/packages/runtime/src/components/Diagnostic.svelte index 300f46c7..4db942b3 100644 --- a/packages/runtime/src/components/Diagnostic.svelte +++ b/packages/runtime/src/components/Diagnostic.svelte @@ -8,7 +8,7 @@ 'vue-tsc': '#64b587', } - const fileRE = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g + const fileRE = /(?:[a-zA-Z]:\\|\/).*(:\d+:\d+)?/g const codeframeRE = /^(?:>?\s+\d+\s+\|.*|\s+\|\s*\^.*)\r?\n/gm codeframeRE.lastIndex = 0 $: hasFrame = diagnostic.frame && codeframeRE.test(diagnostic.frame) @@ -17,9 +17,12 @@ $: stackLinks = calcLink(diagnostic.stack) $: [file] = (diagnostic.loc?.file || diagnostic.id || 'unknown file').split(`?`) - $: errorSource = diagnostic.loc - ? { ...calcLink(`${file}:${diagnostic.loc.line}:${diagnostic.loc.column}`)[0], linkFiles: true } - : { text: file, linkFiles: false } + $: errorSource = { + ...calcLink( + `${file}` + (diagnostic.loc ? `:${diagnostic.loc.line}:${diagnostic.loc.column}` : '') + )[0], + linkFiles: true, + } function calcLink(text) { let curIndex = 0 @@ -50,13 +53,8 @@ >{message} -
{#if errorSource.linkFiles}{errorSource.textContent}
-    {:else}
-      {errorSource.text}
-    {/if}
-  
+
{errorSource.textContent}
{#if hasFrame}
{diagnostic.frame}
{/if} diff --git a/packages/vite-plugin-checker/src/logger.ts b/packages/vite-plugin-checker/src/logger.ts index e3a4dd00..fe60f449 100644 --- a/packages/vite-plugin-checker/src/logger.ts +++ b/packages/vite-plugin-checker/src/logger.ts @@ -208,7 +208,7 @@ export function normalizeTsDiagnostic(d: TsDiagnostic): NormalizedDiagnostic { const message = flattenDiagnosticMessageText(d.messageText, os.EOL) let loc: SourceLocation | undefined - const pos = d.start === undefined ? null : d.file?.getLineAndCharacterOfPosition(d.start) + const pos = d.start === undefined ? null : d.file?.getLineAndCharacterOfPosition?.(d.start) if (pos && d.file && typeof d.start === 'number' && typeof d.length === 'number') { loc = tsLocationToBabelLocation({ start: d.file?.getLineAndCharacterOfPosition(d.start), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a62c992c..0f08f034 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,7 +47,6 @@ importers: vite: ^2.7.13 vite-plugin-checker: workspace:* vitepress: ^1.0.0-alpha.4 - vue: ^3.2.37 ws: ^8.5.0 zx: ^1.14.2 devDependencies: @@ -94,10 +93,15 @@ importers: vite: 2.8.6 vite-plugin-checker: link:packages/vite-plugin-checker vitepress: 1.0.0-alpha.4 - vue: 3.2.37 ws: 8.5.0 zx: 1.15.2 + docs: + specifiers: + vue: ^3.2.37 + dependencies: + vue: 3.2.37 + packages/runtime: specifiers: esbuild: ^0.14.27 @@ -311,7 +315,7 @@ importers: '@typescript-eslint/eslint-plugin': 4.33.0_d212f40a84a592446cd1718bfda08a13 '@typescript-eslint/parser': 4.33.0_eslint@7.32.0+typescript@4.3.5 '@vue/eslint-config-prettier': 6.0.0_50b9bee768de2f5f7fd8f728348d602b - '@vue/eslint-config-typescript': 7.0.0_f2c1c083ca9f8be5792c7dca889a98e3 + '@vue/eslint-config-typescript': 7.0.0_6cd36be12d90dacb64fbbfef541713c8 eslint: 7.32.0 eslint-plugin-prettier: 3.4.1_eslint@7.32.0+prettier@2.6.0 eslint-plugin-vue: 7.20.0_eslint@7.32.0 @@ -2079,7 +2083,6 @@ packages: '@vue/shared': 3.2.37 estree-walker: 2.0.2 source-map: 0.6.1 - dev: true /@vue/compiler-dom/3.2.31: resolution: {integrity: sha512-60zIlFfzIDf3u91cqfqy9KhCKIJgPeqxgveH2L+87RcGU/alT6BRrk5JtUso0OibH3O7NXuNOQ0cDc9beT0wrg==} @@ -2092,7 +2095,6 @@ packages: dependencies: '@vue/compiler-core': 3.2.37 '@vue/shared': 3.2.37 - dev: true /@vue/compiler-sfc/3.2.31: resolution: {integrity: sha512-748adc9msSPGzXgibHiO6T7RWgfnDcVQD+VVwYgSsyyY8Ans64tALHZANrKtOzvkwznV/F4H7OAod/jIlp/dkQ==} @@ -2119,9 +2121,8 @@ packages: '@vue/shared': 3.2.37 estree-walker: 2.0.2 magic-string: 0.25.9 - postcss: 8.4.12 + postcss: 8.4.14 source-map: 0.6.1 - dev: true /@vue/compiler-ssr/3.2.31: resolution: {integrity: sha512-mjN0rqig+A8TVDnsGPYJM5dpbjlXeHUm2oZHZwGyMYiGT/F4fhJf/cXy8QpjnLQK4Y9Et4GWzHn9PS8AHUnSkw==} @@ -2134,7 +2135,6 @@ packages: dependencies: '@vue/compiler-dom': 3.2.37 '@vue/shared': 3.2.37 - dev: true /@vue/component-compiler-utils/3.3.0: resolution: {integrity: sha512-97sfH2mYNU+2PzGrmK2haqffDpVASuib9/w2/noxiFi31Z54hW+q3izKQXXQZSNhtiUpAI36uSuYepeBe4wpHQ==} @@ -2168,7 +2168,7 @@ packages: prettier: 2.6.0 dev: true - /@vue/eslint-config-typescript/7.0.0_f2c1c083ca9f8be5792c7dca889a98e3: + /@vue/eslint-config-typescript/7.0.0_6cd36be12d90dacb64fbbfef541713c8: resolution: {integrity: sha512-UxUlvpSrFOoF8aQ+zX1leYiEBEm7CZmXYn/ZEM1zwSadUzpamx56RB4+Htdjisv1mX2tOjBegNUqH3kz2OL+Aw==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -2176,11 +2176,16 @@ packages: '@typescript-eslint/parser': ^4.4.0 eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 eslint-plugin-vue: ^5.2.3 || ^6.0.0 || ^7.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: '@typescript-eslint/eslint-plugin': 4.33.0_d212f40a84a592446cd1718bfda08a13 '@typescript-eslint/parser': 4.33.0_eslint@7.32.0+typescript@4.3.5 eslint: 7.32.0 eslint-plugin-vue: 7.20.0_eslint@7.32.0 + typescript: 4.3.5 vue-eslint-parser: 7.11.0_eslint@7.32.0 transitivePeerDependencies: - supports-color @@ -2203,7 +2208,6 @@ packages: '@vue/shared': 3.2.37 estree-walker: 2.0.2 magic-string: 0.25.9 - dev: true /@vue/reactivity/3.2.31: resolution: {integrity: sha512-HVr0l211gbhpEKYr2hYe7hRsV91uIVGFYNHj73njbARVGHQvIojkImKMaZNDdoDZOIkMsBc9a1sMqR+WZwfSCw==} @@ -2214,7 +2218,6 @@ packages: resolution: {integrity: sha512-/7WRafBOshOc6m3F7plwzPeCu/RCVv9uMpOwa/5PiY1Zz+WLVRWiy0MYKwmg19KBdGtFWsmZ4cD+LOdVPcs52A==} dependencies: '@vue/shared': 3.2.37 - dev: true /@vue/runtime-core/3.2.31: resolution: {integrity: sha512-Kcog5XmSY7VHFEMuk4+Gap8gUssYMZ2+w+cmGI6OpZWYOEIcbE0TPzzPHi+8XTzAgx1w/ZxDFcXhZeXN5eKWsA==} @@ -2227,7 +2230,6 @@ packages: dependencies: '@vue/reactivity': 3.2.37 '@vue/shared': 3.2.37 - dev: true /@vue/runtime-dom/3.2.31: resolution: {integrity: sha512-N+o0sICVLScUjfLG7u9u5XCjvmsexAiPt17GNnaWHJUfsKed5e85/A3SWgKxzlxx2SW/Hw7RQxzxbXez9PtY3g==} @@ -2242,7 +2244,6 @@ packages: '@vue/runtime-core': 3.2.37 '@vue/shared': 3.2.37 csstype: 2.6.20 - dev: true /@vue/server-renderer/3.2.31_vue@3.2.31: resolution: {integrity: sha512-8CN3Zj2HyR2LQQBHZ61HexF5NReqngLT3oahyiVRfSSvak+oAvVmu8iNLSu6XR77Ili2AOpnAt1y8ywjjqtmkg==} @@ -2261,14 +2262,12 @@ packages: '@vue/compiler-ssr': 3.2.37 '@vue/shared': 3.2.37 vue: 3.2.37 - dev: true /@vue/shared/3.2.31: resolution: {integrity: sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ==} /@vue/shared/3.2.37: resolution: {integrity: sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==} - dev: true /@vueuse/core/8.7.5_vue@3.2.37: resolution: {integrity: sha512-tqgzeZGoZcXzoit4kOGLWJibDMLp0vdm6ZO41SSUQhkhtrPhAg6dbIEPiahhUu6sZAmSYvVrZgEr5aKD51nrLA==} @@ -2928,6 +2927,167 @@ packages: /consolidate/0.16.0: resolution: {integrity: sha512-Nhl1wzCslqXYTJVDyJCu3ODohy9OfBMB5uD2BiBTzd7w+QY0lBzafkR8y8755yMYHAaMD4NuzbAw03/xzfw+eQ==} engines: {node: '>= 0.10.0'} + peerDependencies: + arc-templates: ^0.5.3 + atpl: '>=0.7.6' + babel-core: ^6.26.3 + bracket-template: ^1.1.5 + coffee-script: ^1.12.7 + dot: ^1.1.3 + dust: ^0.3.0 + dustjs-helpers: ^1.7.4 + dustjs-linkedin: ^2.7.5 + eco: ^1.1.0-rc-3 + ect: ^0.5.9 + ejs: ^3.1.5 + haml-coffee: ^1.14.1 + hamlet: ^0.3.3 + hamljs: ^0.6.2 + handlebars: ^4.7.6 + hogan.js: ^3.0.2 + htmling: ^0.0.8 + jade: ^1.11.0 + jazz: ^0.0.18 + jqtpl: ~1.1.0 + just: ^0.1.8 + liquid-node: ^3.0.1 + liquor: ^0.0.5 + lodash: ^4.17.20 + marko: ^3.14.4 + mote: ^0.2.0 + mustache: ^4.0.1 + nunjucks: ^3.2.2 + plates: ~0.4.11 + pug: ^3.0.0 + qejs: ^3.0.5 + ractive: ^1.3.12 + razor-tmpl: ^1.3.1 + react: ^16.13.1 + react-dom: ^16.13.1 + slm: ^2.0.0 + squirrelly: ^5.1.0 + swig: ^1.4.2 + swig-templates: ^2.0.3 + teacup: ^2.0.0 + templayed: '>=0.2.3' + then-jade: '*' + then-pug: '*' + tinyliquid: ^0.2.34 + toffee: ^0.3.6 + twig: ^1.15.2 + twing: ^5.0.2 + underscore: ^1.11.0 + vash: ^0.13.0 + velocityjs: ^2.0.1 + walrus: ^0.10.1 + whiskers: ^0.4.0 + peerDependenciesMeta: + arc-templates: + optional: true + atpl: + optional: true + babel-core: + optional: true + bracket-template: + optional: true + coffee-script: + optional: true + dot: + optional: true + dust: + optional: true + dustjs-helpers: + optional: true + dustjs-linkedin: + optional: true + eco: + optional: true + ect: + optional: true + ejs: + optional: true + haml-coffee: + optional: true + hamlet: + optional: true + hamljs: + optional: true + handlebars: + optional: true + hogan.js: + optional: true + htmling: + optional: true + jade: + optional: true + jazz: + optional: true + jqtpl: + optional: true + just: + optional: true + liquid-node: + optional: true + liquor: + optional: true + lodash: + optional: true + marko: + optional: true + mote: + optional: true + mustache: + optional: true + nunjucks: + optional: true + plates: + optional: true + pug: + optional: true + qejs: + optional: true + ractive: + optional: true + razor-tmpl: + optional: true + react: + optional: true + react-dom: + optional: true + slm: + optional: true + squirrelly: + optional: true + swig: + optional: true + swig-templates: + optional: true + teacup: + optional: true + templayed: + optional: true + then-jade: + optional: true + then-pug: + optional: true + tinyliquid: + optional: true + toffee: + optional: true + twig: + optional: true + twing: + optional: true + underscore: + optional: true + vash: + optional: true + velocityjs: + optional: true + walrus: + optional: true + whiskers: + optional: true dependencies: bluebird: 3.7.2 dev: true @@ -5806,7 +5966,6 @@ packages: resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - dev: true /natural-compare/1.4.0: resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=} @@ -6289,7 +6448,6 @@ packages: nanoid: 3.3.4 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: true /preact/10.8.2: resolution: {integrity: sha512-AKGt0BsDSiAYzVS78jZ9qRwuorY2CoSZtf1iOC6gLb/3QyZt+fLT09aYJBjRc/BEcRc4j+j3ggERMdNE43i1LQ==} @@ -7627,7 +7785,60 @@ packages: vue-template-compiler: 2.6.14 vue-template-es2015-compiler: 1.9.1 transitivePeerDependencies: + - arc-templates + - atpl + - babel-core + - bracket-template + - coffee-script + - dot + - dust + - dustjs-helpers + - dustjs-linkedin + - eco + - ect + - ejs + - haml-coffee + - hamlet + - hamljs + - handlebars + - hogan.js + - htmling + - jade + - jazz + - jqtpl + - just + - liquid-node + - liquor + - lodash + - marko + - mote + - mustache + - nunjucks + - plates + - pug + - qejs + - ractive + - razor-tmpl + - react + - react-dom + - slm + - squirrelly - supports-color + - swig + - swig-templates + - teacup + - templayed + - then-jade + - then-pug + - tinyliquid + - toffee + - twig + - twing + - underscore + - vash + - velocityjs + - walrus + - whiskers dev: true /vite/2.8.6: @@ -7895,7 +8106,6 @@ packages: '@vue/runtime-dom': 3.2.37 '@vue/server-renderer': 3.2.37_vue@3.2.37 '@vue/shared': 3.2.37 - dev: true /vuex/3.6.2_vue@2.6.14: resolution: {integrity: sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==}