@riebeckite/core 0.0.28 → 0.0.30

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.ts CHANGED
@@ -32,6 +32,8 @@ export { buildGraphEdges, layoutForceGraph, layoutRadialGraph, } from "./src/con
32
32
  export { IMAGE_EXTENSIONS } from "./src/content/image_extensions.js";
33
33
  export type { OutputChangeSet, OutputDescriptor, OutputKind, } from "./src/content/output_dependency.js";
34
34
  export { buildOutputInventory, determineOutputChanges, htmlOutputPath, } from "./src/content/output_dependency.js";
35
+ export type { OutputPlan, OutputPlanAction, OutputPlanComparison, OutputPlanConflict, OutputPlanEntry, OutputPlanInput, OutputPlanKind, OutputPlanOwner, } from "./src/content/output_plan.js";
36
+ export { buildOutputPlan, compareOutputPlan, } from "./src/content/output_plan.js";
35
37
  export { createPublicContentView, type PublicContentEntry, type PublicContentView, } from "./src/content/public_content_view.js";
36
38
  export type { PublishingResolutionOptions, PublishingVisibility, ResolvedPublishingState, } from "./src/content/publishing.js";
37
39
  export { resolvePublishingBuildTime, resolvePublishingState, } from "./src/content/publishing.js";
package/dist/index.js CHANGED
@@ -6515,6 +6515,120 @@ function clampFinite(value, min, max) {
6515
6515
  return clamp(value, min, max);
6516
6516
  }
6517
6517
 
6518
+ // src/content/output_plan.ts
6519
+ function buildOutputPlan(input) {
6520
+ const candidates = [
6521
+ ...input.inventory.map((output) => inventoryEntry(output, input)),
6522
+ ...(input.removed ?? []).map(removedEntry),
6523
+ ...entriesForPaths(
6524
+ input.honoStaticRoutePaths,
6525
+ "hono-static-route",
6526
+ "hono-static-route",
6527
+ "route"
6528
+ ),
6529
+ ...entriesForPaths(
6530
+ input.viteClientAssetPaths,
6531
+ "vite-client-asset",
6532
+ "asset",
6533
+ "client"
6534
+ ),
6535
+ ...entriesForPaths(
6536
+ input.sitePublicAssetPaths,
6537
+ "site-public-asset",
6538
+ "asset",
6539
+ "public"
6540
+ )
6541
+ ];
6542
+ const byPath = /* @__PURE__ */ new Map();
6543
+ for (const candidate of candidates) {
6544
+ const existing = byPath.get(candidate.path) ?? [];
6545
+ existing.push(candidate);
6546
+ byPath.set(candidate.path, existing);
6547
+ }
6548
+ const conflicts = [...byPath.entries()].filter(
6549
+ ([, entries2]) => new Set(entries2.map((entry) => entry.owner)).size > 1
6550
+ ).map(([path6, entries2]) => ({
6551
+ path: path6,
6552
+ owners: [...new Set(entries2.map((entry) => entry.owner))].sort()
6553
+ })).sort((left, right) => left.path.localeCompare(right.path));
6554
+ const entries = [...byPath.values()].map((samePathEntries) => samePathEntries[0]).sort((left, right) => left.path.localeCompare(right.path));
6555
+ return {
6556
+ entries,
6557
+ conflicts,
6558
+ unknownPaths: entries.filter((entry) => entry.owner === "unknown").map((entry) => entry.path)
6559
+ };
6560
+ }
6561
+ function compareOutputPlan(plan, actualPaths) {
6562
+ const actual = new Set(actualPaths);
6563
+ const entries = new Map(plan.entries.map((entry) => [entry.path, entry]));
6564
+ const missingInPlan = [...actual].filter((path6) => {
6565
+ const entry = entries.get(path6);
6566
+ return entry === void 0 || entry.owner === "unknown";
6567
+ }).sort();
6568
+ const missingInDist = plan.entries.filter((entry) => entry.expectedToExist && !actual.has(entry.path)).map((entry) => entry.path).sort();
6569
+ const publicationViolations = plan.entries.filter(
6570
+ (entry) => entry.owner !== "unknown" && !entry.publicationEligible && actual.has(entry.path)
6571
+ ).map((entry) => entry.path).sort();
6572
+ const unknown = [
6573
+ .../* @__PURE__ */ new Set([
6574
+ ...plan.entries.filter((entry) => entry.owner === "unknown").map((entry) => entry.path),
6575
+ ...missingInPlan
6576
+ ])
6577
+ ].sort();
6578
+ const matched = plan.entries.filter(
6579
+ (entry) => entry.owner !== "unknown" && entry.expectedToExist && actual.has(entry.path)
6580
+ ).map((entry) => entry.path);
6581
+ return {
6582
+ matched,
6583
+ missingInPlan,
6584
+ missingInDist,
6585
+ ownerConflicts: plan.conflicts,
6586
+ unknown,
6587
+ publicationViolations
6588
+ };
6589
+ }
6590
+ function inventoryEntry(output, input) {
6591
+ const affected = input.affectedPaths?.has(output.path) ?? true;
6592
+ const cacheAvailable = input.cacheAvailable ?? false;
6593
+ return {
6594
+ path: output.path,
6595
+ owner: output.producer.startsWith("content:") ? "content" : "plugin",
6596
+ kind: output.kind,
6597
+ source: output.producer,
6598
+ dependencies: output.dependencies,
6599
+ publicationEligible: true,
6600
+ cacheEligible: true,
6601
+ expectedToExist: true,
6602
+ action: affected || !cacheAvailable ? "generate" : "reuse"
6603
+ };
6604
+ }
6605
+ function removedEntry(output) {
6606
+ return {
6607
+ path: output.path,
6608
+ owner: output.producer.startsWith("content:") ? "content" : "plugin",
6609
+ kind: output.kind,
6610
+ source: output.producer,
6611
+ dependencies: output.dependencies,
6612
+ publicationEligible: false,
6613
+ cacheEligible: false,
6614
+ expectedToExist: false,
6615
+ action: "remove"
6616
+ };
6617
+ }
6618
+ function entriesForPaths(paths, owner, kind, sourceKind) {
6619
+ return [...paths ?? []].map((path6) => ({
6620
+ path: path6,
6621
+ owner,
6622
+ kind,
6623
+ source: `${sourceKind}:${path6}`,
6624
+ dependencies: [{ type: "unknown" }],
6625
+ publicationEligible: true,
6626
+ cacheEligible: false,
6627
+ expectedToExist: true,
6628
+ action: "unknown"
6629
+ }));
6630
+ }
6631
+
6518
6632
  // src/content/public_content_view.ts
