New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@liip/esbuild-plugin-ast-vue

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liip/esbuild-plugin-ast-vue

Esbuild plugin to parse Vue AST

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
118
increased by126.92%
Maintainers
0
Weekly downloads
 
Created
Source

esbuild-plugin-ast-vue

A plugin to generate an AST representation of your .vue files. The plugin use Acorn to produce an estree compliant AST object. You can then apply transformations by providing a visitor object. In order to also parse your .js dependencies imported in your scripts, you should probably use the @liip/esbuild-plugin-ast in conjunction with this plugin since esbuild does not allow plugin composition.

Installation

npm i -D @liip/esbuild-plugin-ast-vue @liip/esbuild-plugin-ast

Usage

import { astParser } from '@liip/esbuild-plugin-ast';
import { astParserVue } from '@liip/esbuild-plugin-ast-vue';

...

await esbuild.context({
  ...
  plugins: [astParserVue(vueParserOptions), astParser(parserOptions)],
  ...
});

...

Options

You can configure the way the plugin works by setting different options.

interface AstParserVueOptions extends AstParserOptions {
  scriptNamespace?: string;
  templateVisitor: AstParserOptions['visitor'];
  templateOptions?: Pick<
    SFCTemplateCompileOptions,
    | 'compiler'
    | 'preprocessLang'
    | 'preprocessOptions'
    | 'compilerOptions'
    | 'transformAssetUrls'
  >;
  scriptOptions?: Pick<SFCScriptCompileOptions, 'babelParserPlugins'>;
  styleOptions?: Pick<
    SFCAsyncStyleCompileOptions,
    | 'modulesOptions'
    | 'preprocessLang'
    | 'preprocessOptions'
    | 'postcssOptions'
    | 'postcssPlugins'
  >;
}

scriptNamespace

A string namespace used to tell @liip/esbuild-plugin-ast to parse .js dependencies from your .vue files. This is required since esbuild does not allow plugin composition. This namespace should also be provided to astParser in order to work correctly.

visitor

An ESTraverse.Visitor object used to apply AST transformations. Check the Estraverse documentation form more information on the available API.

templateVisitor

An ESTraverse.Visitor object used to apply AST transformations to the JavaScript produce by the template interpretation. Check the Estraverse documentation form more information on the available API.

templateOptions

Template options passed to the underlying SFCCompiler. See the compileTemplate.ts implementation for more details

scriptOptions

Script options passed to the underlying SFCCompiler. See the compileScript.ts implementation for more details

styleOptions

Style options passed to the underlying SFCCompiler. See the compileStyle.ts implementation for more details

Keywords

FAQs

Package last updated on 16 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc