UNPKG

astro-i18n-aut

Version:
1 lines 22.1 kB
{"version":3,"sources":["../../src/integration/index.ts","../../src/integration/integration.ts","../../src/astro/internal-helpers/path.ts","../../src/shared/configs.ts","../../src/integration/ensureValidConfigs/ensureValidTrailingSlashAndFormat.ts","../../src/integration/ensureValidConfigs/createVirtualPlugin.ts","../../src/integration/ensureValidConfigs/createVirtualModules.ts","../../src/integration/ensureValidConfigs/ensureValidConfigs.ts","../../src/edge-runtime/removeHtmlExtension.ts","../../src/shared/filterSitemapByDefaultLocale.ts"],"sourcesContent":["export { i18n, i18n as default } from \"./integration\";\nexport { filterSitemapByDefaultLocale } from \"../shared/filterSitemapByDefaultLocale\";\nexport { defaultI18nConfig } from \"../shared/configs\";\nexport type {\n UserI18nConfig,\n UserFilterSitemapByDefaultLocaleConfig,\n} from \"../shared/configs\";\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { AstroIntegration, AstroIntegrationLogger } from \"astro\";\nimport fg from \"fast-glob\";\nimport fs from \"fs-extra\";\nimport slash from \"slash\";\nimport { removeLeadingForwardSlashWindows } from \"../astro/internal-helpers/path\";\nimport { defaultI18nConfig } from \"../shared/configs\";\nimport type { UserI18nConfig, I18nConfig } from \"../shared/configs\";\nimport { ensureValidConfigs } from \"./ensureValidConfigs\";\n\n// injectRoute doesn't generate build pages https://github.com/withastro/astro/issues/5096\n// workaround: copy pages folder when command === \"build\"\n\n/**\n * The i18n integration for Astro\n *\n * See the full [astro-i18n-aut](https://github.com/jlarmstrongiv/astro-i18n-aut#readme) documentation\n */\nexport function i18n(userI18nConfig: UserI18nConfig): AstroIntegration {\n const i18nConfig: I18nConfig = Object.assign(\n defaultI18nConfig,\n userI18nConfig\n );\n\n const { defaultLocale, locales, exclude, include, redirectDefaultLocale } =\n i18nConfig;\n\n let pagesPathTmp: Record<string, string> = {};\n async function removePagesPathTmp(): Promise<void> {\n await Promise.all(\n Object.values(pagesPathTmp).map((pagePathTmp) => fs.remove(pagePathTmp))\n );\n }\n\n return {\n name: \"astro-i18n-integration\",\n hooks: {\n \"astro:config:setup\": async ({\n config,\n updateConfig,\n addMiddleware,\n command,\n injectRoute,\n logger,\n }) => {\n ensureValidLocales(locales, defaultLocale, logger);\n await ensureValidConfigs(config, updateConfig, i18nConfig, logger);\n addMiddleware({\n entrypoint: \"astro-i18n-aut/middleware\",\n order: \"pre\",\n });\n\n const configSrcDirPathname = fileURLToPath(config.srcDir);\n\n let included: string[] = ensureGlobsHaveConfigSrcDirPathname(\n typeof include === \"string\" ? [include] : include,\n configSrcDirPathname\n );\n let excluded: string[] = ensureGlobsHaveConfigSrcDirPathname(\n typeof exclude === \"string\" ? [exclude] : exclude,\n configSrcDirPathname\n );\n\n const pagesPath = path.join(configSrcDirPathname, \"pages\");\n\n const pagesPathTmpRoot = path.join(\n configSrcDirPathname,\n // tmp filename from https://github.com/withastro/astro/blob/e6bff651ff80466b3e862e637d2a6a3334d8cfda/packages/astro/src/core/routing/manifest/create.ts#L279\n \"astro_tmp_pages\"\n );\n for (const locale of Object.keys(locales)) {\n pagesPathTmp[locale] = `${pagesPathTmpRoot}_${locale}`;\n }\n\n await removePagesPathTmp();\n if (command === \"build\") {\n await Promise.all(\n Object.keys(locales)\n .filter((locale) => {\n if (\n redirectDefaultLocale === false ||\n config.output === \"server\"\n ) {\n return locale !== defaultLocale;\n } else {\n return true;\n }\n })\n .map((locale) => fs.copy(pagesPath, pagesPathTmp[locale]))\n );\n }\n\n const entries = fg.stream(included, {\n ignore: excluded,\n onlyFiles: true,\n });\n // typing https://stackoverflow.com/a/68358341\n let entry: string;\n // @ts-expect-error\n for await (entry of entries) {\n const parsedPath = path.parse(entry);\n const relativePath = path.relative(pagesPath, parsedPath.dir);\n const extname = parsedPath.ext.slice(1).toLowerCase();\n\n // warn on files that cannot be translated with specific and actionable warnings\n // astro pages file types https://docs.astro.build/en/core-concepts/astro-pages/#supported-page-files\n // any file that is not included as an astro page file types, will be automatically warned about by astro\n if (extname !== \"astro\") {\n warnIsInvalidPage(\n extname,\n path.join(relativePath, parsedPath.base),\n configSrcDirPathname,\n logger\n );\n continue;\n }\n\n for (const locale of Object.keys(locales)) {\n // ignore defaultLocale if redirectDefaultLocale is false or if using SSR\n if (\n (redirectDefaultLocale === false || config.output === \"server\") &&\n locale === defaultLocale\n ) {\n continue;\n }\n\n const entrypoint =\n command === \"build\"\n ? path.join(pagesPathTmp[locale], relativePath, parsedPath.base)\n : path.join(pagesPath, relativePath, parsedPath.base);\n\n const pattern = slash(\n path.join(\n // astro automatically handles prepending `config.base`\n locale,\n relativePath,\n parsedPath.name.endsWith(\"index\") ? \"\" : parsedPath.name,\n config.build.format === \"directory\" ? \"/\" : \"\"\n )\n );\n\n injectRoute({\n entrypoint,\n pattern,\n });\n }\n }\n },\n \"astro:build:done\": async () => {\n await removePagesPathTmp();\n },\n \"astro:server:done\": async () => {\n await removePagesPathTmp();\n },\n },\n };\n}\n\nfunction ensureValidLocales(\n locales: Record<string, string>,\n defaultLocale: string,\n logger: AstroIntegrationLogger\n) {\n if (!Object.keys(locales).includes(defaultLocale)) {\n const errorMessage = `locales ${JSON.stringify(\n locales\n )} does not include \"${defaultLocale}\"`;\n logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\nfunction ensureGlobsHaveConfigSrcDirPathname(\n filePaths: string[],\n configSrcDirPathname: string\n) {\n return filePaths.map((filePath) => {\n filePath = path.normalize(removeLeadingForwardSlashWindows(filePath));\n\n if (filePath.includes(configSrcDirPathname)) {\n filePath = path.relative(configSrcDirPathname, filePath);\n }\n\n // fast-glob prefers unix paths https://www.npmjs.com/package/fast-glob#how-to-write-patterns-on-windows\n filePath = path.posix.join(\n fg.convertPathToPattern(configSrcDirPathname),\n slash(filePath)\n );\n\n return filePath;\n });\n}\n\nlet hasWarnedIsInvalidPage = false;\nfunction warnIsInvalidPage(\n extname: string,\n filePath: string,\n configSrcDirPathname: string,\n logger: AstroIntegrationLogger\n): boolean {\n // astro pages file types https://docs.astro.build/en/core-concepts/astro-pages/#supported-page-files\n if ([\"js\", \"ts\", \"md\", \"mdx\", \"html\"].includes(extname)) {\n if (hasWarnedIsInvalidPage === false) {\n logger.warn(\n `exclude or remove non-astro files from \"${configSrcDirPathname}pages\", as they cannot be translated`\n );\n hasWarnedIsInvalidPage = true;\n }\n logger.warn(path.join(configSrcDirPathname, \"pages\", filePath));\n return true;\n }\n return false;\n}\n","export function removeLeadingForwardSlashWindows(path: string) {\n return path.startsWith(\"/\") && path[2] === \":\" ? path.substring(1) : path;\n}\n","import type { AstroConfig, ValidRedirectStatus } from \"astro\";\n\nexport interface UserI18nConfig {\n /**\n * glob pattern(s) to include\n * @defaultValue [\"pages\\/\\*\\*\\/\\*\"]\n */\n include?: string | string[];\n /**\n * glob pattern(s) to exclude\n * @defaultValue [\"pages\\/api\\/\\*\\*\\/\\*\"]\n */\n exclude?: string | string[];\n /**\n * all language locales\n *\n * @example\n * ```ts\n * const locales = {\n * en: \"en-US\", // the `defaultLocale` value must present in `locales` keys\n * es: \"es-ES\",\n * fr: \"fr-CA\",\n * };\n * ```\n */\n locales: Record<string, string>;\n /**\n * the default language locale\n *\n * the `defaultLocale` value must present in `locales` keys\n *\n * @example \"en\"\n */\n defaultLocale: string;\n /**\n * given the defaultLocale \"en\", whether\n * \"/en/about\" redirects to \"/about\"\n *\n * whether the url with the default locale\n * should redirect to the url without the locale\n *\n * if a status is given, such as 302,\n * redirectDefaultLocale will be truthy,\n * and all redirects will use that status\n *\n * @defaultValue true\n */\n redirectDefaultLocale?: boolean | ValidRedirectStatus;\n}\n\nexport type VirtualAstroi18nautConfig = Pick<\n UserI18nConfig,\n \"defaultLocale\" | \"locales\" | \"redirectDefaultLocale\"\n> & {\n BASE_URL: string;\n trailingSlash: AstroConfig[\"trailingSlash\"];\n build: {\n format: AstroConfig[\"build\"][\"format\"];\n };\n};\n\nexport type UserFilterSitemapByDefaultLocaleConfig = Pick<\n UserI18nConfig,\n \"defaultLocale\"\n> & {\n base?: string;\n};\n\nexport type I18nConfig = Required<UserI18nConfig>;\n\n// opposite of RequiredFieldsOnly https://stackoverflow.com/a/68261391\ntype PartialFieldsOnly<T> = {\n [K in keyof T as T[K] extends Required<T>[K] ? never : K]: T[K];\n};\n\n/**\n * The default values for I18nConfig\n */\nexport const defaultI18nConfig: Required<PartialFieldsOnly<UserI18nConfig>> = {\n include: [\"pages/**/*\"],\n exclude: [\"pages/api/**/*\"],\n redirectDefaultLocale: 308,\n};\n","import type { AstroConfig, AstroIntegrationLogger } from \"astro\";\nimport type { UpdateConfig } from \"./UpdateConfig\";\n\nexport function ensureValidTrailingSlashAndFormat(\n config: AstroConfig,\n updateConfig: UpdateConfig,\n logger: AstroIntegrationLogger\n) {\n if (config.trailingSlash === \"ignore\" && config.output === \"static\") {\n logger.warn(\n `avoid setting config.trailingSlash = \"ignore\" when config.output = \"static\"`\n );\n logger.warn(\n `config.trailingSlash = \"always\" && config.build.format = \"directory\"`\n );\n logger.warn(\n `config.trailingSlash = \"never\" && config.build.format = \"file\"`\n );\n logger.warn(`setting config.trailingSlash = \"${config.trailingSlash}\"`);\n updateConfig({\n trailingSlash: config.build.format === \"directory\" ? \"always\" : \"never\",\n });\n }\n if (config.trailingSlash === \"always\" && config.build.format === \"file\") {\n logger.warn(\n `config.trailingSlash = \"always\" must always be used with config.build.format = \"directory\"`\n );\n logger.warn(`setting config.build.format = \"directory\"`);\n updateConfig({\n build: {\n format: \"directory\",\n },\n });\n }\n if (config.trailingSlash === \"never\" && config.build.format === \"directory\") {\n logger.warn(\n `config.trailingSlash = \"never\" must always be used with config.build.format = \"file\"`\n );\n logger.warn(`setting config.build.format = \"file\"`);\n updateConfig({\n build: {\n format: \"file\",\n },\n });\n }\n}\n","import type { Plugin } from \"vite\";\n\n// documentation https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention\n\nexport function createVirtualPlugin(\n virtualModuleId: string,\n json: any\n): Plugin {\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\n\n return {\n name: \"vite-plugin:\" + virtualModuleId, // required, will show up in warnings and errors\n // @ts-expect-error\n resolveId(id) {\n if (id === virtualModuleId) {\n return resolvedVirtualModuleId;\n }\n },\n // @ts-expect-error\n load(id) {\n if (id === resolvedVirtualModuleId) {\n return `export default ${JSON.stringify(json)}`;\n }\n },\n };\n}\n","import type { AstroConfig } from \"astro\";\nimport { UpdateConfig } from \"./UpdateConfig\";\nimport type {\n I18nConfig,\n VirtualAstroi18nautConfig,\n} from \"../../shared/configs\";\nimport { createVirtualPlugin } from \"./createVirtualPlugin\";\n\nexport function createVirtualModules(\n config: AstroConfig,\n updateConfig: UpdateConfig,\n i18nConfig: I18nConfig\n): void {\n const virtualAstroi18nautConfig: VirtualAstroi18nautConfig = {\n defaultLocale: i18nConfig.defaultLocale,\n locales: i18nConfig.locales,\n redirectDefaultLocale: i18nConfig.redirectDefaultLocale,\n BASE_URL: getBaseUrl(config),\n trailingSlash: config.trailingSlash,\n build: {\n format: config.build.format,\n },\n };\n\n const virtualPlugin = createVirtualPlugin(\n \"virtual:astro-i18n-aut\",\n virtualAstroi18nautConfig\n );\n\n updateConfig({\n vite: {\n plugins: [virtualPlugin],\n // worker plugins are separate https://github.com/vitejs/vite/issues/8520\n worker: {\n plugins: () => [virtualPlugin],\n },\n // exclude virtual modules from optimizeDeps https://github.com/storybookjs/builder-vite/issues/311#issuecomment-1092577628\n optimizeDeps: {\n exclude: [\"virtual:astro-i18n-aut\"],\n },\n },\n });\n}\n\nfunction getBaseUrl(config: AstroConfig): string {\n let base = config.base;\n\n // astro `BASE_URL` always starts with `/` and respects `config.trailingSlash`\n if (base[0] !== \"/\") {\n base = \"/\" + base;\n }\n\n // https://docs.astro.build/en/reference/configuration-reference/#base\n // The value of import.meta.env.BASE_URL respects your trailingSlash config\n // and will include a trailing slash\n // if you explicitly include one\n // or if trailingSlash: \"always\" is set.\n // If trailingSlash: \"never\" is set,\n // BASE_URL will not include a trailing slash,\n // even if base includes one.\n if (config.trailingSlash === \"always\") {\n if (base.at(-1) !== \"/\") {\n base = base + \"/\";\n }\n } else if (config.trailingSlash === \"never\") {\n if (base !== \"/\" && base.at(-1) === \"/\") {\n base = base.slice(0, -1);\n }\n }\n\n return base;\n}\n","import type { AstroConfig, AstroIntegrationLogger } from \"astro\";\nimport type { UpdateConfig } from \"./UpdateConfig\";\nimport type { I18nConfig } from \"../../shared/configs\";\nimport { ensureValidTrailingSlashAndFormat } from \"./ensureValidTrailingSlashAndFormat\";\nimport { createVirtualModules } from \"./createVirtualModules\";\n\nexport async function ensureValidConfigs(\n config: AstroConfig,\n updateConfig: UpdateConfig,\n i18nConfig: I18nConfig,\n logger: AstroIntegrationLogger\n) {\n ensureValidTrailingSlashAndFormat(config, updateConfig, logger);\n createVirtualModules(config, updateConfig, i18nConfig);\n}\n","export function removeHtmlExtension(url: string) {\n return url.endsWith(\".html\") ? url.slice(0, -\".html\".length) : url;\n}\n","import { removeHtmlExtension } from \"../edge-runtime/removeHtmlExtension\";\nimport type { UserFilterSitemapByDefaultLocaleConfig } from \"./configs\";\n\n// sitemap filter https://docs.astro.build/en/guides/integrations-guide/sitemap/#filter\nexport function filterSitemapByDefaultLocale({\n defaultLocale,\n base: baseUrl = \"/\",\n}: UserFilterSitemapByDefaultLocaleConfig) {\n // astro `BASE_URL` always starts with `/` and respects `config.trailingSlash`\n if (baseUrl[0] !== \"/\") {\n baseUrl = \"/\" + baseUrl;\n }\n\n const baseUrlWithoutTrailingSlash =\n baseUrl.at(-1) === \"/\" ? baseUrl.slice(0, -1) : baseUrl;\n\n return function filter(page: string) {\n const pathName = new URL(page).pathname;\n const pathNameWithoutHtmlExtension = removeHtmlExtension(pathName);\n\n // remove baseUrlWithoutTrailingSlash from pathNameWithoutBaseUrl\n let pathNameWithoutBaseUrl =\n baseUrl === \"/\"\n ? pathNameWithoutHtmlExtension\n : pathNameWithoutHtmlExtension.replace(baseUrlWithoutTrailingSlash, \"\");\n\n const pathNameWithoutBaseUrlStartsWithDefaultLocale =\n pathNameWithoutBaseUrl.slice(1, 3) === defaultLocale;\n\n if (\n pathNameWithoutBaseUrl.length === 3 &&\n pathNameWithoutBaseUrlStartsWithDefaultLocale\n ) {\n return false;\n }\n // catch all \"/en/**/*\" urls\n if (\n pathNameWithoutBaseUrl[0] === \"/\" &&\n pathNameWithoutBaseUrl[3] === \"/\" &&\n pathNameWithoutBaseUrlStartsWithDefaultLocale\n ) {\n return false;\n }\n\n return true;\n };\n}\n"],"mappings":"q+BAAA,iPCAA,qBAAiB,2BACjB,gBAA8B,eAE9B,iBAAe,gCACf,gBAAe,+BACf,aAAkB,4BCLX,SAAS,iCAAiCA,MAAc,CAC7D,OAAOA,MAAK,WAAW,GAAG,GAAKA,MAAK,CAAC,IAAM,IAAMA,MAAK,UAAU,CAAC,EAAIA,KACvE,CAFgB,4EC8ET,IAAM,kBAAiE,CAC5E,QAAS,CAAC,YAAY,EACtB,QAAS,CAAC,gBAAgB,EAC1B,sBAAuB,GACzB,EC/EO,SAAS,kCACd,OACA,aACA,OACA,CACI,OAAO,gBAAkB,UAAY,OAAO,SAAW,WACzD,OAAO,KACL,6EACF,EACA,OAAO,KACL,sEACF,EACA,OAAO,KACL,gEACF,EACA,OAAO,KAAK,mCAAmC,OAAO,aAAa,GAAG,EACtE,aAAa,CACX,cAAe,OAAO,MAAM,SAAW,YAAc,SAAW,OAClE,CAAC,GAEC,OAAO,gBAAkB,UAAY,OAAO,MAAM,SAAW,SAC/D,OAAO,KACL,4FACF,EACA,OAAO,KAAK,2CAA2C,EACvD,aAAa,CACX,MAAO,CACL,OAAQ,WACV,CACF,CAAC,GAEC,OAAO,gBAAkB,SAAW,OAAO,MAAM,SAAW,cAC9D,OAAO,KACL,sFACF,EACA,OAAO,KAAK,sCAAsC,EAClD,aAAa,CACX,MAAO,CACL,OAAQ,MACV,CACF,CAAC,EAEL,CA1CgB,8ECCT,SAAS,oBACd,gBACA,KACQ,CACR,IAAM,wBAA0B,KAAO,gBAEvC,MAAO,CACL,KAAM,eAAiB,gBAEvB,UAAU,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