@vizejs/vite-plugin-musea 0.263.0 → 0.264.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import { i as MuseaVrtRunner, n as generateVrtJsonReport, r as generateVrtReport
|
|
|
3
3
|
import { t as MuseaA11yRunner } from "./a11y-62l8G1tr.mjs";
|
|
4
4
|
import { n as writeArtFile, t as generateArtFile } from "./autogen-B7_TO0n5.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
|
-
import { transformWithEsbuild } from "vite";
|
|
7
6
|
import fs from "node:fs";
|
|
8
7
|
import path from "node:path";
|
|
9
8
|
import { fileURLToPath } from "node:url";
|
|
10
9
|
import crypto from "node:crypto";
|
|
11
10
|
import { VIZE_CONFIG_FILE_ENV, loadConfig, vizeConfigStore } from "@vizejs/vite-plugin";
|
|
11
|
+
import * as vite from "vite";
|
|
12
12
|
//#region src/native-loader.ts
|
|
13
13
|
/**
|
|
14
14
|
* Native binding loader for @vizejs/native.
|
|
@@ -3450,6 +3450,25 @@ async function processMuseaArtFile(filePath, ctx) {
|
|
|
3450
3450
|
}
|
|
3451
3451
|
}
|
|
3452
3452
|
//#endregion
|
|
3453
|
+
//#region src/plugin/virtual-transform.ts
|
|
3454
|
+
function createMuseaVirtualTransformer(viteApi) {
|
|
3455
|
+
return async (code, id, sourcemap) => {
|
|
3456
|
+
if (typeof viteApi.transformWithOxc === "function") return viteApi.transformWithOxc(code, id, {
|
|
3457
|
+
lang: "ts",
|
|
3458
|
+
sourcemap,
|
|
3459
|
+
target: "esnext"
|
|
3460
|
+
});
|
|
3461
|
+
if (typeof viteApi.transformWithEsbuild === "function") return viteApi.transformWithEsbuild(code, id, {
|
|
3462
|
+
loader: "ts",
|
|
3463
|
+
format: "esm",
|
|
3464
|
+
sourcemap,
|
|
3465
|
+
target: "esnext"
|
|
3466
|
+
});
|
|
3467
|
+
throw new Error("Installed Vite does not expose transformWithOxc or transformWithEsbuild");
|
|
3468
|
+
};
|
|
3469
|
+
}
|
|
3470
|
+
const transformMuseaVirtualModule = createMuseaVirtualTransformer(vite);
|
|
3471
|
+
//#endregion
|
|
3453
3472
|
//#region src/plugin/index.ts
|
|
3454
3473
|
function musea(options = {}) {
|
|
3455
3474
|
let include = options.include ?? ["**/*.art.vue"];
|
|
@@ -3629,12 +3648,7 @@ function musea(options = {}) {
|
|
|
3629
3648
|
if (!id.includes("?musea-virtual")) return null;
|
|
3630
3649
|
if (!id.includes("musea-art:") && !id.includes("\0musea:")) return null;
|
|
3631
3650
|
const safeId = id.replaceAll("\0", "").replace(/[^\w./-]+/g, "_").replace(/_+/g, "_");
|
|
3632
|
-
return
|
|
3633
|
-
loader: "ts",
|
|
3634
|
-
format: "esm",
|
|
3635
|
-
sourcemap: config.command === "serve",
|
|
3636
|
-
target: "esnext"
|
|
3637
|
-
});
|
|
3651
|
+
return transformMuseaVirtualModule(code, path.join(config.root, `.musea-${safeId}.ts`), config.command === "serve");
|
|
3638
3652
|
},
|
|
3639
3653
|
handleHotUpdate: createHandleHotUpdate(virtualState)
|
|
3640
3654
|
};
|