@mintlify/validation 0.1.891 → 0.1.892

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/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { z } from 'zod';
1
2
  import { zodToJsonSchema } from 'zod-to-json-schema';
2
3
  import { mintConfigSchema } from './mint-config/schemas/v1/config.js';
3
4
  import { docsConfigSchema } from './mint-config/schemas/v2/index.js';
@@ -36,7 +37,14 @@ export { collectOpenApiOverlayConfig, normalizeOpenApiSourceKey, } from './mint-
36
37
  export { overlayDocumentSchema, overlayActionSchema, overlayInfoSchema, isOverlayDocument, parseOverlayDocument, safeParseOverlayDocument, } from './openapi/overlay.js';
37
38
  export { convertMintDecoratedNavToDocsDecoratedNav } from './mint-config/upgrades/convertMintDecoratedNavToDocsDecoratedNav.js';
38
39
  export const mintConfigJsonSchema = zodToJsonSchema(mintConfigSchema, 'Schema');
39
- export const docsConfigJsonSchema = zodToJsonSchema(docsConfigSchema, {
40
+ const omitUnreleasedKeys = (schema) => schema.omit({ packages: true });
41
+ const [firstThemeSchema, secondThemeSchema, ...otherThemeSchemas] = docsConfigSchema.options;
42
+ const publicDocsConfigSchema = z.union([
43
+ omitUnreleasedKeys(firstThemeSchema),
44
+ omitUnreleasedKeys(secondThemeSchema),
45
+ ...otherThemeSchemas.map(omitUnreleasedKeys),
46
+ ]);
47
+ export const docsConfigJsonSchema = zodToJsonSchema(publicDocsConfigSchema, {
40
48
  definitions: {
41
49
  anchorSchema,
42
50
  anchorsSchema,
@@ -1866,6 +1866,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
1866
1866
  schema?: boolean | undefined;
1867
1867
  instructions?: string | string[] | undefined;
1868
1868
  }>>>;
1869
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
1870
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
1871
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1872
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1873
+ ssr: z.ZodOptional<z.ZodBoolean>;
1874
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
1875
+ }, "strip", z.ZodTypeAny, {
1876
+ registries?: Record<string, string> | undefined;
1877
+ css?: string[] | undefined;
1878
+ provider?: string | undefined;
1879
+ ssr?: boolean | undefined;
1880
+ isolation?: "page" | "frame" | undefined;
1881
+ }, {
1882
+ registries?: Record<string, string> | undefined;
1883
+ css?: string[] | undefined;
1884
+ provider?: string | undefined;
1885
+ ssr?: boolean | undefined;
1886
+ isolation?: "page" | "frame" | undefined;
1887
+ }>>>;
1869
1888
  theme: z.ZodLiteral<"mint">;
1870
1889
  }, "strip", z.ZodTypeAny, {
1871
1890
  name: string;
@@ -2307,6 +2326,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
2307
2326
  schema?: boolean | undefined;
2308
2327
  instructions?: string | string[] | undefined;
2309
2328
  } | undefined;
2329
+ packages?: {
2330
+ registries?: Record<string, string> | undefined;
2331
+ css?: string[] | undefined;
2332
+ provider?: string | undefined;
2333
+ ssr?: boolean | undefined;
2334
+ isolation?: "page" | "frame" | undefined;
2335
+ } | undefined;
2310
2336
  }, {
2311
2337
  name: string;
2312
2338
  theme: "mint";
@@ -2747,6 +2773,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
2747
2773
  schema?: boolean | undefined;
2748
2774
  instructions?: string | string[] | undefined;
2749
2775
  } | undefined;
2776
+ packages?: unknown;
2750
2777
  }>, z.ZodObject<{
2751
2778
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2752
2779
  name: z.ZodString;
@@ -4611,6 +4638,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
4611
4638
  schema?: boolean | undefined;
4612
4639
  instructions?: string | string[] | undefined;
4613
4640
  }>>>;
