finish CSS delivery and generated type remediation
This commit is contained in:
@@ -566,14 +566,17 @@ export async function runBuild(appRoot: string): Promise<void> {
|
||||
},
|
||||
config.styles,
|
||||
);
|
||||
const combinedSource = `${frameworkStyles}\n${css}`;
|
||||
// Theme tokens are request-selected and loaded separately. Keep only the
|
||||
// shared UI primitives with application CSS so the full theme/accent
|
||||
// matrix cannot leak back into the blocking stylesheet.
|
||||
const combinedSource = `${uiStyles}\n${css}`;
|
||||
const combinedInput = join(distDir, ".wrnexus-combined.css");
|
||||
writeFileSync(combinedInput, combinedSource, "utf8");
|
||||
const combinedCss = await bundleCss(combinedInput, "production");
|
||||
rmSync(combinedInput, { force: true });
|
||||
assetHash.update(combinedCss);
|
||||
// One blocking CSS request in production: tokens → UI → application CSS.
|
||||
// The standalone framework.css remains available for apps without global CSS.
|
||||
// One shared blocking request for UI + application CSS. The small active
|
||||
// theme stylesheet is selected from the request cookie and loaded first.
|
||||
writeFileSync(join(distDir, "styles.css"), combinedCss, "utf8");
|
||||
hasStyles = true;
|
||||
if (Buffer.byteLength(combinedCss, "utf8") <= INLINE_CSS_LIMIT_BYTES) {
|
||||
@@ -655,8 +658,8 @@ applyAuthzManifestEarly([${authzSetupEntries}]);
|
||||
const componentsLit = router.components
|
||||
.map((c) => {
|
||||
const v = `c${counter++}`;
|
||||
imports.push(`import * as ${v} from ${JSON.stringify(importPathFor(c.file))};`);
|
||||
return `{ name: ${JSON.stringify(c.name)}, mod: ${v} }`;
|
||||
imports.push(`import { render as ${v} } from ${JSON.stringify(importPathFor(c.file))};`);
|
||||
return `{ name: ${JSON.stringify(c.name)}, mod: { render: ${v} } }`;
|
||||
})
|
||||
.join(", ");
|
||||
console.log(`✓ Components: ${router.components.length}`);
|
||||
@@ -665,8 +668,8 @@ applyAuthzManifestEarly([${authzSetupEntries}]);
|
||||
const layoutsLit = router.layouts
|
||||
.map((l) => {
|
||||
const v = `c${counter++}`;
|
||||
imports.push(`import * as ${v} from ${JSON.stringify(importPathFor(l.file))};`);
|
||||
return `{ name: ${JSON.stringify(l.name)}, mod: ${v} }`;
|
||||
imports.push(`import { render as ${v} } from ${JSON.stringify(importPathFor(l.file))};`);
|
||||
return `{ name: ${JSON.stringify(l.name)}, mod: { render: ${v} } }`;
|
||||
})
|
||||
.join(", ");
|
||||
if (router.layouts.length) console.log(`✓ Layouts: ${router.layouts.length}`);
|
||||
@@ -748,7 +751,7 @@ await createProductionServer(
|
||||
realtime: ${config.realtime ? JSON.stringify(config.realtime) : "undefined"},
|
||||
publicDir: join(import.meta.dir, "public"),
|
||||
${hasStyles ? `stylesPath: join(import.meta.dir, "styles.css"),` : ""}
|
||||
${hasStyles ? `stylesIncludeFramework: true,` : ""}
|
||||
${hasStyles ? `stylesIncludeUi: true,` : ""}
|
||||
${inlineStyles ? `inlineStyles: ${JSON.stringify(inlineStyles)},` : ""}
|
||||
assetVersion: ${JSON.stringify(assetVersion)},
|
||||
clientRuntimes: ${JSON.stringify(emittedPluginAssets.runtimes)},
|
||||
|
||||
@@ -75,7 +75,7 @@ function writePluginArtifacts(root: string, contributions?: PluginContributions)
|
||||
});
|
||||
writeFileSync(
|
||||
join(typeDir, "wrnexus.plugins.generated.d.ts"),
|
||||
`// AUTO-GENERATED plugin type aggregation - do not edit.\n${references.join("\n")}\n`,
|
||||
`// AUTO-GENERATED plugin type aggregation - do not edit.\n${references.length > 0 ? `${references.join("\n")}\n` : ""}`,
|
||||
"utf8",
|
||||
);
|
||||
const docsDir = join(root, ".wrnexus", "documentation");
|
||||
@@ -182,7 +182,6 @@ export function generateApplicationTypes(
|
||||
.map((name) => join(root, name))
|
||||
.find(existsSync);
|
||||
const code = `// AUTO-GENERATED by \`wrnexus generate types\` - do not edit.
|
||||
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
||||
declare namespace WRNexusGenerated {
|
||||
type ApiContract<T> = T extends import("@wrnexus/core").DefinedEndpoint<infer I, infer O>
|
||||
? { input: I; output: O }
|
||||
|
||||
Reference in New Issue
Block a user