Skip to content

Commit 24cb9a4

Browse files
authored
fix: move vite and @lwc/rollup-plugin to peer dependencies (#10)
1 parent 71c3dde commit 24cb9a4

File tree

3 files changed

+14
-26
lines changed

3 files changed

+14
-26
lines changed

packages/vite-plugin-lwc/package.json

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
"license": "MIT",
55
"author": "Matheus Cardoso <[email protected]>",
66
"type": "module",
7-
"files": [
8-
"dist"
9-
],
7+
"files": ["dist"],
108
"module": "./dist/index.mjs",
119
"types": "./dist/index.d.ts",
1210
"exports": {
@@ -29,14 +27,11 @@
2927
"url": "https://github.com/cardoso/vite-plugin-lwc/issues"
3028
},
3129
"homepage": "https://github.com/cardoso/vite-plugin-lwc/tree/main/packages/vite-plugin-lwc#readme",
32-
"dependencies": {
33-
"@lwc/rollup-plugin": "catalog:"
34-
},
3530
"peerDependencies": {
36-
"vite": "catalog:"
31+
"vite": ">= 6",
32+
"@lwc/rollup-plugin": ">= 8"
3733
},
3834
"devDependencies": {
39-
"unbuild": "catalog:",
40-
"rollup": "^4.34.1"
35+
"unbuild": "^3.3.1"
4136
}
4237
}

packages/vite-plugin-lwc/src/lwc.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { createFilter, type Plugin } from "vite";
1+
import { createFilter, type Plugin, type Rollup } from "vite";
22
import lwc, { type RollupLwcOptions } from "@lwc/rollup-plugin";
3-
import type { RollupError } from "rollup";
43
import path from "node:path";
54

65
export type ViteLwcOptions = RollupLwcOptions;
@@ -130,7 +129,7 @@ function getError(
130129
error: unknown,
131130
id?: string,
132131
src?: string,
133-
): RollupError | string {
132+
): Rollup.RollupError | string {
134133
if (typeof error === "string") {
135134
return error;
136135
}
@@ -139,7 +138,7 @@ function getError(
139138
return String(error);
140139
}
141140

142-
const rollupError: RollupError = {
141+
const rollupError: Rollup.RollupError = {
143142
message: "An unknown error occurred.",
144143
};
145144

@@ -151,21 +150,21 @@ function getError(
151150
return rollupError;
152151
}
153152

154-
function addErrorCode(error: object, rollupError: RollupError) {
153+
function addErrorCode(error: object, rollupError: Rollup.RollupError) {
155154
if ("code" in error && typeof error.code === "number") {
156155
rollupError.pluginCode = error.code;
157156
}
158157
}
159158

160-
function addErrorMessage(error: object, rollupError: RollupError) {
159+
function addErrorMessage(error: object, rollupError: Rollup.RollupError) {
161160
if ("message" in error && typeof error.message === "string") {
162161
rollupError.message = error.message;
163162
}
164163
}
165164

166165
function addErrorLocation(
167166
error: object,
168-
rollupError: RollupError,
167+
rollupError: Rollup.RollupError,
169168
src?: string,
170169
) {
171170
if ("filename" in error && typeof error.filename === "string") {
@@ -207,7 +206,7 @@ function addErrorLocation(
207206
}
208207
}
209208

210-
function addErrorId(id: string | undefined, rollupError: RollupError) {
209+
function addErrorId(id: string | undefined, rollupError: Rollup.RollupError) {
211210
if (typeof id === "string") {
212211
rollupError.id = id;
213212
}

pnpm-lock.yaml

+3-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)