grantthomas-nuxt 1.0.4 → 1.0.5

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": "@grantthomas/nuxt",
3
3
  "configKey": "grantThomasNuxt",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -16,6 +16,7 @@ const module = defineNuxtModule({
16
16
  const resolver = createResolver(import.meta.url);
17
17
  nuxt.options.runtimeConfig.public.grantThomasNuxt = options;
18
18
  nuxt.options.build.transpile.push("qs");
19
+ nuxt.options.build.transpile.push("heic2any");
19
20
  addServerHandler({
20
21
  route: "/api/maps/autocomplete",
21
22
  handler: resolver.resolve("runtime/server/api/maps/autocomplete")
@@ -106,7 +106,21 @@ const isHeicFile = (file) => {
106
106
  const convertHeicToJpeg = async (file) => {
107
107
  try {
108
108
  convertingHeic.value = true;
109
- const heic2any = (await import("heic2any")).default;
109
+ const heic2anyModule = await import("heic2any");
110
+ let heic2any;
111
+ if (typeof heic2anyModule === "function") {
112
+ heic2any = heic2anyModule;
113
+ } else if (heic2anyModule.default && typeof heic2anyModule.default === "function") {
114
+ heic2any = heic2anyModule.default;
115
+ } else if (heic2anyModule.heic2any && typeof heic2anyModule.heic2any === "function") {
116
+ heic2any = heic2anyModule.heic2any;
117
+ } else {
118
+ heic2any = Object.values(heic2anyModule).find((val) => typeof val === "function");
119
+ }
120
+ if (!heic2any || typeof heic2any !== "function") {
121
+ console.error("heic2any module structure:", heic2anyModule);
122
+ throw new Error("Failed to load HEIC converter. Please refresh and try again.");
123
+ }
110
124
  const convertedBlob = await heic2any({
111
125
  blob: file,
112
126
  toType: "image/jpeg",
@@ -124,6 +138,8 @@ const convertHeicToJpeg = async (file) => {
124
138
  throw new Error("This HEIC file format is not supported. Please use a JPEG or PNG instead.");
125
139
  } else if (error.code === 1 || error.message?.includes("corrupt")) {
126
140
  throw new Error("This HEIC file appears to be corrupted. Please try a different file.");
141
+ } else if (error.message?.includes("load HEIC converter")) {
142
+ throw error;
127
143
  } else {
128
144
  throw new Error("Failed to convert HEIC image. Please try converting to JPEG/PNG first.");
129
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grantthomas-nuxt",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Crud module for Nuxt 3 interacting with sibling .net project",
5
5
  "repository": "Tap-Leagues/GrantThomas.Nuxt",
6
6
  "license": "MIT",