feat(config): add shared browser cookie policy
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/cli",
|
||||
"version": "0.8.28",
|
||||
"version": "0.8.29",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -44,6 +44,7 @@ import {
|
||||
bundleCss,
|
||||
renderStyles,
|
||||
resolveThemeConfig,
|
||||
resolveBrowserCookieOptions,
|
||||
renderActiveThemeCss,
|
||||
renderThemeCss,
|
||||
renderThemeRuntime,
|
||||
@@ -493,7 +494,7 @@ export async function runBuild(appRoot: string): Promise<void> {
|
||||
console.log(`✓ Controllers: ${controllersPath}`);
|
||||
|
||||
// 1a) Theme tokens + client switcher (always emitted; built-in light/dark).
|
||||
const theme = resolveThemeConfig(config.theme);
|
||||
const theme = resolveThemeConfig(config.theme, config.cookies);
|
||||
const themeCss = renderThemeCss(theme);
|
||||
const themeJs = renderThemeRuntime(theme);
|
||||
writeFileSync(join(distDir, "theme.css"), themeCss, "utf8");
|
||||
@@ -541,8 +542,17 @@ export async function runBuild(appRoot: string): Promise<void> {
|
||||
|
||||
// 1a4) i18n: bake locale messages into the manifest (opt-in via app/locales).
|
||||
const localeMessages = loadLocales(join(appDir, "locales"));
|
||||
const i18nConfig = config.i18n
|
||||
? {
|
||||
...config.i18n,
|
||||
cookie: {
|
||||
...resolveBrowserCookieOptions(config.cookies, "language"),
|
||||
...(config.i18n.cookie ?? {}),
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const i18n = Object.keys(localeMessages).length
|
||||
? resolveI18n(localeMessages, config.i18n)
|
||||
? resolveI18n(localeMessages, i18nConfig)
|
||||
: undefined;
|
||||
if (i18n) console.log(`✓ i18n: ${i18n.langs.length} locales (default: ${i18n.default})`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user