nuxt-schema-org 1.0.2 → 1.0.3-beta.3

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { NuxtModule } from '@nuxt/schema';
2
1
  import { UserConfig } from '@vueuse/schema-org';
2
+ import { NuxtModule } from '@nuxt/schema';
3
3
  import { MetaInput } from 'schema-org-graph-js';
4
4
 
5
5
  interface ModuleOptions extends UserConfig {
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "name": "nuxt-schema-org",
8
- "version": "1.0.2"
8
+ "version": "1.0.3-beta.3"
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { defineNuxtModule, createResolver, addPlugin, addTemplate, addComponent, extendWebpackConfig } from '@nuxt/kit';
2
- import { resolveUserConfig, AliasProvider, AliasRuntime, schemaOrgComponents, schemaOrgAutoImports } from '@vueuse/schema-org';
1
+ import { defineNuxtModule, createResolver, addPlugin, addTemplate, addComponent, importModule, extendWebpackConfig } from '@nuxt/kit';
2
+ import { resolveUserConfig, AliasRuntime, schemaOrgComponents, schemaOrgAutoImports } from '@vueuse/schema-org';
3
3
  import { dirname } from 'pathe';
4
- import { AliasRuntimePluginVite, AliasRuntimePluginWebpack } from '@vueuse/schema-org-vite';
5
4
 
6
5
  const Pkg = "@vueuse/schema-org";
7
6
  const module = defineNuxtModule({
@@ -19,17 +18,12 @@ const module = defineNuxtModule({
19
18
  console.warn("WARN [nuxt-schema-org] Please provide a `canonicalHost` to use this module with SSR enabled.");
20
19
  return;
21
20
  }
22
- const schemaOrgPath = dirname(await resolvePath(Pkg));
23
21
  if (!nuxt.options.ssr)
24
22
  moduleOptions.client = true;
25
23
  if (typeof moduleOptions.client === "undefined")
26
24
  moduleOptions.client = !!nuxt.options.dev;
27
- const providerPath = await resolvePath(`${schemaOrgPath}/providers/${moduleOptions.full ? "full" : "simple"}`);
28
- const runtimePath = await resolvePath(`${schemaOrgPath}/runtime`);
29
- const runtimeMockPath = await resolvePath(`${schemaOrgPath}/runtime-mock`);
30
- nuxt.options.alias[AliasProvider] = providerPath;
31
- nuxt.options.alias[AliasRuntime] = runtimePath;
32
- nuxt.options.alias[Pkg] = schemaOrgPath;
25
+ const pkgPath = dirname(await resolvePath(Pkg));
26
+ nuxt.options.alias[AliasRuntime] = `${pkgPath}/runtime-${moduleOptions.full ? "schema-dts" : "simple"}`;
33
27
  const moduleRuntimeDir = resolve("./runtime");
34
28
  nuxt.options.build.transpile.push(...[moduleRuntimeDir, AliasRuntime]);
35
29
  if (!moduleOptions.client)
@@ -50,49 +44,29 @@ const module = defineNuxtModule({
50
44
  filePath: AliasRuntime
51
45
  });
52
46
  }
53
- await addComponent({
54
- name: "SchemaOrgDebug",
55
- export: "SchemaOrgDebug",
56
- filePath: `${schemaOrgPath}/runtime/components/SchemaOrgDebug`
57
- });
58
47
  nuxt.hooks.hook("autoImports:sources", (autoImports) => {
59
48
  autoImports.unshift(...schemaOrgAutoImports);
60
49
  });
61
- const realPaths = {
62
- runtime: runtimePath,
63
- provider: providerPath,
64
- pkg: schemaOrgPath
65
- };
66
- const mockPaths = {
67
- runtime: runtimeMockPath,
68
- provider: runtimeMockPath,
69
- pkg: schemaOrgPath
70
- };
71
- nuxt.hooks.hook("vite:extendConfig", (config, { isClient }) => {
72
- config.plugins = config.plugins || [];
73
- config.plugins.push(AliasRuntimePluginVite({
74
- paths: !moduleOptions.client && isClient ? mockPaths : realPaths
75
- }));
76
- });
77
- extendWebpackConfig((config) => {
50
+ nuxt.hooks.hook("vite:extendConfig", async (config, { isClient }) => {
78
51
  config.plugins = config.plugins || [];
79
- config.plugins.push(AliasRuntimePluginWebpack({
80
- paths: realPaths
52
+ const SchemaOrgVite = await importModule(`${pkgPath}/vite`, { interopDefault: true });
53
+ config.plugins.push(SchemaOrgVite({
54
+ root: nuxt.options.rootDir,
55
+ dts: false,
56
+ mock: !moduleOptions.client && isClient,
57
+ full: moduleOptions.full
81
58
  }));
82
- }, {
83
- client: false,
84
- modern: false,
85
- server: true
86
59
  });
87
- extendWebpackConfig((config) => {
60
+ extendWebpackConfig(async (config) => {
88
61
  config.plugins = config.plugins || [];
89
- config.plugins.push(AliasRuntimePluginWebpack({
90
- paths: !moduleOptions.client ? mockPaths : realPaths
91
- }));
92
- }, {
93
- client: true,
94
- modern: true,
95
- server: false
62
+ const SchemaOrgWebpack = await importModule(`${pkgPath}/webpack`, { interopDefault: true });
63
+ const plugins = SchemaOrgWebpack({
64
+ root: nuxt.options.rootDir,
65
+ dts: false,
66
+ mock: !moduleOptions.client && config.name === "client",
67
+ full: moduleOptions.full
68
+ });
69
+ config.plugins.push(...plugins);
96
70
  });
97
71
  }
98
72
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-schema-org",
3
3
  "type": "module",
4
- "version": "1.0.2",
4
+ "version": "1.0.3-beta.3",
5
5
  "description": "Nuxt module for @vueuse/schema-org",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -35,10 +35,10 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@nuxt/kit": "^3.0.0-rc.8",
38
- "@vueuse/schema-org": "1.0.2",
39
- "@vueuse/schema-org-vite": "1.0.2",
38
+ "@vueuse/schema-org": "1.0.3-beta.3",
39
+ "@vueuse/schema-org-vite": "1.0.3-beta.3",
40
40
  "pathe": "^0.3.5",
41
- "schema-org-graph-js": "0.5.0"
41
+ "schema-org-graph-js": "0.5.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@nuxt/module-builder": "latest",