@pracht/vite-plugin 0.10.0 → 0.11.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/dist/index.d.mts +83 -4
- package/dist/index.mjs +499 -56
- package/dist/{pages-router-KcCRkhnf.mjs → pages-router-MA9rOl88.mjs} +48 -18
- package/dist/pages-router.d.mts +1 -0
- package/dist/pages-router.mjs +1 -1
- package/package.json +9 -5
- package/virtual.d.ts +255 -0
package/dist/index.d.mts
CHANGED
|
@@ -135,6 +135,21 @@ interface PrachtLlmsTxtOptions {
|
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
137
|
exclude?: string[];
|
|
138
|
+
/**
|
|
139
|
+
* Ceiling on how many prerendered instances a single dynamic route
|
|
140
|
+
* contributes to the Pages section. Defaults to 50; `0` lists every
|
|
141
|
+
* instance.
|
|
142
|
+
*
|
|
143
|
+
* The instances kept are the first ones `getStaticPaths()` returns, after
|
|
144
|
+
* `exclude` is applied — the author's order, which for a blog is usually
|
|
145
|
+
* newest-first.
|
|
146
|
+
*
|
|
147
|
+
* llms.txt is an index, not a sitemap. A 5,000-post blog expanded through
|
|
148
|
+
* `getStaticPaths()` produces a 5,000-line, 180 KB file — larger than most
|
|
149
|
+
* agent context budgets. Truncation is never silent: a line above the Pages
|
|
150
|
+
* section names the route and the ratio it lists.
|
|
151
|
+
*/
|
|
152
|
+
maxPagesPerRoute?: number;
|
|
138
153
|
}
|
|
139
154
|
/**
|
|
140
155
|
* Optional client-router features, compiled out of the client bundle when
|
|
@@ -157,6 +172,16 @@ interface PrachtPluginOptions {
|
|
|
157
172
|
* compiled out of the client bundle. See {@link PrachtClientOptions}.
|
|
158
173
|
*/
|
|
159
174
|
client?: PrachtClientOptions;
|
|
175
|
+
/**
|
|
176
|
+
* Group the Preact runtime into a shared `vendor` chunk. Defaults to `true`.
|
|
177
|
+
*
|
|
178
|
+
* The group is appended to whatever `build.rollupOptions.output` chunking
|
|
179
|
+
* the app configures, so app-level grouping and the framework chunk compose
|
|
180
|
+
* (see `frameworkChunkGroups()`). Set `false` to contribute nothing at all —
|
|
181
|
+
* for an app that places `frameworkChunkGroups()` itself, or one that wants
|
|
182
|
+
* Preact merged into its own chunks.
|
|
183
|
+
*/
|
|
184
|
+
vendorChunk?: boolean;
|
|
160
185
|
appFile?: string;
|
|
161
186
|
routesDir?: string;
|
|
162
187
|
shellsDir?: string;
|
|
@@ -218,6 +243,50 @@ interface PrachtPluginOptions {
|
|
|
218
243
|
llmsTxt?: false | PrachtLlmsTxtOptions;
|
|
219
244
|
}
|
|
220
245
|
//#endregion
|
|
246
|
+
//#region src/chunk-groups.d.ts
|
|
247
|
+
/**
|
|
248
|
+
* Pracht's client chunking policy, expressed as something an app can build on.
|
|
249
|
+
*
|
|
250
|
+
* The framework has exactly one opinion here: Preact belongs in its own chunk,
|
|
251
|
+
* shared by every route and cached across deploys that only change app code.
|
|
252
|
+
* Everything else about chunking is the app's call — merging the long tail of
|
|
253
|
+
* small initial chunks, splitting a heavy dependency out of a route, grouping
|
|
254
|
+
* by feature.
|
|
255
|
+
*
|
|
256
|
+
* Those two have to coexist, and under Rolldown that is not automatic:
|
|
257
|
+
* `output.codeSplitting` makes `manualChunks` and `advancedChunks` ignored
|
|
258
|
+
* outright, so a plugin that hard-codes one form silently deletes whichever
|
|
259
|
+
* form the app used. Pracht therefore looks at what the app configured and
|
|
260
|
+
* contributes its group in the same form, as one entry appended to the app's
|
|
261
|
+
* list rather than as a replacement for it.
|
|
262
|
+
*
|
|
263
|
+
* Precedence follows Rolldown's own rule — higher `priority` first, then
|
|
264
|
+
* declaration order. The app's groups are declared first, so an app group that
|
|
265
|
+
* would also capture Preact wins at equal priority, and pracht's group only
|
|
266
|
+
* takes what nothing else claimed. To keep the framework chunk intact while
|
|
267
|
+
* merging everything around it, give the app group a `test` that excludes
|
|
268
|
+
* Preact, or raise pracht's group by placing {@link frameworkChunkGroups}
|
|
269
|
+
* explicitly and setting `vendorChunk: false`.
|
|
270
|
+
*/
|
|
271
|
+
/** Name of the chunk pracht groups the Preact runtime into. */
|
|
272
|
+
declare const FRAMEWORK_VENDOR_CHUNK = "vendor";
|
|
273
|
+
interface ChunkGroup {
|
|
274
|
+
name: string;
|
|
275
|
+
test?: RegExp | string;
|
|
276
|
+
priority?: number;
|
|
277
|
+
minSize?: number;
|
|
278
|
+
[option: string]: unknown;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Pracht's chunk groups, as a fresh array an app can place in its own
|
|
282
|
+
* `output.codeSplitting.groups`.
|
|
283
|
+
*
|
|
284
|
+
* Use this together with `pracht({ vendorChunk: false })` when the framework
|
|
285
|
+
* group has to sit somewhere other than last — pracht then contributes no
|
|
286
|
+
* chunking config of its own and the app's list is the whole policy.
|
|
287
|
+
*/
|
|
288
|
+
declare function frameworkChunkGroups(): ChunkGroup[];
|
|
289
|
+
//#endregion
|
|
221
290
|
//#region src/plugin-codegen.d.ts
|
|
222
291
|
declare function createPrachtClientModuleSource(options?: PrachtPluginOptions, buildOptions?: {
|
|
223
292
|
root?: string;
|
|
@@ -244,10 +313,12 @@ interface ExtractedCapability {
|
|
|
244
313
|
name: string;
|
|
245
314
|
/** Manifest-relative module path, e.g. "./capabilities/notes-search.ts". */
|
|
246
315
|
file: string;
|
|
316
|
+
title: string;
|
|
247
317
|
description: string;
|
|
248
318
|
effect: string | null;
|
|
249
319
|
httpPath: string | null;
|
|
250
320
|
webmcp: boolean;
|
|
321
|
+
webmcpUntrustedContent: boolean;
|
|
251
322
|
inputSchema: Record<string, unknown> | null;
|
|
252
323
|
}
|
|
253
324
|
/**
|
|
@@ -276,9 +347,17 @@ declare function createPrachtCapabilitiesClientModuleSource(options?: PrachtPlug
|
|
|
276
347
|
* validation/middleware/policy stays server-side. Each dispatch carries the
|
|
277
348
|
* transport marker header so audit events can attribute it to WebMCP.
|
|
278
349
|
*
|
|
279
|
-
* Targets the
|
|
280
|
-
* (
|
|
281
|
-
*
|
|
350
|
+
* Targets the WebMCP CG draft API: `document.modelContext.registerTool()`
|
|
351
|
+
* (ChatGPT desktop's built-in browser; Chromium 150+ within the 149–156
|
|
352
|
+
* origin trial — the `document` getter landed in 150 and the deprecated
|
|
353
|
+
* `navigator.modelContext` alias was removed in 152, so trial builds before
|
|
354
|
+
* 150 are not targeted and no fallback is kept; current polyfills install the
|
|
355
|
+
* `document` shape). No-ops silently when the API is absent.
|
|
356
|
+
*
|
|
357
|
+
* `execute()` returns the capability envelope (`{ ok, data }` /
|
|
358
|
+
* `{ ok: false, error }`) as a plain object: per the spec the host serializes
|
|
359
|
+
* the returned value itself, so wrapping it in MCP-style content blocks would
|
|
360
|
+
* reach the agent double-encoded.
|
|
282
361
|
*/
|
|
283
362
|
declare function createPrachtWebmcpModuleSource(options?: PrachtPluginOptions, buildOptions?: {
|
|
284
363
|
root?: string;
|
|
@@ -287,4 +366,4 @@ declare function createPrachtWebmcpModuleSource(options?: PrachtPluginOptions, b
|
|
|
287
366
|
//#region src/index.d.ts
|
|
288
367
|
declare function pracht(options?: PrachtPluginOptions): Plugin[];
|
|
289
368
|
//#endregion
|
|
290
|
-
export { type EnvLeakReference, type EnvSafetyOptions, type LlmsTxtSection, PRACHT_CAPABILITIES_MODULE_ID, PRACHT_CLIENT_MODULE_ID, PRACHT_ISLANDS_CLIENT_MODULE_ID, PRACHT_SERVER_MODULE_ID, PRACHT_WEBMCP_MODULE_ID, PUBLIC_ENV_PREFIX, type PrachtAdapter, type PrachtClientOptions, type PrachtLlmsTxtOptions, type PrachtPluginOptions, type RenderMode, VITE_BUILTIN_ENV_VARS, createEnvSafetyPlugin, createPrachtCapabilitiesClientModuleSource, createPrachtClientModuleSource, createPrachtIslandsClientModuleSource, createPrachtRegistryModuleSource, createPrachtServerModuleSource, createPrachtWebmcpModuleSource, extractCapabilities, formatEnvLeakError, pracht, scanCodeForEnvLeaks };
|
|
369
|
+
export { type ChunkGroup, type EnvLeakReference, type EnvSafetyOptions, FRAMEWORK_VENDOR_CHUNK, type LlmsTxtSection, PRACHT_CAPABILITIES_MODULE_ID, PRACHT_CLIENT_MODULE_ID, PRACHT_ISLANDS_CLIENT_MODULE_ID, PRACHT_SERVER_MODULE_ID, PRACHT_WEBMCP_MODULE_ID, PUBLIC_ENV_PREFIX, type PrachtAdapter, type PrachtClientOptions, type PrachtLlmsTxtOptions, type PrachtPluginOptions, type RenderMode, VITE_BUILTIN_ENV_VARS, createEnvSafetyPlugin, createPrachtCapabilitiesClientModuleSource, createPrachtClientModuleSource, createPrachtIslandsClientModuleSource, createPrachtRegistryModuleSource, createPrachtServerModuleSource, createPrachtWebmcpModuleSource, extractCapabilities, formatEnvLeakError, frameworkChunkGroups, pracht, scanCodeForEnvLeaks };
|