Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@vue/compiler-dom
Advanced tools
Package description
The @vue/compiler-dom package is part of the Vue.js ecosystem, specifically designed for compiling Vue template syntax into render functions directly in the browser or on the server. It is a core utility for Vue's template compilation, enabling developers to pre-compile templates or compile them on the fly, optimizing performance and enhancing the development experience with Vue.js applications.
Compiling Template Strings
This feature allows developers to compile Vue template strings into render functions. The compiled code can then be used to render Vue components dynamically. This is particularly useful for applications that need to compile templates on the fly, such as those that receive template code from a server.
import { compile } from '@vue/compiler-dom';
const { code } = compile('<div>{{ message }}</div>');
console.log(code);
Parsing Template Options
The package provides functionality to parse template strings into Abstract Syntax Trees (ASTs). This is useful for tools and libraries that need to analyze or manipulate Vue templates at a syntactic level, enabling advanced use cases like static analysis, linting, and custom transformations.
import { parse, baseParse } from '@vue/compiler-dom';
const ast = baseParse('<div>{{ message }}</div>');
console.log(ast);
Transforming AST Nodes
After parsing a template into an AST, @vue/compiler-dom allows developers to apply transformations to the AST nodes. This feature is powerful for creating custom directives or modifying the behavior of existing ones, enabling a high degree of customization and optimization for Vue applications.
import { transform } from '@vue/compiler-dom';
transform(ast, {
nodeTransforms: [/* array of node transform functions */]
});
This package is a Babel plugin that transforms JSX syntax into Vue render functions. While it serves a similar purpose to @vue/compiler-dom by enabling developers to write Vue components using JSX, it operates within the Babel ecosystem and requires a build step, unlike @vue/compiler-dom which can compile templates on the fly.
Part of the Vue 2 ecosystem, this package compiles Vue 2 templates into render functions. It is similar to @vue/compiler-dom but is specifically tailored for Vue 2, whereas @vue/compiler-dom is designed for Vue 3. The vue-template-compiler package is essential for Vue 2 development, offering compatibility with Vue 2's reactivity system and component structure.
Changelog
3.4.1 (2023-12-30)
Read this blog post for an overview of the release highlights.
To fully leverage new features in 3.4, it is recommended to also update the following dependencies when upgrading to 3.4:
If using TSX with Vue, check actions needed in Removed: Global JSX Namespace.
Make sure you are no longer using any deprecated features (if you are, you should have warnings in the console telling you so). They may have been removed in 3.4.
once
option to watch (#9034) (a645e7a)using
syntax (#8786) (5b2bd1d)defineModel
support local mutation by default, remove local option (f74785b), closes /github.com/vuejs/rfcs/discussions/503#discussioncomment-7566278__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
feature flag (#9550) (bc7698d)FunctionalComponent
(#8644) (927ab17)AriaAttributes
type (#8909) (fd0b6ba)ObjectPlugin
and FunctionPlugin
types (#8946) (fa4969e), closes #8577DefineProps
type (096ba81)PublicProps
type (#2403) (44135dc)h
with native elements (#9756) (a625376)ComponentInstance
type (#5408) (bfb8565)Starting in 3.4, Vue no longer registers the global JSX
namespace by default. This is necessary to avoid global namespace collision with React so that TSX of both libs can co-exist in the same project. This should not affect SFC-only users with latest version of Volar.
If you are using TSX, there are two options:
Explicitly set jsxImportSource to 'vue'
in tsconfig.json
before upgrading to 3.4. You can also opt-in per file by adding a /* @jsxImportSource vue */
comment at the top of the file.
If you have code that depends on the presence of the global JSX
namespace, e.g. usage of types like JSX.Element
etc., you can retain the exact pre-3.4 global behavior by explicitly referencing vue/jsx
, which registers the global JSX
namespace.
Note that this is a type-only breaking change in a minor release, which adheres to our release policy.
app.config.unwrapInjectedRef
has been removed. It was deprecated and enabled by default in 3.3. In 3.4 it is no longer possible to disable this behavior.@vnodeXXX
event listeners in templates are now a compiler error instead of a deprecation warning. Use @vue:XXX
listeners instead.v-is
directive has been removed. It was deprecated in 3.3. Use the is
attribute with vue:
prefix instead.Readme
FAQs
@vue/compiler-dom
We found that @vue/compiler-dom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).