nuxtseo-shared 0.1.0 → 0.1.2

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.
Files changed (40) hide show
  1. package/dist/content.d.mts +39 -39
  2. package/dist/content.mjs +56 -29
  3. package/dist/devtools.d.mts +10 -10
  4. package/dist/devtools.mjs +37 -43
  5. package/dist/i18n.d.mts +31 -15
  6. package/dist/i18n.mjs +109 -108
  7. package/dist/index.d.mts +3 -7
  8. package/dist/index.mjs +3 -7
  9. package/dist/kit.d.mts +22 -12
  10. package/dist/kit.mjs +79 -73
  11. package/dist/pro.d.mts +7 -7
  12. package/dist/pro.mjs +64 -64
  13. package/dist/runtime/app/composables/rpc.d.mts +16 -0
  14. package/dist/runtime/app/composables/rpc.mjs +28 -0
  15. package/dist/runtime/app/composables/shiki.d.mts +8 -0
  16. package/dist/runtime/app/composables/shiki.mjs +31 -0
  17. package/dist/runtime/app/index.d.mts +2 -0
  18. package/dist/runtime/app/index.mjs +2 -0
  19. package/package.json +29 -44
  20. package/dist/client/composables/rpc.d.mts +0 -21
  21. package/dist/client/composables/rpc.d.ts +0 -21
  22. package/dist/client/composables/rpc.mjs +0 -25
  23. package/dist/client/composables/shiki.d.mts +0 -13
  24. package/dist/client/composables/shiki.d.ts +0 -13
  25. package/dist/client/composables/shiki.mjs +0 -39
  26. package/dist/client/index.d.mts +0 -7
  27. package/dist/client/index.d.ts +0 -7
  28. package/dist/client/index.mjs +0 -6
  29. package/dist/content.d.ts +0 -82
  30. package/dist/devtools.d.ts +0 -14
  31. package/dist/i18n.d.ts +0 -28
  32. package/dist/index.d.ts +0 -7
  33. package/dist/kit.d.ts +0 -32
  34. package/dist/pro.d.ts +0 -18
  35. package/dist/runtime/server/kit.d.mts +0 -7
  36. package/dist/runtime/server/kit.d.ts +0 -7
  37. package/dist/runtime/server/kit.mjs +0 -27
  38. /package/{src/client → dist/runtime/app}/components/NuxtSeoLogo.vue +0 -0
  39. /package/{src/client → dist/runtime/app}/components/OCodeBlock.vue +0 -0
  40. /package/{src/client → dist/runtime/app}/components/OSectionBlock.vue +0 -0
