@b10cks/nuxt 0.10.4 → 0.10.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": "@b10cks/nuxt",
3
3
  "configKey": "b10cks",
4
- "version": "0.10.4",
4
+ "version": "0.10.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -66,7 +66,6 @@ export const useB10cksApi = () => {
66
66
  ...options,
67
67
  params,
68
68
  transform: (result) => {
69
- console.log("Content fetched:", result);
70
69
  if ("data" in result) {
71
70
  return result.data;
72
71
  }
@@ -167,7 +166,6 @@ export const useB10cksApi = () => {
167
166
  if (!configCache.value) {
168
167
  await execute();
169
168
  configCache.value = config.value?.content || {};
170
- console.log("Config fetched:", configCache.value);
171
169
  }
172
170
  return {
173
171
  config: computed(() => configCache.value)
@@ -177,7 +175,6 @@ export const useB10cksApi = () => {
177
175
  const { data: space, execute } = useSpace({ immediate: false });
178
176
  await execute();
179
177
  $b10cksClient.setRv(space.value?.rv || 426713400);
180
- console.log("Space fetched:", space.value);
181
178
  });
182
179
  return {
183
180
  useContent,
@@ -1,13 +1,29 @@
1
1
  import { useState } from "#app";
2
2
  import { ApiClient } from "@b10cks/client";
3
- import { B10cksVue, previewBridge } from "@b10cks/vue";
3
+ import { B10cksComponentResolverKey, B10cksVue, previewBridge } from "@b10cks/vue";
4
4
  import { defineNuxtPlugin, useRequestURL, useRuntimeConfig } from "nuxt/app";
5
+ import { resolveComponent } from "vue";
5
6
  let rv = 0;
6
7
  export default defineNuxtPlugin({
7
8
  name: "b10cks",
8
9
  setup(nuxtApp) {
9
10
  const config = useRuntimeConfig();
10
11
  const url = useRequestURL();
12
+ nuxtApp.vueApp.provide(B10cksComponentResolverKey, (componentName) => {
13
+ const pascalCaseBlockType = componentName.replace(/^([a-z])/, (match) => match.toUpperCase()).replace(/([a-z])([A-Z])/g, "$1$2");
14
+ return new Promise((resolve, reject) => {
15
+ try {
16
+ const component = resolveComponent(pascalCaseBlockType, false);
17
+ if (typeof component === "string") {
18
+ reject(new Error(`Component "${pascalCaseBlockType}" not found`));
19
+ } else {
20
+ resolve(component);
21
+ }
22
+ } catch (error) {
23
+ reject(error);
24
+ }
25
+ });
26
+ });
11
27
  nuxtApp.vueApp.use(B10cksVue);
12
28
  if (previewBridge.isInPreviewMode()) {
13
29
  if (import.meta.client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b10cks/nuxt",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "description": "b10cks Nuxt module",
5
5
  "license": "MIT",
6
6
  "author": "Michael Wallner @ Coder's Cantina",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@b10cks/client": "^0.10.2",
28
- "@b10cks/vue": "^0.10.3"
28
+ "@b10cks/vue": "^0.10.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@nuxt/kit": "^4.2.1",