diff --git a/package.json b/package.json index f0a6c61a1..32cddb27a 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "tags": "vetur/tags.json", "attributes": "vetur/attributes.json" }, + "web-types": "vetur/web-types.json", "eslintConfig": { "root": true, "extends": [ diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index 5092b228a..0461f1387 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -51,7 +51,7 @@ "@types/jest": "^25.1.3", "@vant/eslint-config": "^2.0.0", "@vant/markdown-loader": "^2.3.0", - "@vant/markdown-vetur": "^1.1.0", + "@vant/markdown-vetur": "^2.0.0", "@vant/stylelint-config": "^1.2.0", "@vant/touch-emulator": "^1.2.0", "@vue/babel-preset-jsx": "^1.1.2", diff --git a/packages/vant-cli/src/compiler/gen-vetur-config.ts b/packages/vant-cli/src/compiler/gen-vetur-config.ts index bedc51c9f..0c5541962 100644 --- a/packages/vant-cli/src/compiler/gen-vetur-config.ts +++ b/packages/vant-cli/src/compiler/gen-vetur-config.ts @@ -1,15 +1,23 @@ import markdownVetur from '@vant/markdown-vetur'; import { join } from 'path'; import { get } from 'lodash'; -import { SRC_DIR, getVantConfig, ROOT } from '../common/constant'; +import { + ROOT, + SRC_DIR, + getVantConfig, + getPackageJson, +} from '../common/constant'; // generate vetur tags & attributes export function genVeturConfig() { const vantConfig = getVantConfig(); + const pkgJson = getPackageJson(); const options = get(vantConfig, 'build.vetur'); if (options) { markdownVetur.parseAndWrite({ + name: vantConfig.name, + version: pkgJson.version, path: SRC_DIR, test: /zh-CN\.md/, outputDir: join(ROOT, 'vetur'), diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index b983e0c47..76eb6d731 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -1563,10 +1563,13 @@ markdown-it-anchor "^5.2.5" transliteration "^2.1.7" -"@vant/markdown-vetur@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@vant/markdown-vetur/-/markdown-vetur-1.1.0.tgz#e02d29f3180e47dd588d7dcacaa06b66724915c9" - integrity sha512-abdWeVzCmVMwYzzFoqKtiLb1SVlWNoF3lgDXE0/gGBxkNXSN3XWeGXSaq7LNReyEjpRmfqqEIuP18NvkhBk4DQ== +"@vant/markdown-vetur@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@vant/markdown-vetur/-/markdown-vetur-2.0.0.tgz#19cb9b089fbd04dfb2b74c3edb497297086229e0" + integrity sha512-XcAcVOIUhuYbD5nmKjv4y9WxuP/YytDJi17xn1SwJe2gjIKNMli/gc2oNN2v8npCaCZAaDWpAUTXYy7XefdH9Q== + dependencies: + fast-glob "^3.2.2" + fs-extra "^9.0.0" "@vant/stylelint-config@^1.2.0": version "1.2.0" @@ -2200,6 +2203,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + atob@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" @@ -4903,6 +4911,16 @@ fs-extra@^7.0.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3" + integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^1.0.0" + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -5230,7 +5248,7 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.3: +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== @@ -6797,6 +6815,15 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179" + integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg== + dependencies: + universalify "^1.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -11124,6 +11151,11 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" + integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" diff --git a/packages/vant-markdown-vetur/package.json b/packages/vant-markdown-vetur/package.json index e2928d4f8..30f39177e 100644 --- a/packages/vant-markdown-vetur/package.json +++ b/packages/vant-markdown-vetur/package.json @@ -1,6 +1,6 @@ { "name": "@vant/markdown-vetur", - "version": "1.1.0", + "version": "2.0.0", "description": "simple parse markdown to vue component description for vetur auto-completion", "main": "lib/index.js", "license": "MIT", diff --git a/packages/vant-markdown-vetur/tsconfig.json b/packages/vant-markdown-vetur/tsconfig.json index dc75009d2..83790d350 100644 --- a/packages/vant-markdown-vetur/tsconfig.json +++ b/packages/vant-markdown-vetur/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig", - "include": ["src/*"], "compilerOptions": { + "target": "ES2017", + "outDir": "./lib", "module": "commonjs", - "outDir": "lib", - "noEmit": false - } + "strict": true, + "declaration": true, + "skipLibCheck": true, + "esModuleInterop": true, + "lib": ["esnext"] + }, + "include": ["src/**/*"] }