4641
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
4642
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
4643
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
4644
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
4645
+ ssr: z.ZodOptional<z.ZodBoolean>;
4646
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
4647
+ }, "strip", z.ZodTypeAny, {
4648
+ registries?: Record<string, string> | undefined;
4649
+ css?: string[] | undefined;
4650
+ provider?: string | undefined;
4651
+ ssr?: boolean | undefined;
4652
+ isolation?: "page" | "frame" | undefined;
4653
+ }, {
4654
+ registries?: Record<string, string> | undefined;
4655
+ css?: string[] | undefined;
4656
+ provider?: string | undefined;
4657
+ ssr?: boolean | undefined;
4658
+ isolation?: "page" | "frame" | undefined;
4659
+ }>>>;
4614
4660
  theme: z.ZodLiteral<"maple">;
4615
4661
  }, "strip", z.ZodTypeAny, {
4616
4662
  name: string;
@@ -5052,6 +5098,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
5052
5098
  schema?: boolean | undefined;
5053
5099
  instructions?: string | string[] | undefined;
5054
5100
  } | undefined;
5101
+ packages?: {
5102
+ registries?: Record<string, string> | undefined;
5103
+ css?: string[] | undefined;
5104
+ provider?: string | undefined;
5105
+ ssr?: boolean | undefined;
5106
+ isolation?: "page" | "frame" | undefined;
5107
+ } | undefined;
5055
5108
  }, {
5056
5109
  name: string;
5057
5110
  theme: "maple";
@@ -5492,6 +5545,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
5492
5545
  schema?: boolean | undefined;
5493
5546
  instructions?: string | string[] | undefined;
5494
5547
  } | undefined;
5548
+ packages?: unknown;
5495
5549
  }>, z.ZodObject<{
5496
5550
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
5497
5551
  name: z.ZodString;
@@ -7356,6 +7410,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
7356
7410
  schema?: boolean | undefined;
7357
7411
  instructions?: string | string[] | undefined;
7358
7412
  }>>>;
7413
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
7414
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
7415
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
7416
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
7417
+ ssr: z.ZodOptional<z.ZodBoolean>;
7418
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
7419
+ }, "strip", z.ZodTypeAny, {
7420
+ registries?: Record<string, string> | undefined;
7421
+ css?: string[] | undefined;
7422
+ provider?: string | undefined;
7423
+ ssr?: boolean | undefined;
7424
+ isolation?: "page" | "frame" | undefined;
7425
+ }, {
7426
+ registries?: Record<string, string> | undefined;
7427
+ css?: string[] | undefined;
7428
+ provider?: string | undefined;
7429
+ ssr?: boolean | undefined;
7430
+ isolation?: "page" | "frame" | undefined;
7431
+ }>>>;
7359
7432
  theme: z.ZodLiteral<"palm">;
7360
7433
  }, "strip", z.ZodTypeAny, {
7361
7434
  name: string;
@@ -7797,6 +7870,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
7797
7870
  schema?: boolean | undefined;
7798
7871
  instructions?: string | string[] | undefined;
7799
7872
  } | undefined;
7873
+ packages?: {
7874
+ registries?: Record<string, string> | undefined;
7875
+ css?: string[] | undefined;
7876
+ provider?: string | undefined;
7877
+ ssr?: boolean | undefined;
7878
+ isolation?: "page" | "frame" | undefined;
7879
+ } | undefined;
7800
7880
  }, {
7801
7881
  name: string;
7802
7882
  theme: "palm";
@@ -8237,6 +8317,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
8237
8317
  schema?: boolean | undefined;
8238
8318
  instructions?: string | string[] | undefined;
8239
8319
  } | undefined;
8320
+ packages?: unknown;
8240
8321
  }>, z.ZodObject<{
8241
8322
  variations: z.ZodOptional<z.ZodEffects<z.ZodObject<{
8242
8323
  options: z.ZodArray<z.ZodObject<{
@@ -10133,6 +10214,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
10133
10214
  schema?: boolean | undefined;
10134
10215
  instructions?: string | string[] | undefined;
10135
10216
  }>>>;
10217
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
10218
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
10219
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
10220
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
10221
+ ssr: z.ZodOptional<z.ZodBoolean>;
10222
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
10223
+ }, "strip", z.ZodTypeAny, {
10224
+ registries?: Record<string, string> | undefined;
10225
+ css?: string[] | undefined;
10226
+ provider?: string | undefined;
10227
+ ssr?: boolean | undefined;
10228
+ isolation?: "page" | "frame" | undefined;
10229
+ }, {
10230
+ registries?: Record<string, string> | undefined;
10231
+ css?: string[] | undefined;
10232
+ provider?: string | undefined;
10233
+ ssr?: boolean | undefined;
10234
+ isolation?: "page" | "frame" | undefined;
10235
+ }>>>;
10136
10236
  theme: z.ZodLiteral<"willow">;
10137
10237
  }, "strip", z.ZodTypeAny, {
10138
10238
  name: string;
@@ -10574,6 +10674,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
10574
10674
  schema?: boolean | undefined;
10575
10675
  instructions?: string | string[] | undefined;
10576
10676
  } | undefined;
