Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@vue/compiler-core
Advanced tools
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.
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);
}
}
]
});
Babel is a JavaScript compiler that includes capabilities for transforming syntax. While it is not specific to Vue, it provides similar functionality in terms of parsing code and generating abstract syntax trees, which can then be transformed and compiled.
TypeScript is a superset of JavaScript that compiles to plain JavaScript. It includes a compiler that can parse TypeScript code, perform type checking, and output JavaScript code. It is similar to @vue/compiler-core in that it involves a compilation step, but it is focused on type safety and JavaScript rather than Vue templates.
Svelte is a compiler for building user interfaces. It compiles Svelte components, which are written in a syntax similar to Vue's, into efficient JavaScript code. Like @vue/compiler-core, Svelte provides a way to compile declarative components into imperative code that can be executed in the browser.
3.5.1 (2024-09-04)
concat
method (#11794) (475977a), closes #11792Readonly<...>
to fix JSDoc emit (#11799) (7518bc1)onEffectCleanup
API (2cc5615), closes #10173failSilently
argument for onScopeDispose
(9a936aa)watch
, getCurrentWatcher
, and onWatcherCleanup
(#9927) (205e5b5)deep
option to control the watch depth (#9572) (22f7d96)MultiWatchSources
type (#9563) (998dca5)useId()
and app.config.idPrefix
(#11404) (73ef156)useHost()
helper (775103a)useShadowRoot()
helper (5a1a89b), closes #6113 #8195this.$host
in Options API (1ef8f46):host
selector by applying css vars on host element (#8830) (03a9ea2), closes #8826nonce
option for injected style tags (bb4a02a), closes #6530shadowRoot: false
in defineCustomElement()
(37d2ce5), closes #4314 #4404useTemplateRef()
(3ba70e4)app.onUnmount()
for registering cleanup functions (#4619) (582a3a3), closes #4516app.config.throwUnhandledErrorInProduction
(f476b7f), closes #7876Symbol
global in template expressions (#9069) (a501a85)className
during SSR (#11722) (52cdb0f)FAQs
@vue/compiler-core
The npm package @vue/compiler-core receives a total of 4,472,315 weekly downloads. As such, @vue/compiler-core popularity was classified as popular.
We found that @vue/compiler-core 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.