Skip to content

Commit

Permalink
feat: support for new sfc experimental features
Browse files Browse the repository at this point in the history
- new `<script setup>` vuejs/rfcs#227
- new `<style>` variable injection vuejs/rfcs#231

Requires a version of `@vue/compiler-sfc` that supports the above features.
  • Loading branch information
grudev32 committed Nov 21, 2020
1 parent 2737a65 commit f820fe6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function resolveScript(
if (compileScript) {
try {
resolved = compileScript(descriptor, {
// @ts-ignore
id: scopeId,
isProd,
inlineTemplate: true,
Expand Down
1 change: 1 addition & 0 deletions src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export async function transformStyle(
const result = await compileStyleAsync({
filename: query.filename,
id: `data-v-${query.id}`,
// @ts-ignore
isProd: isProduction,
source: code,
scoped: block.scoped,
Expand Down
3 changes: 2 additions & 1 deletion src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function transformTemplate(
const descriptor = getDescriptor(query.filename)
const result = compileTemplate({
...getTemplateCompilerOptions(options, descriptor, query.id),
id: query.id,
source: code,
filename: query.filename,
})
Expand Down Expand Up @@ -73,6 +72,7 @@ export function getTemplateCompilerOptions(
options.templatePreprocessOptions[preprocessLang]
const resolvedScript = getResolvedScript(descriptor, isServer)
return {
// @ts-ignore
id: scopeId,
scoped: hasScoped,
isProd,
Expand All @@ -83,6 +83,7 @@ export function getTemplateCompilerOptions(
preprocessCustomRequire: options.preprocessCustomRequire,
compiler: options.compiler,
ssr: isServer,
// @ts-ignore
ssrCssVars: descriptor.cssVars,
compilerOptions: {
...options.compilerOptions,
Expand Down

0 comments on commit f820fe6

Please sign in to comment.