@lukoweb/apitogo 0.1.53 → 0.1.55

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.
Files changed (47) hide show
  1. package/dist/cli/cli.js +686 -373
  2. package/dist/declarations/config/apitogo-config-core.d.ts +14 -4
  3. package/dist/declarations/config/landing-manifest.d.ts +76 -0
  4. package/dist/declarations/config/local-manifest.d.ts +91 -1
  5. package/dist/declarations/config/validators/ModulesSchema.d.ts +227 -0
  6. package/dist/declarations/config/validators/ZudokuConfig.d.ts +84 -2
  7. package/dist/declarations/lib/authentication/header-nav-filter.d.ts +4 -0
  8. package/dist/declarations/lib/authentication/providers/dev-portal-auth-pages.d.ts +15 -0
  9. package/dist/declarations/lib/authentication/providers/dev-portal-constants.d.ts +19 -1
  10. package/dist/declarations/lib/authentication/providers/dev-portal-utils.d.ts +5 -1
  11. package/dist/declarations/lib/authentication/providers/dev-portal.d.ts +5 -0
  12. package/dist/declarations/lib/components/HeaderAuthActions.d.ts +3 -0
  13. package/dist/declarations/lib/components/SiteTitle.d.ts +6 -0
  14. package/dist/declarations/lib/components/ThemeSwitch.d.ts +3 -1
  15. package/dist/declarations/lib/components/TopNavigation.d.ts +1 -1
  16. package/dist/declarations/lib/core/ZudokuContext.d.ts +1 -0
  17. package/dist/flat-config.d.ts +61 -1
  18. package/package.json +1 -1
  19. package/src/app/main.css +2 -2
  20. package/src/config/apitogo-config-core.ts +140 -11
  21. package/src/config/apitogo-config-loader.browser.ts +17 -0
  22. package/src/config/apitogo-config-loader.node.ts +28 -8
  23. package/src/config/build-apitogo-config.ts +13 -4
  24. package/src/config/landing-manifest.ts +11 -0
  25. package/src/config/landing-openapi-showcase.ts +115 -0
  26. package/src/config/loader.ts +17 -3
  27. package/src/config/local-manifest.ts +146 -11
  28. package/src/config/resolve-modules.ts +22 -1
  29. package/src/config/validators/ModulesSchema.ts +84 -0
  30. package/src/config/validators/ZudokuConfig.ts +26 -1
  31. package/src/lib/authentication/auth-header-nav.ts +5 -15
  32. package/src/lib/authentication/header-nav-filter.ts +36 -0
  33. package/src/lib/authentication/providers/dev-portal-auth-pages.tsx +499 -0
  34. package/src/lib/authentication/providers/dev-portal-constants.ts +15 -1
  35. package/src/lib/authentication/providers/dev-portal-utils.ts +128 -3
  36. package/src/lib/authentication/providers/dev-portal.tsx +51 -6
  37. package/src/lib/components/Header.tsx +49 -39
  38. package/src/lib/components/HeaderAuthActions.tsx +36 -0
  39. package/src/lib/components/HeaderNavigation.tsx +11 -9
  40. package/src/lib/components/MobileTopNavigation.tsx +43 -24
  41. package/src/lib/components/SiteTitle.tsx +20 -0
  42. package/src/lib/components/ThemeSwitch.tsx +36 -2
  43. package/src/lib/components/TopNavigation.tsx +20 -33
  44. package/src/lib/core/ZudokuContext.ts +1 -0
  45. package/src/vite/config.ts +21 -0
  46. package/src/vite/plugin-auth.ts +4 -1
  47. package/src/vite/plugin-config.ts +39 -4
