Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
fix: support options for template block preprocessor render (#377)
Browse files Browse the repository at this point in the history
also bump vue-compiler deps
  • Loading branch information
underfin authored Jul 30, 2020
1 parent a90f147 commit 3222451
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/debug": "^4.1.5",
"@types/jest": "^25.2.3",
"@types/node": "^13.13.2",
"@vue/compiler-sfc": "^3.0.0-beta.22",
"@vue/compiler-sfc": "^3.0.0-rc.5",
"husky": "^4.2.0",
"jest": "^26.0.1",
"lint-staged": "^10.1.7",
Expand Down
12 changes: 11 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export interface Options {
preprocessStyles?: boolean

// sfc template options
templatePreprocessOptions?: Record<
string,
SFCTemplateCompileOptions['preprocessOptions']
>
compiler?: SFCTemplateCompileOptions['compiler']
compilerOptions?: SFCTemplateCompileOptions['compilerOptions']
transformAssetUrls?: SFCTemplateCompileOptions['transformAssetUrls']
Expand Down Expand Up @@ -142,11 +146,17 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
if (query.type === 'template') {
debug(`transform(${id})`)
const block = descriptor.template!
const preprocessLang = block.lang
const preprocessOptions =
preprocessLang &&
options.templatePreprocessOptions &&
options.templatePreprocessOptions[preprocessLang]
const result = compileTemplate({
filename: query.filename,
source: code,
inMap: query.src ? undefined : block.map,
preprocessLang: block.lang,
preprocessLang,
preprocessOptions,
preprocessCustomRequire: options.preprocessCustomRequire,
compiler: options.compiler,
ssr: isServer,
Expand Down
58 changes: 29 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -643,36 +643,36 @@
dependencies:
"@types/yargs-parser" "*"

"@vue/compiler-core@3.0.0-beta.22":
version "3.0.0-beta.22"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-beta.22.tgz#d49acac2125d5e54fcf6958402ad449e2587c540"
integrity sha512-i/e965dQbJ4EGkX53a/aBO//IjgG5Rl9LOoRh91ZmPxi44WSG+tu+mvq+y7lRl5HoxkjGWo8GVErFYSRQnSLPA==
"@vue/compiler-core@3.0.0-rc.5":
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.5.tgz#dd4f1816fcae34a81bc60e584f97993cad284d54"
integrity sha512-dNz5AObEYg0Oglw3emIsBhTAOVfObrfxDaAzR0UTRDDq+Ohfr6KTSaVQAH88Ym+oa08ZlLZBFc6ARe9doAOIxg==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/shared" "3.0.0-beta.22"
"@vue/shared" "3.0.0-rc.5"
estree-walker "^2.0.1"
source-map "^0.6.1"

"@vue/compiler-dom@3.0.0-beta.22":
version "3.0.0-beta.22"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-beta.22.tgz#d3eae4321767529ca73f93a1ddb378f53e5728b4"
integrity sha512-kJCEeyaBbS+VjYNFEi3o2mnwS2rqdthpQ6TNigojXmGKEoA3UCOrn3IGR3iTSdo/3knaoA9/zwJ8LcxSXkZXMg==
"@vue/compiler-dom@3.0.0-rc.5":
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.5.tgz#83905e8601123a3654b90fbd80708a16530ce21a"
integrity sha512-z8n+R1GhFnWuKURLYxfVSEfP7nSNM91qteobxwys55fhlZZuReouMnUwgrn+ois/IL6RdFlT9H+n4+N6yLrdJA==
dependencies:
"@vue/compiler-core" "3.0.0-beta.22"
"@vue/shared" "3.0.0-beta.22"
"@vue/compiler-core" "3.0.0-rc.5"
"@vue/shared" "3.0.0-rc.5"

"@vue/compiler-sfc@^3.0.0-beta.22":
version "3.0.0-beta.22"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-beta.22.tgz#14694b57b78c7332d7c65084395b5eb457241be6"
integrity sha512-G2ex92dbhrsshQV38SrPKwlvBi3kNqxXs2yJ49OojPxuQrH/ndcLHeFaiuK2T6W796xHMBesGCsS8AmHFNuOBg==
"@vue/compiler-sfc@^3.0.0-rc.5":
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.5.tgz#374e52a6fbf8fb9aee1213026050a0f1c496fecf"
integrity sha512-huoIFEfFCJxHcpoByAUQti7CIwJdHPLJXKuy2HG7J1B+IEKugtBdF50CLH35ZD8dWM0nyOMFFqTbO7i6CCjL3Q==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/compiler-core" "3.0.0-beta.22"
"@vue/compiler-dom" "3.0.0-beta.22"
"@vue/compiler-ssr" "3.0.0-beta.22"
"@vue/shared" "3.0.0-beta.22"
"@vue/compiler-core" "3.0.0-rc.5"
"@vue/compiler-dom" "3.0.0-rc.5"
"@vue/compiler-ssr" "3.0.0-rc.5"
"@vue/shared" "3.0.0-rc.5"
consolidate "^0.15.1"
estree-walker "^2.0.1"
hash-sum "^2.0.0"
Expand All @@ -684,18 +684,18 @@
postcss-selector-parser "^6.0.2"
source-map "^0.6.1"

"@vue/compiler-ssr@3.0.0-beta.22":
version "3.0.0-beta.22"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-beta.22.tgz#98f42e44f1d83f336dfa26613f6e0a2e07ec43a2"
integrity sha512-v4Va4ODKV1OO0Vn+Xm9C7btZeNyerkrGxJ+s4Rd8szDN92TVHEvQUQymwVvUf7nzdS2Jf8K/8r1xz++xOaOPxQ==
"@vue/compiler-ssr@3.0.0-rc.5":
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.5.tgz#878406c59daff362ecdcb199fb9467a769ca8de5"
integrity sha512-OU5Vl2+bCDMImS9OeCVnl4lfxZ3/sopdwX2SrUWVKQvCxmmmlyWvoVkC6nNGCs/MrOmIMhKmL6etgzLTWyCkUg==
dependencies:
"@vue/compiler-dom" "3.0.0-beta.22"
"@vue/shared" "3.0.0-beta.22"
"@vue/compiler-dom" "3.0.0-rc.5"
"@vue/shared" "3.0.0-rc.5"

"@vue/shared@3.0.0-beta.22":
version "3.0.0-beta.22"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-beta.22.tgz#b5c40f27f9fbb76f235255d836c3226566ae9652"
integrity sha512-LX/unRMM9QUGIQjR9v2pKy60MRXWQRVEgaL6R8nFSRkbx2TTmShIdqmQPgciQwEBe7n5hsdZcSms+8LepNEykg==
"@vue/shared@3.0.0-rc.5":
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.5.tgz#cea2378e3e37363ddc1f5dd158edc9c9b5b3fff0"
integrity sha512-ZhcgGzBpp+pUzisZgQpM4ctIGgLpYjBj7/rZfbhEPxFHF/BuTV2jmhXvAl8aF9xDAejIcw85xCy92gDSwKtPag==

abab@^2.0.3:
version "2.0.3"
Expand Down

0 comments on commit 3222451

Please sign in to comment.