{"_id":"@aissab/component-compiler","name":"@aissab/component-compiler","dist-tags":{"latest":"4.2.5"},"versions":{"4.2.5":{"name":"@aissab/component-compiler","version":"4.2.5","description":"bundler agnostic API for compiling Vue SFC-upgrade dependencies","repository":{"type":"git","url":"git+https://github.com/vuejs/vue-component-compiler.git"},"keywords":["vue","compiler","sfc"],"author":{"name":"Rahul Kadyan"},"license":"MIT","bugs":{"url":"https://github.com/vuejs/vue-component-compiler/issues"},"main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"tsc","prepare":"rm -rf dist && npm run build","pretest":"npm run build","test":"jest","prerelease":"npm run test","release":"standard-version -a"},"homepage":"https://github.com/vuejs/vue-component-compiler#readme","devDependencies":{"@types/clean-css":"^3.4.30","@types/jest":"^25.2.3","@types/node":"^9.4.7","babel-plugin-external-helpers":"^6.22.0","babel-preset-env":"^1.6.1","conventional-changelog":"^1.1.24","jest":"24.x","pug":"^3.0.1","puppeteer":"^1.3.0","rollup":"^0.58.2","rollup-plugin-babel":"^3.0.4","rollup-plugin-commonjs":"^9.1.0","rollup-plugin-image":"^1.0.2","rollup-plugin-node-resolve":"^3.3.0","sass":"^1.18.0","ts-jest":"24.3.0","typescript":"^3.2.4","typescript-eslint-parser":"^15.0.0","vue":"^2.5.16","vue-template-compiler":"^2.5.16"},"optionalDependencies":{"less":"^3.9.0","pug":"^3.0.1","sass":"^1.18.0","stylus":"^0.54.5"},"peerDependencies":{"postcss":"7","vue-template-compiler":"*"},"dependencies":{"@vue/component-compiler-utils":"^3.0.0","clean-css":"^4.1.11","hash-sum":"^1.0.2","@aissab/postcss-modules-sync":"^1.0.1","source-map":"0.6.*","less":"^3.9.0","pug":"^3.0.1","sass":"^1.18.0","stylus":"^0.54.5"},"gitHead":"c4c445ba76102adaac39a5f59d4aeb2fd89bfc8f","_id":"@aissab/component-compiler@4.2.5","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-30MoaxtmydmEx0uzpxiy+K+FQ0KAnOBZeBPKANsxDls13MCIJVQgrCF7WgDXH8047YUIfm3QrhTAiq6XtO6diQ==","shasum":"2658aa006d53c0ed189a876eda084257918f6b6a","tarball":"https://registry.npmjs.org/@aissab/component-compiler/-/component-compiler-4.2.5.tgz","fileCount":13,"unpackedSize":37558,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC9rCnPT2eGI5y371ceQJV79TCioScB8vQtgDeKW41DSwIhAKWFewepGURVya2FVWgaW95aweLGZe5FQjAFjkWjIwUr"}]},"_npmUser":{"name":"aissab","email":"aissa.berrachiche@gmail.com"},"directories":{},"maintainers":[{"name":"aissab","email":"aissa.berrachiche@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/component-compiler_4.2.5_1693987798622_0.38454073343190354"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-06T08:09:58.443Z","4.2.5":"2023-09-06T08:09:58.795Z","modified":"2023-09-06T08:09:59.060Z"},"maintainers":[{"name":"aissab","email":"aissa.berrachiche@gmail.com"}],"description":"bundler agnostic API for compiling Vue SFC-upgrade dependencies","homepage":"https://github.com/vuejs/vue-component-compiler#readme","keywords":["vue","compiler","sfc"],"repository":{"type":"git","url":"git+https://github.com/vuejs/vue-component-compiler.git"},"author":{"name":"Rahul Kadyan"},"bugs":{"url":"https://github.com/vuejs/vue-component-compiler/issues"},"license":"MIT","readme":"# @vue/component-compiler [![Build Status](https://circleci.com/gh/vuejs/vue-component-compiler/tree/master.svg?style=shield)](https://circleci.com/gh/vuejs/vue-component-compiler)\n\n> High level utilities for compiling Vue single file components\n\nThis 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](https://github.com/vuejs/rollup-plugin-vue) version 3 and above.\n\nThe API surface is intentionally minimal - the goal is to reuse as much as possible while being as flexible as possible.\n\n## API\n\n### createDefaultCompiler(Options): SFCCompiler\n\nCreates a compiler instance.\n\n```typescript\ninterface Options {\n  script?: ScriptOptions\n  style?: StyleOptions\n  template?: TemplateOptions\n}\n\ninterface ScriptOptions {\n  preprocessorOptions?: any\n}\n\ninterface StyleOptions {\n  postcssOptions?: any\n  postcssPlugins?: any[]\n  postcssModulesOptions?: any\n  preprocessOptions?: any\n  postcssCleanOptions?: any\n  trim?: boolean\n}\n\ninterface TemplateOptions {\n  compiler: VueTemplateCompiler\n  compilerOptions: VueTemplateCompilerOptions\n  preprocessOptions?: any\n  transformAssetUrls?: AssetURLOptions | boolean\n  transpileOptions?: any\n  isProduction?: boolean\n  optimizeSSR?: boolean\n}\n```\n\n### SFCCompiler.compileToDescriptor(filename: string, source: string): DescriptorCompileResult\n\nTakes raw source and compiles each block separately. Internally, it uses [compileTemplate](https://github.com/vuejs/component-compiler-utils/blob/master/README.md#compiletemplatetemplatecompileoptions-templatecompileresults) and [compileStyle](https://github.com/vuejs/component-compiler-utils/blob/master/README.md#compilestylestylecompileoptions) from [@vue/component-compiler-utils](https://github.com/vuejs/component-compiler-utils).\n\n```typescript\ninterface DescriptorCompileResult {\n  customBlocks: SFCBlock[]\n  scopeId: string\n  script?: CompileResult\n  styles: StyleCompileResult[]\n  template?: TemplateCompileResult & { functional: boolean }\n}\n\ninterface CompileResult {\n  code: string\n  map?: any\n}\n\ninterface StyleCompileResult {\n  code: string\n  map?: any\n  scoped?: boolean\n  media?: string\n  moduleName?: string\n  module?: any\n}\n\ninterface TemplateCompileResult {\n  code: string;\n  source: string;\n  tips: string[];\n  errors: string[];\n  functional: boolean;\n}\n```\n\n#### Handling the Output\n\nThe blocks from the resulting descriptor should be assembled into JavaScript code:\n\n##### assemble(compiler: SFCCompiler, filename: string, result: DescriptorCompileResult, options: AssembleOptions): AssembleResults\n\n```typescript\ninterface AssembleResults {\n  code: string\n  map?: any\n}\n```\n\n```typescript\ninterface AssembleOptions {\n  normalizer?: string\n  styleInjector?: string\n  styleInjectorSSR?: string\n}\n```\n\n\nThe `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`:\n\n* Directly in-lined (default)\n* Using a global function (normalizer: 'myComponentNormalizer')\n* Using an import ({ normalizer: '~my-component-normalizer' })\n\nThe `assemble` method also accepts global variable name in `source`, `map` and `module` of styles. \n","readmeFilename":"README.md"}