@@ -71,6 +71,7 @@ type Site = Partial<{
71
71
  dir?: "ltr" | "rtl";
72
72
  showPoweredBy?: boolean;
73
73
  title?: string;
74
+ showTitleInHeader?: boolean;
74
75
  logo?: {
75
76
  src: {
76
77
  light: string;
@@ -21,6 +21,11 @@ import { ensurePagefindDevStub } from "./pagefind-dev-stub.js";
21
21
  import vitePlugin from "./plugin.js";
22
22
  import { getZuploSystemConfigurations } from "./zuplo.js";
23
23
 
24
+ const browserConfigLoaderPath = path.join(
25
+ getZudokuRootDir(),
26
+ "src/config/apitogo-config-loader.browser.ts",
27
+ );
28
+
24
29
  /** Resolved absolute public directory (Vite default: `<root>/public`). */
25
30
  const resolveMergedPublicDir = (
26
31
  rootDir: string,
@@ -114,6 +119,22 @@ export async function getViteConfig(
114
119
  "@mdx-js/react": import.meta.resolve("@mdx-js/react"),
115
120
  },
116
121
  },
122
+ environments: {
123
+ client: {
124
+ resolve: {
125
+ alias: {
126
+ [path.join(
127
+ getZudokuRootDir(),
128
+ "src/config/apitogo-config-loader.node.ts",
129
+ )]: browserConfigLoaderPath,
130
+ [path.join(
131
+ getZudokuRootDir(),
132
+ "src/config/apitogo-config-loader.node.js",
133
+ )]: browserConfigLoaderPath,
134
+ },
135
+ },
136
+ },
137
+ },
117
138
  define: {
118
139
  "process.env.ZUDOKU_VERSION": JSON.stringify(packageJson.version),
119
140
  "process.env.IS_ZUPLO": ZuploEnv.isZuplo,
@@ -16,7 +16,10 @@ const viteAuthPlugin = (): Plugin => {
16
16
  if (id === resolvedVirtualModuleId) {
17
17
  const config = getCurrentConfig();
18
18
 
19
- if (!config.authentication || config.__meta.mode === "standalone") {
19
+ if (
20
+ !config.authentication?.type ||
21
+ config.__meta.mode === "standalone"
22
+ ) {
20
23
  return `export const configuredAuthProvider = undefined;`;
21
24
  }
22
25
  // TODO: Validate that the authConfig.type is a valid authentication provider
@@ -1,18 +1,50 @@
1
+ import path from "node:path";
1
2
  import { normalizePath, type Plugin, type ResolvedConfig } from "vite";
3
+ import { getZudokuRootDir } from "../cli/common/package-json.js";
2
4
  import { getCurrentConfig, loadZudokuConfig } from "../config/loader.js";
5
+ import type { ConfigWithMeta } from "../config/loader.js";
3
6
 
4
7
  const virtualModuleId = "virtual:zudoku-config";
5
8
  const resolvedVirtualModuleId = `\0${virtualModuleId}`;
9
+ const browserConfigLoaderPath = path.join(
10
+ getZudokuRootDir(),
11
+ "src/config/apitogo-config-loader.browser.ts",
12
+ );
13
+
14
+ function serializeClientConfig(config: ConfigWithMeta): string {
15
+ const {
16
+ plugins: _plugins,
17
+ __meta: _meta,
18
+ __resolvedModules,
19
+ ...rest
20
+ } = config;
21
+
22
+ return JSON.stringify({ ...rest, __resolvedModules }, (_key, value) =>
23
+ typeof value === "function" ? undefined : value,
24
+ );
25
+ }
6
26
 
7
27
  const viteConfigPlugin = (): Plugin => {
8
28
  let viteConfig: ResolvedConfig;
9
29
 
10
30
  return {
11
31
  name: "zudoku-config-plugin",
12
- resolveId(id) {
13
- if (id !== virtualModuleId) return;
32
+ resolveId(source, _importer, options) {
33
+ if (source === virtualModuleId) {
34
+ return resolvedVirtualModuleId;
35
+ }
36
+
37
+ if (!source.includes("apitogo-config-loader.node")) {
38
+ return;
39
+ }
40
+
41
+ const isServerEnvironment =
42
+ options?.ssr === true ||
43
+ this.environment?.config?.consumer === "server";
14
44
 
15
- return resolvedVirtualModuleId;
45
+ if (!isServerEnvironment) {
46
+ return browserConfigLoaderPath;
47
+ }
16
48
  },
17
49
  configResolved(resolvedConfig) {
18
50
  viteConfig = resolvedConfig;
@@ -43,8 +75,11 @@ const viteConfigPlugin = (): Plugin => {
43
75
  import rawConfig from "${normalizePath(configPath)}";
44
76
  import { runPluginTransformConfig } from "@lukoweb/apitogo/plugins";
45
77
 
78
+ const embeddedConfig = ${serializeClientConfig(loadedConfig)};
79
+
46
80
  const config = await runPluginTransformConfig({
47
- ...rawConfig,
81
+ ...embeddedConfig,
82
+ plugins: rawConfig?.plugins ?? embeddedConfig.plugins ?? [],
48
83
  __meta: ${JSON.stringify(clientMeta)},
49
84
  });
50
85
  export default config;