6519
6633
  var emptyEntries = Object.freeze([]);
6520
6634
  function createPublicContentView(manifest) {
@@ -6726,7 +6840,9 @@ export {
6726
6840
  buildContentCollections,
6727
6841
  buildGraphEdges,
6728
6842
  buildOutputInventory,
6843
+ buildOutputPlan,
6729
6844
  calculateReadingTime,
6845
+ compareOutputPlan,
6730
6846
  computePipelineFingerprint,
6731
6847
  createClientEntry,
6732
6848
  createContentGraph,
@@ -0,0 +1,44 @@
1
+ import type { OutputDependency } from "../types/output_dependency.js";
2
+ import type { OutputDescriptor } from "./output_dependency.js";
3
+ export type OutputPlanOwner = "content" | "plugin" | "hono-static-route" | "vite-client-asset" | "site-public-asset" | "unknown";
4
+ export type OutputPlanKind = "content" | "redirect" | "plugin-page" | "generated" | "hono-static-route" | "asset" | "unknown";
5
+ export type OutputPlanAction = "generate" | "reuse" | "remove" | "unknown";
6
+ export type OutputPlanEntry = {
7
+ readonly path: string;
8
+ readonly owner: OutputPlanOwner;
9
+ readonly kind: OutputPlanKind;
10
+ readonly source: string;
11
+ readonly dependencies: readonly OutputDependency[];
12
+ readonly publicationEligible: boolean;
13
+ readonly cacheEligible: boolean;
14
+ readonly expectedToExist: boolean;
15
+ readonly action: OutputPlanAction;
16
+ };
17
+ export type OutputPlanConflict = {
18
+ readonly path: string;
19
+ readonly owners: readonly OutputPlanOwner[];
20
+ };
21
+ export type OutputPlan = {
22
+ readonly entries: readonly OutputPlanEntry[];
23
+ readonly conflicts: readonly OutputPlanConflict[];
24
+ readonly unknownPaths: readonly string[];
25
+ };
26
+ export type OutputPlanComparison = {
27
+ readonly matched: readonly string[];
28
+ readonly missingInPlan: readonly string[];
29
+ readonly missingInDist: readonly string[];
30
+ readonly ownerConflicts: readonly OutputPlanConflict[];
31
+ readonly unknown: readonly string[];
32
+ readonly publicationViolations: readonly string[];
33
+ };
34
+ export type OutputPlanInput = {
35
+ readonly inventory: readonly OutputDescriptor[];
36
+ readonly affectedPaths?: ReadonlySet<string>;
37
+ readonly removed?: readonly OutputDescriptor[];
38
+ readonly cacheAvailable?: boolean;
39
+ readonly honoStaticRoutePaths?: ReadonlySet<string>;
40
+ readonly viteClientAssetPaths?: ReadonlySet<string>;
41
+ readonly sitePublicAssetPaths?: ReadonlySet<string>;
42
+ };
43
+ export declare function buildOutputPlan(input: OutputPlanInput): OutputPlan;
44
+ export declare function compareOutputPlan(plan: OutputPlan, actualPaths: Iterable<string>): OutputPlanComparison;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/core",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsx": "^4.22.4",
52
- "@riebeckite/test": "0.0.28"
52
+ "@riebeckite/test": "0.0.30"
53
53
  },
54
54
  "repository": {
55
55
  "type": "git",