@blokkli/editor 2.0.0-alpha.47 → 2.0.0-alpha.48

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": "@blokkli/editor",
3
3
  "configKey": "blokkli",
4
- "version": "2.0.0-alpha.47",
4
+ "version": "2.0.0-alpha.48",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -18,7 +18,7 @@ import 'typescript';
18
18
  import 'oxc-walker';
19
19
 
20
20
  const name = "@blokkli/editor";
21
- const version = "2.0.0-alpha.47";
21
+ const version = "2.0.0-alpha.48";
22
22
 
23
23
  function validateOption(optionKey, option, icons) {
24
24
  const errors = [];
@@ -809,16 +809,32 @@ const BlokkliEditingPlugin = (nuxt) => {
809
809
  }
810
810
  },
811
811
  vite: {
812
- handleHotUpdate({ file, server }) {
813
- if (file.endsWith(".vue") && !file.includes(EDITING_MARKER)) {
812
+ hotUpdate: {
813
+ order: "post",
814
+ async handler({ file, modules, server }) {
815
+ if (!file.endsWith(".vue") || file.includes(EDITING_MARKER)) {
816
+ return;
817
+ }
814
818
  const editingVariantPath = file.replace(
815
819
  /\.vue$/,
816
820
  `${EDITING_MARKER}.vue`
817
821
  );
818
- const editingModule = server.moduleGraph.getModuleById(editingVariantPath);
819
- if (editingModule) {
820
- server.reloadModule(editingModule);
822
+ const environment = server.environments["client"];
823
+ if (!environment) {
824
+ return;
825
+ }
826
+ const editingModules = environment.moduleGraph.getModulesByFile(editingVariantPath);
827
+ if (!editingModules || editingModules.size === 0) {
828
+ return;
829
+ }
830
+ const mainModule = [...editingModules].find(
831
+ (m) => !m.url.includes("?")
832
+ );
833
+ if (mainModule) {
834
+ environment.moduleGraph.invalidateModule(mainModule);
835
+ await environment.transformRequest(mainModule.url);
821
836
  }
837
+ return [...modules, ...editingModules];
822
838
  }
823
839
  }
824
840
  }