nuxt-discord 0.0.7 → 0.0.8

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-discord",
3
3
  "configKey": "discord",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -312,10 +312,10 @@ function prepareHMR(ctx) {
312
312
  if (fullPath.startsWith(commandsDir)) {
313
313
  path2 = ctx.resolve.root(path2);
314
314
  const command = processCommandFile(ctx, path2) ?? null;
315
- websocket?.broadcast({ event, path: path2, command });
316
315
  if (event === "add" || event === "change") {
317
316
  await generateDynamicCommandBuild(path2, rollupConfig, ctx);
318
317
  }
318
+ websocket?.broadcast({ event, path: path2, command });
319
319
  await updateTemplates({
320
320
  filter: (template) => template.filename === "discord/slashCommands"
321
321
  });
@@ -406,7 +406,7 @@ async function generateDynamicCommandBuild(file, config, ctx) {
406
406
  bundle = await rollup({ ...config, input: file });
407
407
  const { output } = await bundle.generate({ ...config.output, sourcemap: false });
408
408
  mkdirSync(path.join(ctx.nuxt.options.buildDir, "discord", "commands"), { recursive: true });
409
- writeFileSync(file.replace(ctx.resolve.root(ctx.nuxt.options.rootDir), ctx.nuxt.options.buildDir).replace(".ts", ".mjs"), output[0].code, "utf-8");
409
+ writeFileSync(file.replace(ctx.resolve.root(ctx.nuxt.options.rootDir), ctx.nuxt.options.buildDir).replace(".ts", ".mjs"), output[0].code, { encoding: "utf-8", flush: true });
410
410
  } catch (error) {
411
411
  ctx.logger.error(`Error processing command file ${file}:`, error);
412
412
  return;
@@ -22,7 +22,7 @@ export default defineNitroPlugin(async (nitro) => {
22
22
  const existingCommand = slashCommands.find((c) => c.path === cmd.path);
23
23
  if (existsSync(buildPath)) {
24
24
  logger.log(`Dynamically loading slash command at ${buildPath}`);
25
- runtimeCommand.load = () => import(buildPath).then((m) => m.default);
25
+ runtimeCommand.load = () => import(`${buildPath}?${Date.now()}`).then((m) => m.default);
26
26
  } else if (existingCommand) {
27
27
  runtimeCommand.execute = existingCommand.execute;
28
28
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-discord",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "description": "A Nuxt module for building Discord bots",
6
6
  "author": "Jize Zou <jeffzou2001@gmail.com> (https://github.com/zojize)",
7
7
  "license": "MIT",