From 46e64b257cbb81aa302d0d9a4c6434d21216ed2d Mon Sep 17 00:00:00 2001 From: likui <2218301630@qq.com> Date: Sun, 13 Oct 2019 07:49:23 +0800 Subject: [PATCH] feat(compiler-core/runtime-core): show codeframe in runtime compile errors (#220) --- .../__snapshots__/codeframe.spec.ts.snap | 37 +++++++++++++++ .../compiler-core/__tests__/codeframe.spec.ts | 46 +++++++++++++++++++ packages/compiler-core/src/codeframe.ts | 37 +++++++++++++++ packages/compiler-core/src/index.ts | 1 + packages/runtime-core/src/component.ts | 19 ++++++-- 5 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 packages/compiler-core/__tests__/__snapshots__/codeframe.spec.ts.snap create mode 100644 packages/compiler-core/__tests__/codeframe.spec.ts create mode 100644 packages/compiler-core/src/codeframe.ts diff --git a/packages/compiler-core/__tests__/__snapshots__/codeframe.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/codeframe.spec.ts.snap new file mode 100644 index 00000000..89a4c263 --- /dev/null +++ b/packages/compiler-core/__tests__/__snapshots__/codeframe.spec.ts.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`compiler: codeframe line in middle 1`] = ` +"2 | +3 | +6 | " +`; + +exports[`compiler: codeframe line near bottom 1`] = ` +"4 |
  • hi
  • +5 | +6 | + | ^^^^^^^^^ +7 | " +`; + +exports[`compiler: codeframe line near top 1`] = ` +"1 |
    +2 | + | ^^^^^^^^^ +3 |