Socket
Socket
Sign inDemoInstall

@vue/compiler-core

Package Overview
Dependencies
5
Maintainers
1
Versions
209
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vue/compiler-core

@vue/compiler-core


Version published
Maintainers
1
Created

Package description

What is @vue/compiler-core?

The @vue/compiler-core package is a lower-level utility for compiling Vue.js templates into render functions. It is part of the Vue.js framework and is used internally by higher-level tools like vue-loader or @vue/compiler-sfc. It provides the core algorithms for parsing template syntax and generating JavaScript code from templates.

What are @vue/compiler-core's main functionalities?

Parsing Template Syntax

This feature allows you to parse Vue template syntax into an Abstract Syntax Tree (AST). The AST can then be manipulated or compiled into render functions.

import { baseParse } from '@vue/compiler-core';
const ast = baseParse('<div>Hello, {{ world }}</div>');

Compiling AST to Render Functions

This feature takes an AST and compiles it into JavaScript render functions, which can be used to render Vue components.

import { baseCompile } from '@vue/compiler-core';
const { code } = baseCompile('<div>Hello, {{ world }}</div>');

Transforming AST Nodes

This feature allows you to apply custom transformations to AST nodes. In this example, we're changing the content of an interpolation from 'world' to 'universe'.

import { transform } from '@vue/compiler-core';
import { createSimpleExpression } from '@vue/compiler-core';

const ast = baseParse('<div>Hello, {{ world }}</div>');
transform(ast, {
  nodeTransforms: [
    (node) => {
      if (node.type === 5 /* INTERPOLATION */) {
        node.content = createSimpleExpression('universe', false);
      }
    }
  ]
});

Other packages similar to @vue/compiler-core

Changelog

Source

3.4.0-alpha.2 (2023-11-27)

Bug Fixes

  • avoid confusing breakage in @vitejs/plugin-vue (ceec69c)

  • compiler-core: fix line/column tracking when fast forwarding (2e65ea4)

  • compiler-sfc: fix ast reuse for ssr (fb619cf)

  • compiler-sfc: support :is and :where selector in scoped css rewrite (#8929) (c6083dc)

  • compiler-sfc: use correct compiler when re-parsing in ssr mode (678378a)

  • feat!: remove reactivity transform (#9321) (79b8a09), closes #9321

Features

  • compiler-core: support specifying root namespace when parsing (40f72d5)
  • compiler-core: support v-bind shorthand for key and value with the same name (#9451) (26399aa)
  • compiler: improve parsing tolerance for language-tools (41ff68e)
  • reactivity: expose last result for computed getter (#9497) (48b47a1)

Performance Improvements

  • avoid sfc source map unnecessary serialization and parsing (f15d2f6)
  • codegen: optimize line / column calculation during codegen (3be53d9)
  • codegen: optimize source map generation (c11002f)
  • compiler-sfc: remove magic-string trim on script (e8e3ec6)
  • compiler-sfc: use faster source map addMapping (50cde7c)
  • optimize away isBuiltInType (66c0ed0)
  • optimize makeMap (ae6fba9)
  • optimize position cloning (2073236)

BREAKING CHANGES

  • Reactivity Transform was marked deprecated in 3.3 and is now removed in 3.4. This change does not require a major due to the feature being experimental. Users who wish to continue using the feature can do so via the external plugin at https://vue-macros.dev/features/reactivity-transform.html

Keywords

FAQs

Last updated on 27 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc