@lukoweb/apitogo 0.1.54 → 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.
- package/dist/cli/cli.js +604 -376
- package/dist/declarations/config/landing-manifest.d.ts +76 -0
- package/dist/declarations/config/local-manifest.d.ts +76 -0
- package/dist/declarations/config/validators/ModulesSchema.d.ts +227 -0
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +50 -0
- package/dist/declarations/lib/authentication/header-nav-filter.d.ts +4 -0
- package/dist/declarations/lib/authentication/providers/dev-portal-auth-pages.d.ts +5 -5
- package/dist/declarations/lib/components/HeaderAuthActions.d.ts +3 -0
- package/dist/declarations/lib/components/SiteTitle.d.ts +6 -0
- package/dist/declarations/lib/components/ThemeSwitch.d.ts +3 -1
- package/dist/declarations/lib/components/TopNavigation.d.ts +1 -1
- package/dist/declarations/lib/core/ZudokuContext.d.ts +1 -0
- package/dist/flat-config.d.ts +44 -0
- package/package.json +1 -1
- package/src/app/main.css +2 -2
- package/src/config/apitogo-config-core.ts +13 -0
- package/src/config/apitogo-config-loader.browser.ts +17 -0
- package/src/config/build-apitogo-config.ts +13 -4
- package/src/config/landing-manifest.ts +11 -0
- package/src/config/landing-openapi-showcase.ts +115 -0
- package/src/config/loader.ts +17 -3
- package/src/config/local-manifest.ts +114 -10
- package/src/config/resolve-modules.ts +22 -1
- package/src/config/validators/ModulesSchema.ts +84 -0
- package/src/config/validators/ZudokuConfig.ts +1 -0
- package/src/lib/authentication/auth-header-nav.ts +5 -15
- package/src/lib/authentication/header-nav-filter.ts +36 -0
- package/src/lib/authentication/providers/dev-portal-auth-pages.tsx +95 -35
- package/src/lib/authentication/providers/dev-portal-utils.ts +17 -7
- package/src/lib/authentication/providers/dev-portal.tsx +18 -8
- package/src/lib/components/Header.tsx +49 -39
- package/src/lib/components/HeaderAuthActions.tsx +36 -0
- package/src/lib/components/HeaderNavigation.tsx +11 -9
- package/src/lib/components/MobileTopNavigation.tsx +43 -24
- package/src/lib/components/SiteTitle.tsx +20 -0
- package/src/lib/components/ThemeSwitch.tsx +36 -2
- package/src/lib/components/TopNavigation.tsx +20 -33
- package/src/lib/core/ZudokuContext.ts +1 -0
- package/src/vite/config.ts +21 -0
- package/src/vite/plugin-auth.ts +4 -1
- package/src/vite/plugin-config.ts +39 -4
package/dist/cli/cli.js
CHANGED
|
@@ -64,39 +64,25 @@ function applyAuthenticationHeaderNav(config2) {
|
|
|
64
64
|
}
|
|
65
65
|
const authNavEnabled = config2.__meta?.authenticationEnabled === true;
|
|
66
66
|
const navigation = config2.header?.navigation ?? [];
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
if (filtered.length === navigation.length) {
|
|
70
|
-
return config2;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
...config2,
|
|
74
|
-
header: {
|
|
75
|
-
...config2.header,
|
|
76
|
-
navigation: filtered
|
|
77
|
-
}
|
|
78
|
-
};
|
|
67
|
+
if (authNavEnabled) {
|
|
68
|
+
return config2;
|
|
79
69
|
}
|
|
80
|
-
|
|
70
|
+
const filtered = withoutLoginNavigation(navigation);
|
|
71
|
+
if (filtered.length === navigation.length) {
|
|
81
72
|
return config2;
|
|
82
73
|
}
|
|
83
74
|
return {
|
|
84
75
|
...config2,
|
|
85
76
|
header: {
|
|
86
77
|
...config2.header,
|
|
87
|
-
navigation:
|
|
78
|
+
navigation: filtered
|
|
88
79
|
}
|
|
89
80
|
};
|
|
90
81
|
}
|
|
91
|
-
var LOGIN_NAV_PATH
|
|
82
|
+
var LOGIN_NAV_PATH;
|
|
92
83
|
var init_auth_header_nav = __esm({
|
|
93
84
|
"src/lib/authentication/auth-header-nav.ts"() {
|
|
94
85
|
LOGIN_NAV_PATH = "/signin";
|
|
95
|
-
LOGIN_HEADER_NAV_ITEM = {
|
|
96
|
-
label: "Login",
|
|
97
|
-
to: LOGIN_NAV_PATH,
|
|
98
|
-
display: "anon"
|
|
99
|
-
};
|
|
100
86
|
}
|
|
101
87
|
});
|
|
102
88
|
|
|
@@ -508,6 +494,17 @@ function deriveManifestFields(config2) {
|
|
|
508
494
|
}
|
|
509
495
|
continue;
|
|
510
496
|
}
|
|
497
|
+
if (key === "landing") {
|
|
498
|
+
const modules = asRecord(normalized.modules);
|
|
499
|
+
const landing = asRecord(modules?.landing);
|
|
500
|
+
if (landing?.content || landing?.enabled !== void 0) {
|
|
501
|
+
manifest.landing = {
|
|
502
|
+
enabled: typeof landing.enabled === "boolean" ? landing.enabled : void 0,
|
|
503
|
+
content: landing.content
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
511
508
|
if (normalized[key] !== void 0) {
|
|
512
509
|
manifest[key] = normalized[key];
|
|
513
510
|
}
|
|
@@ -525,7 +522,28 @@ function extractManifest(config2) {
|
|
|
525
522
|
const manifest = deriveManifestFields(config2);
|
|
526
523
|
return Object.keys(manifest).length > 0 ? manifest : null;
|
|
527
524
|
}
|
|
528
|
-
|
|
525
|
+
function extractSiteConfig(config2) {
|
|
526
|
+
if (!config2 || typeof config2 !== "object") {
|
|
527
|
+
return {};
|
|
528
|
+
}
|
|
529
|
+
const normalized = normalizeApitogoConfig(config2);
|
|
530
|
+
const siteConfig = {};
|
|
531
|
+
for (const key of SITE_CONFIG_KEYS) {
|
|
532
|
+
if (normalized[key] !== void 0) {
|
|
533
|
+
siteConfig[key] = normalized[key];
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (normalized.authentication !== void 0) {
|
|
537
|
+
siteConfig.authentication = normalized.authentication;
|
|
538
|
+
}
|
|
539
|
+
const modulesDocs = asRecord(asRecord(normalized.modules)?.docs);
|
|
540
|
+
if (modulesDocs) {
|
|
541
|
+
const { enabled: _enabled, ...docsConfig } = modulesDocs;
|
|
542
|
+
siteConfig.docs = docsConfig;
|
|
543
|
+
}
|
|
544
|
+
return siteConfig;
|
|
545
|
+
}
|
|
546
|
+
var APITOGO_CONFIG_FILENAME, ENV_PREFIX, DERIVED_MANIFEST_KEYS, SITE_CONFIG_KEYS;
|
|
529
547
|
var init_apitogo_config_core = __esm({
|
|
530
548
|
"src/config/apitogo-config-core.ts"() {
|
|
531
549
|
APITOGO_CONFIG_FILENAME = "apitogo.config.json";
|
|
@@ -538,7 +556,25 @@ var init_apitogo_config_core = __esm({
|
|
|
538
556
|
"plans",
|
|
539
557
|
"backend",
|
|
540
558
|
"gateway",
|
|
541
|
-
"projectId"
|
|
559
|
+
"projectId",
|
|
560
|
+
"landing"
|
|
561
|
+
];
|
|
562
|
+
SITE_CONFIG_KEYS = [
|
|
563
|
+
"site",
|
|
564
|
+
"metadata",
|
|
565
|
+
"modules",
|
|
566
|
+
"navigation",
|
|
567
|
+
"apis",
|
|
568
|
+
"redirects",
|
|
569
|
+
"theme",
|
|
570
|
+
"search",
|
|
571
|
+
"llms",
|
|
572
|
+
"protectedRoutes",
|
|
573
|
+
"slots",
|
|
574
|
+
"mdx",
|
|
575
|
+
"catalogs",
|
|
576
|
+
"versions",
|
|
577
|
+
"options"
|
|
542
578
|
];
|
|
543
579
|
}
|
|
544
580
|
});
|
|
@@ -571,18 +607,277 @@ var init_apitogo_config_loader = __esm({
|
|
|
571
607
|
}
|
|
572
608
|
});
|
|
573
609
|
|
|
610
|
+
// src/config/build-apitogo-config.ts
|
|
611
|
+
function mergeOptionalRecord(...records) {
|
|
612
|
+
const merged = Object.assign({}, ...records.filter(Boolean));
|
|
613
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
614
|
+
}
|
|
615
|
+
function buildApitogoConfig({
|
|
616
|
+
plugins,
|
|
617
|
+
plans: _legacyPlans,
|
|
618
|
+
...jsonOverrides
|
|
619
|
+
} = {}) {
|
|
620
|
+
const jsonConfig = normalizeApitogoConfig({
|
|
621
|
+
...jsonOverrides,
|
|
622
|
+
..._legacyPlans !== void 0 ? { plans: _legacyPlans } : {}
|
|
623
|
+
});
|
|
624
|
+
const siteConfig = extractSiteConfig(jsonConfig);
|
|
625
|
+
const { plans: _rootPlans, ...restOverrides } = jsonOverrides;
|
|
626
|
+
const authentication = mergeOptionalRecord(
|
|
627
|
+
siteConfig.authentication,
|
|
628
|
+
jsonOverrides.authentication
|
|
629
|
+
);
|
|
630
|
+
return {
|
|
631
|
+
...siteConfig,
|
|
632
|
+
...restOverrides,
|
|
633
|
+
plugins,
|
|
634
|
+
...authentication ? { authentication } : {},
|
|
635
|
+
site: {
|
|
636
|
+
...siteConfig.site,
|
|
637
|
+
...jsonOverrides.site
|
|
638
|
+
},
|
|
639
|
+
metadata: {
|
|
640
|
+
...siteConfig.metadata,
|
|
641
|
+
...jsonOverrides.metadata
|
|
642
|
+
},
|
|
643
|
+
docs: {
|
|
644
|
+
...siteConfig.docs,
|
|
645
|
+
...jsonOverrides.docs
|
|
646
|
+
},
|
|
647
|
+
modules: {
|
|
648
|
+
...jsonConfig.modules,
|
|
649
|
+
...jsonOverrides.modules
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
var init_build_apitogo_config = __esm({
|
|
654
|
+
"src/config/build-apitogo-config.ts"() {
|
|
655
|
+
init_apitogo_config_core();
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
|
|
574
659
|
// src/config/file-exists.ts
|
|
575
660
|
import { stat } from "node:fs/promises";
|
|
576
661
|
var fileExists;
|
|
577
662
|
var init_file_exists = __esm({
|
|
578
663
|
"src/config/file-exists.ts"() {
|
|
579
|
-
fileExists = (
|
|
664
|
+
fileExists = (path40) => stat(path40).then(() => true).catch(() => false);
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
// src/config/validators/ModulesSchema.ts
|
|
669
|
+
import { z as z3 } from "zod";
|
|
670
|
+
var ModuleToggleSchema, DocsModuleSchema, LandingLinkSchema, LandingFeatureSchema, LandingCodeExampleSchema, LandingHeroSchema, LandingTickerItemSchema, LandingTickerSchema, LandingTrustSchema, LandingApiShowcaseItemSchema, LandingApiShowcaseSchema, LandingPricingCtaSchema, LandingContentSchema, DashboardContentSchema, ProfileContentSchema, PlanTierSchema, PlansContentSchema, SubmodulePageFields, LandingModuleSchema, UserManagementModuleSchema, ApiKeysModuleSchema, PlanCatalogItemSchema, PlansModuleSchema, DashboardModuleSchema, UserPanelModuleSchema, ModulesSchema;
|
|
671
|
+
var init_ModulesSchema = __esm({
|
|
672
|
+
"src/config/validators/ModulesSchema.ts"() {
|
|
673
|
+
ModuleToggleSchema = z3.object({
|
|
674
|
+
enabled: z3.boolean().describe("Whether this module is active in the application.")
|
|
675
|
+
}).partial();
|
|
676
|
+
DocsModuleSchema = ModuleToggleSchema.extend({
|
|
677
|
+
files: z3.union([z3.string(), z3.array(z3.string())]).optional(),
|
|
678
|
+
publishMarkdown: z3.boolean().optional(),
|
|
679
|
+
defaultOptions: z3.object({
|
|
680
|
+
toc: z3.boolean(),
|
|
681
|
+
copyPage: z3.boolean().optional(),
|
|
682
|
+
disablePager: z3.boolean(),
|
|
683
|
+
showLastModified: z3.boolean(),
|
|
684
|
+
suggestEdit: z3.object({
|
|
685
|
+
url: z3.string(),
|
|
686
|
+
text: z3.string().optional()
|
|
687
|
+
}).optional()
|
|
688
|
+
}).partial().optional(),
|
|
689
|
+
llms: z3.object({
|
|
690
|
+
llmsTxt: z3.boolean().optional(),
|
|
691
|
+
llmsTxtFull: z3.boolean().optional(),
|
|
692
|
+
includeProtected: z3.boolean().optional()
|
|
693
|
+
}).optional()
|
|
694
|
+
});
|
|
695
|
+
LandingLinkSchema = z3.object({
|
|
696
|
+
label: z3.string(),
|
|
697
|
+
href: z3.string()
|
|
698
|
+
});
|
|
699
|
+
LandingFeatureSchema = z3.object({
|
|
700
|
+
title: z3.string(),
|
|
701
|
+
description: z3.string(),
|
|
702
|
+
icon: z3.string().optional()
|
|
703
|
+
});
|
|
704
|
+
LandingCodeExampleSchema = z3.object({
|
|
705
|
+
filename: z3.string().optional(),
|
|
706
|
+
language: z3.string().optional(),
|
|
707
|
+
code: z3.string()
|
|
708
|
+
}).optional();
|
|
709
|
+
LandingHeroSchema = z3.object({
|
|
710
|
+
title: z3.string().optional(),
|
|
711
|
+
subtitle: z3.string().optional(),
|
|
712
|
+
description: z3.string().optional(),
|
|
713
|
+
badge: z3.string().optional(),
|
|
714
|
+
highlights: z3.array(z3.string()).optional(),
|
|
715
|
+
codeExample: LandingCodeExampleSchema
|
|
716
|
+
}).optional();
|
|
717
|
+
LandingTickerItemSchema = z3.object({
|
|
718
|
+
label: z3.string(),
|
|
719
|
+
value: z3.string(),
|
|
720
|
+
change: z3.string().optional()
|
|
721
|
+
});
|
|
722
|
+
LandingTickerSchema = z3.object({
|
|
723
|
+
enabled: z3.boolean().optional(),
|
|
724
|
+
items: z3.array(LandingTickerItemSchema).optional()
|
|
725
|
+
}).optional();
|
|
726
|
+
LandingTrustSchema = z3.object({
|
|
727
|
+
enabled: z3.boolean().optional(),
|
|
728
|
+
title: z3.string().optional(),
|
|
729
|
+
logos: z3.array(z3.string()).optional()
|
|
730
|
+
}).optional();
|
|
731
|
+
LandingApiShowcaseItemSchema = z3.object({
|
|
732
|
+
name: z3.string(),
|
|
733
|
+
path: z3.string(),
|
|
734
|
+
icon: z3.string().optional(),
|
|
735
|
+
latency: z3.string().optional(),
|
|
736
|
+
summary: z3.string().optional()
|
|
737
|
+
});
|
|
738
|
+
LandingApiShowcaseSchema = z3.object({
|
|
739
|
+
enabled: z3.boolean().optional(),
|
|
740
|
+
title: z3.string().optional(),
|
|
741
|
+
subtitle: z3.string().optional(),
|
|
742
|
+
browseAllHref: z3.string().optional(),
|
|
743
|
+
browseAllLabel: z3.string().optional(),
|
|
744
|
+
autoFromOpenApi: z3.boolean().optional(),
|
|
745
|
+
items: z3.array(LandingApiShowcaseItemSchema).optional()
|
|
746
|
+
}).optional();
|
|
747
|
+
LandingPricingCtaSchema = z3.object({
|
|
748
|
+
enabled: z3.boolean().optional(),
|
|
749
|
+
title: z3.string().optional(),
|
|
750
|
+
description: z3.string().optional(),
|
|
751
|
+
primaryAction: LandingLinkSchema.optional(),
|
|
752
|
+
secondaryAction: LandingLinkSchema.optional()
|
|
753
|
+
}).optional();
|
|
754
|
+
LandingContentSchema = z3.object({
|
|
755
|
+
hero: LandingHeroSchema,
|
|
756
|
+
features: z3.array(LandingFeatureSchema).optional(),
|
|
757
|
+
primaryAction: LandingLinkSchema.optional(),
|
|
758
|
+
secondaryAction: LandingLinkSchema.optional(),
|
|
759
|
+
ticker: LandingTickerSchema,
|
|
760
|
+
trust: LandingTrustSchema,
|
|
761
|
+
apiShowcase: LandingApiShowcaseSchema,
|
|
762
|
+
pricingCta: LandingPricingCtaSchema,
|
|
763
|
+
showPoweredBy: z3.boolean().optional()
|
|
764
|
+
}).optional();
|
|
765
|
+
DashboardContentSchema = z3.object({
|
|
766
|
+
title: z3.string().optional(),
|
|
767
|
+
subtitle: z3.string().optional(),
|
|
768
|
+
description: z3.string().optional(),
|
|
769
|
+
quickLinks: z3.array(LandingLinkSchema).optional()
|
|
770
|
+
}).optional();
|
|
771
|
+
ProfileContentSchema = z3.object({
|
|
772
|
+
title: z3.string().optional(),
|
|
773
|
+
description: z3.string().optional()
|
|
774
|
+
}).optional();
|
|
775
|
+
PlanTierSchema = z3.object({
|
|
776
|
+
name: z3.string(),
|
|
777
|
+
price: z3.string().optional(),
|
|
778
|
+
description: z3.string().optional()
|
|
779
|
+
});
|
|
780
|
+
PlansContentSchema = z3.object({
|
|
781
|
+
title: z3.string().optional(),
|
|
782
|
+
description: z3.string().optional(),
|
|
783
|
+
tiers: z3.array(PlanTierSchema).optional()
|
|
784
|
+
}).optional();
|
|
785
|
+
SubmodulePageFields = {
|
|
786
|
+
page: z3.string().optional().describe(
|
|
787
|
+
"Path to a custom page component file, relative to the project root."
|
|
788
|
+
),
|
|
789
|
+
component: z3.custom().optional().describe("Custom React component for this sub-module page.")
|
|
790
|
+
};
|
|
791
|
+
LandingModuleSchema = ModuleToggleSchema.extend({
|
|
792
|
+
path: z3.string().default("/").describe("Route path for the landing page."),
|
|
793
|
+
component: z3.custom().optional().describe("Custom React component for the landing page."),
|
|
794
|
+
page: z3.string().optional().describe(
|
|
795
|
+
"Path to a custom landing page component file, relative to the project root."
|
|
796
|
+
),
|
|
797
|
+
layout: z3.enum(["default", "landing", "none"]).default("landing").describe(
|
|
798
|
+
"Layout wrapper: landing (header + footer), default (docs layout), or none."
|
|
799
|
+
),
|
|
800
|
+
content: LandingContentSchema.describe(
|
|
801
|
+
"Default landing page content when no custom component is provided."
|
|
802
|
+
)
|
|
803
|
+
});
|
|
804
|
+
UserManagementModuleSchema = ModuleToggleSchema.extend({
|
|
805
|
+
routes: z3.object({
|
|
806
|
+
login: z3.string().default("/signin"),
|
|
807
|
+
register: z3.string().default("/signup"),
|
|
808
|
+
profile: z3.string().default("profile"),
|
|
809
|
+
logout: z3.string().default("/signout")
|
|
810
|
+
}).partial().optional(),
|
|
811
|
+
page: SubmodulePageFields.page,
|
|
812
|
+
component: SubmodulePageFields.component,
|
|
813
|
+
content: ProfileContentSchema.describe(
|
|
814
|
+
"Default profile page content when no custom component is provided."
|
|
815
|
+
)
|
|
816
|
+
});
|
|
817
|
+
ApiKeysModuleSchema = ModuleToggleSchema.extend({
|
|
818
|
+
path: z3.string().default("settings/api-keys").describe("Route path for API key management.")
|
|
819
|
+
});
|
|
820
|
+
PlanCatalogItemSchema = z3.object({
|
|
821
|
+
sku: z3.string(),
|
|
822
|
+
displayName: z3.string(),
|
|
823
|
+
priceAmount: z3.number().default(0),
|
|
824
|
+
priceCurrency: z3.string().optional(),
|
|
825
|
+
billingPeriod: z3.string().optional(),
|
|
826
|
+
limitsJson: z3.string().optional(),
|
|
827
|
+
includedActionKeys: z3.array(z3.string()).optional()
|
|
828
|
+
});
|
|
829
|
+
PlansModuleSchema = ModuleToggleSchema.extend({
|
|
830
|
+
path: z3.string().default("plans").describe("Route path for plans and subscription management."),
|
|
831
|
+
page: SubmodulePageFields.page,
|
|
832
|
+
component: SubmodulePageFields.component,
|
|
833
|
+
content: PlansContentSchema.describe(
|
|
834
|
+
"Default plans page content when no custom component is provided."
|
|
835
|
+
),
|
|
836
|
+
items: z3.array(PlanCatalogItemSchema).optional().describe(
|
|
837
|
+
"Gateway plan catalog for /pricing preview and publish (canonical storage)."
|
|
838
|
+
)
|
|
839
|
+
});
|
|
840
|
+
DashboardModuleSchema = ModuleToggleSchema.extend({
|
|
841
|
+
path: z3.string().default("dashboard").describe("Route path for the user dashboard."),
|
|
842
|
+
page: SubmodulePageFields.page,
|
|
843
|
+
component: SubmodulePageFields.component,
|
|
844
|
+
content: DashboardContentSchema.describe(
|
|
845
|
+
"Default dashboard page content when no custom component is provided."
|
|
846
|
+
)
|
|
847
|
+
});
|
|
848
|
+
UserPanelModuleSchema = ModuleToggleSchema.extend({
|
|
849
|
+
basePath: z3.string().default("/account").describe("Base path prefix for user panel routes."),
|
|
850
|
+
dashboard: DashboardModuleSchema.optional(),
|
|
851
|
+
userManagement: UserManagementModuleSchema.optional(),
|
|
852
|
+
apiKeys: ApiKeysModuleSchema.optional(),
|
|
853
|
+
plans: PlansModuleSchema.optional()
|
|
854
|
+
});
|
|
855
|
+
ModulesSchema = z3.object({
|
|
856
|
+
docs: DocsModuleSchema.optional().describe(
|
|
857
|
+
"Documentation module \u2014 MD/MDX pages and OpenAPI reference."
|
|
858
|
+
),
|
|
859
|
+
landing: LandingModuleSchema.optional().describe(
|
|
860
|
+
"Landing page module \u2014 marketing or home page."
|
|
861
|
+
),
|
|
862
|
+
userPanel: UserPanelModuleSchema.optional().describe(
|
|
863
|
+
"User panel module \u2014 authenticated user area with sub-modules."
|
|
864
|
+
)
|
|
865
|
+
}).optional();
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// src/config/landing-manifest.ts
|
|
870
|
+
var LandingManifestContentSchema;
|
|
871
|
+
var init_landing_manifest = __esm({
|
|
872
|
+
"src/config/landing-manifest.ts"() {
|
|
873
|
+
init_ModulesSchema();
|
|
874
|
+
LandingManifestContentSchema = LandingContentSchema;
|
|
580
875
|
}
|
|
581
876
|
});
|
|
582
877
|
|
|
583
878
|
// src/config/local-manifest.ts
|
|
584
879
|
import path3 from "node:path";
|
|
585
|
-
import { z as
|
|
880
|
+
import { z as z4 } from "zod";
|
|
586
881
|
function isPricingEnabled(manifest) {
|
|
587
882
|
return manifest?.pricing?.enabled === true;
|
|
588
883
|
}
|
|
@@ -671,215 +966,69 @@ var BillingPeriodSchema, ManifestPlanInputSchema, DevPortalLocalManifestSchema;
|
|
|
671
966
|
var init_local_manifest = __esm({
|
|
672
967
|
"src/config/local-manifest.ts"() {
|
|
673
968
|
init_apitogo_config_loader();
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
969
|
+
init_landing_manifest();
|
|
970
|
+
BillingPeriodSchema = z4.enum(["month", "year", "monthly", "annual"]);
|
|
971
|
+
ManifestPlanInputSchema = z4.object({
|
|
972
|
+
sku: z4.string().min(1),
|
|
973
|
+
displayName: z4.string().min(1),
|
|
974
|
+
priceAmount: z4.number().default(0),
|
|
975
|
+
priceCurrency: z4.string().optional(),
|
|
680
976
|
billingPeriod: BillingPeriodSchema.optional(),
|
|
681
|
-
limitsJson:
|
|
682
|
-
includedActionKeys:
|
|
977
|
+
limitsJson: z4.string().optional(),
|
|
978
|
+
includedActionKeys: z4.array(z4.string()).optional()
|
|
683
979
|
});
|
|
684
|
-
DevPortalLocalManifestSchema =
|
|
685
|
-
siteName:
|
|
686
|
-
branding:
|
|
687
|
-
title:
|
|
688
|
-
logoUrl:
|
|
980
|
+
DevPortalLocalManifestSchema = z4.object({
|
|
981
|
+
siteName: z4.string().optional(),
|
|
982
|
+
branding: z4.object({
|
|
983
|
+
title: z4.string().optional(),
|
|
984
|
+
logoUrl: z4.string().optional()
|
|
689
985
|
}).optional(),
|
|
690
|
-
pricing:
|
|
691
|
-
enabled:
|
|
986
|
+
pricing: z4.object({
|
|
987
|
+
enabled: z4.boolean().optional()
|
|
692
988
|
}).optional(),
|
|
693
|
-
authentication:
|
|
694
|
-
enabled:
|
|
695
|
-
apiBaseUrl:
|
|
696
|
-
native:
|
|
697
|
-
enabled:
|
|
989
|
+
authentication: z4.object({
|
|
990
|
+
enabled: z4.boolean().optional(),
|
|
991
|
+
apiBaseUrl: z4.string().optional(),
|
|
992
|
+
native: z4.object({
|
|
993
|
+
enabled: z4.boolean().optional()
|
|
698
994
|
}).optional(),
|
|
699
|
-
email:
|
|
700
|
-
provider:
|
|
701
|
-
from:
|
|
995
|
+
email: z4.object({
|
|
996
|
+
provider: z4.string().optional(),
|
|
997
|
+
from: z4.string().optional()
|
|
702
998
|
}).optional(),
|
|
703
|
-
providers:
|
|
704
|
-
|
|
705
|
-
id:
|
|
706
|
-
displayName:
|
|
707
|
-
authority:
|
|
708
|
-
clientId:
|
|
709
|
-
scopes:
|
|
999
|
+
providers: z4.array(
|
|
1000
|
+
z4.object({
|
|
1001
|
+
id: z4.string().min(1),
|
|
1002
|
+
displayName: z4.string().optional(),
|
|
1003
|
+
authority: z4.string().optional(),
|
|
1004
|
+
clientId: z4.string().optional(),
|
|
1005
|
+
scopes: z4.string().optional()
|
|
710
1006
|
})
|
|
711
1007
|
).optional()
|
|
712
1008
|
}).optional(),
|
|
713
|
-
plans:
|
|
714
|
-
backend:
|
|
715
|
-
sourceDirectory:
|
|
716
|
-
publishDirectory:
|
|
717
|
-
openApiPath:
|
|
718
|
-
runtime:
|
|
719
|
-
runtimeVersion:
|
|
720
|
-
deployed:
|
|
1009
|
+
plans: z4.array(ManifestPlanInputSchema).optional(),
|
|
1010
|
+
backend: z4.object({
|
|
1011
|
+
sourceDirectory: z4.string().optional(),
|
|
1012
|
+
publishDirectory: z4.string().optional(),
|
|
1013
|
+
openApiPath: z4.string().optional(),
|
|
1014
|
+
runtime: z4.string().optional(),
|
|
1015
|
+
runtimeVersion: z4.string().optional(),
|
|
1016
|
+
deployed: z4.boolean().optional()
|
|
721
1017
|
}).optional(),
|
|
722
|
-
gateway:
|
|
723
|
-
authMode:
|
|
724
|
-
oidcMetadataUrl:
|
|
725
|
-
oidcAllowedIssuers:
|
|
726
|
-
oidcAudiences:
|
|
727
|
-
limitsJson:
|
|
728
|
-
publicHealthActionKey:
|
|
1018
|
+
gateway: z4.object({
|
|
1019
|
+
authMode: z4.enum(["platformManagedEntra", "bringYourOwnOidc"]).optional(),
|
|
1020
|
+
oidcMetadataUrl: z4.string().optional(),
|
|
1021
|
+
oidcAllowedIssuers: z4.array(z4.string()).optional(),
|
|
1022
|
+
oidcAudiences: z4.array(z4.string()).optional(),
|
|
1023
|
+
limitsJson: z4.string().optional(),
|
|
1024
|
+
publicHealthActionKey: z4.string().optional()
|
|
729
1025
|
}).optional(),
|
|
730
|
-
projectId:
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
// src/config/validators/ModulesSchema.ts
|
|
736
|
-
import { z as z4 } from "zod";
|
|
737
|
-
var ModuleToggleSchema, DocsModuleSchema, LandingLinkSchema, LandingFeatureSchema, LandingHeroSchema, LandingContentSchema, DashboardContentSchema, ProfileContentSchema, PlanTierSchema, PlansContentSchema, SubmodulePageFields, LandingModuleSchema, UserManagementModuleSchema, ApiKeysModuleSchema, PlanCatalogItemSchema, PlansModuleSchema, DashboardModuleSchema, UserPanelModuleSchema, ModulesSchema;
|
|
738
|
-
var init_ModulesSchema = __esm({
|
|
739
|
-
"src/config/validators/ModulesSchema.ts"() {
|
|
740
|
-
ModuleToggleSchema = z4.object({
|
|
741
|
-
enabled: z4.boolean().describe("Whether this module is active in the application.")
|
|
742
|
-
}).partial();
|
|
743
|
-
DocsModuleSchema = ModuleToggleSchema.extend({
|
|
744
|
-
files: z4.union([z4.string(), z4.array(z4.string())]).optional(),
|
|
745
|
-
publishMarkdown: z4.boolean().optional(),
|
|
746
|
-
defaultOptions: z4.object({
|
|
747
|
-
toc: z4.boolean(),
|
|
748
|
-
copyPage: z4.boolean().optional(),
|
|
749
|
-
disablePager: z4.boolean(),
|
|
750
|
-
showLastModified: z4.boolean(),
|
|
751
|
-
suggestEdit: z4.object({
|
|
752
|
-
url: z4.string(),
|
|
753
|
-
text: z4.string().optional()
|
|
754
|
-
}).optional()
|
|
755
|
-
}).partial().optional(),
|
|
756
|
-
llms: z4.object({
|
|
757
|
-
llmsTxt: z4.boolean().optional(),
|
|
758
|
-
llmsTxtFull: z4.boolean().optional(),
|
|
759
|
-
includeProtected: z4.boolean().optional()
|
|
1026
|
+
projectId: z4.string().optional(),
|
|
1027
|
+
landing: z4.object({
|
|
1028
|
+
enabled: z4.boolean().optional(),
|
|
1029
|
+
content: LandingManifestContentSchema
|
|
760
1030
|
}).optional()
|
|
761
1031
|
});
|
|
762
|
-
LandingLinkSchema = z4.object({
|
|
763
|
-
label: z4.string(),
|
|
764
|
-
href: z4.string()
|
|
765
|
-
});
|
|
766
|
-
LandingFeatureSchema = z4.object({
|
|
767
|
-
title: z4.string(),
|
|
768
|
-
description: z4.string()
|
|
769
|
-
});
|
|
770
|
-
LandingHeroSchema = z4.object({
|
|
771
|
-
title: z4.string().optional(),
|
|
772
|
-
subtitle: z4.string().optional(),
|
|
773
|
-
description: z4.string().optional()
|
|
774
|
-
}).optional();
|
|
775
|
-
LandingContentSchema = z4.object({
|
|
776
|
-
hero: LandingHeroSchema,
|
|
777
|
-
features: z4.array(LandingFeatureSchema).optional(),
|
|
778
|
-
primaryAction: LandingLinkSchema.optional(),
|
|
779
|
-
secondaryAction: LandingLinkSchema.optional(),
|
|
780
|
-
showPoweredBy: z4.boolean().optional()
|
|
781
|
-
}).optional();
|
|
782
|
-
DashboardContentSchema = z4.object({
|
|
783
|
-
title: z4.string().optional(),
|
|
784
|
-
subtitle: z4.string().optional(),
|
|
785
|
-
description: z4.string().optional(),
|
|
786
|
-
quickLinks: z4.array(LandingLinkSchema).optional()
|
|
787
|
-
}).optional();
|
|
788
|
-
ProfileContentSchema = z4.object({
|
|
789
|
-
title: z4.string().optional(),
|
|
790
|
-
description: z4.string().optional()
|
|
791
|
-
}).optional();
|
|
792
|
-
PlanTierSchema = z4.object({
|
|
793
|
-
name: z4.string(),
|
|
794
|
-
price: z4.string().optional(),
|
|
795
|
-
description: z4.string().optional()
|
|
796
|
-
});
|
|
797
|
-
PlansContentSchema = z4.object({
|
|
798
|
-
title: z4.string().optional(),
|
|
799
|
-
description: z4.string().optional(),
|
|
800
|
-
tiers: z4.array(PlanTierSchema).optional()
|
|
801
|
-
}).optional();
|
|
802
|
-
SubmodulePageFields = {
|
|
803
|
-
page: z4.string().optional().describe(
|
|
804
|
-
"Path to a custom page component file, relative to the project root."
|
|
805
|
-
),
|
|
806
|
-
component: z4.custom().optional().describe("Custom React component for this sub-module page.")
|
|
807
|
-
};
|
|
808
|
-
LandingModuleSchema = ModuleToggleSchema.extend({
|
|
809
|
-
path: z4.string().default("/").describe("Route path for the landing page."),
|
|
810
|
-
component: z4.custom().optional().describe("Custom React component for the landing page."),
|
|
811
|
-
page: z4.string().optional().describe(
|
|
812
|
-
"Path to a custom landing page component file, relative to the project root."
|
|
813
|
-
),
|
|
814
|
-
layout: z4.enum(["default", "landing", "none"]).default("landing").describe(
|
|
815
|
-
"Layout wrapper: landing (header + footer), default (docs layout), or none."
|
|
816
|
-
),
|
|
817
|
-
content: LandingContentSchema.describe(
|
|
818
|
-
"Default landing page content when no custom component is provided."
|
|
819
|
-
)
|
|
820
|
-
});
|
|
821
|
-
UserManagementModuleSchema = ModuleToggleSchema.extend({
|
|
822
|
-
routes: z4.object({
|
|
823
|
-
login: z4.string().default("/signin"),
|
|
824
|
-
register: z4.string().default("/signup"),
|
|
825
|
-
profile: z4.string().default("profile"),
|
|
826
|
-
logout: z4.string().default("/signout")
|
|
827
|
-
}).partial().optional(),
|
|
828
|
-
page: SubmodulePageFields.page,
|
|
829
|
-
component: SubmodulePageFields.component,
|
|
830
|
-
content: ProfileContentSchema.describe(
|
|
831
|
-
"Default profile page content when no custom component is provided."
|
|
832
|
-
)
|
|
833
|
-
});
|
|
834
|
-
ApiKeysModuleSchema = ModuleToggleSchema.extend({
|
|
835
|
-
path: z4.string().default("settings/api-keys").describe("Route path for API key management.")
|
|
836
|
-
});
|
|
837
|
-
PlanCatalogItemSchema = z4.object({
|
|
838
|
-
sku: z4.string(),
|
|
839
|
-
displayName: z4.string(),
|
|
840
|
-
priceAmount: z4.number().default(0),
|
|
841
|
-
priceCurrency: z4.string().optional(),
|
|
842
|
-
billingPeriod: z4.string().optional(),
|
|
843
|
-
limitsJson: z4.string().optional(),
|
|
844
|
-
includedActionKeys: z4.array(z4.string()).optional()
|
|
845
|
-
});
|
|
846
|
-
PlansModuleSchema = ModuleToggleSchema.extend({
|
|
847
|
-
path: z4.string().default("plans").describe("Route path for plans and subscription management."),
|
|
848
|
-
page: SubmodulePageFields.page,
|
|
849
|
-
component: SubmodulePageFields.component,
|
|
850
|
-
content: PlansContentSchema.describe(
|
|
851
|
-
"Default plans page content when no custom component is provided."
|
|
852
|
-
),
|
|
853
|
-
items: z4.array(PlanCatalogItemSchema).optional().describe(
|
|
854
|
-
"Gateway plan catalog for /pricing preview and publish (canonical storage)."
|
|
855
|
-
)
|
|
856
|
-
});
|
|
857
|
-
DashboardModuleSchema = ModuleToggleSchema.extend({
|
|
858
|
-
path: z4.string().default("dashboard").describe("Route path for the user dashboard."),
|
|
859
|
-
page: SubmodulePageFields.page,
|
|
860
|
-
component: SubmodulePageFields.component,
|
|
861
|
-
content: DashboardContentSchema.describe(
|
|
862
|
-
"Default dashboard page content when no custom component is provided."
|
|
863
|
-
)
|
|
864
|
-
});
|
|
865
|
-
UserPanelModuleSchema = ModuleToggleSchema.extend({
|
|
866
|
-
basePath: z4.string().default("/account").describe("Base path prefix for user panel routes."),
|
|
867
|
-
dashboard: DashboardModuleSchema.optional(),
|
|
868
|
-
userManagement: UserManagementModuleSchema.optional(),
|
|
869
|
-
apiKeys: ApiKeysModuleSchema.optional(),
|
|
870
|
-
plans: PlansModuleSchema.optional()
|
|
871
|
-
});
|
|
872
|
-
ModulesSchema = z4.object({
|
|
873
|
-
docs: DocsModuleSchema.optional().describe(
|
|
874
|
-
"Documentation module \u2014 MD/MDX pages and OpenAPI reference."
|
|
875
|
-
),
|
|
876
|
-
landing: LandingModuleSchema.optional().describe(
|
|
877
|
-
"Landing page module \u2014 marketing or home page."
|
|
878
|
-
),
|
|
879
|
-
userPanel: UserPanelModuleSchema.optional().describe(
|
|
880
|
-
"User panel module \u2014 authenticated user area with sub-modules."
|
|
881
|
-
)
|
|
882
|
-
}).optional();
|
|
883
1032
|
}
|
|
884
1033
|
});
|
|
885
1034
|
|
|
@@ -916,11 +1065,14 @@ var init_resolve_modules = __esm({
|
|
|
916
1065
|
];
|
|
917
1066
|
resolveLandingContent = (config2, content) => {
|
|
918
1067
|
const siteTitle = config2.metadata?.applicationName ?? config2.site?.title ?? "APIToGo";
|
|
919
|
-
|
|
1068
|
+
const resolved = {
|
|
920
1069
|
hero: {
|
|
921
1070
|
title: content?.hero?.title ?? siteTitle,
|
|
922
1071
|
subtitle: content?.hero?.subtitle ?? "Developer portal",
|
|
923
|
-
description: content?.hero?.description ?? config2.metadata?.description ?? "Ship beautiful API documentation and developer experiences with APIToGo."
|
|
1072
|
+
description: content?.hero?.description ?? config2.metadata?.description ?? "Ship beautiful API documentation and developer experiences with APIToGo.",
|
|
1073
|
+
badge: content?.hero?.badge,
|
|
1074
|
+
highlights: content?.hero?.highlights,
|
|
1075
|
+
codeExample: content?.hero?.codeExample
|
|
924
1076
|
},
|
|
925
1077
|
features: content?.features ?? DEFAULT_LANDING_FEATURES,
|
|
926
1078
|
primaryAction: content?.primaryAction ?? {
|
|
@@ -933,6 +1085,19 @@ var init_resolve_modules = __esm({
|
|
|
933
1085
|
},
|
|
934
1086
|
showPoweredBy: content?.showPoweredBy
|
|
935
1087
|
};
|
|
1088
|
+
if (content?.ticker && content.ticker.enabled !== false) {
|
|
1089
|
+
resolved.ticker = content.ticker;
|
|
1090
|
+
}
|
|
1091
|
+
if (content?.trust && content.trust.enabled !== false) {
|
|
1092
|
+
resolved.trust = content.trust;
|
|
1093
|
+
}
|
|
1094
|
+
if (content?.apiShowcase && content.apiShowcase.enabled !== false) {
|
|
1095
|
+
resolved.apiShowcase = content.apiShowcase;
|
|
1096
|
+
}
|
|
1097
|
+
if (content?.pricingCta && content.pricingCta.enabled !== false) {
|
|
1098
|
+
resolved.pricingCta = content.pricingCta;
|
|
1099
|
+
}
|
|
1100
|
+
return resolved;
|
|
936
1101
|
};
|
|
937
1102
|
DEFAULT_DASHBOARD_QUICK_LINKS = [
|
|
938
1103
|
{ label: "Documentation", href: "/introduction" },
|
|
@@ -4234,6 +4399,7 @@ var init_ZudokuConfig = __esm({
|
|
|
4234
4399
|
});
|
|
4235
4400
|
SiteSchema = z9.object({
|
|
4236
4401
|
title: z9.string(),
|
|
4402
|
+
showTitleInHeader: z9.boolean().optional(),
|
|
4237
4403
|
logoUrl: z9.string(),
|
|
4238
4404
|
dir: z9.enum(["ltr", "rtl"]).optional(),
|
|
4239
4405
|
logo: LogoSchema,
|
|
@@ -4378,7 +4544,17 @@ async function loadZudokuConfigWithMeta(rootDir) {
|
|
|
4378
4544
|
perEnvironmentStartEndDuringDev: true
|
|
4379
4545
|
}
|
|
4380
4546
|
});
|
|
4381
|
-
const
|
|
4547
|
+
const importedConfig = module.default;
|
|
4548
|
+
let config2;
|
|
4549
|
+
try {
|
|
4550
|
+
const fileConfig = loadApitogoConfig(rootDir);
|
|
4551
|
+
config2 = buildApitogoConfig({
|
|
4552
|
+
...fileConfig,
|
|
4553
|
+
plugins: importedConfig.plugins
|
|
4554
|
+
});
|
|
4555
|
+
} catch {
|
|
4556
|
+
config2 = importedConfig;
|
|
4557
|
+
}
|
|
4382
4558
|
validateConfig(config2, configPath);
|
|
4383
4559
|
const configWithMetadata = {
|
|
4384
4560
|
...config2,
|
|
@@ -4389,7 +4565,7 @@ async function loadZudokuConfigWithMeta(rootDir) {
|
|
|
4389
4565
|
dependencies,
|
|
4390
4566
|
configPath
|
|
4391
4567
|
},
|
|
4392
|
-
__resolvedModules: resolveModulesConfig(config2)
|
|
4568
|
+
__resolvedModules: resolveModulesConfig(config2, { rootDir })
|
|
4393
4569
|
};
|
|
4394
4570
|
return configWithMetadata;
|
|
4395
4571
|
}
|
|
@@ -4499,7 +4675,9 @@ async function loadZudokuConfig(configEnv, rootDir) {
|
|
|
4499
4675
|
...transformedConfig.__meta,
|
|
4500
4676
|
...configWithManifestMeta.__meta
|
|
4501
4677
|
},
|
|
4502
|
-
__resolvedModules: resolveModulesConfig(transformedConfig
|
|
4678
|
+
__resolvedModules: resolveModulesConfig(transformedConfig, {
|
|
4679
|
+
rootDir: transformedConfig.__meta.rootDir
|
|
4680
|
+
})
|
|
4503
4681
|
};
|
|
4504
4682
|
if (!process.env.APITOGO_JSON_ONLY) {
|
|
4505
4683
|
logger.info(
|
|
@@ -4527,6 +4705,7 @@ var init_loader = __esm({
|
|
|
4527
4705
|
init_transform_config();
|
|
4528
4706
|
init_invariant();
|
|
4529
4707
|
init_apitogo_config_loader();
|
|
4708
|
+
init_build_apitogo_config();
|
|
4530
4709
|
init_file_exists();
|
|
4531
4710
|
init_local_manifest();
|
|
4532
4711
|
init_resolve_modules();
|
|
@@ -4566,7 +4745,7 @@ __export(llms_exports, {
|
|
|
4566
4745
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
4567
4746
|
});
|
|
4568
4747
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
4569
|
-
import
|
|
4748
|
+
import path27 from "node:path";
|
|
4570
4749
|
import colors6 from "picocolors";
|
|
4571
4750
|
async function generateLlmsTxtFiles({
|
|
4572
4751
|
markdownFileInfos,
|
|
@@ -4601,7 +4780,7 @@ async function generateLlmsTxtFiles({
|
|
|
4601
4780
|
}
|
|
4602
4781
|
}
|
|
4603
4782
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
4604
|
-
await writeFile4(
|
|
4783
|
+
await writeFile4(path27.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
4605
4784
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
4606
4785
|
console.log(colors6.blue("\u2713 generated llms.txt"));
|
|
4607
4786
|
}
|
|
@@ -4629,7 +4808,7 @@ ${info.content}
|
|
|
4629
4808
|
}
|
|
4630
4809
|
const llmsFull = llmsFullParts.join("\n");
|
|
4631
4810
|
await writeFile4(
|
|
4632
|
-
|
|
4811
|
+
path27.join(baseOutputDir, "llms-full.txt"),
|
|
4633
4812
|
llmsFull,
|
|
4634
4813
|
"utf-8"
|
|
4635
4814
|
);
|
|
@@ -4650,11 +4829,11 @@ import { hideBin } from "yargs/helpers";
|
|
|
4650
4829
|
import yargs from "yargs/yargs";
|
|
4651
4830
|
|
|
4652
4831
|
// src/cli/build/handler.ts
|
|
4653
|
-
import
|
|
4832
|
+
import path31 from "node:path";
|
|
4654
4833
|
|
|
4655
4834
|
// src/vite/build.ts
|
|
4656
4835
|
import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
4657
|
-
import
|
|
4836
|
+
import path29 from "node:path";
|
|
4658
4837
|
import { build as esbuild } from "esbuild";
|
|
4659
4838
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
4660
4839
|
|
|
@@ -4790,7 +4969,7 @@ init_invariant();
|
|
|
4790
4969
|
init_joinUrl();
|
|
4791
4970
|
|
|
4792
4971
|
// src/vite/config.ts
|
|
4793
|
-
import
|
|
4972
|
+
import path24 from "node:path";
|
|
4794
4973
|
import dotenv from "dotenv";
|
|
4795
4974
|
import colors4 from "picocolors";
|
|
4796
4975
|
import {
|
|
@@ -4801,7 +4980,7 @@ import {
|
|
|
4801
4980
|
// package.json
|
|
4802
4981
|
var package_default = {
|
|
4803
4982
|
name: "@lukoweb/apitogo",
|
|
4804
|
-
version: "0.1.
|
|
4983
|
+
version: "0.1.55",
|
|
4805
4984
|
type: "module",
|
|
4806
4985
|
sideEffects: [
|
|
4807
4986
|
"**/*.css",
|
|
@@ -5570,14 +5749,14 @@ var flattenAllOf = (schema2) => {
|
|
|
5570
5749
|
};
|
|
5571
5750
|
|
|
5572
5751
|
// src/lib/util/traverse.ts
|
|
5573
|
-
var traverse = (specification, transform,
|
|
5574
|
-
const transformed = transform(specification,
|
|
5752
|
+
var traverse = (specification, transform, path40 = []) => {
|
|
5753
|
+
const transformed = transform(specification, path40);
|
|
5575
5754
|
if (typeof transformed !== "object" || transformed === null) {
|
|
5576
5755
|
return transformed;
|
|
5577
5756
|
}
|
|
5578
5757
|
const result = Array.isArray(transformed) ? [] : {};
|
|
5579
5758
|
for (const [key, value] of Object.entries(transformed)) {
|
|
5580
|
-
const currentPath = [...
|
|
5759
|
+
const currentPath = [...path40, key];
|
|
5581
5760
|
if (Array.isArray(value)) {
|
|
5582
5761
|
result[key] = value.map(
|
|
5583
5762
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -5605,9 +5784,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
5605
5784
|
if (schemaCache?.has(ref)) {
|
|
5606
5785
|
return schemaCache.get(ref);
|
|
5607
5786
|
}
|
|
5608
|
-
const
|
|
5787
|
+
const path40 = ref.split("/").slice(1);
|
|
5609
5788
|
let current = schema2;
|
|
5610
|
-
for (const segment of
|
|
5789
|
+
for (const segment of path40) {
|
|
5611
5790
|
if (!current || typeof current !== "object") {
|
|
5612
5791
|
current = null;
|
|
5613
5792
|
}
|
|
@@ -5626,7 +5805,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5626
5805
|
}
|
|
5627
5806
|
const cloned = structuredClone(schema2);
|
|
5628
5807
|
const visited = /* @__PURE__ */ new Set();
|
|
5629
|
-
const resolve = async (current,
|
|
5808
|
+
const resolve = async (current, path40) => {
|
|
5630
5809
|
if (isIndexableObject(current)) {
|
|
5631
5810
|
if (visited.has(current)) {
|
|
5632
5811
|
return CIRCULAR_REF;
|
|
@@ -5634,7 +5813,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5634
5813
|
visited.add(current);
|
|
5635
5814
|
if (Array.isArray(current)) {
|
|
5636
5815
|
for (let index = 0; index < current.length; index++) {
|
|
5637
|
-
current[index] = await resolve(current[index], `${
|
|
5816
|
+
current[index] = await resolve(current[index], `${path40}/${index}`);
|
|
5638
5817
|
}
|
|
5639
5818
|
} else {
|
|
5640
5819
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -5645,13 +5824,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5645
5824
|
for (const resolver of resolvers) {
|
|
5646
5825
|
const resolved = await resolver($ref);
|
|
5647
5826
|
if (resolved) {
|
|
5648
|
-
result2 = await resolve(resolved,
|
|
5827
|
+
result2 = await resolve(resolved, path40);
|
|
5649
5828
|
break;
|
|
5650
5829
|
}
|
|
5651
5830
|
}
|
|
5652
5831
|
if (result2 === void 0) {
|
|
5653
5832
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
5654
|
-
result2 = await resolve(resolved,
|
|
5833
|
+
result2 = await resolve(resolved, path40);
|
|
5655
5834
|
}
|
|
5656
5835
|
if (hasSiblings) {
|
|
5657
5836
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -5664,7 +5843,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5664
5843
|
return result2;
|
|
5665
5844
|
}
|
|
5666
5845
|
for (const key in current) {
|
|
5667
|
-
current[key] = await resolve(current[key], `${
|
|
5846
|
+
current[key] = await resolve(current[key], `${path40}/${key}`);
|
|
5668
5847
|
}
|
|
5669
5848
|
}
|
|
5670
5849
|
visited.delete(current);
|
|
@@ -5703,9 +5882,9 @@ var upgradeSchema = (schema2) => {
|
|
|
5703
5882
|
}
|
|
5704
5883
|
return sub;
|
|
5705
5884
|
});
|
|
5706
|
-
schema2 = traverse(schema2, (sub,
|
|
5885
|
+
schema2 = traverse(schema2, (sub, path40) => {
|
|
5707
5886
|
if (sub.example !== void 0) {
|
|
5708
|
-
if (isSchemaPath(
|
|
5887
|
+
if (isSchemaPath(path40 ?? [])) {
|
|
5709
5888
|
sub.examples = [sub.example];
|
|
5710
5889
|
} else {
|
|
5711
5890
|
sub.examples = {
|
|
@@ -5718,11 +5897,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5718
5897
|
}
|
|
5719
5898
|
return sub;
|
|
5720
5899
|
});
|
|
5721
|
-
schema2 = traverse(schema2, (schema3,
|
|
5900
|
+
schema2 = traverse(schema2, (schema3, path40) => {
|
|
5722
5901
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
5723
|
-
const parentPath =
|
|
5902
|
+
const parentPath = path40?.slice(0, -1);
|
|
5724
5903
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
5725
|
-
return segment === "content" &&
|
|
5904
|
+
return segment === "content" && path40?.[index + 1] === "multipart/form-data";
|
|
5726
5905
|
});
|
|
5727
5906
|
if (isMultipart) {
|
|
5728
5907
|
const entries = Object.entries(schema3.properties);
|
|
@@ -5736,8 +5915,8 @@ var upgradeSchema = (schema2) => {
|
|
|
5736
5915
|
}
|
|
5737
5916
|
return schema3;
|
|
5738
5917
|
});
|
|
5739
|
-
schema2 = traverse(schema2, (schema3,
|
|
5740
|
-
if (
|
|
5918
|
+
schema2 = traverse(schema2, (schema3, path40) => {
|
|
5919
|
+
if (path40?.includes("content") && path40.includes("application/octet-stream")) {
|
|
5741
5920
|
return {};
|
|
5742
5921
|
}
|
|
5743
5922
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -5763,11 +5942,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5763
5942
|
}
|
|
5764
5943
|
return sub;
|
|
5765
5944
|
});
|
|
5766
|
-
schema2 = traverse(schema2, (schema3,
|
|
5945
|
+
schema2 = traverse(schema2, (schema3, path40) => {
|
|
5767
5946
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
5768
|
-
const parentPath =
|
|
5947
|
+
const parentPath = path40?.slice(0, -1);
|
|
5769
5948
|
const contentMediaType = parentPath?.find(
|
|
5770
|
-
(_, index) =>
|
|
5949
|
+
(_, index) => path40?.[index - 1] === "content"
|
|
5771
5950
|
);
|
|
5772
5951
|
return {
|
|
5773
5952
|
type: "string",
|
|
@@ -5779,7 +5958,7 @@ var upgradeSchema = (schema2) => {
|
|
|
5779
5958
|
});
|
|
5780
5959
|
return schema2;
|
|
5781
5960
|
};
|
|
5782
|
-
function isSchemaPath(
|
|
5961
|
+
function isSchemaPath(path40) {
|
|
5783
5962
|
const schemaLocations = [
|
|
5784
5963
|
["components", "schemas"],
|
|
5785
5964
|
"properties",
|
|
@@ -5792,10 +5971,10 @@ function isSchemaPath(path39) {
|
|
|
5792
5971
|
];
|
|
5793
5972
|
return schemaLocations.some((location) => {
|
|
5794
5973
|
if (Array.isArray(location)) {
|
|
5795
|
-
return location.every((segment, index) =>
|
|
5974
|
+
return location.every((segment, index) => path40[index] === segment);
|
|
5796
5975
|
}
|
|
5797
|
-
return
|
|
5798
|
-
}) ||
|
|
5976
|
+
return path40.includes(location);
|
|
5977
|
+
}) || path40.includes("schema") || path40.some((segment) => segment.endsWith("Schema"));
|
|
5799
5978
|
}
|
|
5800
5979
|
|
|
5801
5980
|
// src/lib/oas/parser/index.ts
|
|
@@ -5877,13 +6056,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
5877
6056
|
"anyOf",
|
|
5878
6057
|
"oneOf"
|
|
5879
6058
|
]);
|
|
5880
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
6059
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path40 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
5881
6060
|
if (obj === null || typeof obj !== "object") return obj;
|
|
5882
6061
|
const refPath = obj.__$ref;
|
|
5883
6062
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
5884
6063
|
if (isCircular) {
|
|
5885
6064
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
5886
|
-
const circularProp =
|
|
6065
|
+
const circularProp = path40.find((p) => !OPENAPI_PROPS.has(p)) || path40[0];
|
|
5887
6066
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
5888
6067
|
}
|
|
5889
6068
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -5893,7 +6072,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
5893
6072
|
value,
|
|
5894
6073
|
currentPath,
|
|
5895
6074
|
refs,
|
|
5896
|
-
[...
|
|
6075
|
+
[...path40, key],
|
|
5897
6076
|
currentRefPaths
|
|
5898
6077
|
);
|
|
5899
6078
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -5928,7 +6107,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
5928
6107
|
var getAllTags = (schema2) => {
|
|
5929
6108
|
const rootTags = schema2.tags ?? [];
|
|
5930
6109
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
5931
|
-
(
|
|
6110
|
+
(path40) => HttpMethods.map((k) => path40?.[k]).filter((op) => op != null)
|
|
5932
6111
|
);
|
|
5933
6112
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
5934
6113
|
const hasUntaggedOperations = operations.some(
|
|
@@ -5983,7 +6162,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
5983
6162
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
5984
6163
|
var getAllOperations = (paths) => {
|
|
5985
6164
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
5986
|
-
([
|
|
6165
|
+
([path40, value]) => HttpMethods.flatMap((method) => {
|
|
5987
6166
|
if (!value?.[method]) return [];
|
|
5988
6167
|
const operation = value[method];
|
|
5989
6168
|
const pathParameters = value.parameters ?? [];
|
|
@@ -6003,7 +6182,7 @@ var getAllOperations = (paths) => {
|
|
|
6003
6182
|
return {
|
|
6004
6183
|
...operation,
|
|
6005
6184
|
method,
|
|
6006
|
-
path:
|
|
6185
|
+
path: path40,
|
|
6007
6186
|
parameters,
|
|
6008
6187
|
servers,
|
|
6009
6188
|
tags: operation.tags ?? []
|
|
@@ -6361,8 +6540,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
6361
6540
|
}),
|
|
6362
6541
|
paths: t.field({
|
|
6363
6542
|
type: [PathItem],
|
|
6364
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
6365
|
-
path:
|
|
6543
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path40, value]) => ({
|
|
6544
|
+
path: path40,
|
|
6366
6545
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
6367
6546
|
methods: Object.keys(value)
|
|
6368
6547
|
}))
|
|
@@ -6509,7 +6688,7 @@ init_joinUrl();
|
|
|
6509
6688
|
|
|
6510
6689
|
// src/vite/api/schema-codegen.ts
|
|
6511
6690
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
6512
|
-
var getSegmentsFromPath = (
|
|
6691
|
+
var getSegmentsFromPath = (path40) => path40.split("/").slice(1).map(unescapeJsonPointer);
|
|
6513
6692
|
var createLocalRefMap = (obj) => {
|
|
6514
6693
|
const refMap = /* @__PURE__ */ new Map();
|
|
6515
6694
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -6540,16 +6719,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
6540
6719
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
6541
6720
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
6542
6721
|
);
|
|
6543
|
-
var lookup = (schema2,
|
|
6544
|
-
const parts = getSegmentsFromPath(
|
|
6722
|
+
var lookup = (schema2, path40, filePath) => {
|
|
6723
|
+
const parts = getSegmentsFromPath(path40);
|
|
6545
6724
|
let val = schema2;
|
|
6546
6725
|
for (const part of parts) {
|
|
6547
6726
|
while (val.$ref?.startsWith("#/")) {
|
|
6548
|
-
val = val.$ref ===
|
|
6727
|
+
val = val.$ref === path40 ? val : lookup(schema2, val.$ref, filePath);
|
|
6549
6728
|
}
|
|
6550
6729
|
if (val[part] === void 0) {
|
|
6551
6730
|
throw new Error(
|
|
6552
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
6731
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path40}`
|
|
6553
6732
|
);
|
|
6554
6733
|
}
|
|
6555
6734
|
val = val[part];
|
|
@@ -6794,8 +6973,8 @@ var SchemaManager = class {
|
|
|
6794
6973
|
}
|
|
6795
6974
|
}
|
|
6796
6975
|
};
|
|
6797
|
-
getLatestSchema = (
|
|
6798
|
-
getSchemasForPath = (
|
|
6976
|
+
getLatestSchema = (path40) => this.processedSchemas[path40]?.at(0);
|
|
6977
|
+
getSchemasForPath = (path40) => this.processedSchemas[path40];
|
|
6799
6978
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
6800
6979
|
getUrlToFilePathMap = () => {
|
|
6801
6980
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -7410,7 +7589,7 @@ var viteAuthPlugin = () => {
|
|
|
7410
7589
|
async load(id) {
|
|
7411
7590
|
if (id === resolvedVirtualModuleId5) {
|
|
7412
7591
|
const config2 = getCurrentConfig();
|
|
7413
|
-
if (!config2.authentication || config2.__meta.mode === "standalone") {
|
|
7592
|
+
if (!config2.authentication?.type || config2.__meta.mode === "standalone") {
|
|
7414
7593
|
return `export const configuredAuthProvider = undefined;`;
|
|
7415
7594
|
}
|
|
7416
7595
|
return [
|
|
@@ -7466,17 +7645,43 @@ var viteAliasPlugin = () => {
|
|
|
7466
7645
|
var plugin_component_default = viteAliasPlugin;
|
|
7467
7646
|
|
|
7468
7647
|
// src/vite/plugin-config.ts
|
|
7648
|
+
init_package_json();
|
|
7469
7649
|
init_loader();
|
|
7650
|
+
import path16 from "node:path";
|
|
7470
7651
|
import { normalizePath } from "vite";
|
|
7471
7652
|
var virtualModuleId3 = "virtual:zudoku-config";
|
|
7472
7653
|
var resolvedVirtualModuleId3 = `\0${virtualModuleId3}`;
|
|
7654
|
+
var browserConfigLoaderPath = path16.join(
|
|
7655
|
+
getZudokuRootDir(),
|
|
7656
|
+
"src/config/apitogo-config-loader.browser.ts"
|
|
7657
|
+
);
|
|
7658
|
+
function serializeClientConfig(config2) {
|
|
7659
|
+
const {
|
|
7660
|
+
plugins: _plugins,
|
|
7661
|
+
__meta: _meta,
|
|
7662
|
+
__resolvedModules,
|
|
7663
|
+
...rest
|
|
7664
|
+
} = config2;
|
|
7665
|
+
return JSON.stringify(
|
|
7666
|
+
{ ...rest, __resolvedModules },
|
|
7667
|
+
(_key, value) => typeof value === "function" ? void 0 : value
|
|
7668
|
+
);
|
|
7669
|
+
}
|
|
7473
7670
|
var viteConfigPlugin = () => {
|
|
7474
7671
|
let viteConfig;
|
|
7475
7672
|
return {
|
|
7476
7673
|
name: "zudoku-config-plugin",
|
|
7477
|
-
resolveId(
|
|
7478
|
-
if (
|
|
7479
|
-
|
|
7674
|
+
resolveId(source, _importer, options) {
|
|
7675
|
+
if (source === virtualModuleId3) {
|
|
7676
|
+
return resolvedVirtualModuleId3;
|
|
7677
|
+
}
|
|
7678
|
+
if (!source.includes("apitogo-config-loader.node")) {
|
|
7679
|
+
return;
|
|
7680
|
+
}
|
|
7681
|
+
const isServerEnvironment = options?.ssr === true || this.environment?.config?.consumer === "server";
|
|
7682
|
+
if (!isServerEnvironment) {
|
|
7683
|
+
return browserConfigLoaderPath;
|
|
7684
|
+
}
|
|
7480
7685
|
},
|
|
7481
7686
|
configResolved(resolvedConfig) {
|
|
7482
7687
|
viteConfig = resolvedConfig;
|
|
@@ -7504,8 +7709,11 @@ var viteConfigPlugin = () => {
|
|
|
7504
7709
|
import rawConfig from "${normalizePath(configPath)}";
|
|
7505
7710
|
import { runPluginTransformConfig } from "@lukoweb/apitogo/plugins";
|
|
7506
7711
|
|
|
7712
|
+
const embeddedConfig = ${serializeClientConfig(loadedConfig)};
|
|
7713
|
+
|
|
7507
7714
|
const config = await runPluginTransformConfig({
|
|
7508
|
-
...
|
|
7715
|
+
...embeddedConfig,
|
|
7716
|
+
plugins: rawConfig?.plugins ?? embeddedConfig.plugins ?? [],
|
|
7509
7717
|
__meta: ${JSON.stringify(clientMeta)},
|
|
7510
7718
|
});
|
|
7511
7719
|
export default config;
|
|
@@ -7610,7 +7818,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
7610
7818
|
|
|
7611
7819
|
// src/vite/plugin-docs.ts
|
|
7612
7820
|
init_loader();
|
|
7613
|
-
import
|
|
7821
|
+
import path17 from "node:path";
|
|
7614
7822
|
import { glob as glob3 } from "glob";
|
|
7615
7823
|
import globParent from "glob-parent";
|
|
7616
7824
|
init_ZudokuConfig();
|
|
@@ -7679,7 +7887,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7679
7887
|
if (process.env.NODE_ENV !== "development") {
|
|
7680
7888
|
const draftStatuses = await Promise.all(
|
|
7681
7889
|
globbedFiles.map(async (file) => {
|
|
7682
|
-
const absolutePath =
|
|
7890
|
+
const absolutePath = path17.resolve(config2.__meta.rootDir, file);
|
|
7683
7891
|
const { data } = await readFrontmatter(absolutePath);
|
|
7684
7892
|
return { file, isDraft: data.draft === true };
|
|
7685
7893
|
})
|
|
@@ -7692,9 +7900,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7692
7900
|
if (draftFiles.has(file)) {
|
|
7693
7901
|
continue;
|
|
7694
7902
|
}
|
|
7695
|
-
const relativePath =
|
|
7903
|
+
const relativePath = path17.posix.relative(parent, file);
|
|
7696
7904
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
7697
|
-
const filePath = options.absolute ?
|
|
7905
|
+
const filePath = options.absolute ? path17.resolve(config2.__meta.rootDir, file) : file;
|
|
7698
7906
|
fileMapping[routePath] = filePath;
|
|
7699
7907
|
}
|
|
7700
7908
|
}
|
|
@@ -7758,7 +7966,7 @@ var viteDocsPlugin = () => {
|
|
|
7758
7966
|
const globbedDocuments = {};
|
|
7759
7967
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
7760
7968
|
const importPath = ensureLeadingSlash(
|
|
7761
|
-
|
|
7969
|
+
path17.posix.join(globImportBasePath, file)
|
|
7762
7970
|
);
|
|
7763
7971
|
globbedDocuments[routePath] = importPath;
|
|
7764
7972
|
}
|
|
@@ -7784,7 +7992,7 @@ var plugin_docs_default = viteDocsPlugin;
|
|
|
7784
7992
|
// src/vite/plugin-local-manifest.ts
|
|
7785
7993
|
init_apitogo_config_loader();
|
|
7786
7994
|
init_local_manifest();
|
|
7787
|
-
import
|
|
7995
|
+
import path18 from "node:path";
|
|
7788
7996
|
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
7789
7997
|
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
7790
7998
|
var viteLocalManifestPlugin = () => {
|
|
@@ -7834,8 +8042,8 @@ var viteLocalManifestPlugin = () => {
|
|
|
7834
8042
|
server.watcher.add(watchPath);
|
|
7835
8043
|
}
|
|
7836
8044
|
server.watcher.on("change", async (changedPath) => {
|
|
7837
|
-
const resolvedChanged =
|
|
7838
|
-
if (!watchPaths.some((p) =>
|
|
8045
|
+
const resolvedChanged = path18.resolve(changedPath);
|
|
8046
|
+
if (!watchPaths.some((p) => path18.resolve(p) === resolvedChanged)) {
|
|
7839
8047
|
return;
|
|
7840
8048
|
}
|
|
7841
8049
|
const module = server.moduleGraph.getModuleById(
|
|
@@ -7862,7 +8070,7 @@ init_loader();
|
|
|
7862
8070
|
init_ProtectedRoutesSchema();
|
|
7863
8071
|
init_joinUrl();
|
|
7864
8072
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
7865
|
-
import
|
|
8073
|
+
import path19 from "node:path";
|
|
7866
8074
|
import { matchPath } from "react-router";
|
|
7867
8075
|
var processMarkdownFile = async (filePath) => {
|
|
7868
8076
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -7950,7 +8158,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7950
8158
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
7951
8159
|
return;
|
|
7952
8160
|
}
|
|
7953
|
-
const distDir =
|
|
8161
|
+
const distDir = path19.join(
|
|
7954
8162
|
config2.__meta.rootDir,
|
|
7955
8163
|
"dist",
|
|
7956
8164
|
config2.basePath ?? ""
|
|
@@ -7971,15 +8179,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7971
8179
|
content: finalMarkdown
|
|
7972
8180
|
});
|
|
7973
8181
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
7974
|
-
const outputPath = `${
|
|
7975
|
-
await mkdir2(
|
|
8182
|
+
const outputPath = `${path19.join(distDir, ...segments)}.md`;
|
|
8183
|
+
await mkdir2(path19.dirname(outputPath), { recursive: true });
|
|
7976
8184
|
await writeFile2(outputPath, finalMarkdown, "utf-8");
|
|
7977
8185
|
} catch (error) {
|
|
7978
8186
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
7979
8187
|
}
|
|
7980
8188
|
}
|
|
7981
8189
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
7982
|
-
const markdownInfoPath =
|
|
8190
|
+
const markdownInfoPath = path19.join(
|
|
7983
8191
|
config2.__meta.rootDir,
|
|
7984
8192
|
"node_modules/.apitogo/markdown-info.json"
|
|
7985
8193
|
);
|
|
@@ -8131,9 +8339,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
8131
8339
|
};
|
|
8132
8340
|
|
|
8133
8341
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
8134
|
-
import
|
|
8342
|
+
import path20 from "node:path";
|
|
8135
8343
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
8136
|
-
const relativePath =
|
|
8344
|
+
const relativePath = path20.relative(rootDir, vfile.path).split(path20.sep).join(path20.posix.sep);
|
|
8137
8345
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
8138
8346
|
};
|
|
8139
8347
|
|
|
@@ -8220,18 +8428,18 @@ var remarkLastModified = () => {
|
|
|
8220
8428
|
};
|
|
8221
8429
|
|
|
8222
8430
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
8223
|
-
import
|
|
8431
|
+
import path21 from "node:path";
|
|
8224
8432
|
import { visit as visit5 } from "unist-util-visit";
|
|
8225
8433
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
8226
8434
|
visit5(tree, "link", (node) => {
|
|
8227
8435
|
if (!node.url) return;
|
|
8228
8436
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
8229
8437
|
node.url = node.url.replace(/\\/g, "/");
|
|
8230
|
-
const base =
|
|
8438
|
+
const base = path21.posix.join(basePath);
|
|
8231
8439
|
if (basePath && node.url.startsWith(base)) {
|
|
8232
8440
|
node.url = node.url.slice(base.length);
|
|
8233
8441
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
8234
|
-
node.url =
|
|
8442
|
+
node.url = path21.posix.join("..", node.url);
|
|
8235
8443
|
}
|
|
8236
8444
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
8237
8445
|
});
|
|
@@ -8451,11 +8659,11 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
8451
8659
|
|
|
8452
8660
|
// src/vite/plugin-modules.ts
|
|
8453
8661
|
init_loader();
|
|
8454
|
-
import
|
|
8662
|
+
import path22 from "node:path";
|
|
8455
8663
|
import { normalizePath as normalizePath2 } from "vite";
|
|
8456
|
-
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
8457
|
-
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
8458
|
-
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(
|
|
8664
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path22.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
8665
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path22.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
8666
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path22.resolve(rootDir, pagePath));
|
|
8459
8667
|
var viteModulesPlugin = () => {
|
|
8460
8668
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
8461
8669
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -8576,7 +8784,7 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
8576
8784
|
|
|
8577
8785
|
// src/vite/plugin-search.ts
|
|
8578
8786
|
init_loader();
|
|
8579
|
-
import
|
|
8787
|
+
import path23 from "node:path";
|
|
8580
8788
|
var viteSearchPlugin = () => {
|
|
8581
8789
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
8582
8790
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -8594,7 +8802,7 @@ var viteSearchPlugin = () => {
|
|
|
8594
8802
|
return resolvedVirtualModuleId5;
|
|
8595
8803
|
}
|
|
8596
8804
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
8597
|
-
return
|
|
8805
|
+
return path23.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
8598
8806
|
}
|
|
8599
8807
|
},
|
|
8600
8808
|
async load(id) {
|
|
@@ -8733,13 +8941,17 @@ function vitePlugin() {
|
|
|
8733
8941
|
}
|
|
8734
8942
|
|
|
8735
8943
|
// src/vite/config.ts
|
|
8944
|
+
var browserConfigLoaderPath2 = path24.join(
|
|
8945
|
+
getZudokuRootDir(),
|
|
8946
|
+
"src/config/apitogo-config-loader.browser.ts"
|
|
8947
|
+
);
|
|
8736
8948
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
8737
8949
|
if (merged.publicDir === false) return void 0;
|
|
8738
8950
|
const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
8739
|
-
return
|
|
8951
|
+
return path24.resolve(rootDir, rel);
|
|
8740
8952
|
};
|
|
8741
|
-
var getAppClientEntryPath = () =>
|
|
8742
|
-
var getAppServerEntryPath = () =>
|
|
8953
|
+
var getAppClientEntryPath = () => path24.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
8954
|
+
var getAppServerEntryPath = () => path24.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
8743
8955
|
var hasLoggedCdnInfo = false;
|
|
8744
8956
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
8745
8957
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -8769,7 +8981,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8769
8981
|
);
|
|
8770
8982
|
if (ZuploEnv.isZuplo) {
|
|
8771
8983
|
dotenv.config({
|
|
8772
|
-
path:
|
|
8984
|
+
path: path24.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
8773
8985
|
quiet: true
|
|
8774
8986
|
});
|
|
8775
8987
|
}
|
|
@@ -8790,6 +9002,22 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8790
9002
|
"@mdx-js/react": import.meta.resolve("@mdx-js/react")
|
|
8791
9003
|
}
|
|
8792
9004
|
},
|
|
9005
|
+
environments: {
|
|
9006
|
+
client: {
|
|
9007
|
+
resolve: {
|
|
9008
|
+
alias: {
|
|
9009
|
+
[path24.join(
|
|
9010
|
+
getZudokuRootDir(),
|
|
9011
|
+
"src/config/apitogo-config-loader.node.ts"
|
|
9012
|
+
)]: browserConfigLoaderPath2,
|
|
9013
|
+
[path24.join(
|
|
9014
|
+
getZudokuRootDir(),
|
|
9015
|
+
"src/config/apitogo-config-loader.node.js"
|
|
9016
|
+
)]: browserConfigLoaderPath2
|
|
9017
|
+
}
|
|
9018
|
+
}
|
|
9019
|
+
}
|
|
9020
|
+
},
|
|
8793
9021
|
define: {
|
|
8794
9022
|
"process.env.ZUDOKU_VERSION": JSON.stringify(package_default.version),
|
|
8795
9023
|
"process.env.IS_ZUPLO": ZuploEnv.isZuplo,
|
|
@@ -8828,8 +9056,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8828
9056
|
ssr: configEnv.isSsrBuild,
|
|
8829
9057
|
sourcemap: true,
|
|
8830
9058
|
target: "es2022",
|
|
8831
|
-
outDir:
|
|
8832
|
-
|
|
9059
|
+
outDir: path24.resolve(
|
|
9060
|
+
path24.join(
|
|
8833
9061
|
dir,
|
|
8834
9062
|
"dist",
|
|
8835
9063
|
config2.basePath ?? "",
|
|
@@ -8848,7 +9076,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8848
9076
|
},
|
|
8849
9077
|
experimental: {
|
|
8850
9078
|
renderBuiltUrl(filename) {
|
|
8851
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
9079
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path24.extname(filename))) {
|
|
8852
9080
|
return joinUrl(cdnUrl.base, filename);
|
|
8853
9081
|
}
|
|
8854
9082
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -8861,7 +9089,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8861
9089
|
esbuildOptions: {
|
|
8862
9090
|
target: "es2022"
|
|
8863
9091
|
},
|
|
8864
|
-
entries: [
|
|
9092
|
+
entries: [path24.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
8865
9093
|
exclude: [
|
|
8866
9094
|
"@lukoweb/apitogo",
|
|
8867
9095
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -8967,7 +9195,7 @@ init_package_json();
|
|
|
8967
9195
|
init_joinUrl();
|
|
8968
9196
|
import assert from "node:assert";
|
|
8969
9197
|
import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
8970
|
-
import
|
|
9198
|
+
import path25 from "node:path";
|
|
8971
9199
|
var pkgJson = getZudokuPackageJson();
|
|
8972
9200
|
function generateOutput({
|
|
8973
9201
|
config: config2,
|
|
@@ -9024,9 +9252,9 @@ async function writeOutput(dir, {
|
|
|
9024
9252
|
rewrites
|
|
9025
9253
|
}) {
|
|
9026
9254
|
const output = generateOutput({ config: config2, redirects, rewrites });
|
|
9027
|
-
const outputDir = process.env.VERCEL ?
|
|
9255
|
+
const outputDir = process.env.VERCEL ? path25.join(dir, ".vercel/output") : path25.join(dir, "dist/.output");
|
|
9028
9256
|
await mkdir3(outputDir, { recursive: true });
|
|
9029
|
-
const outputFile =
|
|
9257
|
+
const outputFile = path25.join(outputDir, "config.json");
|
|
9030
9258
|
await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
|
|
9031
9259
|
if (process.env.VERCEL) {
|
|
9032
9260
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -9038,7 +9266,7 @@ init_logger();
|
|
|
9038
9266
|
init_file_exists();
|
|
9039
9267
|
import { readFile as readFile2, rm } from "node:fs/promises";
|
|
9040
9268
|
import os from "node:os";
|
|
9041
|
-
import
|
|
9269
|
+
import path28 from "node:path";
|
|
9042
9270
|
import { pathToFileURL } from "node:url";
|
|
9043
9271
|
import { createIndex } from "pagefind";
|
|
9044
9272
|
import colors7 from "picocolors";
|
|
@@ -9080,7 +9308,7 @@ function throttle(fn) {
|
|
|
9080
9308
|
init_joinUrl();
|
|
9081
9309
|
import { createWriteStream, existsSync as existsSync2 } from "node:fs";
|
|
9082
9310
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
9083
|
-
import
|
|
9311
|
+
import path26 from "node:path";
|
|
9084
9312
|
import colors5 from "picocolors";
|
|
9085
9313
|
import { SitemapStream } from "sitemap";
|
|
9086
9314
|
async function generateSitemap({
|
|
@@ -9094,11 +9322,11 @@ async function generateSitemap({
|
|
|
9094
9322
|
return;
|
|
9095
9323
|
}
|
|
9096
9324
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
9097
|
-
const outputDir =
|
|
9325
|
+
const outputDir = path26.resolve(baseOutputDir, config2.outDir ?? "");
|
|
9098
9326
|
if (!existsSync2(outputDir)) {
|
|
9099
9327
|
await mkdir4(outputDir, { recursive: true });
|
|
9100
9328
|
}
|
|
9101
|
-
const sitemapOutputPath =
|
|
9329
|
+
const sitemapOutputPath = path26.join(outputDir, "sitemap.xml");
|
|
9102
9330
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
9103
9331
|
sitemap.pipe(writeStream);
|
|
9104
9332
|
let lastmod;
|
|
@@ -9128,14 +9356,14 @@ async function generateSitemap({
|
|
|
9128
9356
|
|
|
9129
9357
|
// src/vite/prerender/utils.ts
|
|
9130
9358
|
init_joinUrl();
|
|
9131
|
-
var resolveRoutePath = (
|
|
9132
|
-
const segments =
|
|
9359
|
+
var resolveRoutePath = (path40) => {
|
|
9360
|
+
const segments = path40.split("/");
|
|
9133
9361
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
9134
9362
|
return void 0;
|
|
9135
9363
|
}
|
|
9136
9364
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
9137
9365
|
};
|
|
9138
|
-
var isSkipped = (
|
|
9366
|
+
var isSkipped = (path40) => path40.includes("*") || /^\d+$/.test(path40);
|
|
9139
9367
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
9140
9368
|
if (route.path && isSkipped(route.path)) return [];
|
|
9141
9369
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -9184,12 +9412,12 @@ var prerender = async ({
|
|
|
9184
9412
|
serverConfigFilename,
|
|
9185
9413
|
writeRedirects = true
|
|
9186
9414
|
}) => {
|
|
9187
|
-
const distDir =
|
|
9415
|
+
const distDir = path28.join(dir, "dist", basePath);
|
|
9188
9416
|
const serverConfigPath = pathToFileURL(
|
|
9189
|
-
|
|
9417
|
+
path28.join(distDir, "server", serverConfigFilename)
|
|
9190
9418
|
).href;
|
|
9191
9419
|
const entryServerPath = pathToFileURL(
|
|
9192
|
-
|
|
9420
|
+
path28.join(distDir, "server/entry.server.js")
|
|
9193
9421
|
).href;
|
|
9194
9422
|
const rawConfig = await import(serverConfigPath).then(
|
|
9195
9423
|
(m) => m.default
|
|
@@ -9274,7 +9502,7 @@ var prerender = async ({
|
|
|
9274
9502
|
})
|
|
9275
9503
|
);
|
|
9276
9504
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
9277
|
-
outputPath:
|
|
9505
|
+
outputPath: path28.join(distDir, "pagefind")
|
|
9278
9506
|
});
|
|
9279
9507
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
9280
9508
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -9306,7 +9534,7 @@ var prerender = async ({
|
|
|
9306
9534
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
9307
9535
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
9308
9536
|
const llmsConfig = docsConfig.llms ?? {};
|
|
9309
|
-
const markdownInfoPath =
|
|
9537
|
+
const markdownInfoPath = path28.join(
|
|
9310
9538
|
dir,
|
|
9311
9539
|
"node_modules/.apitogo/markdown-info.json"
|
|
9312
9540
|
);
|
|
@@ -9397,7 +9625,7 @@ async function runBuild(options) {
|
|
|
9397
9625
|
html,
|
|
9398
9626
|
basePath: config2.basePath
|
|
9399
9627
|
});
|
|
9400
|
-
await rm2(
|
|
9628
|
+
await rm2(path29.join(clientOutDir, "index.html"), { force: true });
|
|
9401
9629
|
} else {
|
|
9402
9630
|
await runPrerender({
|
|
9403
9631
|
dir,
|
|
@@ -9421,7 +9649,7 @@ var runPrerender = async (options) => {
|
|
|
9421
9649
|
serverConfigFilename,
|
|
9422
9650
|
writeRedirects: process.env.VERCEL === void 0
|
|
9423
9651
|
});
|
|
9424
|
-
const indexHtml =
|
|
9652
|
+
const indexHtml = path29.join(clientOutDir, "index.html");
|
|
9425
9653
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
9426
9654
|
await writeFile5(indexHtml, html, "utf-8");
|
|
9427
9655
|
}
|
|
@@ -9431,15 +9659,15 @@ var runPrerender = async (options) => {
|
|
|
9431
9659
|
for (const statusPage of statusPages) {
|
|
9432
9660
|
await rename(
|
|
9433
9661
|
statusPage,
|
|
9434
|
-
|
|
9662
|
+
path29.join(dir, DIST_DIR, path29.basename(statusPage))
|
|
9435
9663
|
);
|
|
9436
9664
|
}
|
|
9437
9665
|
await rm2(serverOutDir, { recursive: true, force: true });
|
|
9438
9666
|
if (process.env.VERCEL) {
|
|
9439
|
-
await mkdir5(
|
|
9667
|
+
await mkdir5(path29.join(dir, ".vercel/output/static"), { recursive: true });
|
|
9440
9668
|
await rename(
|
|
9441
|
-
|
|
9442
|
-
|
|
9669
|
+
path29.join(dir, DIST_DIR),
|
|
9670
|
+
path29.join(dir, ".vercel/output/static")
|
|
9443
9671
|
);
|
|
9444
9672
|
}
|
|
9445
9673
|
await writeOutput(dir, {
|
|
@@ -9449,7 +9677,7 @@ var runPrerender = async (options) => {
|
|
|
9449
9677
|
});
|
|
9450
9678
|
if (ZuploEnv.isZuplo && issuer) {
|
|
9451
9679
|
await writeFile5(
|
|
9452
|
-
|
|
9680
|
+
path29.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
9453
9681
|
JSON.stringify({ issuer }, null, 2),
|
|
9454
9682
|
"utf-8"
|
|
9455
9683
|
);
|
|
@@ -9461,10 +9689,10 @@ var runPrerender = async (options) => {
|
|
|
9461
9689
|
};
|
|
9462
9690
|
var bundleSSREntry = async (options) => {
|
|
9463
9691
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
9464
|
-
const tempEntryPath =
|
|
9692
|
+
const tempEntryPath = path29.join(dir, "__ssr-entry.ts");
|
|
9465
9693
|
const packageRoot = getZudokuRootDir();
|
|
9466
9694
|
const templateContent = await readFile3(
|
|
9467
|
-
|
|
9695
|
+
path29.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
9468
9696
|
"utf-8"
|
|
9469
9697
|
);
|
|
9470
9698
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -9479,9 +9707,9 @@ var bundleSSREntry = async (options) => {
|
|
|
9479
9707
|
platform: adapter === "node" ? "node" : "neutral",
|
|
9480
9708
|
target: "es2022",
|
|
9481
9709
|
format: "esm",
|
|
9482
|
-
outfile:
|
|
9710
|
+
outfile: path29.join(serverOutDir, "entry.js"),
|
|
9483
9711
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
9484
|
-
nodePaths: [
|
|
9712
|
+
nodePaths: [path29.join(packageRoot, "node_modules")],
|
|
9485
9713
|
banner: { js: "// Bundled SSR entry" }
|
|
9486
9714
|
});
|
|
9487
9715
|
} finally {
|
|
@@ -9536,11 +9764,11 @@ function textOrJson(text) {
|
|
|
9536
9764
|
init_package_json();
|
|
9537
9765
|
|
|
9538
9766
|
// src/cli/preview/handler.ts
|
|
9539
|
-
import
|
|
9767
|
+
import path30 from "node:path";
|
|
9540
9768
|
import { preview as vitePreview } from "vite";
|
|
9541
9769
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
9542
9770
|
async function preview(argv) {
|
|
9543
|
-
const dir =
|
|
9771
|
+
const dir = path30.resolve(process.cwd(), argv.dir);
|
|
9544
9772
|
const viteConfig = await getViteConfig(dir, {
|
|
9545
9773
|
command: "serve",
|
|
9546
9774
|
mode: "production",
|
|
@@ -9581,7 +9809,7 @@ async function build(argv) {
|
|
|
9581
9809
|
printDiagnosticsToConsole("");
|
|
9582
9810
|
printDiagnosticsToConsole("");
|
|
9583
9811
|
}
|
|
9584
|
-
const dir =
|
|
9812
|
+
const dir = path31.resolve(process.cwd(), argv.dir);
|
|
9585
9813
|
try {
|
|
9586
9814
|
await runBuild({
|
|
9587
9815
|
dir,
|
|
@@ -9741,7 +9969,7 @@ var build_default = {
|
|
|
9741
9969
|
// src/cli/configure-github-workflow/handler.ts
|
|
9742
9970
|
import { constants } from "node:fs";
|
|
9743
9971
|
import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
9744
|
-
import
|
|
9972
|
+
import path32 from "node:path";
|
|
9745
9973
|
var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
|
|
9746
9974
|
|
|
9747
9975
|
on:
|
|
@@ -9852,9 +10080,9 @@ jobs:
|
|
|
9852
10080
|
run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
|
|
9853
10081
|
`;
|
|
9854
10082
|
async function configureGithubWorkflow(argv) {
|
|
9855
|
-
const dir =
|
|
9856
|
-
const workflowDir =
|
|
9857
|
-
const workflowPath =
|
|
10083
|
+
const dir = path32.resolve(process.cwd(), argv.dir);
|
|
10084
|
+
const workflowDir = path32.join(dir, ".github", "workflows");
|
|
10085
|
+
const workflowPath = path32.join(workflowDir, "apitogo-deploy.yml");
|
|
9858
10086
|
try {
|
|
9859
10087
|
try {
|
|
9860
10088
|
await access(workflowPath, constants.F_OK);
|
|
@@ -9927,14 +10155,14 @@ function applyJsonOnlyDeployQuietMode() {
|
|
|
9927
10155
|
|
|
9928
10156
|
// src/cli/deploy/handler.ts
|
|
9929
10157
|
import { access as access2, readFile as readFile4 } from "node:fs/promises";
|
|
9930
|
-
import
|
|
10158
|
+
import path33 from "node:path";
|
|
9931
10159
|
import { create as createTar } from "tar";
|
|
9932
10160
|
var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
|
|
9933
10161
|
var ARCHIVE_NAME = "dist.tgz";
|
|
9934
10162
|
var createDeploymentArchive = async (dir) => {
|
|
9935
|
-
const distDir =
|
|
10163
|
+
const distDir = path33.join(dir, "dist");
|
|
9936
10164
|
await access2(distDir);
|
|
9937
|
-
const archivePath =
|
|
10165
|
+
const archivePath = path33.join(dir, ARCHIVE_NAME);
|
|
9938
10166
|
await createTar(
|
|
9939
10167
|
{
|
|
9940
10168
|
cwd: dir,
|
|
@@ -9948,7 +10176,7 @@ var createDeploymentArchive = async (dir) => {
|
|
|
9948
10176
|
};
|
|
9949
10177
|
async function deploy(argv) {
|
|
9950
10178
|
await build({ ...argv, preview: void 0 });
|
|
9951
|
-
const dir =
|
|
10179
|
+
const dir = path33.resolve(process.cwd(), argv.dir);
|
|
9952
10180
|
const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
|
|
9953
10181
|
const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
|
|
9954
10182
|
try {
|
|
@@ -9961,7 +10189,7 @@ async function deploy(argv) {
|
|
|
9961
10189
|
const archivePath = await createDeploymentArchive(dir);
|
|
9962
10190
|
if (!isJsonOnlyDeployEnv()) {
|
|
9963
10191
|
printDiagnosticsToConsole(
|
|
9964
|
-
`Uploading ${
|
|
10192
|
+
`Uploading ${path33.basename(archivePath)} to ${env}...`
|
|
9965
10193
|
);
|
|
9966
10194
|
}
|
|
9967
10195
|
const archiveBuffer = await readFile4(archivePath);
|
|
@@ -9969,7 +10197,7 @@ async function deploy(argv) {
|
|
|
9969
10197
|
formData.append(
|
|
9970
10198
|
"file",
|
|
9971
10199
|
new Blob([archiveBuffer], { type: "application/gzip" }),
|
|
9972
|
-
|
|
10200
|
+
path33.basename(archivePath)
|
|
9973
10201
|
);
|
|
9974
10202
|
formData.append("deploymentToken", deploymentToken);
|
|
9975
10203
|
formData.append("env", env);
|
|
@@ -10054,14 +10282,14 @@ var deploy_default = {
|
|
|
10054
10282
|
|
|
10055
10283
|
// src/cli/dev/handler.ts
|
|
10056
10284
|
init_joinUrl();
|
|
10057
|
-
import
|
|
10285
|
+
import path36 from "node:path";
|
|
10058
10286
|
|
|
10059
10287
|
// src/vite/dev-server.ts
|
|
10060
10288
|
init_logger();
|
|
10061
10289
|
import fs4 from "node:fs/promises";
|
|
10062
10290
|
import http from "node:http";
|
|
10063
10291
|
import https from "node:https";
|
|
10064
|
-
import
|
|
10292
|
+
import path35 from "node:path";
|
|
10065
10293
|
import { createHttpTerminator } from "http-terminator";
|
|
10066
10294
|
import {
|
|
10067
10295
|
createServer as createViteServer,
|
|
@@ -10094,7 +10322,7 @@ init_loader();
|
|
|
10094
10322
|
// src/vite/pagefind-dev-index.ts
|
|
10095
10323
|
init_invariant();
|
|
10096
10324
|
init_joinUrl();
|
|
10097
|
-
import
|
|
10325
|
+
import path34 from "node:path";
|
|
10098
10326
|
import { createIndex as createIndex2 } from "pagefind";
|
|
10099
10327
|
import { isRunnableDevEnvironment } from "vite";
|
|
10100
10328
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -10147,7 +10375,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
10147
10375
|
path: urlPath
|
|
10148
10376
|
};
|
|
10149
10377
|
}
|
|
10150
|
-
const outputPath =
|
|
10378
|
+
const outputPath = path34.join(vite.config.publicDir, "pagefind");
|
|
10151
10379
|
await pagefindIndex.writeFiles({ outputPath });
|
|
10152
10380
|
yield { type: "complete", success: true, indexed };
|
|
10153
10381
|
}
|
|
@@ -10166,9 +10394,9 @@ var DevServer = class {
|
|
|
10166
10394
|
this.protocol = "https";
|
|
10167
10395
|
const { dir } = this.options;
|
|
10168
10396
|
const [key, cert, ca] = await Promise.all([
|
|
10169
|
-
fs4.readFile(
|
|
10170
|
-
fs4.readFile(
|
|
10171
|
-
config2.https.ca ? fs4.readFile(
|
|
10397
|
+
fs4.readFile(path35.resolve(dir, config2.https.key)),
|
|
10398
|
+
fs4.readFile(path35.resolve(dir, config2.https.cert)),
|
|
10399
|
+
config2.https.ca ? fs4.readFile(path35.resolve(dir, config2.https.ca)) : void 0
|
|
10172
10400
|
]);
|
|
10173
10401
|
return https.createServer({ key, cert, ca });
|
|
10174
10402
|
}
|
|
@@ -10185,7 +10413,7 @@ var DevServer = class {
|
|
|
10185
10413
|
);
|
|
10186
10414
|
const server = await this.createNodeServer(config2);
|
|
10187
10415
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
10188
|
-
const publicRoot =
|
|
10416
|
+
const publicRoot = path35.resolve(
|
|
10189
10417
|
this.options.dir,
|
|
10190
10418
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
10191
10419
|
);
|
|
@@ -10202,7 +10430,7 @@ var DevServer = class {
|
|
|
10202
10430
|
// built-in transform middleware which would treat the path as a static asset.
|
|
10203
10431
|
name: "apitogo:entry-client",
|
|
10204
10432
|
configureServer(server2) {
|
|
10205
|
-
const entryPath =
|
|
10433
|
+
const entryPath = path35.posix.join(
|
|
10206
10434
|
server2.config.base,
|
|
10207
10435
|
"/__z/entry.client.tsx"
|
|
10208
10436
|
);
|
|
@@ -10367,7 +10595,7 @@ init_package_json();
|
|
|
10367
10595
|
async function dev(argv) {
|
|
10368
10596
|
const packageJson2 = getZudokuPackageJson();
|
|
10369
10597
|
process.env.NODE_ENV = "development";
|
|
10370
|
-
const dir =
|
|
10598
|
+
const dir = path36.resolve(process.cwd(), argv.dir);
|
|
10371
10599
|
const server = new DevServer({
|
|
10372
10600
|
dir,
|
|
10373
10601
|
argPort: argv.port,
|
|
@@ -10452,14 +10680,14 @@ var dev_default = {
|
|
|
10452
10680
|
// src/cli/make-config/handler.ts
|
|
10453
10681
|
import { constants as constants3 } from "node:fs";
|
|
10454
10682
|
import { access as access4, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
|
|
10455
|
-
import
|
|
10683
|
+
import path38 from "node:path";
|
|
10456
10684
|
import { glob as glob5 } from "glob";
|
|
10457
10685
|
|
|
10458
10686
|
// src/cli/make-config/scaffold-project.ts
|
|
10459
10687
|
init_package_json();
|
|
10460
10688
|
import { constants as constants2 } from "node:fs";
|
|
10461
10689
|
import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
|
|
10462
|
-
import
|
|
10690
|
+
import path37 from "node:path";
|
|
10463
10691
|
import { glob as glob4 } from "glob";
|
|
10464
10692
|
var OPENAPI_GLOBS = [
|
|
10465
10693
|
"apis/openapi.json",
|
|
@@ -10519,9 +10747,9 @@ var findMatchingCurly = (source, startIndex) => {
|
|
|
10519
10747
|
}
|
|
10520
10748
|
throw new Error("Could not find matching closing brace for object.");
|
|
10521
10749
|
};
|
|
10522
|
-
var toPosix = (p) => p.split(
|
|
10750
|
+
var toPosix = (p) => p.split(path37.sep).join("/");
|
|
10523
10751
|
var sanitizePackageName = (dir) => {
|
|
10524
|
-
const base =
|
|
10752
|
+
const base = path37.basename(path37.resolve(dir));
|
|
10525
10753
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
10526
10754
|
return s || "apitogo-site";
|
|
10527
10755
|
};
|
|
@@ -10531,7 +10759,7 @@ var apitogoVersionRange = () => {
|
|
|
10531
10759
|
};
|
|
10532
10760
|
async function findOpenApiSpecPath(dir) {
|
|
10533
10761
|
for (const rel of OPENAPI_GLOBS) {
|
|
10534
|
-
const full =
|
|
10762
|
+
const full = path37.join(dir, rel);
|
|
10535
10763
|
try {
|
|
10536
10764
|
await access3(full, constants2.R_OK);
|
|
10537
10765
|
return toPosix(rel);
|
|
@@ -10546,7 +10774,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
10546
10774
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
10547
10775
|
}
|
|
10548
10776
|
async function ensurePackageJson(dir) {
|
|
10549
|
-
const pkgPath =
|
|
10777
|
+
const pkgPath = path37.join(dir, "package.json");
|
|
10550
10778
|
const apitogoVer = apitogoVersionRange();
|
|
10551
10779
|
const baseDeps = {
|
|
10552
10780
|
react: ">=19.0.0",
|
|
@@ -10609,7 +10837,7 @@ async function ensurePackageJson(dir) {
|
|
|
10609
10837
|
return false;
|
|
10610
10838
|
}
|
|
10611
10839
|
async function ensureTsconfigJson(dir) {
|
|
10612
|
-
const tsPath =
|
|
10840
|
+
const tsPath = path37.join(dir, "tsconfig.json");
|
|
10613
10841
|
try {
|
|
10614
10842
|
await access3(tsPath, constants2.R_OK);
|
|
10615
10843
|
return false;
|
|
@@ -10691,7 +10919,7 @@ var CONFIG_FILENAMES = [
|
|
|
10691
10919
|
];
|
|
10692
10920
|
var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
|
|
10693
10921
|
var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
|
|
10694
|
-
var toPosixPath2 = (value) => value.split(
|
|
10922
|
+
var toPosixPath2 = (value) => value.split(path38.sep).join(path38.posix.sep);
|
|
10695
10923
|
var toRoutePath = (relativeFile, pagesDir) => {
|
|
10696
10924
|
const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
|
|
10697
10925
|
const withoutPagesPrefix = relativeNoExt.replace(
|
|
@@ -10936,7 +11164,7 @@ export default config;
|
|
|
10936
11164
|
`;
|
|
10937
11165
|
};
|
|
10938
11166
|
var ensureApitogoDeployWorkflow = async (dir) => {
|
|
10939
|
-
const workflowPath =
|
|
11167
|
+
const workflowPath = path38.join(
|
|
10940
11168
|
dir,
|
|
10941
11169
|
".github",
|
|
10942
11170
|
"workflows",
|
|
@@ -10947,13 +11175,13 @@ var ensureApitogoDeployWorkflow = async (dir) => {
|
|
|
10947
11175
|
return false;
|
|
10948
11176
|
} catch {
|
|
10949
11177
|
}
|
|
10950
|
-
await mkdir7(
|
|
11178
|
+
await mkdir7(path38.join(dir, ".github", "workflows"), { recursive: true });
|
|
10951
11179
|
await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
|
|
10952
11180
|
return true;
|
|
10953
11181
|
};
|
|
10954
11182
|
var findExistingConfigPath = async (dir) => {
|
|
10955
11183
|
for (const filename of CONFIG_FILENAMES) {
|
|
10956
|
-
const fullPath =
|
|
11184
|
+
const fullPath = path38.join(dir, filename);
|
|
10957
11185
|
try {
|
|
10958
11186
|
await readFile6(fullPath, "utf8");
|
|
10959
11187
|
return fullPath;
|
|
@@ -10963,7 +11191,7 @@ var findExistingConfigPath = async (dir) => {
|
|
|
10963
11191
|
return null;
|
|
10964
11192
|
};
|
|
10965
11193
|
async function makeConfig(argv) {
|
|
10966
|
-
const dir =
|
|
11194
|
+
const dir = path38.resolve(process.cwd(), argv.dir);
|
|
10967
11195
|
const pagesDir = toPosixPath2(
|
|
10968
11196
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
10969
11197
|
);
|
|
@@ -10982,7 +11210,7 @@ async function makeConfig(argv) {
|
|
|
10982
11210
|
let configPath = await findExistingConfigPath(dir);
|
|
10983
11211
|
let createdNew = false;
|
|
10984
11212
|
if (!configPath) {
|
|
10985
|
-
configPath =
|
|
11213
|
+
configPath = path38.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
|
|
10986
11214
|
await writeFile8(
|
|
10987
11215
|
configPath,
|
|
10988
11216
|
buildNewConfigContents(pagesDir, openApiSpecPath),
|
|
@@ -11023,7 +11251,7 @@ async function makeConfig(argv) {
|
|
|
11023
11251
|
await writeFile8(configPath, withRedirects, "utf8");
|
|
11024
11252
|
const action = createdNew ? "Initialized" : "Updated";
|
|
11025
11253
|
printResultToConsole(
|
|
11026
|
-
`${action} ${
|
|
11254
|
+
`${action} ${path38.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
|
|
11027
11255
|
);
|
|
11028
11256
|
const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
|
|
11029
11257
|
if (createdWorkflow) {
|
|
@@ -11216,12 +11444,12 @@ function box(message, {
|
|
|
11216
11444
|
|
|
11217
11445
|
// src/cli/common/xdg/lib.ts
|
|
11218
11446
|
import { homedir } from "node:os";
|
|
11219
|
-
import
|
|
11447
|
+
import path39 from "node:path";
|
|
11220
11448
|
function defineDirectoryWithFallback(xdgName, fallback) {
|
|
11221
11449
|
if (process.env[xdgName]) {
|
|
11222
11450
|
return process.env[xdgName];
|
|
11223
11451
|
} else {
|
|
11224
|
-
return
|
|
11452
|
+
return path39.join(homedir(), fallback);
|
|
11225
11453
|
}
|
|
11226
11454
|
}
|
|
11227
11455
|
var XDG_CONFIG_HOME = defineDirectoryWithFallback(
|
|
@@ -11236,15 +11464,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
|
|
|
11236
11464
|
"XDG_DATA_HOME",
|
|
11237
11465
|
".local/state"
|
|
11238
11466
|
);
|
|
11239
|
-
var ZUDOKU_XDG_CONFIG_HOME =
|
|
11467
|
+
var ZUDOKU_XDG_CONFIG_HOME = path39.join(
|
|
11240
11468
|
XDG_CONFIG_HOME,
|
|
11241
11469
|
CLI_XDG_FOLDER_NAME
|
|
11242
11470
|
);
|
|
11243
|
-
var ZUDOKU_XDG_DATA_HOME =
|
|
11471
|
+
var ZUDOKU_XDG_DATA_HOME = path39.join(
|
|
11244
11472
|
XDG_DATA_HOME,
|
|
11245
11473
|
CLI_XDG_FOLDER_NAME
|
|
11246
11474
|
);
|
|
11247
|
-
var ZUDOKU_XDG_STATE_HOME =
|
|
11475
|
+
var ZUDOKU_XDG_STATE_HOME = path39.join(
|
|
11248
11476
|
XDG_STATE_HOME,
|
|
11249
11477
|
CLI_XDG_FOLDER_NAME
|
|
11250
11478
|
);
|