Skip to content

Commit 306a8f0

Browse files
cardosodivmain
andauthored
feat(rollup-plugin): expose version (#5194)
* feat(rollup-plugin): expose version * test(rollup-plugin): exposes plugin version * chore: add comment --------- Co-authored-by: Dale Bustad <dale@divmain.com>
1 parent e54ebff commit 306a8f0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import lwc from '@lwc/rollup-plugin';
2+
import { test, expect } from 'vitest';
3+
4+
test('exposes plugin version', () => {
5+
const plugin = lwc();
6+
expect(plugin.version).toMatch(/^\d+\.\d+\.\d+/);
7+
});

packages/@lwc/rollup-plugin/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ export default function lwc(pluginOptions: RollupLwcOptions = {}): Plugin {
182182

183183
return {
184184
name: PLUGIN_NAME,
185-
185+
// The version from the package.json is inlined by the build script
186+
version: process.env.LWC_VERSION,
186187
buildStart({ input }) {
187188
if (rootDir === undefined) {
188189
if (Array.isArray(input)) {

0 commit comments

Comments
 (0)