boltdocs 2.8.4 → 2.9.1
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/bin/boltdocs.js +7 -6
- package/dist/{banner-DFACg5Dy.d.cts → banner-C_xkGxzI.d.cts} +1 -1
- package/dist/{banner-BLTQUA2O.d.ts → banner-D2NddBfF.d.ts} +1 -1
- package/dist/cache-B19MLTpN.cjs +6 -0
- package/dist/cache-CfhOTR3Q.mjs +6 -0
- package/dist/chunk-Ds5LZdWN.cjs +6 -0
- package/dist/client/index.cjs +464 -279
- package/dist/client/index.d.cts +74 -8
- package/dist/client/index.d.ts +74 -8
- package/dist/client/index.js +463 -280
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +4 -4
- package/dist/client/primitives.d.cts +1 -1
- package/dist/client/primitives.d.ts +1 -1
- package/dist/client/primitives.js +4 -4
- package/dist/client/theme/neutral.css +5 -3
- package/dist/client/theme/reset.css +19 -0
- package/dist/config-BqZUYono.cjs +7 -0
- package/dist/config-DBKBEj3j.mjs +7 -0
- package/dist/config-GPVEdeon.mjs +6 -0
- package/dist/config-kIQOJHXC.cjs +6 -0
- package/dist/csp-CBysWlAf.cjs +6 -0
- package/dist/csp-RJyh0nHV.mjs +6 -0
- package/dist/{docs-layout-CVCf3xkZ.cjs → docs-layout-3TpAt6MB.cjs} +302 -238
- package/dist/{docs-layout-BBv6wILp.js → docs-layout-6FQ8__ok.js} +303 -239
- package/dist/doctor-C19DsI1e.mjs +7 -0
- package/dist/{doctor-DT4jh07O.cjs → doctor-D8fl3Sbg.cjs} +1 -1
- package/dist/doctor-DzEgMMRo.cjs +7 -0
- package/dist/errors-C0Hx15Ag.mjs +6 -0
- package/dist/errors-Dx6JHoKE.cjs +6 -0
- package/dist/{generator-BHCrLU6h.mjs → generator-B6lrnDZ-.mjs} +1 -1
- package/dist/{generator-CC2yHzhZ.cjs → generator-DtUU3Cfk.cjs} +2 -2
- package/dist/handler-1LRMYeI4.cjs +28 -0
- package/dist/handler-CyIBbZdb.mjs +28 -0
- package/dist/{doctor-BGPdO1Ah.mjs → handler-eNNcucnf.mjs} +1 -1
- package/dist/headers-BJ4jJAhU.cjs +6 -0
- package/dist/headers-HD_qTVVW.mjs +6 -0
- package/dist/{icons-dev-C8sFxeBk.cjs → icons-dev-BryEFkJu.cjs} +90 -4
- package/dist/{icons-dev-CFcv5Nb8.js → icons-dev-kJyGWNeg.js} +73 -5
- package/dist/{image-DCMxxidi.cjs → image-B9YA_oQ_.cjs} +17 -9
- package/dist/{image-DufDOid8.js → image-CjYu9Eml.js} +17 -9
- package/dist/{mdx-Bto8CvGl.js → mdx-Cy_c2zio.js} +116 -33
- package/dist/{mdx-BH9kHiF9.cjs → mdx-WXjAMS8Y.cjs} +121 -32
- package/dist/{meta-loader-Cv9O0Pzl.cjs → meta-loader-C9MKjAs0.cjs} +1 -1
- package/dist/{meta-loader-DzwDFtdT.mjs → meta-loader-CxAoQthW.mjs} +1 -1
- package/dist/node/cli-entry.cjs +8 -2
- package/dist/node/cli-entry.mjs +8 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +362 -18
- package/dist/node/index.d.mts +364 -19
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.cjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/node-B7qbjtLl.mjs +105 -0
- package/dist/node-Dj3-2YYP.cjs +105 -0
- package/dist/{package-CwNjt3Sd.cjs → package-ByXh2JHp.cjs} +1 -1
- package/dist/{package-DlgexgpQ.mjs → package-DQBAV8uo.mjs} +1 -1
- package/dist/{parser-BzB-zCkF.cjs → parser-B8naUXl2.cjs} +1 -1
- package/dist/parser-D4oEyuP-.cjs +6 -0
- package/dist/parser-IR9tfyGE.mjs +6 -0
- package/dist/plugin-BkquLpOI.mjs +61 -0
- package/dist/plugin-CL1LsQXk.cjs +61 -0
- package/dist/routes-DR13Y1em.mjs +6 -0
- package/dist/routes-DX8ryKjs.cjs +6 -0
- package/dist/routes-DgTQxpZi.cjs +6 -0
- package/dist/routes-TUSK5wD7.mjs +6 -0
- package/dist/{search-dialog-Cvux-qSk.cjs → search-dialog-BhXg05Ri.cjs} +1 -1
- package/dist/{search-dialog-CmHYOt18.cjs → search-dialog-BsAiQgnx.cjs} +2 -2
- package/dist/{search-dialog-jHZ21G4i.js → search-dialog-CaOO1Q4i.js} +2 -2
- package/dist/{search-dialog-Cr7SC8Xt.cjs → search-dialog-CzwvKoLW.cjs} +1 -1
- package/dist/{search-dialog-DBNaG5At.js → search-dialog-DRNJsxOv.js} +1 -1
- package/dist/{search-dialog-e86WPpck.js → search-dialog-DaR66wl0.js} +1 -1
- package/dist/shiki-adapter-BB71nVsG.cjs +6 -0
- package/dist/shiki-adapter-CL-IQwKI.cjs +6 -0
- package/dist/shiki-adapter-CxTLkjew.mjs +6 -0
- package/dist/shiki-adapter-rQ087Lx3.mjs +6 -0
- package/dist/{sidebar-kQBonN82.d.ts → sidebar-BtJyWHy4.d.cts} +42 -5
- package/dist/{sidebar---RgTmZD.d.cts → sidebar-C4fuRYYS.d.ts} +42 -5
- package/dist/types-generator-BRyf4o9F.mjs +26 -0
- package/dist/types-generator-BqNKCbrx.cjs +26 -0
- package/dist/types-generator-Cu2jQP-V.mjs +6 -0
- package/dist/utils-BWy_8ASj.cjs +7 -0
- package/dist/utils-DexBrwiP.mjs +7 -0
- package/dist/worker-pool-C6r6V05j.mjs +6 -0
- package/dist/worker-pool-m81xuM5v.cjs +6 -0
- package/package.json +6 -3
- package/src/shared/types.ts +36 -3
- package/dist/cache-BMUyNiiA.mjs +0 -6
- package/dist/cache-CKm45d2w.cjs +0 -6
- package/dist/chunk-CU-zTemE.cjs +0 -6
- package/dist/doctor-Dnv77Lfx.mjs +0 -28
- package/dist/doctor-VBPlQf7d.cjs +0 -28
- package/dist/node-JM9bx0mO.cjs +0 -160
- package/dist/node-q-Y2mdLX.mjs +0 -160
- package/dist/parser-9LqyiEnB.mjs +0 -6
- package/dist/parser-B7-6PyQz.cjs +0 -6
- package/dist/routes-3sAccArX.cjs +0 -6
- package/dist/routes-DZpXqq1p.mjs +0 -6
- package/dist/routes-DjoxNeef.mjs +0 -6
- package/dist/routes-DpJnb2VS.cjs +0 -6
- package/dist/utils-BYITg7T5.mjs +0 -7
- package/dist/utils-Cjmx1hhk.cjs +0 -7
- package/dist/worker-pool-DXLyeHJg.cjs +0 -6
- package/dist/worker-pool-Kn4F9gDq.mjs +0 -6
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { InlineConfig, Plugin } from "vite";
|
|
3
2
|
import { z } from "zod";
|
|
3
|
+
import { InlineConfig, Plugin } from "vite";
|
|
4
4
|
import { EXIT, SKIP } from "unist-util-visit";
|
|
5
|
+
import { VercelRequest, VercelResponse } from "@vercel/node";
|
|
6
|
+
import { HandlerEvent, HandlerResponse } from "@netlify/functions";
|
|
7
|
+
import { Writable } from "node:stream";
|
|
8
|
+
|
|
5
9
|
//#region src/shared/types.d.ts
|
|
6
10
|
/**
|
|
7
11
|
* Represents a single social link in the configuration.
|
|
@@ -194,10 +198,42 @@ interface BoltdocsAlgoliaConfig {
|
|
|
194
198
|
apiKey: string;
|
|
195
199
|
indexName: string;
|
|
196
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Configuration for Giscus comments.
|
|
203
|
+
*/
|
|
204
|
+
interface BoltdocsGiscusConfig {
|
|
205
|
+
repo: string;
|
|
206
|
+
repoId: string;
|
|
207
|
+
category?: string;
|
|
208
|
+
categoryId?: string;
|
|
209
|
+
mapping?: 'pathname' | 'url' | 'title' | 'og:title' | 'specific' | 'number';
|
|
210
|
+
strict?: '0' | '1' | boolean;
|
|
211
|
+
reactionsEnabled?: '0' | '1' | boolean;
|
|
212
|
+
emitMetadata?: '0' | '1' | boolean;
|
|
213
|
+
inputPosition?: 'top' | 'bottom';
|
|
214
|
+
theme?: string;
|
|
215
|
+
darkTheme?: string;
|
|
216
|
+
lang?: string;
|
|
217
|
+
loading?: 'lazy' | 'eager';
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Configuration for custom feedback system using GitHub Discussions API.
|
|
221
|
+
*/
|
|
222
|
+
interface BoltdocsCustomFeedbackConfig {
|
|
223
|
+
enabled: boolean;
|
|
224
|
+
owner: string;
|
|
225
|
+
repo: string;
|
|
226
|
+
categorySlug?: string;
|
|
227
|
+
endpoint?: string;
|
|
228
|
+
}
|
|
197
229
|
interface BoltdocsIntegrationsConfig {
|
|
198
230
|
ga4?: BoltdocsGA4Config;
|
|
199
231
|
gtm?: BoltdocsGTMConfig;
|
|
200
232
|
algolia?: BoltdocsAlgoliaConfig;
|
|
233
|
+
feedback?: {
|
|
234
|
+
giscus?: BoltdocsGiscusConfig;
|
|
235
|
+
custom?: BoltdocsCustomFeedbackConfig;
|
|
236
|
+
};
|
|
201
237
|
}
|
|
202
238
|
/**
|
|
203
239
|
* The root configuration object for Boltdocs.
|
|
@@ -215,9 +251,8 @@ interface BoltdocsConfig {
|
|
|
215
251
|
security?: BoltdocsSecurityConfig;
|
|
216
252
|
seo?: BoltdocsSeoConfig;
|
|
217
253
|
integrations?: BoltdocsIntegrationsConfig;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
vite?: any;
|
|
254
|
+
directoryMeta?: Record<string, unknown>;
|
|
255
|
+
vite?: unknown;
|
|
221
256
|
}
|
|
222
257
|
/**
|
|
223
258
|
* Global namespace for Boltdocs types that can be augmented by generated code.
|
|
@@ -364,23 +399,25 @@ interface RouteMeta {
|
|
|
364
399
|
slugParts?: string[];
|
|
365
400
|
}
|
|
366
401
|
//#endregion
|
|
367
|
-
//#region src/node/
|
|
402
|
+
//#region src/node/cache.d.ts
|
|
368
403
|
/**
|
|
369
|
-
*
|
|
370
|
-
* Ensures consistent path handling across different operating systems.
|
|
371
|
-
*
|
|
372
|
-
* @param p - The file path to normalize
|
|
373
|
-
* @returns The normalized path using forward slashes
|
|
404
|
+
* Specialized cache for processed assets (e.g., optimized images).
|
|
374
405
|
*/
|
|
375
|
-
declare
|
|
406
|
+
declare class AssetCache {
|
|
407
|
+
private readonly assetsDir;
|
|
408
|
+
private hashMap;
|
|
409
|
+
constructor(root?: string);
|
|
410
|
+
getFileHash(filePath: string): Promise<string>;
|
|
411
|
+
get(sourcePath: string, cacheKey: string): Promise<string | null>;
|
|
412
|
+
set(sourcePath: string, cacheKey: string, content: Buffer | string, sourceHash: string): void;
|
|
413
|
+
private getCachedPath;
|
|
414
|
+
clear(): void;
|
|
415
|
+
flush(): Promise<void>;
|
|
416
|
+
}
|
|
376
417
|
/**
|
|
377
|
-
*
|
|
378
|
-
* Prevents multiple dots to avoid path traversal tricks.
|
|
379
|
-
*
|
|
380
|
-
* @param name - The name to sanitize
|
|
381
|
-
* @returns The sanitized name
|
|
418
|
+
* Flushes all pending background cache operations.
|
|
382
419
|
*/
|
|
383
|
-
declare function
|
|
420
|
+
declare function flushCache(): Promise<void>;
|
|
384
421
|
//#endregion
|
|
385
422
|
//#region src/node/plugins/plugin-types.d.ts
|
|
386
423
|
interface PluginContext {
|
|
@@ -413,6 +450,14 @@ interface PluginLifecycleHooks {
|
|
|
413
450
|
beforeDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
414
451
|
afterDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
415
452
|
buildEnd?: (ctx: PluginContext) => Promise<void> | void;
|
|
453
|
+
transformSource?: (ctx: PluginContext, params: {
|
|
454
|
+
code: string;
|
|
455
|
+
filePath: string;
|
|
456
|
+
}) => Promise<{
|
|
457
|
+
code: string;
|
|
458
|
+
}> | {
|
|
459
|
+
code: string;
|
|
460
|
+
};
|
|
416
461
|
transformMdx?: (ctx: PluginContext, params: {
|
|
417
462
|
code: string;
|
|
418
463
|
filePath: string;
|
|
@@ -686,12 +731,312 @@ declare const MDX_NODES: {
|
|
|
686
731
|
//#region src/node/plugins/index.d.ts
|
|
687
732
|
declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
|
|
688
733
|
//#endregion
|
|
734
|
+
//#region src/node/feedback/adapters/vercel.d.ts
|
|
735
|
+
declare function handleVercelFeedback(req: VercelRequest, res: VercelResponse): Promise<VercelResponse | undefined>;
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/node/feedback/adapters/netlify.d.ts
|
|
738
|
+
declare function handleNetlifyFeedback(event: HandlerEvent, env?: Record<string, string | undefined>): Promise<HandlerResponse>;
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/node/feedback/adapters/web.d.ts
|
|
741
|
+
declare function handleWebFeedback(request: Request, env?: Record<string, string | undefined>): Promise<Response>;
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/common/api-gateway.d.ts
|
|
744
|
+
// Default authorizer type, prefer using a specific type with the "...WithAuthorizer..." variant types.
|
|
745
|
+
// Note that this doesn't have to be a context from a custom lambda outhorizer, AWS also has a cognito
|
|
746
|
+
// authorizer type and could add more, so the property won't always be a string.
|
|
747
|
+
type APIGatewayEventDefaultAuthorizerContext = undefined | null | {
|
|
748
|
+
[name: string]: any;
|
|
749
|
+
};
|
|
750
|
+
// The requestContext property of both request authorizer and proxy integration events.
|
|
751
|
+
interface APIGatewayEventRequestContextWithAuthorizer<TAuthorizerContext> {
|
|
752
|
+
accountId: string;
|
|
753
|
+
apiId: string; // This one is a bit confusing: it is not actually present in authorizer calls
|
|
754
|
+
// and proxy calls without an authorizer. We model this by allowing undefined in the type,
|
|
755
|
+
// since it ends up the same and avoids breaking users that are testing the property.
|
|
756
|
+
// This lets us allow parameterizing the authorizer for proxy events that know what authorizer
|
|
757
|
+
// context values they have.
|
|
758
|
+
authorizer: TAuthorizerContext;
|
|
759
|
+
connectedAt?: number | undefined;
|
|
760
|
+
connectionId?: string | undefined;
|
|
761
|
+
domainName?: string | undefined;
|
|
762
|
+
domainPrefix?: string | undefined;
|
|
763
|
+
eventType?: string | undefined;
|
|
764
|
+
extendedRequestId?: string | undefined;
|
|
765
|
+
protocol: string;
|
|
766
|
+
httpMethod: string;
|
|
767
|
+
identity: APIGatewayEventIdentity;
|
|
768
|
+
messageDirection?: string | undefined;
|
|
769
|
+
messageId?: string | null | undefined;
|
|
770
|
+
path: string;
|
|
771
|
+
stage: string;
|
|
772
|
+
requestId: string;
|
|
773
|
+
requestTime?: string | undefined;
|
|
774
|
+
requestTimeEpoch: number;
|
|
775
|
+
resourceId: string;
|
|
776
|
+
resourcePath: string;
|
|
777
|
+
routeKey?: string | undefined;
|
|
778
|
+
}
|
|
779
|
+
interface APIGatewayEventClientCertificate {
|
|
780
|
+
clientCertPem: string;
|
|
781
|
+
serialNumber: string;
|
|
782
|
+
subjectDN: string;
|
|
783
|
+
issuerDN: string;
|
|
784
|
+
validity: {
|
|
785
|
+
notAfter: string;
|
|
786
|
+
notBefore: string;
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
interface APIGatewayEventIdentity {
|
|
790
|
+
accessKey: string | null;
|
|
791
|
+
accountId: string | null;
|
|
792
|
+
apiKey: string | null;
|
|
793
|
+
apiKeyId: string | null;
|
|
794
|
+
caller: string | null;
|
|
795
|
+
clientCert: APIGatewayEventClientCertificate | null;
|
|
796
|
+
cognitoAuthenticationProvider: string | null;
|
|
797
|
+
cognitoAuthenticationType: string | null;
|
|
798
|
+
cognitoIdentityId: string | null;
|
|
799
|
+
cognitoIdentityPoolId: string | null;
|
|
800
|
+
principalOrgId: string | null;
|
|
801
|
+
sourceIp: string;
|
|
802
|
+
user: string | null;
|
|
803
|
+
userAgent: string | null;
|
|
804
|
+
userArn: string | null;
|
|
805
|
+
vpcId?: string | undefined;
|
|
806
|
+
vpceId?: string | undefined;
|
|
807
|
+
}
|
|
808
|
+
//#endregion
|
|
809
|
+
//#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/handler.d.ts
|
|
810
|
+
/**
|
|
811
|
+
* {@link Handler} context parameter.
|
|
812
|
+
* See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}.
|
|
813
|
+
*/
|
|
814
|
+
interface Context {
|
|
815
|
+
callbackWaitsForEmptyEventLoop: boolean;
|
|
816
|
+
functionName: string;
|
|
817
|
+
functionVersion: string;
|
|
818
|
+
invokedFunctionArn: string;
|
|
819
|
+
memoryLimitInMB: string;
|
|
820
|
+
awsRequestId: string;
|
|
821
|
+
logGroupName: string;
|
|
822
|
+
logStreamName: string;
|
|
823
|
+
identity?: CognitoIdentity | undefined;
|
|
824
|
+
clientContext?: ClientContext | undefined;
|
|
825
|
+
tenantId?: string | undefined;
|
|
826
|
+
getRemainingTimeInMillis(): number; // Functions for compatibility with earlier Node.js Runtime v0.10.42
|
|
827
|
+
// No longer documented, so they are deprecated, but they still work
|
|
828
|
+
// as of the 12.x runtime, so they are not removed from the types.
|
|
829
|
+
/** @deprecated Use handler callback or promise result */
|
|
830
|
+
done(error?: Error, result?: any): void;
|
|
831
|
+
/** @deprecated Use handler callback with first argument or reject a promise result */
|
|
832
|
+
fail(error: Error | string): void;
|
|
833
|
+
/** @deprecated Use handler callback with second argument or resolve a promise result */
|
|
834
|
+
succeed(messageOrObject: any): void; // Unclear what behavior this is supposed to have, I couldn't find any still extant reference,
|
|
835
|
+
// and it behaves like the above, ignoring the object parameter.
|
|
836
|
+
/** @deprecated Use handler callback or promise result */
|
|
837
|
+
succeed(message: string, object: any): void;
|
|
838
|
+
}
|
|
839
|
+
interface CognitoIdentity {
|
|
840
|
+
cognitoIdentityId: string;
|
|
841
|
+
cognitoIdentityPoolId: string;
|
|
842
|
+
}
|
|
843
|
+
interface ClientContext {
|
|
844
|
+
client: ClientContextClient;
|
|
845
|
+
custom?: any;
|
|
846
|
+
env: ClientContextEnv;
|
|
847
|
+
}
|
|
848
|
+
interface ClientContextClient {
|
|
849
|
+
installationId: string;
|
|
850
|
+
appTitle: string;
|
|
851
|
+
appVersionName: string;
|
|
852
|
+
appVersionCode: string;
|
|
853
|
+
appPackageName: string;
|
|
854
|
+
}
|
|
855
|
+
interface ClientContextEnv {
|
|
856
|
+
platformVersion: string;
|
|
857
|
+
platform: string;
|
|
858
|
+
make: string;
|
|
859
|
+
model: string;
|
|
860
|
+
locale: string;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Interface for using response streaming from AWS Lambda.
|
|
864
|
+
* To indicate to the runtime that Lambda should stream your function’s responses, you must wrap your function handler with the `awslambda.streamifyResponse()` decorator.
|
|
865
|
+
*
|
|
866
|
+
* The `streamifyResponse` decorator accepts the following additional parameter, `responseStream`, besides the default node handler parameters, `event`, and `context`.
|
|
867
|
+
* The new `responseStream` object provides a stream object that your function can write data to. Data written to this stream is sent immediately to the client. You can optionally set the Content-Type header of the response to pass additional metadata to your client about the contents of the stream.
|
|
868
|
+
*
|
|
869
|
+
* {@link https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/ AWS blog post}
|
|
870
|
+
* {@link https://docs.aws.amazon.com/lambda/latest/dg/config-rs-write-functions.html AWS documentation}
|
|
871
|
+
*
|
|
872
|
+
* @example <caption>Writing to the response stream</caption>
|
|
873
|
+
* import 'aws-lambda';
|
|
874
|
+
*
|
|
875
|
+
* export const handler = awslambda.streamifyResponse(
|
|
876
|
+
* async (event, responseStream, context) => {
|
|
877
|
+
* responseStream.setContentType("text/plain");
|
|
878
|
+
* responseStream.write("Hello, world!");
|
|
879
|
+
* responseStream.end();
|
|
880
|
+
* }
|
|
881
|
+
* );
|
|
882
|
+
*
|
|
883
|
+
* @example <caption>Using pipeline</caption>
|
|
884
|
+
* import 'aws-lambda';
|
|
885
|
+
* import { Readable } from 'stream';
|
|
886
|
+
* import { pipeline } from 'stream/promises';
|
|
887
|
+
* import zlib from 'zlib';
|
|
888
|
+
*
|
|
889
|
+
* export const handler = awslambda.streamifyResponse(
|
|
890
|
+
* async (event, responseStream, context) => {
|
|
891
|
+
* // As an example, convert event to a readable stream.
|
|
892
|
+
* const requestStream = Readable.from(Buffer.from(JSON.stringify(event)));
|
|
893
|
+
*
|
|
894
|
+
* await pipeline(requestStream, zlib.createGzip(), responseStream);
|
|
895
|
+
* }
|
|
896
|
+
* );
|
|
897
|
+
*/
|
|
898
|
+
type StreamifyHandler<TEvent = any, TResult = any> = (event: TEvent, responseStream: awslambda.HttpResponseStream, context: Context) => TResult | Promise<TResult>;
|
|
899
|
+
declare global {
|
|
900
|
+
namespace awslambda {
|
|
901
|
+
class HttpResponseStream extends Writable {
|
|
902
|
+
static from(writable: Writable, metadata: Record<string, unknown>): HttpResponseStream;
|
|
903
|
+
setContentType: (contentType: string) => void;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Decorator for using response streaming from AWS Lambda.
|
|
907
|
+
* To indicate to the runtime that Lambda should stream your function’s responses, you must wrap your function handler with the `awslambda.streamifyResponse()` decorator.
|
|
908
|
+
*
|
|
909
|
+
* The `streamifyResponse` decorator accepts the following additional parameter, `responseStream`, besides the default node handler parameters, `event`, and `context`.
|
|
910
|
+
* The new `responseStream` object provides a stream object that your function can write data to. Data written to this stream is sent immediately to the client. You can optionally set the Content-Type header of the response to pass additional metadata to your client about the contents of the stream.
|
|
911
|
+
*
|
|
912
|
+
* {@link https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/ AWS blog post}
|
|
913
|
+
* {@link https://docs.aws.amazon.com/lambda/latest/dg/config-rs-write-functions.html AWS documentation}
|
|
914
|
+
*
|
|
915
|
+
* @example <caption>Writing to the response stream</caption>
|
|
916
|
+
* import 'aws-lambda';
|
|
917
|
+
*
|
|
918
|
+
* export const handler = awslambda.streamifyResponse(
|
|
919
|
+
* async (event, responseStream, context) => {
|
|
920
|
+
* responseStream.setContentType("text/plain");
|
|
921
|
+
* responseStream.write("Hello, world!");
|
|
922
|
+
* responseStream.end();
|
|
923
|
+
* }
|
|
924
|
+
* );
|
|
925
|
+
*
|
|
926
|
+
* @example <caption>Using pipeline</caption>
|
|
927
|
+
* import 'aws-lambda';
|
|
928
|
+
* import { Readable } from 'stream';
|
|
929
|
+
* import { pipeline } from 'stream/promises';
|
|
930
|
+
* import zlib from 'zlib';
|
|
931
|
+
*
|
|
932
|
+
* export const handler = awslambda.streamifyResponse(
|
|
933
|
+
* async (event, responseStream, context) => {
|
|
934
|
+
* // As an example, convert event to a readable stream.
|
|
935
|
+
* const requestStream = Readable.from(Buffer.from(JSON.stringify(event)));
|
|
936
|
+
*
|
|
937
|
+
* await pipeline(requestStream, zlib.createGzip(), responseStream);
|
|
938
|
+
* }
|
|
939
|
+
* );
|
|
940
|
+
*/
|
|
941
|
+
function streamifyResponse<TEvent = any, TResult = void>(handler: StreamifyHandler<TEvent, TResult>): StreamifyHandler<TEvent, TResult>;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts
|
|
946
|
+
/**
|
|
947
|
+
* Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0
|
|
948
|
+
* @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
|
|
949
|
+
*/
|
|
950
|
+
type APIGatewayProxyEvent = APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
951
|
+
interface APIGatewayProxyEventHeaders {
|
|
952
|
+
[name: string]: string | undefined;
|
|
953
|
+
}
|
|
954
|
+
interface APIGatewayProxyEventMultiValueHeaders {
|
|
955
|
+
[name: string]: string[] | undefined;
|
|
956
|
+
}
|
|
957
|
+
interface APIGatewayProxyEventPathParameters {
|
|
958
|
+
[name: string]: string | undefined;
|
|
959
|
+
}
|
|
960
|
+
interface APIGatewayProxyEventQueryStringParameters {
|
|
961
|
+
[name: string]: string | undefined;
|
|
962
|
+
}
|
|
963
|
+
interface APIGatewayProxyEventMultiValueQueryStringParameters {
|
|
964
|
+
[name: string]: string[] | undefined;
|
|
965
|
+
}
|
|
966
|
+
interface APIGatewayProxyEventStageVariables {
|
|
967
|
+
[name: string]: string | undefined;
|
|
968
|
+
}
|
|
969
|
+
interface APIGatewayProxyEventBase<TAuthorizerContext> {
|
|
970
|
+
body: string | null;
|
|
971
|
+
headers: APIGatewayProxyEventHeaders;
|
|
972
|
+
multiValueHeaders: APIGatewayProxyEventMultiValueHeaders;
|
|
973
|
+
httpMethod: string;
|
|
974
|
+
isBase64Encoded: boolean;
|
|
975
|
+
path: string;
|
|
976
|
+
pathParameters: APIGatewayProxyEventPathParameters | null;
|
|
977
|
+
queryStringParameters: APIGatewayProxyEventQueryStringParameters | null;
|
|
978
|
+
multiValueQueryStringParameters: APIGatewayProxyEventMultiValueQueryStringParameters | null;
|
|
979
|
+
stageVariables: APIGatewayProxyEventStageVariables | null;
|
|
980
|
+
requestContext: APIGatewayEventRequestContextWithAuthorizer<TAuthorizerContext>;
|
|
981
|
+
resource: string;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0
|
|
985
|
+
* @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
|
|
986
|
+
*/
|
|
987
|
+
interface APIGatewayProxyResult {
|
|
988
|
+
statusCode: number;
|
|
989
|
+
headers?: {
|
|
990
|
+
[header: string]: boolean | number | string;
|
|
991
|
+
} | undefined;
|
|
992
|
+
multiValueHeaders?: {
|
|
993
|
+
[header: string]: Array<boolean | number | string>;
|
|
994
|
+
} | undefined;
|
|
995
|
+
body: string;
|
|
996
|
+
isBase64Encoded?: boolean | undefined;
|
|
997
|
+
}
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/node/feedback/adapters/aws.d.ts
|
|
1000
|
+
declare function handleAwsFeedback(event: APIGatewayProxyEvent, env?: Record<string, string | undefined>): Promise<APIGatewayProxyResult>;
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/node/feedback/handler.d.ts
|
|
1003
|
+
interface FeedbackHandlerOptions {
|
|
1004
|
+
owner?: string;
|
|
1005
|
+
repo?: string;
|
|
1006
|
+
categorySlug?: string;
|
|
1007
|
+
token?: string;
|
|
1008
|
+
appId?: string;
|
|
1009
|
+
privateKey?: string;
|
|
1010
|
+
installationId?: string;
|
|
1011
|
+
}
|
|
1012
|
+
declare function handleFeedback(payload: unknown, env?: Record<string, string | undefined>, options?: FeedbackHandlerOptions): Promise<{
|
|
1013
|
+
success: boolean;
|
|
1014
|
+
}>;
|
|
1015
|
+
//#endregion
|
|
1016
|
+
//#region src/node/utils.d.ts
|
|
1017
|
+
/**
|
|
1018
|
+
* Normalizes a file path by replacing Windows backslashes with forward slashes.
|
|
1019
|
+
* Ensures consistent path handling across different operating systems.
|
|
1020
|
+
*
|
|
1021
|
+
* @param p - The file path to normalize
|
|
1022
|
+
* @returns The normalized path using forward slashes
|
|
1023
|
+
*/
|
|
1024
|
+
declare function normalizePath(p: string): string;
|
|
1025
|
+
/**
|
|
1026
|
+
* Sanitizes a filename or path component by removing dangerous characters.
|
|
1027
|
+
* Prevents multiple dots to avoid path traversal tricks.
|
|
1028
|
+
*
|
|
1029
|
+
* @param name - The name to sanitize
|
|
1030
|
+
* @returns The sanitized name
|
|
1031
|
+
*/
|
|
1032
|
+
declare function sanitizeFilename(name: string): string;
|
|
1033
|
+
//#endregion
|
|
689
1034
|
//#region src/node/index.d.ts
|
|
690
1035
|
declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
|
|
691
1036
|
/**
|
|
692
1037
|
* Generates the complete Vite configuration for a Boltdocs project.
|
|
693
1038
|
* This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
|
|
694
1039
|
*/
|
|
695
|
-
declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
|
|
1040
|
+
declare function createViteConfig(root: string, mode?: 'development' | 'production', preResolvedConfig?: BoltdocsConfig): Promise<InlineConfig>;
|
|
696
1041
|
//#endregion
|
|
697
|
-
export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, EXIT, MDX_NODES, NodeWithHProperties, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, type RouteMeta, SKIP, SecureBoltdocsPlugin, addNodeClass, createMdxAttribute, createMdxElement, createPlugin, createRehypeElement, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, getNodeProperty, hasNodeClass, normalizePath, parseMetaString, removeNodeClass, resolveConfig, sanitizeFilename, setNodeProperty, validatePlugins, visitMdxElements, visitNodes, visitRehypeElements, visitRemarkHeadings, visitRemarkLinks };
|
|
1042
|
+
export { AssetCache, type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, EXIT, MDX_NODES, NodeWithHProperties, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, type RouteMeta, SKIP, SecureBoltdocsPlugin, addNodeClass, createMdxAttribute, createMdxElement, createPlugin, createRehypeElement, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, getNodeProperty, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, hasNodeClass, normalizePath, parseMetaString, removeNodeClass, resolveConfig, sanitizeFilename, setNodeProperty, validatePlugins, visitMdxElements, visitNodes, visitRehypeElements, visitRemarkHeadings, visitRemarkLinks };
|
package/dist/node/index.mjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{A as e,
|
|
6
|
+
import{A as e,C as t,D as n,M as r,N as i,O as a,S as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,x as O,y as k}from"../node-B7qbjtLl.mjs";import{f as A,u as j}from"../utils-DexBrwiP.mjs";import{a as M,n as N}from"../config-DBKBEj3j.mjs";import{a as P,n as F}from"../cache-CfhOTR3Q.mjs";import{o as I,r as L}from"../shiki-adapter-rQ087Lx3.mjs";import{t as R}from"../handler-CyIBbZdb.mjs";export{F as AssetCache,a as BoltdocsPluginStore,u as EXIT,I as MDX_NODES,_ as PluginCompatibilityError,e as PluginError,g as PluginHookError,t as PluginLifecycleManager,r as PluginValidationError,v as SKIP,E as addNodeClass,d as createMdxAttribute,f as createMdxElement,w as createPlugin,S as createRehypeElement,b as createViteConfig,T as default,M as defineConfig,P as flushCache,i as generateEntryCode,y as getNodeProperty,C as handleAwsFeedback,R as handleFeedback,c as handleNetlifyFeedback,x as handleVercelFeedback,h as handleWebFeedback,m as hasNodeClass,j as normalizePath,L as parseMetaString,p as removeNodeClass,N as resolveConfig,A as sanitizeFilename,s as setNodeProperty,n as validatePlugins,D as visitMdxElements,k as visitNodes,l as visitRehypeElements,O as visitRemarkHeadings,o as visitRemarkLinks};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
require(`../../chunk-
|
|
6
|
+
require(`../../chunk-Ds5LZdWN.cjs`);const e=require(`../../parser-D4oEyuP-.cjs`);let t=require(`node:worker_threads`);if(!t.parentPort)throw Error(`This file must be run as a worker thread.`);t.parentPort.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e.t(n.file,n.docsDir,n.basePath,n.config);t.parentPort?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t.parentPort?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{n as e}from"../../parser-
|
|
6
|
+
import{n as e}from"../../parser-IR9tfyGE.mjs";import{parentPort as t}from"node:worker_threads";if(!t)throw Error(`This file must be run as a worker thread.`);t.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e(n.file,n.docsDir,n.basePath,n.config);t?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});export{};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import{r as e,u as t}from"./utils-DexBrwiP.mjs";import{i as n,n as r}from"./config-DBKBEj3j.mjs";import{n as i,t as a}from"./types-generator-BRyf4o9F.mjs";import{t as o}from"./routes-TUSK5wD7.mjs";import{o as s}from"./shiki-adapter-rQ087Lx3.mjs";import{t as c}from"./handler-CyIBbZdb.mjs";import{createRequire as l}from"node:module";import u from"node:path";import d from"node:fs";import{z as f}from"zod";import*as p from"@bdocs/dui";import{colors as m,warn as h}from"@bdocs/dui";import g from"semver";import{build as _}from"@bdocs/ssg/node";import{EXIT as v,SKIP as y,visit as b}from"unist-util-visit";var x=Object.defineProperty,ee=(e,t)=>{let n={};for(var r in e)x(n,r,{get:e[r],enumerable:!0});return t||x(n,Symbol.toStringTag,{value:`Module`}),n},S=l(import.meta.url);function te(e,n){let r=u.resolve(process.cwd(),`index.css`),i=d.existsSync(r)?`import './index.css';`:``,a=n?.plugins?.flatMap(e=>Object.entries(e.components||{}))||[],o=a.map(([e,n])=>`import * as _comp_${e} from '${t(n)}';
|
|
7
|
+
const ${e} = _comp_${e}.default || _comp_${e}['${e}'] || _comp_${e};`).join(`
|
|
8
|
+
`),s=a.map(([e])=>e).join(`, `),c=u.basename(e.docsDir||`docs`),l=u.resolve(process.cwd(),e.docsDir||`docs`),f=[`tsx`,`ts`,`jsx`,`js`].map(e=>u.resolve(l,`pages-external/index.${e}`)).find(e=>d.existsSync(e)),p=f?`import * as _external_module from '${t(f)}';`:``,m=f?`externalPages: _external_module.pages, externalLayout: _external_module.layout,`:``,h=process.env.VITE_SSG===`true`,g=h?`{ eager: true }`:`{}`,_=h?``:`
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
const prefetchAll = () => {
|
|
11
|
+
const getters = Object.values(mdxModules)
|
|
12
|
+
if (getters.length === 0) return
|
|
13
|
+
let i = 0
|
|
14
|
+
const nextBatch = () => {
|
|
15
|
+
if (i >= getters.length) return
|
|
16
|
+
const batch = getters.slice(i, i + 6)
|
|
17
|
+
i += batch.length
|
|
18
|
+
Promise.allSettled(batch.map(fn => fn())).then(() => {
|
|
19
|
+
setTimeout(nextBatch, 0)
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
;(typeof requestIdleCallback === 'function' ? requestIdleCallback : function(cb) { setTimeout(cb, 500) })(nextBatch)
|
|
23
|
+
}
|
|
24
|
+
prefetchAll()
|
|
25
|
+
}
|
|
26
|
+
`;return`
|
|
27
|
+
import { ViteReactSSG, createRoutes } from 'boltdocs/client'
|
|
28
|
+
import _routes from 'virtual:boltdocs-routes.ts'
|
|
29
|
+
import _collections from 'virtual:boltdocs-collections.ts'
|
|
30
|
+
import _config from 'virtual:boltdocs-config.ts'
|
|
31
|
+
import _user_mdx_components from 'virtual:boltdocs-mdx-components.tsx'
|
|
32
|
+
${i}
|
|
33
|
+
${o}
|
|
34
|
+
${p}
|
|
35
|
+
|
|
36
|
+
const mdxModules = import.meta.glob('/${c}/**/*.{md,mdx}', ${g});
|
|
37
|
+
|
|
38
|
+
const _collLayoutMods = import.meta.glob('${`/${c}/**/layout.tsx`}', { eager: true });
|
|
39
|
+
const _collListMods = import.meta.glob('${`/${c}/**/list.tsx`}', { eager: true });
|
|
40
|
+
const _collPostMods = import.meta.glob('${`/${c}/**/post.tsx`}', { eager: true });
|
|
41
|
+
|
|
42
|
+
const _collectionLayouts = {};
|
|
43
|
+
for (const [p, mod] of Object.entries(_collLayoutMods)) {
|
|
44
|
+
const dir = p.split('/').slice(-2, -1)[0];
|
|
45
|
+
if (dir.startsWith('[') && dir.endsWith(']')) {
|
|
46
|
+
_collectionLayouts[dir.slice(1, -1)] = mod.default || mod;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const _collectionLists = {};
|
|
51
|
+
for (const [p, mod] of Object.entries(_collListMods)) {
|
|
52
|
+
const dir = p.split('/').slice(-2, -1)[0];
|
|
53
|
+
if (dir.startsWith('[') && dir.endsWith(']')) {
|
|
54
|
+
_collectionLists[dir.slice(1, -1)] = mod.default || mod;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const _collectionPosts = {};
|
|
59
|
+
for (const [p, mod] of Object.entries(_collPostMods)) {
|
|
60
|
+
const dir = p.split('/').slice(-2, -1)[0];
|
|
61
|
+
if (dir.startsWith('[') && dir.endsWith(']')) {
|
|
62
|
+
_collectionPosts[dir.slice(1, -1)] = mod.default || mod;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const createRoot = ViteReactSSG(
|
|
67
|
+
{
|
|
68
|
+
routes: createRoutes({
|
|
69
|
+
routesData: _routes,
|
|
70
|
+
collectionsData: _collections,
|
|
71
|
+
collectionLayouts: _collectionLayouts,
|
|
72
|
+
collectionLists: _collectionLists,
|
|
73
|
+
collectionPosts: _collectionPosts,
|
|
74
|
+
config: _config,
|
|
75
|
+
mdxModules,
|
|
76
|
+
${m}
|
|
77
|
+
components: { ${s}${s?`, `:``} ...(_user_mdx_components || {}) },
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
({ isClient }) => {
|
|
81
|
+
// Boltdocs initialization hook
|
|
82
|
+
if (isClient) {
|
|
83
|
+
// Client-side initialization
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
${_}
|
|
88
|
+
`}var C=class extends Error{name=this.constructor.name;constructor(e,t,n){super(`[plugin:${e}] ${t}`,n),this.pluginName=e}},w=class extends C{constructor(e,t){super(e,`Validation failed: ${t}`)}},T=class extends C{constructor(e,t){super(e,`Compatibility error: ${t}`)}},E=class extends C{constructor(e,t,n){super(e,`Error in hook '${t}': ${n.message}`,{cause:n}),this.hookName=t}},D=class{data=new Map;getNamespaceKey(e,t){return`${e}:${t}`}get(e,t){let n=this.getNamespaceKey(e,t),r=this.data.get(n);if(r!==void 0)return typeof r==`object`&&r?JSON.parse(JSON.stringify(r)):r}set(e,t,n){let r=this.getNamespaceKey(e,t),i=typeof n==`object`&&n?JSON.parse(JSON.stringify(n)):n;this.data.set(r,i)}has(e,t){let n=this.getNamespaceKey(e,t);return this.data.has(n)}};const O=n.extend({version:f.string().optional(),boltdocsVersion:f.string().optional(),hooks:f.object({beforeBuild:f.function().optional(),afterBuild:f.function().optional(),beforeDev:f.function().optional(),afterDev:f.function().optional(),buildEnd:f.function().optional(),transformSource:f.function().optional(),transformMdx:f.function().optional(),transformHtml:f.function().optional()}).optional()});function k(e,t){let n=[],r=new Set;for(let i of e){let e=O.safeParse(i);if(!e.success)throw new w(i.name||`unknown`,e.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `));let a=e.data;if(r.has(a.name))throw new w(a.name,`Duplicate plugin name detected`);if(r.add(a.name),a.boltdocsVersion&&!g.satisfies(t,a.boltdocsVersion))throw new T(a.name,`Plugin expects Boltdocs version ${a.boltdocsVersion}, but current is ${t}`);if(a.components){for(let[e,t]of Object.entries(a.components))if((t.includes(`..`)||u.isAbsolute(t))&&t.includes(`..`))throw new w(a.name,`Component '${e}' has an invalid path: traversal sequences are not allowed.`)}n.push(a)}return n}function A(e,t=process.cwd()){let n=e.plugins||[];for(let e of n)if(e.name)try{let n=null;try{let{createRequire:r}=S(`node:module`);n=r(u.resolve(t,`package.json`)).resolve(`${e.name}/package.json`)}catch{let r=u.resolve(t,`node_modules`,e.name,`package.json`);d.existsSync(r)&&(n=r)}if(n&&d.existsSync(n)){let t=JSON.parse(d.readFileSync(n,`utf-8`)).scripts||{};(t.preinstall||t.postinstall||t.install)&&h(`💡 ${m.yellow(m.bold(`Nota de seguridad:`))} El plugin ${m.cyan(e.name)} ejecuta scripts nativos al instalarse. Corre ${m.bold(`boltdocs audit`)} para un análisis detallado.`)}}catch{}}var ne=class{name=`ConfigResolve`;async execute(e){e.config=await r(`docs`,e.root),A(e.config,e.root),e.viteConfig=await $(e.root,`production`)}};function j(e){return e.map(e=>({path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],_content:e._content||``,_rawContent:e._rawContent||``,locale:e.locale,version:e.version,tab:e.tab,collection:e.collection,tags:e.tags,author:e.author,draft:e.draft,excerpt:e.excerpt,coverImage:e.coverImage,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,frontmatter:e.frontmatter,slugParts:e.slugParts}))}var M=class{name=`RouteGenerate`;async execute(e){if(!e.config)throw Error(`Config not resolved. Run ConfigResolve first.`);let t=u.resolve(e.root,`docs`),n=e.viteConfig?.base||e.config.base||`/docs`;e.routes=[...await o(t,e.config,n)],e.ssgRoutes=j(e.routes)}};const N=f.object({title:f.string().optional(),description:f.string().optional(),canonical:f.string().url().optional(),robots:f.string().optional(),noindex:f.boolean().optional(),"og:title":f.string().optional(),"og:description":f.string().optional(),"og:image":f.string().optional(),"og:type":f.string().optional(),"og:url":f.string().url().optional()});var P=class{name=`SEOValidate`;async execute(e){if(!e.routes||!e.config)throw Error(`Routes or Config not initialized.`);let t=e.config.siteUrl;e.routes=e.routes.map(e=>{let n=e.seo||{},r=n.canonical||(t?`${t.replace(/\/$/,``)}${e.path}`:void 0),i=n[`og:url`]||r||void 0,a={...n};r&&(a.canonical=r),i&&(a[`og:url`]=i),!a[`og:title`]&&e.title&&(a[`og:title`]=e.title),!a[`og:description`]&&e.description&&(a[`og:description`]=e.description);let o=N.safeParse(a);return o.success||h(`[SEOValidate] Validation issues on route "${e.path}":`,o.error.message),e.title||h(`[SEOValidate] Route "${e.path}" is missing a title.`),{...e,seo:a}}),e.ssgRoutes=j(e.routes)}},F=class{name=`TypeGenerate`;async execute(e){if(!e.config||!e.routes)throw Error(`Config or Routes not initialized.`);let t=u.resolve(e.root,`docs`),n=e.routes.map(e=>e.path),r=(e.config.base||`/docs`).replace(/\/$/,``);n.includes(r)||n.push(r),a(e.config,t,e.root,n),i(n)}},I=class{name=`SSGBuild`;async execute(e){if(!e.routes||!e.viteConfig)throw Error(`Routes or ViteConfig not initialized.`);let t={};for(let n of e.routes)if(n.path&&n.componentPath){t[n.path]=n.componentPath;let e=n.path.replace(/\/$/,``);t[e]=n.componentPath}await _({entry:`boltdocs/entry`,routeToSourceFileMap:t,cacheDir:u.resolve(e.root,`.boltdocs/build`)},e.viteConfig),e.outDir=e.viteConfig.build?.outDir||`dist`}};function L(t,n){let r=(n.siteUrl||``).replace(/\/$/,``);if(!r)return``;let i=n.seo?.indexing!==`all`&&n.seo?.indexing!==`public`;return`<?xml version="1.0" encoding="UTF-8"?>
|
|
89
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
90
|
+
${t.filter(e=>e.seo?.noindex||typeof e.seo?.robots==`string`&&e.seo.robots.includes(`noindex`)?!1:(i&&e.seo?.index,!0)).map(t=>` <url>
|
|
91
|
+
<loc>${e(`${r}${t.path.startsWith(`/`)?t.path:`/${t.path}`}`)}</loc>
|
|
92
|
+
<changefreq>weekly</changefreq>
|
|
93
|
+
<priority>0.7</priority>
|
|
94
|
+
</url>`).join(`
|
|
95
|
+
`)}
|
|
96
|
+
</urlset>`}function R(e){let t=e.siteUrl||``,n=t?`${t.replace(/\/$/,``)}/sitemap.xml`:``;if(e.seo?.indexing!==`all`&&e.seo?.indexing!==`public`&&e.seo?.indexing)return[`User-agent: *`,`Disallow: /`].filter(Boolean).join(`
|
|
97
|
+
`);if(typeof e.robots==`string`)return e.robots;if(e.robots&&typeof e.robots==`object`){let t=e.robots.rules||[],r=e.robots.sitemaps||[],i=t.map(e=>{let t=`User-agent: ${e.userAgent}\n`;return e.allow&&(Array.isArray(e.allow)?t+=e.allow.map(e=>`Allow: ${e}`).join(`
|
|
98
|
+
`)+`
|
|
99
|
+
`:t+=`Allow: ${e.allow}\n`),e.disallow&&(Array.isArray(e.disallow)?t+=e.disallow.map(e=>`Disallow: ${e}`).join(`
|
|
100
|
+
`)+`
|
|
101
|
+
`:t+=`Disallow: ${e.disallow}\n`),t.trim()}).join(`
|
|
102
|
+
|
|
103
|
+
`),a=[...n?[n]:[],...r].map(e=>`Sitemap: ${e}`).join(`
|
|
104
|
+
`);return`${i}${a?`\n\n${a}`:``}`}return[`User-agent: *`,`Allow: /`,``,n?`Sitemap: ${n}`:``].filter(Boolean).join(`
|
|
105
|
+
`)}var z=class{name=`SEOWrite`;async execute(e){if(!e.ssgRoutes||!e.config||!e.outDir)throw Error(`SSG Routes, Config, or OutDir not initialized.`);let t=L(e.ssgRoutes,e.config),n=u.resolve(e.root,e.outDir);t&&d.writeFileSync(u.join(n,`sitemap.xml`),t,`utf-8`);let r=R(e.config);d.writeFileSync(u.join(n,`robots.txt`),r,`utf-8`)}};function B(){return new V().addStep(new ne).addStep(new M).addStep(new P).addStep(new F).addStep(new I).addStep(new z)}var V=class{steps=[];addStep(e){return this.steps.push(e),this}async run(e){let t=[],n=performance.now(),r={...e,timing:{}};for(let e of this.steps){let i=performance.now();try{await e.execute(r);let n=performance.now()-i;t.push({name:e.name,duration:n,success:!0}),r.timing[e.name]=n}catch(a){let o=performance.now()-i;t.push({name:e.name,duration:o,success:!1,error:a instanceof Error?a:Error(String(a))});for(let e of t.filter(e=>e.success).reverse()){let t=this.steps.find(t=>t.name===e.name);if(t?.rollback)try{await t.rollback(r)}catch(t){console.error(`[pipeline] rollback failed for step "${e.name}":`,t)}}let s=performance.now()-n;return{success:!1,failedStep:e.name,error:a instanceof Error?a:Error(String(a)),timing:{total:s,steps:r.timing},stepResults:t}}}return{success:!0,timing:{total:performance.now()-n,steps:r.timing},stepResults:t}}},H=class{plugins;config;store;docsDir;rootDir;constructor(e,t,n,r){this.plugins=e,this.config=t,this.store=new D,this.docsDir=n||process.cwd(),this.rootDir=r||process.cwd()}async runHook(e,...t){let n=this.getSortedPlugins(),r=new V;for(let i of n)i.hooks?.[e]&&r.addStep(this.createStep(i,e,t));await r.run({})}async runChain(e,t){let n=this.getSortedPlugins(),r=t;for(let t of n){if(!t.hooks?.[e])continue;let n=this.createContext(t);try{let i=t.hooks[e],a=await i(n,r);a!==void 0&&(r=a)}catch(r){let i=new E(t.name,e,r instanceof Error?r:Error(String(r)));n.logger.error(i)}}return r}getSortedPlugins(){let e=this.plugins.filter(e=>e.enforce===`pre`),t=this.plugins.filter(e=>!e.enforce),n=this.plugins.filter(e=>e.enforce===`post`);return[...e,...t,...n]}createStep(e,t,n){return{name:`${e.name}:${String(t)}`,execute:async()=>{let r=this.createContext(e);try{let i=e.hooks[t];await i(r,...n)}catch(n){let i=new E(e.name,t,n instanceof Error?n:Error(String(n)));r.logger.error(i)}},rollback:async()=>{let t=e.hooks?.buildEnd;if(t){let n=this.createContext(e);try{await t(n)}catch{}}}}}createContext(e){return{config:Object.freeze({...this.config}),docsDir:this.docsDir,rootDir:this.rootDir,meta:{name:e.name,version:e.version,boltdocsVersion:e.boltdocsVersion},store:{get:(e,t)=>this.store.get(e,t),set:(e,t,n)=>this.store.set(e,t,n),has:(e,t)=>this.store.has(e,t)},logger:this.createLogger(e.name)}}createLogger(e){let t=`[plugin:${e}]`;return{info:e=>p.info(`${t} ${e}`),warn:e=>p.warn(`${t} ${e}`),error:e=>{p.error(`${t} ${e instanceof Error?e.message:e}`)},debug:e=>p.debug(`${t} ${e}`)}}};function U(e,t,n){e&&b(e,typeof t==`function`?t:e=>Array.isArray(t)?t.includes(e.type):e.type===t,(e,t,r)=>{if(t!==void 0&&r!==void 0)return n(e,t,r)})}function W(e,t,n){U(e,s.ELEMENT,(e,r,i)=>{if(e.tagName===t)return n(e,r,i)})}function G(e,t,n){let r=Array.isArray(t)?t:[t],i=[s.JSX_FLOW_ELEMENT,s.JSX_TEXT_ELEMENT];U(e,e=>i.includes(e.type),(e,t,i)=>{if(e.name&&r.includes(e.name))return n(e,t,i)})}function K(e,t,n){e&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties[t]=n)}function q(e,t){return e?.data?.hProperties?.[t]}function J(e,t){return typeof t==`object`&&t?{type:s.JSX_ATTRIBUTE,name:e,value:t}:{type:s.JSX_ATTRIBUTE,name:e,value:String(t)}}function Y(e,t={},n=[]){return{type:s.ELEMENT,tagName:e,properties:t,children:n}}function X(e,t={},n=[],r=!0){let i=Object.entries(t).map(([e,t])=>J(e,t));return{type:r?s.JSX_FLOW_ELEMENT:s.JSX_TEXT_ELEMENT,name:e,attributes:i,children:n}}function re(e,t){e&&b(e,s.HEADING,(e,n,r)=>{if(n!==void 0&&r!==void 0)return t(e,n,r)})}function ie(e,t){e&&b(e,s.LINK,(e,n,r)=>{if(n!==void 0&&r!==void 0)return t(e,n,r)})}function ae(e,t){if(!e)return;e.properties=e.properties||{};let n=e.properties.className;Array.isArray(n)?n.includes(t)||n.push(t):typeof n==`string`?n!==t&&(e.properties.className=[n,t]):e.properties.className=[t]}function oe(e,t){if(!e||!e.properties||!e.properties.className)return;let n=e.properties.className;Array.isArray(n)?e.properties.className=n.filter(e=>e!==t):typeof n==`string`&&n===t&&delete e.properties.className}function se(e,t){if(!e||!e.properties||!e.properties.className)return!1;let n=e.properties.className;return Array.isArray(n)?n.includes(t):typeof n==`string`?n===t:!1}function ce(e){return e}const Z={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`,"Content-Type":`application/json`};async function le(e,t){if(Object.entries(Z).forEach(([e,n])=>{t.setHeader(e,n)}),e.method===`OPTIONS`){t.status(200).end();return}if(e.method!==`POST`){t.status(405).json({error:`Method Not Allowed`});return}try{let n=await c(e.body,process.env);t.status(200).json(n)}catch(e){let n=e instanceof Error?e.message:`Failed to submit feedback`;return t.status(500).json({error:n})}}async function ue(e,t=process.env){let n=(e,t=200)=>({statusCode:t,headers:Z,body:e?JSON.stringify(e):``});if(e.httpMethod===`OPTIONS`)return n(null,200);if(e.httpMethod!==`POST`)return n({error:`Method Not Allowed`},405);try{return n(await c(e.body?JSON.parse(e.body):{},t))}catch(e){return n({error:e instanceof Error?e.message:`Failed to submit feedback`},500)}}async function Q(e,t={}){let n=(e,t=200)=>new Response(e?JSON.stringify(e):null,{status:t,headers:Z});if(e.method===`OPTIONS`)return n(null);if(e.method!==`POST`)return n({error:`Method Not Allowed`},405);try{return n(await c(await e.json(),{...process.env,...t}))}catch(e){return n({error:e instanceof Error?e.message:`Failed to submit feedback`},500)}}async function de(e,t=process.env){let n=(e,t=200)=>({statusCode:t,headers:Z,body:e?JSON.stringify(e):``});if(e.httpMethod===`OPTIONS`)return n(null,200);if(e.httpMethod!==`POST`)return n({error:`Method Not Allowed`},405);try{return n(await c(e.body?JSON.parse(e.body):{},t))}catch(e){return n({error:e instanceof Error?e.message:`Failed to submit feedback`},500)}}async function fe(e){let{resolveConfig:t}=await import(`./config-GPVEdeon.mjs`),{generateRoutes:n}=await import(`./routes-DR13Y1em.mjs`),{generateProjectTypes:r,writeLinkTree:i}=await import(`./types-generator-Cu2jQP-V.mjs`),{boltdocsPlugin:a}=await import(`./plugin-BkquLpOI.mjs`),o=e?.docsDir||`docs`,s=await t(o),c=(await n(o,s)).map(e=>e.path),l=(s.base||`/docs`).replace(/\/$/,``);return c.includes(l)||c.push(l),r(s,o,void 0,c),i(c),a({...e},s)}async function $(e,t=`development`,n){let[r,i,{boltdocsPlugin:a,getExternalAbsolutePaths:o},{SECURITY_HEADERS:s},{getCSPHeader:c},{resolveConfig:l},{generateRoutes:d},{generateProjectTypes:f,writeLinkTree:p},{normalizePath:m}]=await Promise.all([import(`@vitejs/plugin-react`),import(`@tailwindcss/vite`),import(`./plugin-BkquLpOI.mjs`),import(`./headers-HD_qTVVW.mjs`).then(e=>e.n),import(`./csp-RJyh0nHV.mjs`).then(e=>e.t),import(`./config-GPVEdeon.mjs`),import(`./routes-DR13Y1em.mjs`),import(`./types-generator-Cu2jQP-V.mjs`),import(`vite`).then(e=>({normalizePath:e.normalizePath}))]),h=r.default,g=i.default,_=n||await l(`docs`,e),v=(await d(`docs`,_)).map(e=>e.path),y=(_.base||`/docs`).replace(/\/$/,``);v.includes(y)||v.push(y),f(_,`docs`,e,v),p(v);let b=t===`production`,x=b?{...s}:{};return _.security?.enableCSP&&(x[`Content-Security-Policy`]=c(_)),{root:e,mode:t,oxc:{jsx:{development:!b,runtime:`automatic`,importSource:`react`}},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-helmet-async`,`react-router-dom`,`react-fast-compare`,`invariant`,`use-sync-external-store/shim`]},build:{},plugins:[h(),g(),...a({docsDir:`docs`,root:e},_)],resolve:{alias:[{find:`boltdocs/entry`,replacement:m(u.resolve(e,`boltdocs-entry.tsx`))},{find:`boltdocs/client`,replacement:m(u.resolve(e,`boltdocs-client.mjs`))},{find:`use-sync-external-store/shim/index.js`,replacement:`react`},{find:`use-sync-external-store/shim`,replacement:`react`},{find:`use-sync-external-store`,replacement:`react`},{find:`@`,replacement:m(u.resolve(e,`../packages/core/src`))}],dedupe:[`react`,`react-dom`]},ssr:{external:[`react`,`react-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...o()],optimizeDeps:{include:[`react`,`react-dom`,`react-fast-compare`,`invariant`,..._.vite?.ssr?.optimizeDeps?.include||[]]},noExternal:[`boltdocs`,/@bdocs\/(?!ssg).*/,`react-aria-components`,`@react-aria/collections`,`@react-aria/utils`,`react-router-dom`]},server:{headers:{...x,..._.vite?.server?.headers},..._.vite?.server},preview:{headers:{...x,..._.vite?.preview?.headers},..._.vite?.preview},..._.vite}}export{C as A,H as C,k as D,A as E,w as M,te as N,D as O,ee as P,ie as S,j as T,K as _,ue as a,W as b,v as c,J as d,X as f,oe as g,se as h,Q as i,E as j,T as k,y as l,q as m,$ as n,le as o,Y as p,de as r,ce as s,fe as t,ae as u,G as v,B as w,re as x,U as y};
|