@lunariajs/core
Advanced tools
Comparing version 0.0.0 to 0.0.10
@@ -1,872 +0,6 @@ | ||
import { z } from 'zod'; | ||
import { TemplateResult } from 'lit-html'; | ||
import { L as LunariaUserConfig } from './shared/core.4dc6f266.js'; | ||
export { D as Dashboard, F as FileData, a as FileTranslationStatus, b as Locale, c as LunariaConfig, S as SharedPathResolver } from './shared/core.4dc6f266.js'; | ||
export { html } from 'lit-html'; | ||
import 'zod'; | ||
interface FileData { | ||
filePath: string; | ||
isTranslatable: boolean; | ||
lastChange: string; | ||
lastCommitMessage: string; | ||
lastMajorChange: string; | ||
lastMajorCommitMessage: string; | ||
} | ||
interface FileTranslationStatus { | ||
sharedPath: string; | ||
sourcePage: FileData; | ||
gitHostingUrl: string; | ||
translations: { | ||
[locale: string]: TranslationStatus; | ||
}; | ||
} | ||
interface TranslationStatus { | ||
file: FileData | undefined; | ||
completeness: { | ||
complete: boolean; | ||
missingKeys: string[] | null; | ||
}; | ||
isMissing: boolean; | ||
isOutdated: boolean; | ||
gitHostingUrl: string; | ||
sourceHistoryUrl: string; | ||
} | ||
type CustomComponent = (opts: LunariaConfig) => TemplateResult<1>; | ||
type CustomStatusComponent = (opts: LunariaConfig, translationStatus: FileTranslationStatus[]) => TemplateResult<1>; | ||
declare const LocaleSchema: z.ZodObject<{ | ||
/** The label of the locale to show in the status dashboard, e.g. `"English"`, `"Português"`, or `"Español"`. */ | ||
label: z.ZodString; | ||
/** The BCP-47 tag of the locale, both to use in smaller widths and to differentiate regional variants, e.g. `"en-US"` (American English) or `"en-GB"` (British English). */ | ||
lang: z.ZodString; | ||
/** Information about any of your UI dictionaries. */ | ||
dictionaries: z.ZodOptional<z.ZodObject<{ | ||
/** A glob pattern of where your UI dictionaries are and its file type(s), e.g. `"src/i18n/en/**.ts"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
/** Object whose keys equals to true will have its translation considered optional. The value configured in the defaultLocale will be considered for all locales, while individual locales can override it with locale-specific information. */ | ||
optionalKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
/** The name of the export that will be used to import your dictionary. As the initial value, the default export is used. */ | ||
module: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
}>>; | ||
/** Information about your content. */ | ||
content: z.ZodObject<{ | ||
/** A glob pattern of where your content for the locale is and its file type(s), e.g. `"src/content/docs/en/**.mdx"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}>; | ||
declare const SharedPathResolverSchema: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{ | ||
lang: z.ZodString; | ||
filePath: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
filePath: string; | ||
}, { | ||
lang: string; | ||
filePath: string; | ||
}>], z.ZodUnknown>, z.ZodString>>; | ||
declare const DashboardSchema: z.ZodObject<{ | ||
/** The title of your translation dashboard, used as both the main heading and meta title of the page. */ | ||
title: z.ZodDefault<z.ZodString>; | ||
/** The description of your translation dashboard, used in the meta tags of the page. */ | ||
description: z.ZodDefault<z.ZodString>; | ||
/** The deployed URL of your translation dashboard, used in the meta tags of the page. */ | ||
url: z.ZodString; | ||
/** UI dictionary of the dashboard, including the desired `lang` and `dir` attributes of the page. */ | ||
ui: z.ZodDefault<z.ZodObject<{ | ||
/** The BCP-47 tag of the dashboard's UI, used as the page's `lang` attribute, e.g. `'en'` or `'pt-BR'`. */ | ||
lang: z.ZodDefault<z.ZodString>; | ||
/** The directionality of the page's text, used as the page's `dir` attribute. It can be either `'ltr'` (left-to-right) or `'rtl'` (right-to-left). */ | ||
dir: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"ltr">, z.ZodLiteral<"rtl">]>>; | ||
/** The dashboard status of 'done'. */ | ||
'status.done': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status of 'outdated'. */ | ||
'status.outdated': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status 'missing'. */ | ||
'status.missing': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'done'. */ | ||
'status.emojiDone': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'outdated'. */ | ||
'status.emojiOutdated': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'missing'. */ | ||
'status.emojiMissing': z.ZodDefault<z.ZodString>; | ||
/** The heading text that precedes the dropdown lists of each locale's individual progress. */ | ||
'statusByLocale.heading': z.ZodDefault<z.ZodString>; | ||
/** The locale's individual status details summary format. The '{*_amount}' and `{*_word}` | ||
* are placeholder values for the amount of pages (e.g. '10') in the status and the status word | ||
* (e.g. 'done'), respectively. */ | ||
'statusByLocale.detailsSummaryFormat': z.ZodDefault<z.ZodString>; | ||
/** The locale's details title format. The `{locale_name} and `{locale_tag}` are placeholder values | ||
* for the locale's name (e.g. English) and the locale's BCP-47 tag (e.g. en), respectively. */ | ||
'statusByLocale.detailsTitleFormat': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details oudated translation link. */ | ||
'statusByLocale.outdatedTranslationLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details incomplete translation link. */ | ||
'statusByLocale.incompleteTranslationLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details source change history link. */ | ||
'statusByLocale.sourceChangeHistoryLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details UI dictionary missing keys heading. */ | ||
'statusByLocale.missingKeys': z.ZodDefault<z.ZodString>; | ||
/** The text shown in the locale's details when it is complete. */ | ||
'statusByLocale.completeTranslation': z.ZodDefault<z.ZodString>; | ||
/** The heading text that precedes the table with all locale's status by content. */ | ||
'statusByContent.heading': z.ZodDefault<z.ZodString>; | ||
/** The text for the status dashboard table's 'content' row head. */ | ||
'statusByContent.tableRowPage': z.ZodDefault<z.ZodString>; | ||
/** The dashboard table's summary format. The `{*_emoji}` and `{*_word}` are placeholder values for the status emoji (e.g. '❌') and its word (e.g. 'missing'). */ | ||
'statusByContent.tableSummaryFormat': z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
dir: "ltr" | "rtl"; | ||
'status.done': string; | ||
'status.outdated': string; | ||
'status.missing': string; | ||
'status.emojiDone': string; | ||
'status.emojiOutdated': string; | ||
'status.emojiMissing': string; | ||
'statusByLocale.heading': string; | ||
'statusByLocale.detailsSummaryFormat': string; | ||
'statusByLocale.detailsTitleFormat': string; | ||
'statusByLocale.outdatedTranslationLink': string; | ||
'statusByLocale.incompleteTranslationLink': string; | ||
'statusByLocale.sourceChangeHistoryLink': string; | ||
'statusByLocale.missingKeys': string; | ||
'statusByLocale.completeTranslation': string; | ||
'statusByContent.heading': string; | ||
'statusByContent.tableRowPage': string; | ||
'statusByContent.tableSummaryFormat': string; | ||
}, { | ||
lang?: string | undefined; | ||
dir?: "ltr" | "rtl" | undefined; | ||
'status.done'?: string | undefined; | ||
'status.outdated'?: string | undefined; | ||
'status.missing'?: string | undefined; | ||
'status.emojiDone'?: string | undefined; | ||
'status.emojiOutdated'?: string | undefined; | ||
'status.emojiMissing'?: string | undefined; | ||
'statusByLocale.heading'?: string | undefined; | ||
'statusByLocale.detailsSummaryFormat'?: string | undefined; | ||
'statusByLocale.detailsTitleFormat'?: string | undefined; | ||
'statusByLocale.outdatedTranslationLink'?: string | undefined; | ||
'statusByLocale.incompleteTranslationLink'?: string | undefined; | ||
'statusByLocale.sourceChangeHistoryLink'?: string | undefined; | ||
'statusByLocale.missingKeys'?: string | undefined; | ||
'statusByLocale.completeTranslation'?: string | undefined; | ||
'statusByContent.heading'?: string | undefined; | ||
'statusByContent.tableRowPage'?: string | undefined; | ||
'statusByContent.tableSummaryFormat'?: string | undefined; | ||
}>>; | ||
slots: z.ZodDefault<z.ZodObject<{ | ||
head: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
beforeTitle: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
afterTitle: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
}, "strip", z.ZodTypeAny, { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}, { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}>>; | ||
overrides: z.ZodDefault<z.ZodObject<{ | ||
meta: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
styles: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
content: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
statusByLocale: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
statusByContent: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
}, "strip", z.ZodTypeAny, { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}, { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
title: string; | ||
description: string; | ||
url: string; | ||
ui: { | ||
lang: string; | ||
dir: "ltr" | "rtl"; | ||
'status.done': string; | ||
'status.outdated': string; | ||
'status.missing': string; | ||
'status.emojiDone': string; | ||
'status.emojiOutdated': string; | ||
'status.emojiMissing': string; | ||
'statusByLocale.heading': string; | ||
'statusByLocale.detailsSummaryFormat': string; | ||
'statusByLocale.detailsTitleFormat': string; | ||
'statusByLocale.outdatedTranslationLink': string; | ||
'statusByLocale.incompleteTranslationLink': string; | ||
'statusByLocale.sourceChangeHistoryLink': string; | ||
'statusByLocale.missingKeys': string; | ||
'statusByLocale.completeTranslation': string; | ||
'statusByContent.heading': string; | ||
'statusByContent.tableRowPage': string; | ||
'statusByContent.tableSummaryFormat': string; | ||
}; | ||
slots: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}; | ||
overrides: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}; | ||
}, { | ||
url: string; | ||
title?: string | undefined; | ||
description?: string | undefined; | ||
ui?: { | ||
lang?: string | undefined; | ||
dir?: "ltr" | "rtl" | undefined; | ||
'status.done'?: string | undefined; | ||
'status.outdated'?: string | undefined; | ||
'status.missing'?: string | undefined; | ||
'status.emojiDone'?: string | undefined; | ||
'status.emojiOutdated'?: string | undefined; | ||
'status.emojiMissing'?: string | undefined; | ||
'statusByLocale.heading'?: string | undefined; | ||
'statusByLocale.detailsSummaryFormat'?: string | undefined; | ||
'statusByLocale.detailsTitleFormat'?: string | undefined; | ||
'statusByLocale.outdatedTranslationLink'?: string | undefined; | ||
'statusByLocale.incompleteTranslationLink'?: string | undefined; | ||
'statusByLocale.sourceChangeHistoryLink'?: string | undefined; | ||
'statusByLocale.missingKeys'?: string | undefined; | ||
'statusByLocale.completeTranslation'?: string | undefined; | ||
'statusByContent.heading'?: string | undefined; | ||
'statusByContent.tableRowPage'?: string | undefined; | ||
'statusByContent.tableSummaryFormat'?: string | undefined; | ||
} | undefined; | ||
slots?: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
} | undefined; | ||
overrides?: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
} | undefined; | ||
}>; | ||
declare const LunariaConfigSchema: z.ZodObject<{ | ||
dashboard: z.ZodObject<{ | ||
/** The title of your translation dashboard, used as both the main heading and meta title of the page. */ | ||
title: z.ZodDefault<z.ZodString>; | ||
/** The description of your translation dashboard, used in the meta tags of the page. */ | ||
description: z.ZodDefault<z.ZodString>; | ||
/** The deployed URL of your translation dashboard, used in the meta tags of the page. */ | ||
url: z.ZodString; | ||
/** UI dictionary of the dashboard, including the desired `lang` and `dir` attributes of the page. */ | ||
ui: z.ZodDefault<z.ZodObject<{ | ||
/** The BCP-47 tag of the dashboard's UI, used as the page's `lang` attribute, e.g. `'en'` or `'pt-BR'`. */ | ||
lang: z.ZodDefault<z.ZodString>; | ||
/** The directionality of the page's text, used as the page's `dir` attribute. It can be either `'ltr'` (left-to-right) or `'rtl'` (right-to-left). */ | ||
dir: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"ltr">, z.ZodLiteral<"rtl">]>>; | ||
/** The dashboard status of 'done'. */ | ||
'status.done': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status of 'outdated'. */ | ||
'status.outdated': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status 'missing'. */ | ||
'status.missing': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'done'. */ | ||
'status.emojiDone': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'outdated'. */ | ||
'status.emojiOutdated': z.ZodDefault<z.ZodString>; | ||
/** The dashboard status emoji for 'missing'. */ | ||
'status.emojiMissing': z.ZodDefault<z.ZodString>; | ||
/** The heading text that precedes the dropdown lists of each locale's individual progress. */ | ||
'statusByLocale.heading': z.ZodDefault<z.ZodString>; | ||
/** The locale's individual status details summary format. The '{*_amount}' and `{*_word}` | ||
* are placeholder values for the amount of pages (e.g. '10') in the status and the status word | ||
* (e.g. 'done'), respectively. */ | ||
'statusByLocale.detailsSummaryFormat': z.ZodDefault<z.ZodString>; | ||
/** The locale's details title format. The `{locale_name} and `{locale_tag}` are placeholder values | ||
* for the locale's name (e.g. English) and the locale's BCP-47 tag (e.g. en), respectively. */ | ||
'statusByLocale.detailsTitleFormat': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details oudated translation link. */ | ||
'statusByLocale.outdatedTranslationLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details incomplete translation link. */ | ||
'statusByLocale.incompleteTranslationLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details source change history link. */ | ||
'statusByLocale.sourceChangeHistoryLink': z.ZodDefault<z.ZodString>; | ||
/** The text for the locale's details UI dictionary missing keys heading. */ | ||
'statusByLocale.missingKeys': z.ZodDefault<z.ZodString>; | ||
/** The text shown in the locale's details when it is complete. */ | ||
'statusByLocale.completeTranslation': z.ZodDefault<z.ZodString>; | ||
/** The heading text that precedes the table with all locale's status by content. */ | ||
'statusByContent.heading': z.ZodDefault<z.ZodString>; | ||
/** The text for the status dashboard table's 'content' row head. */ | ||
'statusByContent.tableRowPage': z.ZodDefault<z.ZodString>; | ||
/** The dashboard table's summary format. The `{*_emoji}` and `{*_word}` are placeholder values for the status emoji (e.g. '❌') and its word (e.g. 'missing'). */ | ||
'statusByContent.tableSummaryFormat': z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
dir: "ltr" | "rtl"; | ||
'status.done': string; | ||
'status.outdated': string; | ||
'status.missing': string; | ||
'status.emojiDone': string; | ||
'status.emojiOutdated': string; | ||
'status.emojiMissing': string; | ||
'statusByLocale.heading': string; | ||
'statusByLocale.detailsSummaryFormat': string; | ||
'statusByLocale.detailsTitleFormat': string; | ||
'statusByLocale.outdatedTranslationLink': string; | ||
'statusByLocale.incompleteTranslationLink': string; | ||
'statusByLocale.sourceChangeHistoryLink': string; | ||
'statusByLocale.missingKeys': string; | ||
'statusByLocale.completeTranslation': string; | ||
'statusByContent.heading': string; | ||
'statusByContent.tableRowPage': string; | ||
'statusByContent.tableSummaryFormat': string; | ||
}, { | ||
lang?: string | undefined; | ||
dir?: "ltr" | "rtl" | undefined; | ||
'status.done'?: string | undefined; | ||
'status.outdated'?: string | undefined; | ||
'status.missing'?: string | undefined; | ||
'status.emojiDone'?: string | undefined; | ||
'status.emojiOutdated'?: string | undefined; | ||
'status.emojiMissing'?: string | undefined; | ||
'statusByLocale.heading'?: string | undefined; | ||
'statusByLocale.detailsSummaryFormat'?: string | undefined; | ||
'statusByLocale.detailsTitleFormat'?: string | undefined; | ||
'statusByLocale.outdatedTranslationLink'?: string | undefined; | ||
'statusByLocale.incompleteTranslationLink'?: string | undefined; | ||
'statusByLocale.sourceChangeHistoryLink'?: string | undefined; | ||
'statusByLocale.missingKeys'?: string | undefined; | ||
'statusByLocale.completeTranslation'?: string | undefined; | ||
'statusByContent.heading'?: string | undefined; | ||
'statusByContent.tableRowPage'?: string | undefined; | ||
'statusByContent.tableSummaryFormat'?: string | undefined; | ||
}>>; | ||
slots: z.ZodDefault<z.ZodObject<{ | ||
head: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
beforeTitle: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
afterTitle: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
}, "strip", z.ZodTypeAny, { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}, { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}>>; | ||
overrides: z.ZodDefault<z.ZodObject<{ | ||
meta: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
styles: z.ZodOptional<z.ZodType<CustomComponent, z.ZodTypeDef, CustomComponent>>; | ||
content: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
statusByLocale: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
statusByContent: z.ZodOptional<z.ZodType<CustomStatusComponent, z.ZodTypeDef, CustomStatusComponent>>; | ||
}, "strip", z.ZodTypeAny, { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}, { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
title: string; | ||
description: string; | ||
url: string; | ||
ui: { | ||
lang: string; | ||
dir: "ltr" | "rtl"; | ||
'status.done': string; | ||
'status.outdated': string; | ||
'status.missing': string; | ||
'status.emojiDone': string; | ||
'status.emojiOutdated': string; | ||
'status.emojiMissing': string; | ||
'statusByLocale.heading': string; | ||
'statusByLocale.detailsSummaryFormat': string; | ||
'statusByLocale.detailsTitleFormat': string; | ||
'statusByLocale.outdatedTranslationLink': string; | ||
'statusByLocale.incompleteTranslationLink': string; | ||
'statusByLocale.sourceChangeHistoryLink': string; | ||
'statusByLocale.missingKeys': string; | ||
'statusByLocale.completeTranslation': string; | ||
'statusByContent.heading': string; | ||
'statusByContent.tableRowPage': string; | ||
'statusByContent.tableSummaryFormat': string; | ||
}; | ||
slots: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}; | ||
overrides: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}; | ||
}, { | ||
url: string; | ||
title?: string | undefined; | ||
description?: string | undefined; | ||
ui?: { | ||
lang?: string | undefined; | ||
dir?: "ltr" | "rtl" | undefined; | ||
'status.done'?: string | undefined; | ||
'status.outdated'?: string | undefined; | ||
'status.missing'?: string | undefined; | ||
'status.emojiDone'?: string | undefined; | ||
'status.emojiOutdated'?: string | undefined; | ||
'status.emojiMissing'?: string | undefined; | ||
'statusByLocale.heading'?: string | undefined; | ||
'statusByLocale.detailsSummaryFormat'?: string | undefined; | ||
'statusByLocale.detailsTitleFormat'?: string | undefined; | ||
'statusByLocale.outdatedTranslationLink'?: string | undefined; | ||
'statusByLocale.incompleteTranslationLink'?: string | undefined; | ||
'statusByLocale.sourceChangeHistoryLink'?: string | undefined; | ||
'statusByLocale.missingKeys'?: string | undefined; | ||
'statusByLocale.completeTranslation'?: string | undefined; | ||
'statusByContent.heading'?: string | undefined; | ||
'statusByContent.tableRowPage'?: string | undefined; | ||
'statusByContent.tableSummaryFormat'?: string | undefined; | ||
} | undefined; | ||
slots?: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
} | undefined; | ||
overrides?: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
} | undefined; | ||
}>; | ||
/** The default locale of your content that is going to be translated. */ | ||
defaultLocale: z.ZodObject<{ | ||
/** The label of the locale to show in the status dashboard, e.g. `"English"`, `"Português"`, or `"Español"`. */ | ||
label: z.ZodString; | ||
/** The BCP-47 tag of the locale, both to use in smaller widths and to differentiate regional variants, e.g. `"en-US"` (American English) or `"en-GB"` (British English). */ | ||
lang: z.ZodString; | ||
/** Information about any of your UI dictionaries. */ | ||
dictionaries: z.ZodOptional<z.ZodObject<{ | ||
/** A glob pattern of where your UI dictionaries are and its file type(s), e.g. `"src/i18n/en/**.ts"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
/** Object whose keys equals to true will have its translation considered optional. The value configured in the defaultLocale will be considered for all locales, while individual locales can override it with locale-specific information. */ | ||
optionalKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
/** The name of the export that will be used to import your dictionary. As the initial value, the default export is used. */ | ||
module: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
}>>; | ||
/** Information about your content. */ | ||
content: z.ZodObject<{ | ||
/** A glob pattern of where your content for the locale is and its file type(s), e.g. `"src/content/docs/en/**.mdx"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}>; | ||
/** Array of the locales that will be translated. */ | ||
locales: z.ZodArray<z.ZodObject<{ | ||
/** The label of the locale to show in the status dashboard, e.g. `"English"`, `"Português"`, or `"Español"`. */ | ||
label: z.ZodString; | ||
/** The BCP-47 tag of the locale, both to use in smaller widths and to differentiate regional variants, e.g. `"en-US"` (American English) or `"en-GB"` (British English). */ | ||
lang: z.ZodString; | ||
/** Information about any of your UI dictionaries. */ | ||
dictionaries: z.ZodOptional<z.ZodObject<{ | ||
/** A glob pattern of where your UI dictionaries are and its file type(s), e.g. `"src/i18n/en/**.ts"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
/** Object whose keys equals to true will have its translation considered optional. The value configured in the defaultLocale will be considered for all locales, while individual locales can override it with locale-specific information. */ | ||
optionalKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
/** The name of the export that will be used to import your dictionary. As the initial value, the default export is used. */ | ||
module: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
}>>; | ||
/** Information about your content. */ | ||
content: z.ZodObject<{ | ||
/** A glob pattern of where your content for the locale is and its file type(s), e.g. `"src/content/docs/en/**.mdx"`. */ | ||
location: z.ZodString; | ||
/** Array of glob patterns to be ignored from matching. */ | ||
ignore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
location: string; | ||
ignore: string[]; | ||
}, { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}, { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}>, "atleastone">; | ||
/** Array of commit keywords that avoid a commit from trigerring status changes. */ | ||
ignoreKeywords: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
/** Name of the frontmatter property used to mark a page as translatable | ||
* and include it as part of the status dashboard. Keep it empty if you | ||
* want every page to be unconditionally translatable. | ||
*/ | ||
translatableProperty: z.ZodOptional<z.ZodString>; | ||
/** Custom fuction to handle the shared path resolver, used to "link" pages between two locales. */ | ||
customSharedPathResolver: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{ | ||
lang: z.ZodString; | ||
filePath: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
lang: string; | ||
filePath: string; | ||
}, { | ||
lang: string; | ||
filePath: string; | ||
}>], z.ZodUnknown>, z.ZodString>>; | ||
/** The URL of your current repository, used to generate history links, e.g. `"https://github.com/Yan-Thomas/lunaria"`. */ | ||
repository: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>; | ||
/** The root directory of the project being tracked, must be set when using a monorepo. | ||
* | ||
* @example | ||
* Take this project structure as an example: | ||
* ```md | ||
* ├── docs/ | ||
* ├── packages/ | ||
* | ├── package-one/ | ||
* | ├── package-two/ | ||
* ``` | ||
* Considering you're tracking your docs located at `docs/`, `rootDir` should be defined like the following: | ||
* ```json | ||
* rootDir: "./docs" | ||
* ``` | ||
* | ||
* This is necessary because when using a shallow repository, as the entire monorepo is downloaded, | ||
* and therefore there's no other way to reliably know where your content being tracked is. | ||
*/ | ||
rootDir: z.ZodDefault<z.ZodString>; | ||
/** The relative directory path of where your dashboard will build to, e.g. `"./dist/translation-status/index.html"`. */ | ||
outDir: z.ZodDefault<z.ZodString>; | ||
/** The relative directory path of your git history clone, exclusively made when running on a shallow repository, e.g. `"./dist/history"` */ | ||
cloneDir: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
dashboard: { | ||
title: string; | ||
description: string; | ||
url: string; | ||
ui: { | ||
lang: string; | ||
dir: "ltr" | "rtl"; | ||
'status.done': string; | ||
'status.outdated': string; | ||
'status.missing': string; | ||
'status.emojiDone': string; | ||
'status.emojiOutdated': string; | ||
'status.emojiMissing': string; | ||
'statusByLocale.heading': string; | ||
'statusByLocale.detailsSummaryFormat': string; | ||
'statusByLocale.detailsTitleFormat': string; | ||
'statusByLocale.outdatedTranslationLink': string; | ||
'statusByLocale.incompleteTranslationLink': string; | ||
'statusByLocale.sourceChangeHistoryLink': string; | ||
'statusByLocale.missingKeys': string; | ||
'statusByLocale.completeTranslation': string; | ||
'statusByContent.heading': string; | ||
'statusByContent.tableRowPage': string; | ||
'statusByContent.tableSummaryFormat': string; | ||
}; | ||
slots: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
}; | ||
overrides: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
}; | ||
}; | ||
defaultLocale: { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}; | ||
locales: [{ | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}, ...{ | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore: string[]; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore: string[]; | ||
module: string; | ||
optionalKeys?: string[] | undefined; | ||
} | undefined; | ||
}[]]; | ||
ignoreKeywords: string[]; | ||
repository: string; | ||
rootDir: string; | ||
outDir: string; | ||
cloneDir: string; | ||
translatableProperty?: string | undefined; | ||
customSharedPathResolver?: ((args_0: { | ||
lang: string; | ||
filePath: string; | ||
}, ...args_1: unknown[]) => string) | undefined; | ||
}, { | ||
dashboard: { | ||
url: string; | ||
title?: string | undefined; | ||
description?: string | undefined; | ||
ui?: { | ||
lang?: string | undefined; | ||
dir?: "ltr" | "rtl" | undefined; | ||
'status.done'?: string | undefined; | ||
'status.outdated'?: string | undefined; | ||
'status.missing'?: string | undefined; | ||
'status.emojiDone'?: string | undefined; | ||
'status.emojiOutdated'?: string | undefined; | ||
'status.emojiMissing'?: string | undefined; | ||
'statusByLocale.heading'?: string | undefined; | ||
'statusByLocale.detailsSummaryFormat'?: string | undefined; | ||
'statusByLocale.detailsTitleFormat'?: string | undefined; | ||
'statusByLocale.outdatedTranslationLink'?: string | undefined; | ||
'statusByLocale.incompleteTranslationLink'?: string | undefined; | ||
'statusByLocale.sourceChangeHistoryLink'?: string | undefined; | ||
'statusByLocale.missingKeys'?: string | undefined; | ||
'statusByLocale.completeTranslation'?: string | undefined; | ||
'statusByContent.heading'?: string | undefined; | ||
'statusByContent.tableRowPage'?: string | undefined; | ||
'statusByContent.tableSummaryFormat'?: string | undefined; | ||
} | undefined; | ||
slots?: { | ||
head?: CustomComponent | undefined; | ||
beforeTitle?: CustomComponent | undefined; | ||
afterTitle?: CustomComponent | undefined; | ||
} | undefined; | ||
overrides?: { | ||
meta?: CustomComponent | undefined; | ||
styles?: CustomComponent | undefined; | ||
content?: CustomStatusComponent | undefined; | ||
statusByLocale?: CustomStatusComponent | undefined; | ||
statusByContent?: CustomStatusComponent | undefined; | ||
} | undefined; | ||
}; | ||
defaultLocale: { | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}; | ||
locales: [{ | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}, ...{ | ||
lang: string; | ||
content: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
}; | ||
label: string; | ||
dictionaries?: { | ||
location: string; | ||
ignore?: string[] | undefined; | ||
optionalKeys?: string[] | undefined; | ||
module?: string | undefined; | ||
} | undefined; | ||
}[]]; | ||
repository: string; | ||
ignoreKeywords?: string[] | undefined; | ||
translatableProperty?: string | undefined; | ||
customSharedPathResolver?: ((args_0: { | ||
lang: string; | ||
filePath: string; | ||
}, ...args_1: unknown[]) => string) | undefined; | ||
rootDir?: string | undefined; | ||
outDir?: string | undefined; | ||
cloneDir?: string | undefined; | ||
}>; | ||
type Locale = z.output<typeof LocaleSchema>; | ||
type SharedPathResolver = z.infer<typeof SharedPathResolverSchema>; | ||
type Dashboard = z.output<typeof DashboardSchema>; | ||
type LunariaConfig = z.infer<typeof LunariaConfigSchema>; | ||
type LunariaUserConfig = z.input<typeof LunariaConfigSchema>; | ||
declare function createTracker(opts: LunariaUserConfig): Promise<{ | ||
@@ -876,2 +10,2 @@ run: () => Promise<void>; | ||
export { Dashboard, FileData, FileTranslationStatus, Locale, LunariaConfig, SharedPathResolver, createTracker }; | ||
export { createTracker }; |
{ | ||
"name": "@lunariajs/core", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"version": "0.0.10", | ||
"description": "Translation management system for open-source projects", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
@@ -16,5 +16,15 @@ "exports": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
} | ||
}, | ||
"./components": { | ||
"require": { | ||
"types": "./dist/dashboard/components.d.cts", | ||
"default": "./dist/dashboard/components.cjs" | ||
}, | ||
"import": { | ||
"types": "./dist/dashboard/components.d.mts", | ||
"default": "./dist/dashboard/components.mjs" | ||
} | ||
} | ||
@@ -43,7 +53,8 @@ }, | ||
"@types/node": "^20.8.9", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.2.2", | ||
"unbuild": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"fast-glob": "^3.3.1", | ||
"jiti": "^1.21.0", | ||
"lit-html": "^3.0.0", | ||
@@ -58,6 +69,5 @@ "micromatch": "^4.0.5", | ||
"scripts": { | ||
"build": "tsup src/index.ts --format esm,cjs --dts", | ||
"dev": "tsup src/index.ts --watch", | ||
"build": "unbuild", | ||
"lint": "tsc" | ||
} | ||
} |
@@ -69,9 +69,21 @@ # `@lunariajs/core` | ||
], | ||
/** Property containing a boolean value used in files that support frontmatter to mark that the content should be translated */ | ||
// Property to find in valid frontmatter files marking if a page should be translated or not | ||
translatableProperty: 'i18nReady', | ||
}); | ||
// Generates your dashboard, by default at dist/translation-status/index.html | ||
tracker.run(); | ||
``` | ||
To run the script, you need to add a new script to your `package.json` file and trigger it during your website's build and deploy process, for example: | ||
```diff | ||
"scripts": { | ||
"docs:dev": "vitepress dev .", | ||
"docs:build": "vitepress build .", | ||
"docs:preview": "vitepress preview .", | ||
+ "translation-status": "node ./scripts/translation-status.js" | ||
}, | ||
``` | ||
Want other usage examples? Head over to the [`examples/` directory](https://github.com/Yan-Thomas/lunaria/tree/main/examples/) and inspect the source code for tips & tricks about using `@lunariajs/core` with other frameworks and environments. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
337261
26
89
7
9
1703
5
1
+ Addedjiti@^1.21.0
+ Addedjiti@1.21.6(transitive)