10677
+ packages?: {
10678
+ registries?: Record<string, string> | undefined;
10679
+ css?: string[] | undefined;
10680
+ provider?: string | undefined;
10681
+ ssr?: boolean | undefined;
10682
+ isolation?: "page" | "frame" | undefined;
10683
+ } | undefined;
10577
10684
  variations?: {
10578
10685
  options: {
10579
10686
  id: string;
@@ -11020,6 +11127,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
11020
11127
  schema?: boolean | undefined;
11021
11128
  instructions?: string | string[] | undefined;
11022
11129
  } | undefined;
11130
+ packages?: unknown;
11023
11131
  variations?: {
11024
11132
  options: {
11025
11133
  id: string;
@@ -12890,6 +12998,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
12890
12998
  schema?: boolean | undefined;
12891
12999
  instructions?: string | string[] | undefined;
12892
13000
  }>>>;
13001
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
13002
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
13003
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
13004
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
13005
+ ssr: z.ZodOptional<z.ZodBoolean>;
13006
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
13007
+ }, "strip", z.ZodTypeAny, {
13008
+ registries?: Record<string, string> | undefined;
13009
+ css?: string[] | undefined;
13010
+ provider?: string | undefined;
13011
+ ssr?: boolean | undefined;
13012
+ isolation?: "page" | "frame" | undefined;
13013
+ }, {
13014
+ registries?: Record<string, string> | undefined;
13015
+ css?: string[] | undefined;
13016
+ provider?: string | undefined;
13017
+ ssr?: boolean | undefined;
13018
+ isolation?: "page" | "frame" | undefined;
13019
+ }>>>;
12893
13020
  theme: z.ZodLiteral<"linden">;
12894
13021
  }, "strip", z.ZodTypeAny, {
12895
13022
  name: string;
@@ -13331,6 +13458,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
13331
13458
  schema?: boolean | undefined;
13332
13459
  instructions?: string | string[] | undefined;
13333
13460
  } | undefined;
13461
+ packages?: {
13462
+ registries?: Record<string, string> | undefined;
13463
+ css?: string[] | undefined;
13464
+ provider?: string | undefined;
13465
+ ssr?: boolean | undefined;
13466
+ isolation?: "page" | "frame" | undefined;
13467
+ } | undefined;
13334
13468
  }, {
13335
13469
  name: string;
13336
13470
  theme: "linden";
@@ -13771,6 +13905,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
13771
13905
  schema?: boolean | undefined;
13772
13906
  instructions?: string | string[] | undefined;
13773
13907
  } | undefined;
13908
+ packages?: unknown;
13774
13909
  }>, z.ZodObject<{
13775
13910
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
13776
13911
  name: z.ZodString;
@@ -15635,6 +15770,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
15635
15770
  schema?: boolean | undefined;
15636
15771
  instructions?: string | string[] | undefined;
15637
15772
  }>>>;
15773
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
15774
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
15775
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
15776
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
15777
+ ssr: z.ZodOptional<z.ZodBoolean>;
15778
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
15779
+ }, "strip", z.ZodTypeAny, {
15780
+ registries?: Record<string, string> | undefined;
15781
+ css?: string[] | undefined;
15782
+ provider?: string | undefined;
15783
+ ssr?: boolean | undefined;
15784
+ isolation?: "page" | "frame" | undefined;
15785
+ }, {
15786
+ registries?: Record<string, string> | undefined;
15787
+ css?: string[] | undefined;
15788
+ provider?: string | undefined;
15789
+ ssr?: boolean | undefined;
15790
+ isolation?: "page" | "frame" | undefined;
15791
+ }>>>;
15638
15792
  theme: z.ZodLiteral<"almond">;
