nuxtseo-shared 0.1.9 → 0.2.0
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/content.d.mts +37 -37
- package/dist/content.d.ts +75 -0
- package/dist/content.mjs +31 -55
- package/dist/devtools.d.mts +10 -10
- package/dist/devtools.d.ts +14 -0
- package/dist/devtools.mjs +43 -37
- package/dist/i18n.d.mts +19 -19
- package/dist/i18n.d.ts +44 -0
- package/dist/i18n.mjs +117 -105
- package/dist/kit.d.mts +29 -14
- package/dist/kit.d.ts +57 -0
- package/dist/kit.mjs +105 -77
- package/dist/module.d.mts +4 -13
- package/dist/module.d.ts +5 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +31 -32
- package/dist/pro.d.mts +2 -16
- package/dist/pro.d.ts +3 -0
- package/dist/pro.mjs +66 -68
- package/dist/runtime/pure.d.ts +0 -0
- package/dist/runtime/pure.js +36 -0
- package/dist/runtime/server/kit.d.ts +0 -0
- package/dist/runtime/server/kit.js +22 -0
- package/dist/telemetry.d.mts +4 -4
- package/dist/telemetry.d.ts +11 -0
- package/dist/telemetry.mjs +58 -45
- package/dist/types.d.mts +7 -0
- package/package.json +23 -21
- package/src/runtime/pure.ts +57 -0
- package/src/runtime/server/kit.ts +26 -0
- package/dist/index.d.mts +0 -3
- package/dist/index.mjs +0 -3
- package/dist/layer-devtools/app.config.ts +0 -27
- package/dist/layer-devtools/assets/css/global.css +0 -593
- package/dist/layer-devtools/components/DevtoolsAlert.vue +0 -101
- package/dist/layer-devtools/components/DevtoolsCopyButton.vue +0 -20
- package/dist/layer-devtools/components/DevtoolsDocs.vue +0 -11
- package/dist/layer-devtools/components/DevtoolsEmptyState.vue +0 -105
- package/dist/layer-devtools/components/DevtoolsError.vue +0 -78
- package/dist/layer-devtools/components/DevtoolsKeyValue.vue +0 -109
- package/dist/layer-devtools/components/DevtoolsLayout.vue +0 -219
- package/dist/layer-devtools/components/DevtoolsLoading.vue +0 -8
- package/dist/layer-devtools/components/DevtoolsMetric.vue +0 -96
- package/dist/layer-devtools/components/DevtoolsPanel.vue +0 -74
- package/dist/layer-devtools/components/DevtoolsProductionError.vue +0 -41
- package/dist/layer-devtools/components/DevtoolsSection.vue +0 -139
- package/dist/layer-devtools/components/DevtoolsSnippet.vue +0 -51
- package/dist/layer-devtools/components/DevtoolsToolbar.vue +0 -42
- package/dist/layer-devtools/components/NuxtSeoLogo.vue +0 -77
- package/dist/layer-devtools/components/OCodeBlock.vue +0 -23
- package/dist/layer-devtools/composables/clipboard.ts +0 -21
- package/dist/layer-devtools/composables/rpc.ts +0 -39
- package/dist/layer-devtools/composables/shiki.ts +0 -46
- package/dist/layer-devtools/composables/state.ts +0 -33
- package/dist/layer-devtools/nuxt.config.ts +0 -26
package/dist/content.d.mts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
//#region src/content.d.ts
|
|
2
1
|
interface ContentSchemaOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Pass the `z` instance from `@nuxt/content` to ensure `.editor()` works
|
|
4
|
+
* across Zod versions. When omitted, the module's bundled `z` is used.
|
|
5
|
+
*/
|
|
6
|
+
z?: any;
|
|
8
7
|
}
|
|
9
8
|
interface ContentEditorConfig {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
input?: 'media' | 'icon' | 'textarea';
|
|
11
|
+
iconLibraries?: string[];
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Apply Nuxt Content `.editor()` metadata to a zod schema field.
|
|
@@ -21,28 +20,28 @@ declare function withEditor<T>(schema: T, config: ContentEditorConfig): T;
|
|
|
21
20
|
*/
|
|
22
21
|
declare function withEditorHidden<T>(schema: T): T;
|
|
23
22
|
interface DefineContentSchemaConfig<TSchema = any, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The field name used in frontmatter (e.g. 'robots', 'sitemap', 'ogImage').
|
|
25
|
+
*/
|
|
26
|
+
fieldName: string;
|
|
27
|
+
/**
|
|
28
|
+
* Build the zod schema for this field. Receives the zod instance
|
|
29
|
+
* (either the user's `@nuxt/content` patched version or the module's bundled one).
|
|
30
|
+
*/
|
|
31
|
+
buildSchema: (z: any) => TSchema;
|
|
32
|
+
/**
|
|
33
|
+
* Module label for deprecation warnings (e.g. 'robots', 'sitemap').
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Documentation URL for migration guidance.
|
|
38
|
+
*/
|
|
39
|
+
docsUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Hook called when `defineSchema()` is invoked. Use for validation or
|
|
42
|
+
* registering module-specific side effects (e.g. sitemap filter/onUrl).
|
|
43
|
+
*/
|
|
44
|
+
onDefineSchema?: (options: TDefineOptions) => void;
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* Factory for creating a module's `define*Schema()` and deprecated `as*Collection()` exports.
|
|
@@ -66,10 +65,11 @@ interface DefineContentSchemaConfig<TSchema = any, TDefineOptions extends Conten
|
|
|
66
65
|
* export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
|
|
67
66
|
*/
|
|
68
67
|
declare function createContentSchemaFactory<TSchema, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions>(config: DefineContentSchemaConfig<TSchema, TDefineOptions>, defaultZ: any): {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
defineSchema: (options?: TDefineOptions) => TSchema;
|
|
69
|
+
asCollection: <T>(collection: any) => T;
|
|
70
|
+
schema: any;
|
|
71
|
+
fieldSchema: TSchema;
|
|
73
72
|
};
|
|
74
|
-
|
|
75
|
-
export {
|
|
73
|
+
|
|
74
|
+
export { createContentSchemaFactory, withEditor, withEditorHidden };
|
|
75
|
+
export type { ContentEditorConfig, ContentSchemaOptions, DefineContentSchemaConfig };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
interface ContentSchemaOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Pass the `z` instance from `@nuxt/content` to ensure `.editor()` works
|
|
4
|
+
* across Zod versions. When omitted, the module's bundled `z` is used.
|
|
5
|
+
*/
|
|
6
|
+
z?: any;
|
|
7
|
+
}
|
|
8
|
+
interface ContentEditorConfig {
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
input?: 'media' | 'icon' | 'textarea';
|
|
11
|
+
iconLibraries?: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Apply Nuxt Content `.editor()` metadata to a zod schema field.
|
|
15
|
+
* No-ops gracefully when `.editor()` is not patched onto ZodType (outside Nuxt Content).
|
|
16
|
+
*/
|
|
17
|
+
declare function withEditor<T>(schema: T, config: ContentEditorConfig): T;
|
|
18
|
+
/**
|
|
19
|
+
* Hide a zod schema field from the Nuxt Content / Studio editor.
|
|
20
|
+
*/
|
|
21
|
+
declare function withEditorHidden<T>(schema: T): T;
|
|
22
|
+
interface DefineContentSchemaConfig<TSchema = any, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions> {
|
|
23
|
+
/**
|
|
24
|
+
* The field name used in frontmatter (e.g. 'robots', 'sitemap', 'ogImage').
|
|
25
|
+
*/
|
|
26
|
+
fieldName: string;
|
|
27
|
+
/**
|
|
28
|
+
* Build the zod schema for this field. Receives the zod instance
|
|
29
|
+
* (either the user's `@nuxt/content` patched version or the module's bundled one).
|
|
30
|
+
*/
|
|
31
|
+
buildSchema: (z: any) => TSchema;
|
|
32
|
+
/**
|
|
33
|
+
* Module label for deprecation warnings (e.g. 'robots', 'sitemap').
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Documentation URL for migration guidance.
|
|
38
|
+
*/
|
|
39
|
+
docsUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Hook called when `defineSchema()` is invoked. Use for validation or
|
|
42
|
+
* registering module-specific side effects (e.g. sitemap filter/onUrl).
|
|
43
|
+
*/
|
|
44
|
+
onDefineSchema?: (options: TDefineOptions) => void;
|
|
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
|
+
* import { z } from 'zod'
|
|
56
|
+
* import { createContentSchemaFactory } from 'nuxtseo-shared/content'
|
|
57
|
+
*
|
|
58
|
+
* const { defineSchema, asCollection, schema } = createContentSchemaFactory({
|
|
59
|
+
* fieldName: 'robots',
|
|
60
|
+
* label: 'robots',
|
|
61
|
+
* docsUrl: 'https://nuxtseo.com/robots/guides/content',
|
|
62
|
+
* buildSchema: (z) => z.union([z.string(), z.boolean()]).optional(),
|
|
63
|
+
* }, z)
|
|
64
|
+
*
|
|
65
|
+
* export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
|
|
66
|
+
*/
|
|
67
|
+
declare function createContentSchemaFactory<TSchema, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions>(config: DefineContentSchemaConfig<TSchema, TDefineOptions>, defaultZ: any): {
|
|
68
|
+
defineSchema: (options?: TDefineOptions) => TSchema;
|
|
69
|
+
asCollection: <T>(collection: any) => T;
|
|
70
|
+
schema: any;
|
|
71
|
+
fieldSchema: TSchema;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { createContentSchemaFactory, withEditor, withEditorHidden };
|
|
75
|
+
export type { ContentEditorConfig, ContentSchemaOptions, DefineContentSchemaConfig };
|
package/dist/content.mjs
CHANGED
|
@@ -1,64 +1,40 @@
|
|
|
1
|
-
//#region src/content.ts
|
|
2
|
-
/**
|
|
3
|
-
* Apply Nuxt Content `.editor()` metadata to a zod schema field.
|
|
4
|
-
* No-ops gracefully when `.editor()` is not patched onto ZodType (outside Nuxt Content).
|
|
5
|
-
*/
|
|
6
1
|
function withEditor(schema, config) {
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
if (typeof schema.editor === "function")
|
|
3
|
+
return schema.editor(config);
|
|
4
|
+
return schema;
|
|
9
5
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Hide a zod schema field from the Nuxt Content / Studio editor.
|
|
12
|
-
*/
|
|
13
6
|
function withEditorHidden(schema) {
|
|
14
|
-
|
|
7
|
+
return withEditor(schema, { hidden: true });
|
|
15
8
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Factory for creating a module's `define*Schema()` and deprecated `as*Collection()` exports.
|
|
18
|
-
*
|
|
19
|
-
* Each module provides its own schema builder. The factory handles:
|
|
20
|
-
* - Zod instance passthrough for `@nuxt/content` version compatibility
|
|
21
|
-
* - Consistent `DefineSchemaOptions` interface
|
|
22
|
-
* - Deprecated `asXxxCollection()` wrapper with migration warning
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* import { z } from 'zod'
|
|
26
|
-
* import { createContentSchemaFactory } from 'nuxtseo-shared/content'
|
|
27
|
-
*
|
|
28
|
-
* const { defineSchema, asCollection, schema } = createContentSchemaFactory({
|
|
29
|
-
* fieldName: 'robots',
|
|
30
|
-
* label: 'robots',
|
|
31
|
-
* docsUrl: 'https://nuxtseo.com/robots/guides/content',
|
|
32
|
-
* buildSchema: (z) => z.union([z.string(), z.boolean()]).optional(),
|
|
33
|
-
* }, z)
|
|
34
|
-
*
|
|
35
|
-
* export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
|
|
36
|
-
*/
|
|
37
9
|
function createContentSchemaFactory(config, defaultZ) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
10
|
+
const { fieldName, buildSchema, label, docsUrl, onDefineSchema } = config;
|
|
11
|
+
const defaultSchema = buildSchema(defaultZ);
|
|
12
|
+
const schemaObject = defaultZ.object({ [fieldName]: defaultSchema });
|
|
13
|
+
function defineSchema(options) {
|
|
14
|
+
if (options && onDefineSchema)
|
|
15
|
+
onDefineSchema(options);
|
|
16
|
+
const _z = options?.z ?? defaultZ;
|
|
17
|
+
if (_z === defaultZ)
|
|
18
|
+
return defaultSchema;
|
|
19
|
+
return buildSchema(_z);
|
|
20
|
+
}
|
|
21
|
+
function asCollection(collection) {
|
|
22
|
+
const migrationHint = docsUrl ? ` See ${docsUrl}` : "";
|
|
23
|
+
console.warn(`[${label}] \`as${capitalize(label)}Collection()\` is deprecated. Use \`define${capitalize(label)}Schema()\` in your collection schema instead.${migrationHint}`);
|
|
24
|
+
if (collection.type === "page") {
|
|
25
|
+
collection.schema = collection.schema ? schemaObject.extend(collection.schema.shape) : schemaObject;
|
|
26
|
+
}
|
|
27
|
+
return collection;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
defineSchema,
|
|
31
|
+
asCollection,
|
|
32
|
+
schema: schemaObject,
|
|
33
|
+
fieldSchema: defaultSchema
|
|
34
|
+
};
|
|
59
35
|
}
|
|
60
36
|
function capitalize(s) {
|
|
61
|
-
|
|
37
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
62
38
|
}
|
|
63
|
-
|
|
39
|
+
|
|
64
40
|
export { createContentSchemaFactory, withEditor, withEditorHidden };
|
package/dist/devtools.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Resolver } from
|
|
2
|
-
import { Nuxt } from
|
|
1
|
+
import { Resolver } from '@nuxt/kit';
|
|
2
|
+
import { Nuxt } from 'nuxt/schema';
|
|
3
3
|
|
|
4
|
-
//#region src/devtools.d.ts
|
|
5
4
|
interface DevToolsUIConfig {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
route: string;
|
|
6
|
+
name: string;
|
|
7
|
+
title: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
devPort?: number;
|
|
11
10
|
}
|
|
12
11
|
declare function setupDevToolsUI(config: DevToolsUIConfig, resolve: Resolver['resolve'], nuxt?: Nuxt): void;
|
|
13
|
-
|
|
14
|
-
export {
|
|
12
|
+
|
|
13
|
+
export { setupDevToolsUI };
|
|
14
|
+
export type { DevToolsUIConfig };
|
|
@@ -0,0 +1,14 @@
|
|
|
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/devtools.mjs
CHANGED
|
@@ -1,40 +1,46 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { addCustomTab } from
|
|
3
|
-
import { useNuxt } from
|
|
4
|
-
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
3
|
+
import { useNuxt } from '@nuxt/kit';
|
|
4
|
+
import sirv from 'sirv';
|
|
5
|
+
|
|
5
6
|
function setupDevToolsUI(config, resolve, nuxt = useNuxt()) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
const { route, name, title, icon, devPort = 3030 } = config;
|
|
8
|
+
const clientPath = resolve("./client");
|
|
9
|
+
const isProductionBuild = existsSync(clientPath);
|
|
10
|
+
if (isProductionBuild) {
|
|
11
|
+
nuxt.hook("vite:serverCreated", (server) => {
|
|
12
|
+
server.middlewares.use(
|
|
13
|
+
route,
|
|
14
|
+
sirv(clientPath, { dev: true, single: true })
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
nuxt.hook("vite:extendConfig", (config2) => {
|
|
19
|
+
Object.assign(config2, {
|
|
20
|
+
server: {
|
|
21
|
+
...config2.server,
|
|
22
|
+
proxy: {
|
|
23
|
+
...config2.server?.proxy,
|
|
24
|
+
[route]: {
|
|
25
|
+
target: `http://localhost:${devPort}${route}`,
|
|
26
|
+
changeOrigin: true,
|
|
27
|
+
followRedirects: true,
|
|
28
|
+
rewrite: (p) => p.replace(route, "")
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
addCustomTab({
|
|
36
|
+
name,
|
|
37
|
+
title,
|
|
38
|
+
icon,
|
|
39
|
+
view: {
|
|
40
|
+
type: "iframe",
|
|
41
|
+
src: route
|
|
42
|
+
}
|
|
43
|
+
});
|
|
38
44
|
}
|
|
39
|
-
|
|
45
|
+
|
|
40
46
|
export { setupDevToolsUI };
|
package/dist/i18n.d.mts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { LocaleObject, NuxtI18nOptions } from
|
|
1
|
+
import { LocaleObject, NuxtI18nOptions } from '@nuxtjs/i18n';
|
|
2
2
|
|
|
3
|
-
//#region src/i18n.d.ts
|
|
4
3
|
declare const I18N_MODULES: readonly ["@nuxtjs/i18n", "nuxt-i18n-micro"];
|
|
5
4
|
type I18nModuleName = typeof I18N_MODULES[number];
|
|
6
5
|
type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default';
|
|
7
6
|
type NormalisedLocale = LocaleObject & {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
_sitemap: string;
|
|
8
|
+
_hreflang: string;
|
|
10
9
|
};
|
|
11
10
|
interface AutoI18nConfig {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
locales: NormalisedLocale[];
|
|
12
|
+
defaultLocale: string;
|
|
13
|
+
strategy: Strategies;
|
|
14
|
+
differentDomains?: boolean;
|
|
15
|
+
pages?: Record<string, Record<string, string | false>>;
|
|
17
16
|
}
|
|
18
17
|
interface StrategyProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
localeCode: string;
|
|
19
|
+
pageLocales: string;
|
|
20
|
+
nuxtI18nConfig: NuxtI18nOptions;
|
|
21
|
+
forcedStrategy?: Strategies;
|
|
22
|
+
normalisedLocales: AutoI18nConfig['locales'];
|
|
24
23
|
}
|
|
25
24
|
declare function generatePathForI18nPages(ctx: StrategyProps): string;
|
|
26
25
|
declare function splitPathForI18nLocales(path: string, autoI18n: AutoI18nConfig): string | string[];
|
|
27
26
|
declare function normalizeLocales(nuxtI18nConfig: NuxtI18nOptions): AutoI18nConfig['locales'];
|
|
28
27
|
declare function mapPathForI18nPages(path: string, autoI18n: AutoI18nConfig): string[] | false;
|
|
29
28
|
interface I18nModuleResolution {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
module: I18nModuleName;
|
|
30
|
+
isMicro: boolean;
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* Detect which i18n module is installed (@nuxtjs/i18n or nuxt-i18n-micro).
|
|
@@ -37,8 +36,9 @@ interface I18nModuleResolution {
|
|
|
37
36
|
*/
|
|
38
37
|
declare function resolveI18nModule(): false | I18nModuleResolution;
|
|
39
38
|
declare function resolveI18nConfig(logger?: {
|
|
40
|
-
|
|
39
|
+
warn: (msg: string) => void;
|
|
41
40
|
}): Promise<false | AutoI18nConfig>;
|
|
42
41
|
declare function mergeOnKey<T extends Record<string, any>>(arr: T[], key: keyof T): T[];
|
|
43
|
-
|
|
44
|
-
export {
|
|
42
|
+
|
|
43
|
+
export { generatePathForI18nPages, mapPathForI18nPages, mergeOnKey, normalizeLocales, resolveI18nConfig, resolveI18nModule, splitPathForI18nLocales };
|
|
44
|
+
export type { AutoI18nConfig, I18nModuleResolution, NormalisedLocale, Strategies, StrategyProps };
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LocaleObject, NuxtI18nOptions } from '@nuxtjs/i18n';
|
|
2
|
+
|
|
3
|
+
declare const I18N_MODULES: readonly ["@nuxtjs/i18n", "nuxt-i18n-micro"];
|
|
4
|
+
type I18nModuleName = typeof I18N_MODULES[number];
|
|
5
|
+
type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default';
|
|
6
|
+
type NormalisedLocale = LocaleObject & {
|
|
7
|
+
_sitemap: string;
|
|
8
|
+
_hreflang: string;
|
|
9
|
+
};
|
|
10
|
+
interface AutoI18nConfig {
|
|
11
|
+
locales: NormalisedLocale[];
|
|
12
|
+
defaultLocale: string;
|
|
13
|
+
strategy: Strategies;
|
|
14
|
+
differentDomains?: boolean;
|
|
15
|
+
pages?: Record<string, Record<string, string | false>>;
|
|
16
|
+
}
|
|
17
|
+
interface StrategyProps {
|
|
18
|
+
localeCode: string;
|
|
19
|
+
pageLocales: string;
|
|
20
|
+
nuxtI18nConfig: NuxtI18nOptions;
|
|
21
|
+
forcedStrategy?: Strategies;
|
|
22
|
+
normalisedLocales: AutoI18nConfig['locales'];
|
|
23
|
+
}
|
|
24
|
+
declare function generatePathForI18nPages(ctx: StrategyProps): string;
|
|
25
|
+
declare function splitPathForI18nLocales(path: string, autoI18n: AutoI18nConfig): string | string[];
|
|
26
|
+
declare function normalizeLocales(nuxtI18nConfig: NuxtI18nOptions): AutoI18nConfig['locales'];
|
|
27
|
+
declare function mapPathForI18nPages(path: string, autoI18n: AutoI18nConfig): string[] | false;
|
|
28
|
+
interface I18nModuleResolution {
|
|
29
|
+
module: I18nModuleName;
|
|
30
|
+
isMicro: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Detect which i18n module is installed (@nuxtjs/i18n or nuxt-i18n-micro).
|
|
34
|
+
*
|
|
35
|
+
* Returns `false` when neither is installed.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveI18nModule(): false | I18nModuleResolution;
|
|
38
|
+
declare function resolveI18nConfig(logger?: {
|
|
39
|
+
warn: (msg: string) => void;
|
|
40
|
+
}): Promise<false | AutoI18nConfig>;
|
|
41
|
+
declare function mergeOnKey<T extends Record<string, any>>(arr: T[], key: keyof T): T[];
|
|
42
|
+
|
|
43
|
+
export { generatePathForI18nPages, mapPathForI18nPages, mergeOnKey, normalizeLocales, resolveI18nConfig, resolveI18nModule, splitPathForI18nLocales };
|
|
44
|
+
export type { AutoI18nConfig, I18nModuleResolution, NormalisedLocale, Strategies, StrategyProps };
|