@riebeckite/core 0.0.13 → 0.0.14

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
@@ -1,4 +1,5 @@
1
1
  export { defineConfig, isExcluded, isPublished, resolveConfig, resolveConfigModule, } from "./src/config.js";
2
+ export { type ConfigDeprecationNotice, collectConfigDeprecationDiagnostics, } from "./src/config_deprecations.js";
2
3
  export { ConfigValidationError } from "./src/config_validation.js";
3
4
  export { ATTACHMENTS_BASE_PATH, attachmentUrl, getExtension, isAttachmentPath, isImagePath, isMarkdownPath, normalizeContentPath, } from "./src/content/attachment.js";
4
5
  export type { ContentBuildState, FingerprintedContentEntry, } from "./src/content/content_build_state.js";
@@ -23,6 +24,7 @@ export type { GraphEdge, GraphLayoutNode, LinkableGraphNode, RadialGraphLayoutOp
23
24
  export { buildGraphEdges, layoutRadialGraph, } from "./src/content/graph_layout.js";
24
25
  export { IMAGE_EXTENSIONS } from "./src/content/image_extensions.js";
25
26
  export { readOnlyContentGraph } from "./src/content/read_only_content_graph.js";
27
+ export { createDeprecationDiagnostic, type DeprecationKind, type DeprecationNotice, formatDeprecationMessage, } from "./src/deprecation.js";
26
28
  export type { LogContext, Logger, LogLevel, Observability, ObservabilityValue, TraceAttributes, TraceEvent, Tracer, TraceSink, TraceSpan, } from "./src/observability.js";
27
29
  export { CompositeTraceSink, ConsoleLogger, NoopLogger, NoopTracer, SinkTracer, } from "./src/observability.js";
28
30
  export type { PipelineOptions } from "./src/pipeline.js";
package/dist/index.js CHANGED
@@ -693,6 +693,46 @@ function globToRegExp(glob) {
693
693
  return new RegExp(`^${re}$`);
694
694
  }
695
695
 
696
+ // src/deprecation.ts
697
+ function createDeprecationDiagnostic(notice) {
698
+ return {
699
+ code: `deprecated-${notice.kind}`,
700
+ severity: "warning",
701
+ message: formatDeprecationMessage(notice),
702
+ target: notice.target,
703
+ suggestion: notice.replacement ? `Use ${notice.replacement}. ${notice.action}` : notice.action,
704
+ meta: { deprecation: notice }
705
+ };
706
+ }
707
+ function formatDeprecationMessage(notice) {
708
+ const lines = [
709
+ `Deprecated: ${notice.target}`,
710
+ `Deprecated since: ${notice.deprecatedSince}`
711
+ ];
712
+ if (notice.replacement) lines.push(`Use: ${notice.replacement}`);
713
+ lines.push(`Migration: ${notice.action}`);
714
+ if (notice.documentationUrl) lines.push(`See: ${notice.documentationUrl}`);
715
+ if (notice.removedIn) lines.push(`Removal planned: ${notice.removedIn}`);
716
+ return lines.join("\n");
717
+ }
718
+
719
+ // src/config_deprecations.ts
720
+ var configDeprecations = [];
721
+ function collectConfigDeprecationDiagnostics(config, notices = configDeprecations) {
722
+ return notices.filter((notice) => hasConfigPath(config, notice.path)).map(createDeprecationDiagnostic);
723
+ }
724
+ function hasConfigPath(config, path4) {
725
+ let value = config;
726
+ for (const segment of path4.split(".")) {
727
+ if (!isRecord2(value) || !(segment in value)) return false;
728
+ value = value[segment];
729
+ }
730
+ return value !== void 0;
731
+ }
732
+ function isRecord2(value) {
733
+ return typeof value === "object" && value !== null && !Array.isArray(value);
734
+ }
735
+
696
736
  // src/content/image_extensions.ts
697
737
  var IMAGE_EXTENSIONS = [
698
738
  "png",
@@ -770,7 +810,7 @@ async function readContentBuildStateStatus(statePath) {
770
810
  }
771
811
  throw error;
772
812
  }
773
- if (!isRecord2(parsed)) {
813
+ if (!isRecord3(parsed)) {
774
814
  return { kind: "invalid", path: statePath, reason: "invalid-shape" };
775
815
  }
776
816
  if (parsed.version !== CONTENT_BUILD_STATE_VERSION) {
@@ -810,19 +850,19 @@ function resolveContentBuildStatePath(config, contentDirectory) {
810
850
  );
811
851
  }
812
852
  function isContentBuildState(value) {
813
- return isRecord2(value) && value.version === CONTENT_BUILD_STATE_VERSION && isContentBuildStateShape(value);
853
+ return isRecord3(value) && value.version === CONTENT_BUILD_STATE_VERSION && isContentBuildStateShape(value);
814
854
  }
815
855
  function isContentBuildStateShape(value) {
816
- if (!isRecord2(value.entries) || !isRecord2(value.contentIndex)) return false;
856
+ if (!isRecord3(value.entries) || !isRecord3(value.contentIndex)) return false;
817
857
  return Object.values(value.entries).every(
818
- (entry) => isRecord2(entry) && typeof entry.fingerprint === "string" && entry.fingerprint.length > 0 && Array.isArray(entry.dependencies) && entry.dependencies.every(
858
+ (entry) => isRecord3(entry) && typeof entry.fingerprint === "string" && entry.fingerprint.length > 0 && Array.isArray(entry.dependencies) && entry.dependencies.every(
819
859
  (dependency) => typeof dependency === "string"
820
860
  )
821
861
  ) && Object.values(value.contentIndex).every(
822
862
  (entry) => typeof entry === "string"
823
863
  );
824
864
  }
825
- function isRecord2(value) {
865
+ function isRecord3(value) {
826
866
  return typeof value === "object" && value !== null && !Array.isArray(value);
827
867
  }
828
868
  function isNotFoundError(error) {
@@ -2831,7 +2871,8 @@ var ManifestBuilder = class {
2831
2871
  assets: [],
2832
2872
  clientEntries: [],
2833
2873
  diagnostics: [],
2834
- generatedOutputs: []
2874
+ generatedOutputs: [],
2875
+ pagePaths: []
2835
2876
  };
2836
2877
  return { ...manifest, graph: createContentGraph(manifest) };
2837
2878
  }
@@ -3032,6 +3073,9 @@ var ContentManager = class {
3032
3073
  this.locationResolver.populateRedirects(manifest, locations);
3033
3074
  await this.pluginRuntime.runManifestCreated(manifest, contentIndex);
3034
3075
  this.applyPublicView(manifest);
3076
+ manifest.pagePaths = [
3077
+ ...await this.pluginRuntime.getPagePaths(manifest, contentIndex)
3078
+ ];
3035
3079
  manifest.assets = this.pluginRuntime.collectAssets();
3036
3080
  manifest.clientEntries = this.pluginRuntime.collectClientEntries();
3037
3081
  manifest.diagnostics = [
@@ -3333,8 +3377,10 @@ export {
3333
3377
  buildContentCollections,
3334
3378
  buildGraphEdges,
3335
3379
  calculateReadingTime,
3380
+ collectConfigDeprecationDiagnostics,
3336
3381
  createClientEntry,
3337
3382
  createContentGraph,
3383
+ createDeprecationDiagnostic,
3338
3384
  createPluginMemo,
3339
3385
  createStyleAsset,
3340
3386
  createUnavailableGeneratedOutputSink,
@@ -3347,6 +3393,7 @@ export {
3347
3393
  escapeScriptJson,
3348
3394
  extractFrontmatterAliases,
3349
3395
  fingerprintContentEntries,
3396
+ formatDeprecationMessage,
3350
3397
  getContentSourceEntry,
3351
3398
  getExtension,
3352
3399
  getResolvedPluginMetadata,
@@ -0,0 +1,8 @@
1
+ import { type DeprecationNotice } from "./deprecation.js";
2
+ import type { Diagnostic } from "./types/diagnostic.js";
3
+ import type { RiebeckiteConfig } from "./types/riebeckite_config.js";
4
+ export type ConfigDeprecationNotice = DeprecationNotice & {
5
+ readonly kind: "config";
6
+ readonly path: string;
7
+ };
8
+ export declare function collectConfigDeprecationDiagnostics(config: RiebeckiteConfig, notices?: readonly ConfigDeprecationNotice[]): Diagnostic[];
@@ -0,0 +1,14 @@
1
+ import type { Diagnostic } from "./types/diagnostic.js";
2
+ export type DeprecationKind = "config" | "plugin-api" | "theme-api" | "cli" | "scaffold" | "package";
3
+ export type DeprecationNotice = {
4
+ readonly kind: DeprecationKind;
5
+ readonly id: string;
6
+ readonly target: string;
7
+ readonly deprecatedSince: string;
8
+ readonly action: string;
9
+ readonly replacement?: string;
10
+ readonly documentationUrl?: string;
11
+ readonly removedIn?: string;
12
+ };
13
+ export declare function createDeprecationDiagnostic(notice: DeprecationNotice): Diagnostic;
14
+ export declare function formatDeprecationMessage(notice: DeprecationNotice): string;
@@ -112,4 +112,5 @@ export type ContentManifest = {
112
112
  clientEntries: ContentManifestPluginClientEntry[];
113
113
  diagnostics: Diagnostic[];
114
114
  generatedOutputs: GeneratedOutput[];
115
+ pagePaths: string[];
115
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/core",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
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.13"
52
+ "@riebeckite/test": "0.0.14"
53
53
  },
54
54
  "repository": {
55
55
  "type": "git",