@delmaredigital/payload-puck 0.6.18 → 0.6.19
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/plugin/index.js +22 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/plugin/index.js
CHANGED
|
@@ -257,12 +257,22 @@ import { createContextListHandler, createContextCreateHandler, createContextUpda
|
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
// Register API endpoints if enabled
|
|
260
|
+
// Merge with any previously registered puck collections (from prior plugin instances)
|
|
261
|
+
const existingPuckCollections = incomingConfig.custom?.puck?.collections || [];
|
|
260
262
|
const puckCollections = [
|
|
263
|
+
...existingPuckCollections,
|
|
261
264
|
pagesCollection
|
|
262
265
|
];
|
|
263
266
|
const endpointOptions = {
|
|
264
267
|
collections: puckCollections
|
|
265
268
|
};
|
|
269
|
+
// Parameterized endpoint paths that should only exist once (with merged collections)
|
|
270
|
+
const parameterizedPuckPaths = new Set([
|
|
271
|
+
'/puck/:collection',
|
|
272
|
+
'/puck/:collection/:id',
|
|
273
|
+
'/puck/:collection/:id/versions',
|
|
274
|
+
'/puck/:collection/:id/restore'
|
|
275
|
+
]);
|
|
266
276
|
// Build styles endpoint URL list for PuckConfigProvider
|
|
267
277
|
// In production, prefer the pre-compiled static CSS file if provided
|
|
268
278
|
// In development, use runtime compilation endpoint for hot reload
|
|
@@ -276,8 +286,11 @@ import { createContextListHandler, createContextCreateHandler, createContextUpda
|
|
|
276
286
|
] : [],
|
|
277
287
|
...editorStylesheetUrls
|
|
278
288
|
];
|
|
289
|
+
// Filter out parameterized puck endpoints from previous plugin instances
|
|
290
|
+
// so we can re-register them with the merged collections list
|
|
291
|
+
const incomingEndpoints = (incomingConfig.endpoints || []).filter((ep)=>!parameterizedPuckPaths.has(ep.path));
|
|
279
292
|
const endpoints = enableEndpoints ? [
|
|
280
|
-
...
|
|
293
|
+
...incomingEndpoints,
|
|
281
294
|
// Styles endpoint MUST be first - exact match before parameterized routes
|
|
282
295
|
...editorStylesheet ? [
|
|
283
296
|
{
|
|
@@ -387,25 +400,24 @@ import { createContextListHandler, createContextCreateHandler, createContextUpda
|
|
|
387
400
|
collections,
|
|
388
401
|
endpoints,
|
|
389
402
|
// Store options in custom for the view to access
|
|
403
|
+
// Merge with existing puck config from prior plugin instances
|
|
390
404
|
custom: {
|
|
391
405
|
...incomingConfig.custom,
|
|
392
406
|
puck: {
|
|
407
|
+
...incomingConfig.custom?.puck,
|
|
393
408
|
collections: puckCollections,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
pageTree: pageTreeConfig,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// Preview URL configuration
|
|
400
|
-
previewUrl,
|
|
401
|
-
// AI configuration
|
|
409
|
+
// Per-instance settings use this instance's values (last plugin wins for shared settings)
|
|
410
|
+
layouts: options.layouts ?? incomingConfig.custom?.puck?.layouts,
|
|
411
|
+
pageTree: pageTreeConfig ?? incomingConfig.custom?.puck?.pageTree,
|
|
412
|
+
editorStylesheets: editorStylesheets.length > 0 ? editorStylesheets : incomingConfig.custom?.puck?.editorStylesheets,
|
|
413
|
+
previewUrl: previewUrl ?? incomingConfig.custom?.puck?.previewUrl,
|
|
402
414
|
ai: aiConfig?.enabled ? {
|
|
403
415
|
enabled: true,
|
|
404
416
|
context: aiConfig.context,
|
|
405
417
|
examplePrompts: aiConfig.examplePrompts,
|
|
406
418
|
promptsCollection: aiConfig.promptsCollection,
|
|
407
419
|
contextCollection: aiConfig.contextCollection
|
|
408
|
-
} :
|
|
420
|
+
} : incomingConfig.custom?.puck?.ai
|
|
409
421
|
}
|
|
410
422
|
},
|
|
411
423
|
onInit: async (payload)=>{
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.6.
|
|
1
|
+
export declare const VERSION = "0.6.19";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/generate-version.js - do not edit manually
|
|
2
|
-
export const VERSION = '0.6.
|
|
2
|
+
export const VERSION = '0.6.19';
|