15639
15793
  }, "strip", z.ZodTypeAny, {
15640
15794
  name: string;
@@ -16076,6 +16230,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
16076
16230
  schema?: boolean | undefined;
16077
16231
  instructions?: string | string[] | undefined;
16078
16232
  } | undefined;
16233
+ packages?: {
16234
+ registries?: Record<string, string> | undefined;
16235
+ css?: string[] | undefined;
16236
+ provider?: string | undefined;
16237
+ ssr?: boolean | undefined;
16238
+ isolation?: "page" | "frame" | undefined;
16239
+ } | undefined;
16079
16240
  }, {
16080
16241
  name: string;
16081
16242
  theme: "almond";
@@ -16516,6 +16677,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
16516
16677
  schema?: boolean | undefined;
16517
16678
  instructions?: string | string[] | undefined;
16518
16679
  } | undefined;
16680
+ packages?: unknown;
16519
16681
  }>, z.ZodObject<{
16520
16682
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
16521
16683
  name: z.ZodString;
@@ -18380,6 +18542,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
18380
18542
  schema?: boolean | undefined;
18381
18543
  instructions?: string | string[] | undefined;
18382
18544
  }>>>;
18545
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
18546
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
18547
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
18548
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
18549
+ ssr: z.ZodOptional<z.ZodBoolean>;
18550
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
18551
+ }, "strip", z.ZodTypeAny, {
18552
+ registries?: Record<string, string> | undefined;
18553
+ css?: string[] | undefined;
18554
+ provider?: string | undefined;
18555
+ ssr?: boolean | undefined;
18556
+ isolation?: "page" | "frame" | undefined;
18557
+ }, {
18558
+ registries?: Record<string, string> | undefined;
18559
+ css?: string[] | undefined;
18560
+ provider?: string | undefined;
18561
+ ssr?: boolean | undefined;
18562
+ isolation?: "page" | "frame" | undefined;
18563
+ }>>>;
18383
18564
  theme: z.ZodLiteral<"aspen">;
18384
18565
  }, "strip", z.ZodTypeAny, {
18385
18566
  name: string;
@@ -18821,6 +19002,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
18821
19002
  schema?: boolean | undefined;
18822
19003
  instructions?: string | string[] | undefined;
18823
19004
  } | undefined;
19005
+ packages?: {
19006
+ registries?: Record<string, string> | undefined;
19007
+ css?: string[] | undefined;
19008
+ provider?: string | undefined;
19009
+ ssr?: boolean | undefined;
19010
+ isolation?: "page" | "frame" | undefined;
19011
+ } | undefined;
18824
19012
  }, {
18825
19013
  name: string;
18826
19014
  theme: "aspen";
@@ -19261,6 +19449,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
19261
19449
  schema?: boolean | undefined;
19262
19450
  instructions?: string | string[] | undefined;
19263
19451
  } | undefined;
19452
+ packages?: unknown;
19264
19453
  }>, z.ZodObject<{
19265
19454
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
19266
19455
  name: z.ZodString;
@@ -21125,6 +21314,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
21125
21314
  schema?: boolean | undefined;
21126
21315
  instructions?: string | string[] | undefined;
21127
21316
  }>>>;
21317
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
21318
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
21319
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
21320
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
21321
+ ssr: z.ZodOptional<z.ZodBoolean>;
21322
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
21323
+ }, "strip", z.ZodTypeAny, {
21324
+ registries?: Record<string, string> | undefined;
21325
+ css?: string[] | undefined;
21326
+ provider?: string | undefined;
21327
+ ssr?: boolean | undefined;
21328
+ isolation?: "page" | "frame" | undefined;
21329
+ }, {
21330
+ registries?: Record<string, string> | undefined;
21331
+ css?: string[] | undefined;
21332
+ provider?: string | undefined;
21333
+ ssr?: boolean | undefined;
21334
+ isolation?: "page" | "frame" | undefined;
21335
+ }>>>;
21128
21336
  theme: z.ZodLiteral<"luma">;
21129
21337
  }, "strip", z.ZodTypeAny, {
21130
21338
  name: string;
@@ -21566,6 +21774,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
21566
21774
  schema?: boolean | undefined;
21567
21775
  instructions?: string | string[] | undefined;
21568
21776
  } | undefined;
