LWC Compiler Version Babel Plugin (src/compiler-version-number.ts)

lwc · packages/@lwc/babel-plugin-component/src/compiler-version-number.ts · typescript · MIT
dev-tools, crm, tag:babel, tag:lwc, tag:metadata

Babel plugin that injects compiler version metadata as comments into Lightning Web Component class bodies during compilation.

// Source: https://github.com/salesforce/lwc | License: MIT | Copyright 2026, Salesforce, Inc
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright (c) 2023, salesforce.com, inc.
 * All rights reserved.
 * SPDX-License-Identifier: MIT
 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
 */
import { LWC_VERSION_COMMENT } from '@lwc/shared';
import type { types, Visitor } from '@babel/core';
import type { BabelAPI, LwcBabelPluginPass } from './types';

export default function compilerVersionNumber({ types: t }: BabelAPI): Visitor<LwcBabelPluginPass> {
    return {
        ClassBody(path) {
            if ((path.parent as types.ClassDeclaration).superClass === null) {
                // Components *must* extend from

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key