Skip to content

Commit 7f5a0e5

Browse files
committed
cleanup
1 parent 1a7a2f4 commit 7f5a0e5

File tree

3 files changed

+82
-67
lines changed

3 files changed

+82
-67
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@vitest/browser": "^4.1.2",
102102
"@vitest/coverage-istanbul": "^4.1.2",
103103
"@vitest/ui": "^4.1.2",
104-
"happy-dom": "^20.8.8",
104+
"happy-dom": "^20.8.9",
105105
"typescript": "6.0.2",
106106
"vite": "^8.0.3",
107107
"vitest": "^4.1.2"

plugin/index.mjs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ export default function VitePluginVanJS(options = {}) {
7676
enforce: "pre",
7777
buildStart() {
7878
context = this;
79-
viteVersion = (context.meta?.viteVersion[0]);
79+
viteVersion = context.meta?.viteVersion[0];
8080
isOxc = Number(viteVersion) >= 8;
8181
},
82-
// @ts-expect-error - this is temporary esbuild will be
82+
// @ts-expect-error - this is temporary esbuild will be
8383
config() {
8484
return {
8585
optimizeDeps: {
@@ -106,20 +106,22 @@ export default function VitePluginVanJS(options = {}) {
106106
},
107107
},
108108
...(
109-
isOxc ? {
110-
oxc: {
111-
include: /\.(jsx?|tsx?)$/,
112-
jsx: {
113-
runtime: 'preserve', // Options: 'automatic', 'classic', 'preserve'
114-
importSource: "@vanjs/jsx", // Default import source
109+
isOxc
110+
? {
111+
oxc: {
112+
include: /\.(jsx?|tsx?)$/,
113+
jsx: {
114+
runtime: "preserve", // Options: 'automatic', 'classic', 'preserve'
115+
importSource: "@vanjs/jsx", // Default import source
116+
},
115117
},
116118
}
117-
} : {
118-
esbuild: {
119-
jsx: "automatic",
120-
jsxImportSource: "@vanjs/jsx",
119+
: {
120+
esbuild: {
121+
jsx: "automatic",
122+
jsxImportSource: "@vanjs/jsx",
123+
},
121124
}
122-
}
123125
),
124126
};
125127
},
@@ -201,12 +203,12 @@ export default function VitePluginVanJS(options = {}) {
201203
isResolvedVanFile || (source === "vanjs-core" && !isSetupFile)
202204
? "@vanjs/van"
203205
: isResolvedVanXFile ||
204-
(source === "vanjs-ext" &&
205-
!isImportedVanXFile)
206-
? "@vanjs/vanX"
207-
: isResolvedSetupFile && (!ssr && isSetupFile || ssr && !isSetupFile)
208-
? "@vanjs/setup"
209-
: null;
206+
(source === "vanjs-ext" &&
207+
!isImportedVanXFile)
208+
? "@vanjs/vanX"
209+
: isResolvedSetupFile && (!ssr && isSetupFile || ssr && !isSetupFile)
210+
? "@vanjs/setup"
211+
: null;
210212
const resolvedPath = matchedSource ? aliases[matchedSource] : null;
211213

212214
if (resolvedPath) {
@@ -236,16 +238,15 @@ routes.length = 0;
236238
237239
// Register routes
238240
${currentRoutes.map(generateRoute).join("\n")}
239-
${(ops && ops.ssr && currentRoutes.length)
241+
${
242+
(ops && ops.ssr && currentRoutes.length)
240243
? `console.log(\`🍦 @vanjs/router registered ${currentRoutes.length} routes.\`)`
241-
: /* istanbul ignore next @preserve */""
242-
}
244+
: /* istanbul ignore next @preserve */ ""
245+
}
243246
`;
244247

245248
const vite = await import("vite");
246-
const transformer = isOxc
247-
? "transformWithOxc"
248-
: "transformWithEsbuild";
249+
const transformer = isOxc ? "transformWithOxc" : "transformWithEsbuild";
249250
const langProp = isOxc ? "lang" : "loader";
250251
// const mapProp = isOxc ? "source_map" : "sourcemap";
251252

@@ -256,11 +257,13 @@ ${(ops && ops.ssr && currentRoutes.length)
256257

257258
return {
258259
code: result.code,
259-
map: result.map ? (
260-
typeof result.map === "string"
261-
? JSON.parse(result.map)
262-
: /* istanbul ignore next @preserve */ result.map
263-
) : /* istanbul ignore next @preserve */ null,
260+
map: result.map
261+
? (
262+
typeof result.map === "string"
263+
? JSON.parse(result.map)
264+
: /* istanbul ignore next @preserve */ result.map
265+
)
266+
: /* istanbul ignore next @preserve */ null,
264267
};
265268
}
266269
return null;

pnpm-lock.yaml

Lines changed: 48 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)