21777
+ packages?: {
21778
+ registries?: Record<string, string> | undefined;
21779
+ css?: string[] | undefined;
21780
+ provider?: string | undefined;
21781
+ ssr?: boolean | undefined;
21782
+ isolation?: "page" | "frame" | undefined;
21783
+ } | undefined;
21569
21784
  }, {
21570
21785
  name: string;
21571
21786
  theme: "luma";
@@ -22006,6 +22221,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
22006
22221
  schema?: boolean | undefined;
22007
22222
  instructions?: string | string[] | undefined;
22008
22223
  } | undefined;
22224
+ packages?: unknown;
22009
22225
  }>, z.ZodObject<{
22010
22226
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
22011
22227
  name: z.ZodString;
@@ -23870,6 +24086,25 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
23870
24086
  schema?: boolean | undefined;
23871
24087
  instructions?: string | string[] | undefined;
23872
24088
  }>>>;
24089
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
24090
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
24091
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
24092
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
24093
+ ssr: z.ZodOptional<z.ZodBoolean>;
24094
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
24095
+ }, "strip", z.ZodTypeAny, {
24096
+ registries?: Record<string, string> | undefined;
24097
+ css?: string[] | undefined;
24098
+ provider?: string | undefined;
24099
+ ssr?: boolean | undefined;
24100
+ isolation?: "page" | "frame" | undefined;
24101
+ }, {
24102
+ registries?: Record<string, string> | undefined;
24103
+ css?: string[] | undefined;
24104
+ provider?: string | undefined;
24105
+ ssr?: boolean | undefined;
24106
+ isolation?: "page" | "frame" | undefined;
24107
+ }>>>;
23873
24108
  theme: z.ZodLiteral<"sequoia">;
23874
24109
  }, "strip", z.ZodTypeAny, {
23875
24110
  name: string;
@@ -24311,6 +24546,13 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
24311
24546
  schema?: boolean | undefined;
24312
24547
  instructions?: string | string[] | undefined;
24313
24548
  } | undefined;
24549
+ packages?: {
24550
+ registries?: Record<string, string> | undefined;
24551
+ css?: string[] | undefined;
24552
+ provider?: string | undefined;
24553
+ ssr?: boolean | undefined;
24554
+ isolation?: "page" | "frame" | undefined;
24555
+ } | undefined;
24314
24556
  }, {
24315
24557
  name: string;
24316
24558
  theme: "sequoia";
@@ -24751,6 +24993,7 @@ export declare const docsConfigSchema: z.ZodDiscriminatedUnion<"theme", [z.ZodOb
24751
24993
  schema?: boolean | undefined;
24752
24994
  instructions?: string | string[] | undefined;
24753
24995
  } | undefined;
24996
+ packages?: unknown;
24754
24997
  }>]>;
24755
24998
  export declare const docsConfigUnifiedSchema: z.ZodObject<{
24756
24999
  $schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -26616,6 +26859,25 @@ export declare const docsConfigUnifiedSchema: z.ZodObject<{
26616
26859
  schema?: boolean | undefined;
26617
26860
  instructions?: string | string[] | undefined;
26618
26861
  }>>>;
26862
+ packages: z.ZodCatch<z.ZodOptional<z.ZodObject<{
26863
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
26864
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
26865
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
26866
+ ssr: z.ZodOptional<z.ZodBoolean>;
26867
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
26868
+ }, "strip", z.ZodTypeAny, {
26869
+ registries?: Record<string, string> | undefined;
26870
+ css?: string[] | undefined;
26871
+ provider?: string | undefined;
26872
+ ssr?: boolean | undefined;
26873
+ isolation?: "page" | "frame" | undefined;
26874
+ }, {
26875
+ registries?: Record<string, string> | undefined;
26876
+ css?: string[] | undefined;
26877
+ provider?: string | undefined;
26878
+ ssr?: boolean | undefined;
26879
+ isolation?: "page" | "frame" | undefined;
26880
+ }>>>;
26619
26881
  theme: z.ZodEnum<["mint", "maple", "palm", "willow", "linden", "almond", "aspen", "luma", "sequoia"]>;
26620
26882
  }, "strip", z.ZodTypeAny, {
26621
26883
  name: string;
@@ -27057,6 +27319,13 @@ export declare const docsConfigUnifiedSchema: z.ZodObject<{
27057
27319
  schema?: boolean | undefined;
27058
27320
  instructions?: string | string[] | undefined;
27059
27321
  } | undefined;
27322
+ packages?: {
27323
+ registries?: Record<string, string> | undefined;
27324
+ css?: string[] | undefined;
27325
+ provider?: string | undefined;
27326
+ ssr?: boolean | undefined;
27327
+ isolation?: "page" | "frame" | undefined;
27328
+ } | undefined;
27060
27329
  }, {
27061
27330
  name: string;
27062
27331
  theme: "mint" | "maple" | "palm" | "willow" | "linden" | "almond" | "aspen" | "luma" | "sequoia";
@@ -27497,4 +27766,5 @@ export declare const docsConfigUnifiedSchema: z.ZodObject<{
27497
27766
  schema?: boolean | undefined;
27498
27767
  instructions?: string | string[] | undefined;
27499
27768
  } | undefined;
27769
+ packages?: unknown;
27500
27770
  }>;
