nuxt-schema-org 0.2.0 → 0.4.1
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.cjs +5 -0
- package/dist/module.d.ts +20 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +42 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.mjs +17 -0
- package/dist/types.d.ts +11 -0
- package/package.json +5 -6
package/dist/module.cjs
ADDED
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { SchemaOrgOptions } from '@vueuse/schema-org';
|
|
3
|
+
|
|
4
|
+
interface ModuleOptions extends SchemaOrgOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether composables will be automatically imported for you.
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
autoImportComposables: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether components will be automatically imported for you.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
autoImportComponents: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ModuleHooks {
|
|
17
|
+
}
|
|
18
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
19
|
+
|
|
20
|
+
export { ModuleHooks, ModuleOptions, _default as default };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addPlugin, addTemplate, addComponent } from '@nuxt/kit';
|
|
2
|
+
import { schemaOrgAutoImports, schemaOrgComponents } from '@vueuse/schema-org';
|
|
3
|
+
|
|
4
|
+
const module = defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
configKey: "schemaOrg",
|
|
7
|
+
compatibility: {
|
|
8
|
+
bridge: true
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaults: {
|
|
12
|
+
autoImportComposables: true,
|
|
13
|
+
autoImportComponents: true
|
|
14
|
+
},
|
|
15
|
+
async setup(config, nuxt) {
|
|
16
|
+
const { resolve } = createResolver(import.meta.url);
|
|
17
|
+
addPlugin(resolve("./runtime/plugin"));
|
|
18
|
+
addTemplate({
|
|
19
|
+
filename: "schemaOrg.config.mjs",
|
|
20
|
+
getContents: () => `export default ${JSON.stringify({ config })}`
|
|
21
|
+
});
|
|
22
|
+
if (config.autoImportComposables) {
|
|
23
|
+
nuxt.hooks.hookOnce("autoImports:sources", (autoImports) => {
|
|
24
|
+
autoImports.unshift({
|
|
25
|
+
from: "@vueuse/schema-org",
|
|
26
|
+
imports: schemaOrgAutoImports["@vueuse/schema-org"]
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (config.autoImportComponents) {
|
|
31
|
+
schemaOrgComponents.forEach((component) => {
|
|
32
|
+
addComponent({
|
|
33
|
+
name: component,
|
|
34
|
+
export: component,
|
|
35
|
+
filePath: "@vueuse/schema-org"
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { module as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createSchemaOrg } from "@vueuse/schema-org";
|
|
2
|
+
import { defineNuxtPlugin } from "#app";
|
|
3
|
+
import { useRoute, watchEffect } from "#imports";
|
|
4
|
+
import meta from "#build/schemaOrg.config.mjs";
|
|
5
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
6
|
+
const head = nuxtApp.vueApp._context.provides.usehead;
|
|
7
|
+
const schemaOrg = createSchemaOrg({
|
|
8
|
+
useRoute,
|
|
9
|
+
head,
|
|
10
|
+
...meta.config
|
|
11
|
+
});
|
|
12
|
+
nuxtApp.vueApp.use(schemaOrg);
|
|
13
|
+
schemaOrg.setupDOM();
|
|
14
|
+
watchEffect(() => {
|
|
15
|
+
schemaOrg.generateSchema();
|
|
16
|
+
});
|
|
17
|
+
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { ModuleOptions, ModuleHooks } from './module'
|
|
3
|
+
|
|
4
|
+
declare module '@nuxt/schema' {
|
|
5
|
+
interface NuxtConfig { ['schemaOrg']?: Partial<ModuleOptions> }
|
|
6
|
+
interface NuxtOptions { ['schemaOrg']?: ModuleOptions }
|
|
7
|
+
interface NuxtHooks extends ModuleHooks {}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export { default } from './module'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-schema-org",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Nuxt module for @vueuse/schema-org",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"schema-org",
|
|
@@ -35,18 +35,17 @@
|
|
|
35
35
|
"url": "https://github.com/vueuse/schema-org/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nuxt/kit": "
|
|
39
|
-
"@vueuse/schema-org": "0.
|
|
38
|
+
"@nuxt/kit": "3.0.0-rc.2",
|
|
39
|
+
"@vueuse/schema-org": "0.4.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@nuxt/module-builder": "latest",
|
|
43
|
-
"nuxt": "^3.0.0-rc.
|
|
43
|
+
"nuxt": "^3.0.0-rc.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "nuxi prepare ../../playgrounds/nuxt3 && nuxt-module-build",
|
|
47
47
|
"play": "nuxi dev ../../playgrounds/nuxt3",
|
|
48
48
|
"play:build": "nuxi build ../../playgrounds/nuxt3",
|
|
49
49
|
"stub": "nuxt-module-build --stub && nuxi prepare ../../playgrounds/nuxt3"
|
|
50
|
-
}
|
|
51
|
-
"readme": "# nuxt-schema-org\n\nThe Nuxt.js integration for [@vueuse/schema-org](https://github.com/vueuse/schema-org).\n\n## Install\n\n```bash\n# NPM\nnpm install -D nuxt-schema-org\n# or Yarn\nyarn add -D nuxt-schema-org\n# or PNPM\npnpm add -D nuxt-schema-org\n```\n\n## Setup Module\n\nFind documentation in the [Nuxt Setup](https://vue-schema-org.netlify.app/guide/setup/nuxt.html) guide\n\n## License\n\nMIT License © 2022-PRESENT [Harlan Wilton](https://github.com/harlan-zw)\n"
|
|
50
|
+
}
|
|
52
51
|
}
|