@druid-ui/vite 1.0.0 → 1.0.2

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.js CHANGED
@@ -2330,14 +2330,15 @@ async function glob(patternsOrOptions, options) {
2330
2330
  // src/plugin.ts
2331
2331
  function ViteHMRPlugin(pattern, buildType = "wasm", ext) {
2332
2332
  let wasmVersion = Date.now();
2333
+ let publicDir = "public";
2333
2334
  async function rebuildAll(server, reason) {
2334
2335
  const components = await glob(pattern);
2335
2336
  console.log(`[${buildType}] Rebuilding (${reason})\u2026`);
2336
2337
  const start = Date.now();
2337
2338
  await Promise.all(
2338
2339
  components.map(async (comp) => {
2339
- if (buildType === "raw") return await buildRaw(comp, "public");
2340
- await buildWasm(comp, "public", ext);
2340
+ if (buildType === "raw") return await buildRaw(comp, publicDir);
2341
+ await buildWasm(comp, publicDir, ext);
2341
2342
  console.log(`[wasm] Build complete for '${comp}'`);
2342
2343
  })
2343
2344
  );
@@ -2354,6 +2355,11 @@ function ViteHMRPlugin(pattern, buildType = "wasm", ext) {
2354
2355
  }
2355
2356
  return {
2356
2357
  name: "vite-hmr",
2358
+ configResolved(config) {
2359
+ if (config.publicDir) {
2360
+ publicDir = config.publicDir;
2361
+ }
2362
+ },
2357
2363
  async handleHotUpdate({ file, server }) {
2358
2364
  if (file.endsWith(".ts") || file.endsWith(".tsx")) {
2359
2365
  await rebuildAll(server, `change:${file}`);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGzE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAM,GAAG,KAAc,EAClC,GAAG,CAAC,EAAE,YAAY,GACjB,YAAY,CAmDd"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGzE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAM,GAAG,KAAc,EAClC,GAAG,CAAC,EAAE,YAAY,GACjB,YAAY,CAyDd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@druid-ui/vite",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  "build:types": "tsc --emitDeclarationOnly --outDir dist/types"
26
26
  },
27
27
  "dependencies": {
28
- "@druid-ui/build": "1.0.0",
29
- "@druid-ui/host": "1.0.0",
28
+ "@druid-ui/build": "1.0.1",
29
+ "@druid-ui/host": "1.0.1",
30
30
  "tinyglobby": "^0.2.15"
31
31
  },
32
32
  "peerDependencies": {
package/src/plugin.ts CHANGED
@@ -9,6 +9,7 @@ export function ViteHMRPlugin(
9
9
  ext?: WitExtension,
10
10
  ): PluginOption {
11
11
  let wasmVersion = Date.now();
12
+ let publicDir = "public";
12
13
 
13
14
  async function rebuildAll(server: ViteDevServer, reason: string) {
14
15
  const components = await glob(pattern);
@@ -17,8 +18,8 @@ export function ViteHMRPlugin(
17
18
 
18
19
  await Promise.all(
19
20
  components.map(async (comp) => {
20
- if (buildType === "raw") return await buildRaw(comp, "public");
21
- await buildWasm(comp, "public", ext);
21
+ if (buildType === "raw") return await buildRaw(comp, publicDir);
22
+ await buildWasm(comp, publicDir, ext);
22
23
  console.log(`[wasm] Build complete for '${comp}'`);
23
24
  }),
24
25
  );
@@ -36,6 +37,11 @@ export function ViteHMRPlugin(
36
37
 
37
38
  return {
38
39
  name: "vite-hmr",
40
+ configResolved(config) {
41
+ if (config.publicDir) {
42
+ publicDir = config.publicDir;
43
+ }
44
+ },
39
45
  async handleHotUpdate({ file, server }) {
40
46
  if (file.endsWith(".ts") || file.endsWith(".tsx")) {
41
47
  await rebuildAll(server, `change:${file}`);