From 0e37b8c75ec7fe6bf5f7cbf9dc10c5794ae0e280 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Mon, 7 Dec 2020 17:06:12 +0900 Subject: [PATCH 1/5] Add defineCustomBlocksVisitor to parserServices --- README.md | 1 + package.json | 4 +- src/common/fix-locations.ts | 67 +++ src/index.ts | 12 +- src/parser-services.ts | 183 ++++++ src/script/index.ts | 69 +-- src/sfc/custom-block/index.ts | 357 +++++++++++ test/define-custom-blocks-visitor.js | 563 ++++++++++++++++++ .../empty-custom-block/document-fragment.json | 189 ++++++ .../empty-custom-block/source.vue | 1 + .../empty-custom-block/token-ranges.json | 7 + .../empty-custom-block/tree.json | 29 + test/index.js | 2 +- 13 files changed, 1413 insertions(+), 71 deletions(-) create mode 100644 src/common/fix-locations.ts create mode 100644 src/sfc/custom-block/index.ts create mode 100644 test/define-custom-blocks-visitor.js create mode 100644 test/fixtures/document-fragment/empty-custom-block/document-fragment.json create mode 100644 test/fixtures/document-fragment/empty-custom-block/source.vue create mode 100644 test/fixtures/document-fragment/empty-custom-block/token-ranges.json create mode 100644 test/fixtures/document-fragment/empty-custom-block/tree.json diff --git a/README.md b/README.md index 6ef377a6..c2e06a24 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,7 @@ But, it cannot be parsed with Vue 2. - `defineTemplateBodyVisitor(templateVisitor, scriptVisitor)` ... returns ESLint visitor to traverse `