@@ -1,21 +0,0 @@
1
- import * as vue from 'vue';
2
- import * as nitropack from 'nitropack';
3
- import { NuxtDevtoolsClient } from '@nuxt/devtools-kit/types';
4
- import { $Fetch } from 'nitropack/types';
5
-
6
- declare const appFetch: vue.Ref<$Fetch<unknown, nitropack.NitroFetchRequest> | undefined, $Fetch<unknown, nitropack.NitroFetchRequest> | undefined>;
7
- declare const devtools: vue.Ref<NuxtDevtoolsClient | undefined, NuxtDevtoolsClient | undefined>;
8
- declare const colorMode: vue.Ref<"dark" | "light", "dark" | "light">;
9
- interface DevtoolsConnectionOptions {
10
- onConnected?: (client: any) => void;
11
- onRouteChange?: (route: any) => void;
12
- }
13
- /**
14
- * Initialize the base devtools connection.
15
- * Call this in your module's devtools client setup.
16
- * Returns a cleanup function.
17
- */
18
- declare function useDevtoolsConnection(options?: DevtoolsConnectionOptions): void;
19
-
20
- export { appFetch, colorMode, devtools, useDevtoolsConnection };
21
- export type { DevtoolsConnectionOptions };
@@ -1,25 +0,0 @@
1
- import { onDevtoolsClientConnected } from '@nuxt/devtools-kit/iframe-client';
2
- import { ref, watchEffect } from 'vue';
3
-
4
- const appFetch = ref();
5
- const devtools = ref();
6
- const colorMode = ref("dark");
7
- function useDevtoolsConnection(options = {}) {
8
- onDevtoolsClientConnected(async (client) => {
9
- appFetch.value = client.host.app.$fetch;
10
- watchEffect(() => {
11
- colorMode.value = client.host.app.colorMode.value;
12
- });
13
- devtools.value = client.devtools;
14
- options.onConnected?.(client);
15
- if (options.onRouteChange) {
16
- const $route = client.host.nuxt.vueApp.config.globalProperties?.$route;
17
- options.onRouteChange($route);
18
- client.host.nuxt.$router.afterEach((route) => {
19
- options.onRouteChange(route);
20
- });
21
- }
22
- });
23
- }
24
-
25
- export { appFetch, colorMode, devtools, useDevtoolsConnection };
@@ -1,13 +0,0 @@
1
- import * as vue from 'vue';
2
- import { MaybeRef, ComputedRef } from 'vue';
3
- import { LanguageRegistration, HighlighterCore } from 'shiki';
4
-
5
- declare const shiki: vue.Ref<HighlighterCore | undefined, HighlighterCore | undefined>;
6
- interface LoadShikiOptions {
7
- extraLangs?: (LanguageRegistration | Promise<LanguageRegistration>)[];
8
- }
9
- declare function loadShiki(options?: LoadShikiOptions): Promise<HighlighterCore>;
10
- declare function useRenderCodeHighlight(code: MaybeRef<string>, lang: string): ComputedRef<string>;
11
-
12
- export { loadShiki, shiki, useRenderCodeHighlight };
13
- export type { LoadShikiOptions };
@@ -1,13 +0,0 @@
1
- import * as vue from 'vue';
2
- import { MaybeRef, ComputedRef } from 'vue';
3
- import { LanguageRegistration, HighlighterCore } from 'shiki';
4
-
5
- declare const shiki: vue.Ref<HighlighterCore | undefined, HighlighterCore | undefined>;
6
- interface LoadShikiOptions {
7
- extraLangs?: (LanguageRegistration | Promise<LanguageRegistration>)[];
8
- }
9
- declare function loadShiki(options?: LoadShikiOptions): Promise<HighlighterCore>;
10
- declare function useRenderCodeHighlight(code: MaybeRef<string>, lang: string): ComputedRef<string>;
11
-
12
- export { loadShiki, shiki, useRenderCodeHighlight };
13
- export type { LoadShikiOptions };
@@ -1,39 +0,0 @@
1
- import { createHighlighterCore } from 'shiki/core';
2
- import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
3
- import { ref, computed, toValue } from 'vue';
4
- import { colorMode } from './rpc.mjs';
5
- import '@nuxt/devtools-kit/iframe-client';
6
-
7
- const shiki = ref();
8
- async function loadShiki(options = {}) {
9
- const langs = [
10
- import('@shikijs/langs/xml'),
11
- import('@shikijs/langs/json'),
12
- import('@shikijs/langs/js')
13
- ];
14
- if (options.extraLangs) {
15
- langs.push(...options.extraLangs);
16
- }
17
- shiki.value = await createHighlighterCore({
18
- themes: [
19
- import('@shikijs/themes/vitesse-light'),
20
- import('@shikijs/themes/vitesse-dark')
21
- ],
22
- langs,
23
- engine: createJavaScriptRegexEngine()
24
- });
25
- return shiki.value;
26
- }
27
- function useRenderCodeHighlight(code, lang) {
28
- return computed(() => {
29
- if (!shiki.value)
30
- return "";
31
- const theme = colorMode.value === "dark" ? "vitesse-dark" : "vitesse-light";
32
- return shiki.value.codeToHtml(toValue(code) || "", {
33
- lang,
34
- theme
35
- }) || "";
36
- });
37
- }
38
-
39
- export { loadShiki, shiki, useRenderCodeHighlight };
@@ -1,7 +0,0 @@
1
- export { appFetch, colorMode, devtools } from './composables/rpc.mjs';
2
- export { loadShiki, shiki, useRenderCodeHighlight } from './composables/shiki.mjs';
3
- import 'vue';
4
- import 'nitropack';
5
- import '@nuxt/devtools-kit/types';
6
- import 'nitropack/types';
7
- import 'shiki';
@@ -1,7 +0,0 @@
1
- export { appFetch, colorMode, devtools } from './composables/rpc.js';
2
- export { loadShiki, shiki, useRenderCodeHighlight } from './composables/shiki.js';
3
- import 'vue';
4
- import 'nitropack';
5
- import '@nuxt/devtools-kit/types';
6
- import 'nitropack/types';
7
- import 'shiki';
@@ -1,6 +0,0 @@
1
- export { appFetch, colorMode, devtools } from './composables/rpc.mjs';
2
- export { loadShiki, shiki, useRenderCodeHighlight } from './composables/shiki.mjs';
3
- import '@nuxt/devtools-kit/iframe-client';
4
- import 'vue';
5
- import 'shiki/core';
6
- import 'shiki/engine/javascript';
package/dist/content.d.ts DELETED
@@ -1,82 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- type ZodInstance = typeof z;
4
- type ZodTypeAny = z.ZodTypeAny;
5
- interface ContentSchemaOptions {
6
- /**
7
- * Pass the `z` instance from `@nuxt/content` to ensure `.editor()` works
8
- * across Zod versions. When omitted, the module's bundled `z` is used.
9
- */
10
- z?: ZodInstance;
11
- }
12
- interface ContentEditorConfig {
13
- hidden?: boolean;
14
- input?: 'media' | 'icon' | 'textarea';
15
- iconLibraries?: string[];
16
- }
17
- /**
18
- * Apply Nuxt Content `.editor()` metadata to a zod schema field.
19
- * No-ops gracefully when `.editor()` is not patched onto ZodType (outside Nuxt Content).
20
- */
21
- declare function withEditor<T extends ZodTypeAny>(schema: T, config: ContentEditorConfig): T;
22
- /**
23
- * Hide a zod schema field from the Nuxt Content / Studio editor.
24
- * Only use for fields that genuinely don't work in a form (freeform JSON, deeply nested arrays).
25
- */
26
- declare function withEditorHidden<T extends ZodTypeAny>(schema: T): T;
27
- interface DefineContentSchemaConfig<TSchema extends ZodTypeAny> {
28
- /**
29
- * The field name used in frontmatter (e.g. 'robots', 'sitemap', 'ogImage').
30
- */
31
- fieldName: string;
32
- /**
33
- * Build the zod schema for this field. Receives the zod instance
34
- * (either the user's `@nuxt/content` patched version or the module's bundled one).
35
- */
36
- buildSchema: (z: ZodInstance) => TSchema;
37
- /**
38
- * Module label for deprecation warnings (e.g. 'robots', 'sitemap').
39
- */
40
- label: string;
41
- /**
42
- * Documentation URL for migration guidance.
43
- */
44
- docsUrl?: string;
45
- }
46
- /**
47
- * Factory for creating a module's `define*Schema()` and deprecated `as*Collection()` exports.
48
- *
49
- * Each module provides its own schema builder. The factory handles:
50
- * - Zod instance passthrough for `@nuxt/content` version compatibility
51
- * - Consistent `DefineSchemaOptions` interface
52
- * - Deprecated `asXxxCollection()` wrapper with migration warning
53
- *
54
- * @example
55
- * // In @nuxtjs/robots/content.ts
56
- * import { z } from 'zod'
57
- * import { createContentSchemaFactory } from 'nuxtseo-shared/content'
58
- *
59
- * const { defineSchema, asCollection, schema } = createContentSchemaFactory({
60
- * fieldName: 'robots',
61
- * label: 'robots',
62
- * docsUrl: 'https://nuxtseo.com/robots/guides/content',
63
- * buildSchema: (z) => z.enum(['index, follow', 'noindex', 'nofollow', 'noindex, nofollow', 'none']).optional(),
64
- * }, z)
65
- *
66
- * export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
67
- */
68
- declare function createContentSchemaFactory<TSchema extends ZodTypeAny>(config: DefineContentSchemaConfig<TSchema>, defaultZ: ZodInstance): {
69
- defineSchema: (options?: ContentSchemaOptions) => TSchema;
70
- asCollection: <T>(collection: any) => T;
71
- schema: z.ZodObject<{
72
- [x: string]: TSchema;
73
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
74
- [x: string]: TSchema;
75
- }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
76
- [x: string]: TSchema;
77
- }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
78
- fieldSchema: TSchema;
79
- };
80
-
81
- export { createContentSchemaFactory, withEditor, withEditorHidden };
82
- export type { ContentEditorConfig, ContentSchemaOptions, DefineContentSchemaConfig };
@@ -1,14 +0,0 @@
1
- import { Resolver } from '@nuxt/kit';
2
- import { Nuxt } from 'nuxt/schema';
3
-
4
- interface DevToolsUIConfig {
5
- route: string;
6
- name: string;
7
- title: string;
8
- icon: string;
9
- devPort?: number;
10
- }
11
- declare function setupDevToolsUI(config: DevToolsUIConfig, resolve: Resolver['resolve'], nuxt?: Nuxt): void;
12
-
13
- export { setupDevToolsUI };
14
- export type { DevToolsUIConfig };
package/dist/i18n.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import { LocaleObject, NuxtI18nOptions } from '@nuxtjs/i18n';
2
-
3
- type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default';
4
- interface AutoI18nConfig {
5
- locales: LocaleObject[];
6
- defaultLocale: string;
7
- strategy: Strategies;
8
- differentDomains?: boolean;
9
- pages?: Record<string, Record<string, string | false>>;
10
- }
11
- interface StrategyProps {
12
- localeCode: string;
13
- pageLocales: string;
14
- nuxtI18nConfig: NuxtI18nOptions;
15
- forcedStrategy?: Strategies;
16
- normalisedLocales: AutoI18nConfig['locales'];
17
- }
18
- declare function generatePathForI18nPages(ctx: StrategyProps): string;
19
- declare function splitPathForI18nLocales(path: string, autoI18n: AutoI18nConfig): string | string[];
20
- declare function normalizeLocales(nuxtI18nConfig: NuxtI18nOptions): AutoI18nConfig['locales'];
21
- declare function mapPathForI18nPages(path: string, autoI18n: AutoI18nConfig): string[] | false;
22
- declare function resolveI18nConfig(logger?: {
23
- warn: (msg: string) => void;
24
- }): Promise<false | AutoI18nConfig>;
25
- declare function mergeOnKey<T extends Record<string, any>>(arr: T[], key: keyof T): T[];
26
-
27
- export { generatePathForI18nPages, mapPathForI18nPages, mergeOnKey, normalizeLocales, resolveI18nConfig, splitPathForI18nLocales };
28
- export type { AutoI18nConfig, Strategies, StrategyProps };
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export { setupDevToolsUI } from './devtools.js';
2
- export { createNitroPromise, createPagesPromise, detectTarget, extendTypes, getNuxtModuleOptions, isNuxtGenerate, resolveNitroPreset } from './kit.js';
3
- import '@nuxt/kit';
4
- import 'nuxt/schema';
5
- import '@nuxt/schema';
6
- import 'nitropack';
7
- import 'nitropack/types';
package/dist/kit.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import { Nuxt } from '@nuxt/schema';
2
- import { Nitro } from 'nitropack';
3
- import { NitroConfig } from 'nitropack/types';
4
- import { NuxtPage, NuxtModule } from 'nuxt/schema';
5
-
6
- declare function detectTarget(options?: {
7
- static?: boolean;
8
- }): string | undefined;
9
- declare function resolveNitroPreset(nitroConfig?: NitroConfig): string;
10
- /**
11
- * Get the user provided options for a Nuxt module.
12
- *
13
- * These options may not be the resolved options that the module actually uses.
14
- */
15
- declare function getNuxtModuleOptions(module: string | NuxtModule, nuxt?: Nuxt): Promise<Record<string, any>>;
16
- declare function isNuxtGenerate(nuxt?: Nuxt): boolean;
17
- /**
18
- * Generate TypeScript type augmentations for a Nuxt module.
19
- */
20
- declare function extendTypes(module: string, template: (options: {
21
- typesPath: string;
22
- }) => string | Promise<string>): void;
23
- /**
24
- * Create a promise that resolves when Nuxt pages are resolved.
25
- */
26
- declare function createPagesPromise(nuxt?: Nuxt): Promise<NuxtPage[]>;
27
- /**
28
- * Create a promise that resolves when Nitro is initialized.
29
- */
30
- declare function createNitroPromise(nuxt?: Nuxt): Promise<Nitro>;
31
-
32
- export { createNitroPromise, createPagesPromise, detectTarget, extendTypes, getNuxtModuleOptions, isNuxtGenerate, resolveNitroPreset };
package/dist/pro.d.ts DELETED
@@ -1,18 +0,0 @@
1
- interface ModuleRegistration {
2
- name: string;
3
- version?: string;
4
- secret?: string;
5
- features?: Record<string, boolean | string | number>;
6
- }
7
- /**
8
- * Register a Nuxt SEO Pro module for license verification.
9
- * Uses Nuxt hook so modules don't need to import from each other.
10
- *
11
- * Call this in your module setup. Registrations are collected
12
- * before the single license verification fetch.
13
- */
14
- declare function registerNuxtSeoProModule(registration: ModuleRegistration): void;
15
- declare function hookNuxtSeoProLicense(): void;
16
-
17
- export { hookNuxtSeoProLicense, registerNuxtSeoProModule };
18
- export type { ModuleRegistration };
@@ -1,7 +0,0 @@
1
- import { H3Event } from 'h3';
2
- import { NitroRouteConfig } from 'nitropack';
3
-
4
- declare function withoutQuery(path: string): string;
5
- declare function createNitroRouteRuleMatcher(e?: H3Event): (path: string) => NitroRouteConfig;
6
-
7
- export { createNitroRouteRuleMatcher, withoutQuery };
@@ -1,7 +0,0 @@
1
- import { H3Event } from 'h3';
2
- import { NitroRouteConfig } from 'nitropack';
3
-
4
- declare function withoutQuery(path: string): string;
5
- declare function createNitroRouteRuleMatcher(e?: H3Event): (path: string) => NitroRouteConfig;
6
-
7
- export { createNitroRouteRuleMatcher, withoutQuery };
@@ -1,27 +0,0 @@
1
- import { defu } from 'defu';
2
- import { useRuntimeConfig } from 'nitropack/runtime';
3
- import { toRouteMatcher, createRouter } from 'radix3';
4
- import { withoutTrailingSlash, parseURL, withoutBase } from 'ufo';
5
-
6
- function withoutQuery(path) {
7
- return path.split("?")[0];
8
- }
9
- function createNitroRouteRuleMatcher(e) {
10
- const { nitro, app } = useRuntimeConfig(e);
11
- const _routeRulesMatcher = toRouteMatcher(
12
- createRouter({
13
- routes: Object.fromEntries(
14
- Object.entries(nitro?.routeRules || {}).map(([path, rules]) => [path === "/" ? path : withoutTrailingSlash(path), rules])
15
- )
16
- })
17
- );
18
- return (pathOrUrl) => {
19
- const path = pathOrUrl[0] === "/" ? pathOrUrl : parseURL(pathOrUrl, app.baseURL).pathname;
20
- const pathWithoutQuery = withoutQuery(path);
21
- return defu({}, ..._routeRulesMatcher.matchAll(
22
- withoutBase(pathWithoutQuery === "/" ? pathWithoutQuery : withoutTrailingSlash(pathWithoutQuery), app.baseURL)
23
- ).reverse());
24
- };
25
- }
26
-
27
- export { createNitroRouteRuleMatcher, withoutQuery };