nuxt-schema-org 1.0.0-beta.2 → 1.0.0-beta.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
@@ -4,5 +4,5 @@
4
4
  "bridge": false
5
5
  },
6
6
  "name": "nuxt-schema-org",
7
- "version": "1.0.0-beta.2"
7
+ "version": "1.0.0-beta.5"
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtModule, createResolver, addPlugin, addTemplate, addComponent } from '@nuxt/kit';
2
- import { RootSchemas, schemaOrgComponents } from '@vueuse/schema-org';
2
+ import { schemaOrgComponents, RootSchemas } from '@vueuse/schema-org';
3
3
  import { dirname } from 'pathe';
4
4
  import { SchemaOrg } from '@vueuse/schema-org-vite';
5
5
 
@@ -15,50 +15,58 @@ const module = defineNuxtModule({
15
15
  async setup(moduleOptions, nuxt) {
16
16
  const { resolve, resolvePath } = createResolver(import.meta.url);
17
17
  const schemaOrgPath = dirname(await resolvePath(Pkg));
18
- const moduleRuntime = resolve("./runtime");
19
- nuxt.options.build.transpile.push(...[moduleRuntime, RuntimeDir]);
18
+ const moduleRuntimeDir = resolve("./runtime");
19
+ nuxt.options.build.transpile.push(...[moduleRuntimeDir, RuntimeDir]);
20
20
  if (typeof moduleOptions.client === "undefined")
21
21
  moduleOptions.client = !!nuxt.options.dev;
22
22
  if (!moduleOptions.client)
23
- addPlugin(resolve(moduleRuntime, "plugin-fallback.client"));
23
+ addPlugin(resolve(moduleRuntimeDir, "plugin-fallback.client"));
24
24
  addPlugin({
25
- src: resolve(moduleRuntime, "plugin"),
25
+ src: resolve(moduleRuntimeDir, "plugin"),
26
26
  mode: moduleOptions.client ? "all" : "server"
27
27
  });
28
- nuxt.options.alias[Pkg] = schemaOrgPath;
29
- nuxt.options.alias["#vueuse/schema-org/provider"] = await resolvePath(`${schemaOrgPath}/providers/full`);
30
- nuxt.options.alias["#vueuse/schema-org/runtime"] = await resolvePath(`${schemaOrgPath}/runtime`);
31
- nuxt.hook("vite:extendConfig", (config, { isClient }) => {
32
- config.optimizeDeps = config.optimizeDeps || {};
33
- config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
34
- config.optimizeDeps.exclude.push(...[`${schemaOrgPath}/runtime`, Pkg]);
35
- config.plugins = config.plugins || [];
36
- config.plugins.push(SchemaOrg({
37
- mock: !moduleOptions.client && isClient,
38
- full: moduleOptions.full
39
- }));
40
- });
28
+ const nuxtSchemaComposablesRuntime = `${moduleRuntimeDir}/composables`;
41
29
  addTemplate({
42
30
  filename: "nuxt-schema-org-config.mjs",
43
31
  getContents: () => `export default ${JSON.stringify(moduleOptions)}`
44
32
  });
33
+ const componentPath = await resolvePath(`${schemaOrgPath}/runtime/components`);
34
+ for (const component of schemaOrgComponents) {
35
+ await addComponent({
36
+ name: component,
37
+ export: component,
38
+ chunkName: "schema-org-components",
39
+ filePath: componentPath
40
+ });
41
+ }
45
42
  nuxt.hooks.hook("autoImports:sources", (autoImports) => {
46
43
  autoImports.unshift({
47
- from: `${moduleRuntime}/schema-org-runtime`,
44
+ from: nuxtSchemaComposablesRuntime,
48
45
  imports: [
49
46
  "injectSchemaOrg",
50
- "useSchemaOrg",
47
+ "useSchemaOrg"
48
+ ]
49
+ });
50
+ autoImports.unshift({
51
+ from: "#vueuse/schema-org/provider",
52
+ imports: [
51
53
  ...RootSchemas.map((schema) => [`define${schema}`]).flat()
52
54
  ]
53
55
  });
54
56
  });
55
- schemaOrgComponents.forEach((component) => {
56
- addComponent({
57
- name: component,
58
- export: component,
59
- chunkName: "schema-org-components",
60
- filePath: "#vueuse/schema-org/runtime"
61
- });
57
+ nuxt.hooks.hook("vite:extendConfig", (config, { isClient }) => {
58
+ config.optimizeDeps = config.optimizeDeps || {};
59
+ config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
60
+ config.optimizeDeps.exclude.push(...[`${schemaOrgPath}/runtime`, Pkg]);
61
+ config.plugins = config.plugins || [];
62
+ config.plugins.push(SchemaOrg({
63
+ mock: !moduleOptions.client && isClient,
64
+ full: moduleOptions.full,
65
+ aliasPaths: {
66
+ pkgDir: schemaOrgPath,
67
+ runtime: nuxtSchemaComposablesRuntime
68
+ }
69
+ }));
62
70
  });
63
71
  }
64
72
  });
@@ -0,0 +1,2 @@
1
+ export { useSchemaOrg } from '@vueuse/schema-org/runtime';
2
+ export declare function injectSchemaOrg(): any;
@@ -1,6 +1,5 @@
1
1
  import { useNuxtApp } from "#app";
2
- export * from "#vueuse/schema-org/provider";
3
- export { useSchemaOrg } from "#vueuse/schema-org/runtime";
2
+ export { useSchemaOrg } from "@vueuse/schema-org/runtime";
4
3
  export function injectSchemaOrg() {
5
4
  const nuxtApp = useNuxtApp();
6
5
  if (nuxtApp._injectSchemaOrg)
@@ -31,5 +31,6 @@ export default defineNuxtPlugin((nuxtApp) => {
31
31
  }
32
32
  watch(() => nuxtApp._route.path, () => {
33
33
  client.generateSchema();
34
+ client.setupDOM();
34
35
  });
35
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-schema-org",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Nuxt module for @vueuse/schema-org",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@nuxt/kit": "3.0.0-rc.8",
39
- "@vueuse/schema-org": "1.0.0-beta.2",
40
- "@vueuse/schema-org-vite": "1.0.0-beta.2",
39
+ "@vueuse/schema-org": "1.0.0-beta.5",
40
+ "@vueuse/schema-org-vite": "1.0.0-beta.5",
41
41
  "pathe": "^0.3.4",
42
42
  "schema-org-graph-js": "0.3.3"
43
43
  },
@@ -1,3 +0,0 @@
1
- export * from '#vueuse/schema-org/provider';
2
- export { useSchemaOrg } from '#vueuse/schema-org/runtime';
3
- export declare function injectSchemaOrg(): any;