vue-component-compiler

WebJar for vue-component-compiler

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

vue-component-compiler
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

vue-component-compiler
WebJar for vue-component-compiler
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/vuejs/vue-component-compiler

Download vue-component-compiler

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/vue-component-compiler/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>vue-component-compiler</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/vue-component-compiler/
implementation 'org.webjars.npm:vue-component-compiler:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/vue-component-compiler/
implementation ("org.webjars.npm:vue-component-compiler:2.0.0")
'org.webjars.npm:vue-component-compiler:jar:2.0.0'
<dependency org="org.webjars.npm" name="vue-component-compiler" rev="2.0.0">
  <artifact name="vue-component-compiler" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='vue-component-compiler', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "vue-component-compiler" % "2.0.0"
[org.webjars.npm/vue-component-compiler "2.0.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : async jar [1.4.2,2)
org.webjars.npm : clean-css jar [3.4.4,4)
org.webjars.npm : html-minifier jar [0.8.0,0.9)
org.webjars.npm : parse5 jar [1.5.0,2)

Project Modules

There are no modules declared in this project.

@vue/component-compiler Build Status

High level utilities for compiling Vue single file components

This package contains high level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue single file components into JavaScript. It is used in rollup-plugin-vue version 3 and above.

The API surface is intentionally minimal - the goal is to reuse as much as possible while being as flexible as possible.

API

createDefaultCompiler(Options): SFCCompiler

Creates a compiler instance.

interface Options {
  script?: ScriptOptions
  style?: StyleOptions
  template?: TemplateOptions
}

interface ScriptOptions {
  preprocessorOptions?: any
}

interface StyleOptions {
  postcssOptions?: any
  postcssPlugins?: any[]
  postcssModulesOptions?: any
  preprocessOptions?: any
  postcssCleanOptions?: any
  trim?: boolean
}

interface TemplateOptions {
  compiler: VueTemplateCompiler
  compilerOptions: VueTemplateCompilerOptions
  preprocessOptions?: any
  transformAssetUrls?: AssetURLOptions | boolean
  transpileOptions?: any
  isProduction?: boolean
  optimizeSSR?: boolean
}

SFCCompiler.compileToDescriptor(filename: string, source: string): DescriptorCompileResult

Takes raw source and compiles each block separately. Internally, it uses compileTemplate and compileStyle from @vue/component-compiler-utils.

interface DescriptorCompileResult {
  customBlocks: SFCBlock[]
  scopeId: string
  script?: CompileResult
  styles: StyleCompileResult[]
  template?: TemplateCompileResult & { functional: boolean }
}

interface CompileResult {
  code: string
  map?: any
}

interface StyleCompileResult {
  code: string
  map?: any
  scoped?: boolean
  media?: string
  moduleName?: string
  module?: any
}

interface TemplateCompileResult {
  code: string;
  source: string;
  tips: string[];
  errors: string[];
  functional: boolean;
}

Handling the Output

The blocks from the resulting descriptor should be assembled into JavaScript code:

assemble(compiler: SFCCompiler, filename: string, result: DescriptorCompileResult, options: AssembleOptions): AssembleResults
interface AssembleResults {
  code: string
  map?: any
}
interface AssembleOptions {
  normalizer?: string
  styleInjector?: string
  styleInjectorSSR?: string
}

The assemble method is an example implementation for how to combine various parts from the descriptor. You can provide custom implementations for normalizer, styleInjector and styleInjectorSSR:

  • Directly in-lined (default)
  • Using a global function (normalizer: 'myComponentNormalizer')
  • Using an import ({ normalizer: '~my-component-normalizer' })

The assemble method also accepts global variable name in source, map and module of styles.

org.webjars.npm

vuejs

Versions

Version
2.0.0