bg2e-js 2.4.0 → 2.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bg2e-js",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "a graphics engine for productivity applications",
5
5
  "main": "./dist/bg2e-js.js",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,8 @@
1
+ import type { PluginOption } from "vite";
2
+
3
+ export interface CopyBg2eAssetsOptions {
4
+ nodeModulesPath?: string;
5
+ dstSubdir?: string;
6
+ }
7
+
8
+ export declare function copyBg2eAssets(options?: CopyBg2eAssetsOptions): PluginOption;
@@ -1,17 +1,16 @@
1
- import type { ViteDevServer } from "vite";
2
1
  import path from "node:path";
3
2
  import fs from "node:fs/promises";
4
3
 
5
4
  export function copyBg2eAssets({
6
5
  nodeModulesPath = "./node_modules",
7
6
  dstSubdir = "bg2io"
8
- } : { nodeModulesPath?: string, dstSubdir?: string } = {}) {
7
+ } = {}) {
9
8
  const bg2ioPath = path.join(nodeModulesPath, "bg2io");
10
9
 
11
10
  return {
12
11
  name: 'copy-bg2e-assets',
13
12
 
14
- async writeBundle(options: { dir?: string }) {
13
+ async writeBundle(options) {
15
14
  const baseSrcDir = path.resolve(bg2ioPath);
16
15
  const destDir = path.resolve(options.dir || "", dstSubdir);
17
16
 
@@ -27,7 +26,7 @@ export function copyBg2eAssets({
27
26
  )
28
27
  },
29
28
 
30
- async configureServer(server: ViteDevServer) {
29
+ async configureServer(server) {
31
30
  const dstDir = dstSubdir !== "" ? `/${dstSubdir}` : "";
32
31
  server.middlewares.use(`${dstDir}/bg2io.wasm`, async (req, res) => {
33
32
  const wasmPath = path.resolve(bg2ioPath, 'bg2io.wasm');