@riebeckite/core 0.0.7 → 0.0.9
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.js
CHANGED
|
@@ -799,6 +799,9 @@ async function saveContentBuildState(statePath, state) {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
function resolveContentBuildStatePath(config, contentDirectory) {
|
|
802
|
+
if (config?.buildDirectory) {
|
|
803
|
+
return path.join(config.buildDirectory, "build", "content-state.json");
|
|
804
|
+
}
|
|
802
805
|
const directory = config?.content.directory ?? contentDirectory ?? process.cwd();
|
|
803
806
|
return path.resolve(
|
|
804
807
|
directory,
|
|
@@ -1459,6 +1462,7 @@ async function writeAtomically(targetPath, versionDirectory, serialized) {
|
|
|
1459
1462
|
}
|
|
1460
1463
|
function resolvePluginCacheDirectory(config) {
|
|
1461
1464
|
if (!config) return path2.resolve(process.cwd(), ".riebeckite", "cache");
|
|
1465
|
+
if (config.buildDirectory) return path2.join(config.buildDirectory, "cache");
|
|
1462
1466
|
return path2.resolve(config.content.directory, "..", ".riebeckite", "cache");
|
|
1463
1467
|
}
|
|
1464
1468
|
function cachePath(versionDirectory, key) {
|
|
@@ -1760,6 +1764,32 @@ function assertJsonValue(value, ancestors) {
|
|
|
1760
1764
|
ancestors.delete(value);
|
|
1761
1765
|
}
|
|
1762
1766
|
|
|
1767
|
+
// src/plugin/generated_output_registry.ts
|
|
1768
|
+
var GeneratedOutputRegistry = class {
|
|
1769
|
+
outputs = [];
|
|
1770
|
+
owners = /* @__PURE__ */ new Map();
|
|
1771
|
+
sinkFor(pluginName) {
|
|
1772
|
+
return {
|
|
1773
|
+
emit: (output) => {
|
|
1774
|
+
const path4 = normalizeGeneratedOutputPath(output.path);
|
|
1775
|
+
const owner = this.owners.get(path4);
|
|
1776
|
+
if (owner) {
|
|
1777
|
+
throw new Error(
|
|
1778
|
+
`Duplicate generated output path "${path4}" declared by "${owner}" and "${pluginName}".`
|
|
1779
|
+
);
|
|
1780
|
+
}
|
|
1781
|
+
this.owners.set(path4, pluginName);
|
|
1782
|
+
this.outputs.push({ path: path4, content: output.content, owner: pluginName });
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
all() {
|
|
1787
|
+
return [...this.outputs].sort(
|
|
1788
|
+
(a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1763
1793
|
// src/plugin/plugin_lifecycle.ts
|
|
1764
1794
|
var PluginLifecycleError = class extends Error {
|
|
1765
1795
|
constructor(pluginName, hookName, cause) {
|
|
@@ -1830,8 +1860,7 @@ var PluginRuntime = class {
|
|
|
1830
1860
|
disposed = false;
|
|
1831
1861
|
diagnostics = [];
|
|
1832
1862
|
pluginCaches = /* @__PURE__ */ new Map();
|
|
1833
|
-
generatedOutputs =
|
|
1834
|
-
generatedOutputOwners = /* @__PURE__ */ new Map();
|
|
1863
|
+
generatedOutputs = new GeneratedOutputRegistry();
|
|
1835
1864
|
isBuildTime = false;
|
|
1836
1865
|
getDiagnostics() {
|
|
1837
1866
|
return this.diagnostics;
|
|
@@ -1949,9 +1978,7 @@ var PluginRuntime = class {
|
|
|
1949
1978
|
}
|
|
1950
1979
|
/** Returns registered outputs sorted by path for a deterministic build. */
|
|
1951
1980
|
collectGeneratedOutputs() {
|
|
1952
|
-
return
|
|
1953
|
-
(a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0
|
|
1954
|
-
);
|
|
1981
|
+
return this.generatedOutputs.all();
|
|
1955
1982
|
}
|
|
1956
1983
|
async collectDiagnostics(contentIndex) {
|
|
1957
1984
|
const tracer = this.observability().tracer;
|
|
@@ -2023,23 +2050,7 @@ var PluginRuntime = class {
|
|
|
2023
2050
|
};
|
|
2024
2051
|
}
|
|
2025
2052
|
generatedOutputSinkFor(plugin) {
|
|
2026
|
-
return
|
|
2027
|
-
emit: (output) => {
|
|
2028
|
-
const path4 = normalizeGeneratedOutputPath(output.path);
|
|
2029
|
-
const owner = this.generatedOutputOwners.get(path4);
|
|
2030
|
-
if (owner) {
|
|
2031
|
-
throw new Error(
|
|
2032
|
-
`Duplicate generated output path "${path4}" declared by "${owner}" and "${plugin.name}".`
|
|
2033
|
-
);
|
|
2034
|
-
}
|
|
2035
|
-
this.generatedOutputOwners.set(path4, plugin.name);
|
|
2036
|
-
this.generatedOutputs.push({
|
|
2037
|
-
path: path4,
|
|
2038
|
-
content: output.content,
|
|
2039
|
-
owner: plugin.name
|
|
2040
|
-
});
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2053
|
+
return this.generatedOutputs.sinkFor(plugin.name);
|
|
2043
2054
|
}
|
|
2044
2055
|
cacheFor(plugin) {
|
|
2045
2056
|
const cached = this.pluginCaches.get(plugin.name);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GeneratedOutput, GeneratedOutputSink } from "../types/generated_output.js";
|
|
2
|
+
/** Owns plugin-generated output and rejects colliding output paths. */
|
|
3
|
+
export declare class GeneratedOutputRegistry {
|
|
4
|
+
private readonly outputs;
|
|
5
|
+
private readonly owners;
|
|
6
|
+
sinkFor(pluginName: string): GeneratedOutputSink;
|
|
7
|
+
all(): GeneratedOutput[];
|
|
8
|
+
}
|
|
@@ -4,6 +4,11 @@ import type { PublishStrategy } from "./publish_strategy.js";
|
|
|
4
4
|
import type { SiteConfig } from "./site_config.js";
|
|
5
5
|
import type { ThemeConfig, ThemeStyle } from "./theme_config.js";
|
|
6
6
|
export type ResolvedRiebeckiteConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* Directory for build-time cache and state. Host integrations resolve this
|
|
9
|
+
* relative to their application root.
|
|
10
|
+
*/
|
|
11
|
+
buildDirectory?: string;
|
|
7
12
|
site: Required<SiteConfig>;
|
|
8
13
|
content: {
|
|
9
14
|
directory: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
|
-
"@riebeckite/test": "0.0.
|
|
46
|
+
"@riebeckite/test": "0.0.9"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|