@@ -19,3 +19,4 @@ export * from './thumbnails.js';
19
19
  export * from './metadata.js';
20
20
  export * from './variations.js';
21
21
  export * from './shikiThemes.js';
22
+ export * from './packages.js';
@@ -19,3 +19,4 @@ export * from './thumbnails.js';
19
19
  export * from './metadata.js';
20
20
  export * from './variations.js';
21
21
  export * from './shikiThemes.js';
22
+ export * from './packages.js';
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export declare const PACKAGE_SCOPE_REGEX: RegExp;
3
+ export declare const packageIsolationModes: readonly ["page", "frame"];
4
+ export declare const packagesSchema: z.ZodObject<{
5
+ registries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
6
+ css: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
7
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
8
+ ssr: z.ZodOptional<z.ZodBoolean>;
9
+ isolation: z.ZodOptional<z.ZodEnum<["page", "frame"]>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ registries?: Record<string, string> | undefined;
12
+ css?: string[] | undefined;
13
+ provider?: string | undefined;
14
+ ssr?: boolean | undefined;
15
+ isolation?: "page" | "frame" | undefined;
16
+ }, {
17
+ registries?: Record<string, string> | undefined;
18
+ css?: string[] | undefined;
19
+ provider?: string | undefined;
20
+ ssr?: boolean | undefined;
21
+ isolation?: "page" | "frame" | undefined;
22
+ }>;
23
+ export type PackagesConfig = z.infer<typeof packagesSchema>;
24
+ export type PackageIsolationMode = (typeof packageIsolationModes)[number];
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ export const PACKAGE_SCOPE_REGEX = /^@[a-z0-9-~][a-z0-9-._~]*$/;
3
+ export const packageIsolationModes = ['page', 'frame'];
4
+ const registryScopeSchema = z
5
+ .string()
6
+ .regex(PACKAGE_SCOPE_REGEX, 'Registry keys must be npm scopes such as `@acme` (lowercase, starting with `@`)');
7
+ const WHITESPACE_OR_CONTROL_REGEX = /[\s\u0000-\u001f\u007f]/;
8
+ const MAX_REGISTRY_URL_LENGTH = 512;
9
+ const registryUrlProblem = (value) => {
10
+ if (WHITESPACE_OR_CONTROL_REGEX.test(value))
11
+ return 'Registry URLs cannot contain whitespace';
12
+ if (value.includes('${')) {
13
+ return 'Registry URLs cannot contain `${`, which npm expands from environment variables';
14
+ }
15
+ if (/[;#\\]/.test(value)) {
16
+ return 'Registry URLs cannot contain `;`, `#` or `\\`, which npm reads as a comment or escape in .npmrc';
17
+ }
18
+ let url;
19
+ try {
20
+ url = new URL(value);
21
+ }
22
+ catch (_a) {
23
+ return undefined;
24
+ }
25
+ if (url.username !== '' || url.password !== '') {
26
+ return 'Registry URLs cannot include a username, password or token';
27
+ }
28
+ if (value.includes('?') || url.hash !== '') {
29
+ return 'Registry URLs cannot include a query string or fragment';
30
+ }
31
+ if (url.href.includes('${') || /[;#\\]/.test(url.href)) {
32
+ return 'Registry URLs cannot parse to a URL with `${`, `;`, `#` or `\\`, such as from full-width characters in the host, which npm rewrites in .npmrc';
33
+ }
34
+ if (url.hostname.includes('=') || url.pathname.includes('=')) {
35
+ return 'Registry URLs cannot have `=` in the host or path, which npm reads as the end of the auth token key in .npmrc';
36
+ }
37
+ return undefined;
38
+ };
39
+ const registryUrlSchema = z
40
+ .string()
41
+ .max(MAX_REGISTRY_URL_LENGTH, `Registry URLs cannot be longer than ${MAX_REGISTRY_URL_LENGTH} characters`)
42
+ .url('Must be a valid URL')
43
+ .regex(/^https:\/\/[^/]/, 'Registry URLs must start with `https://` and then the host')
44
+ .superRefine((value, ctx) => {
45
+ const message = registryUrlProblem(value);
46
+ if (message)
47
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message });
48
+ });
49
+ const URL_SCHEME_REGEX = /^[a-z][a-z\d+.-]*:/i;
50
+ const isPackageCssPath = (value) => !/^[./\\]/.test(value) && !URL_SCHEME_REGEX.test(value) && !value.split(/[\\/]/).includes('..');
51
+ const cssEntrySchema = z
52
+ .string()
53
+ .min(1, 'CSS entries cannot be empty')
54
+ .refine(isPackageCssPath, 'CSS entries must be paths inside an installed package, such as `@acme/ui/dist/styles.css`');
55
+ const providerPathProblem = (value) => {
56
+ if (value === '')
57
+ return undefined;
58
+ const path = value.replace(/\\/g, '/');
59
+ const segments = path.replace(/^\/+/, '').split('/');
60
+ if (segments.includes('..'))
61
+ return 'Provider path cannot contain `..` segments';
62
+ if (segments.includes('')) {
63
+ return 'Provider path must name a file, such as `/snippets/provider.jsx`, with no empty segments or trailing slash';
64
+ }
65
+ const stripped = path.replace(/[?#].*$/, '');
66
+ const strippedRel = stripped.replace(/^\/+|\/+$/g, '');
67
+ const searched = strippedRel === '' || strippedRel.split('/').includes('..') ? path : stripped;
68
+ if (searched.split('/').slice(0, -1).includes('node_modules')) {
69
+ return 'Provider path cannot be inside a `node_modules` folder';
70
+ }
71
+ if (!value.startsWith('/')) {
72
+ return 'Provider path must start with `/`, such as `/snippets/provider.jsx`';
73
+ }
74
+ if (segments.some((seg) => /[:\0]/.test(seg) || (seg !== '.' && /[. ]$/.test(seg)))) {
75
+ return 'Provider path cannot contain `:` or NUL, or a name that ends in `.` or a space';
76
+ }
77
+ return undefined;
78
+ };
79
+ const providerPathSchema = z
80
+ .string()
81
+ .min(1, 'Provider path cannot be empty')
82
+ .superRefine((value, ctx) => {
83
+ const message = providerPathProblem(value);
84
+ if (message)
85
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message });
86
+ });
87
+ export const packagesSchema = z
88
+ .object({
89
+ registries: z
90
+ .record(registryScopeSchema, registryUrlSchema)
91
+ .optional()
92
+ .describe('Registry to install each npm scope from, e.g. `{ "@acme": "https://npm.acme.com/" }`. One registry per scope. Unscoped packages always install from registry.npmjs.org.'),
93
+ css: z
94
+ .array(cssEntrySchema)
95
+ .optional()
96
+ .describe('Compiled CSS files shipped by your packages to load on every page, e.g. `@acme/ui/dist/styles.css`'),
97
+ provider: providerPathSchema
98
+ .optional()
99
+ .describe('Path to a snippet that exports a `Provider` component, e.g. `/snippets/provider.jsx`. It wraps every package component.'),
100
+ ssr: z
101
+ .boolean()
102
+ .optional()
103
+ .describe('Whether to render package components to HTML at build time so they show before their JavaScript loads. Defaults to true.'),
104
+ isolation: z
105
+ .enum(packageIsolationModes)
106
+ .optional()
107
+ .describe('How package components run in the browser. `page` (default) renders them in the docs page; `frame` runs each one in a sandboxed iframe.'),
108
+ })
109
+ .describe('Use npm packages from package.json in MDX pages and snippets. Adding this key, even as `{}`, turns the feature on. Requires a package-lock.json or pnpm-lock.yaml next to docs.json.');