@riebeckite/core 0.0.8 → 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
|
@@ -1764,6 +1764,32 @@ function assertJsonValue(value, ancestors) {
|
|
|
1764
1764
|
ancestors.delete(value);
|
|
1765
1765
|
}
|
|
1766
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
|
+
|
|
1767
1793
|
// src/plugin/plugin_lifecycle.ts
|
|
1768
1794
|
var PluginLifecycleError = class extends Error {
|
|
1769
1795
|
constructor(pluginName, hookName, cause) {
|
|
@@ -1834,8 +1860,7 @@ var PluginRuntime = class {
|
|
|
1834
1860
|
disposed = false;
|
|
1835
1861
|
diagnostics = [];
|
|
1836
1862
|
pluginCaches = /* @__PURE__ */ new Map();
|
|
1837
|
-
generatedOutputs =
|
|
1838
|
-
generatedOutputOwners = /* @__PURE__ */ new Map();
|
|
1863
|
+
generatedOutputs = new GeneratedOutputRegistry();
|
|
1839
1864
|
isBuildTime = false;
|
|
1840
1865
|
getDiagnostics() {
|
|
1841
1866
|
return this.diagnostics;
|
|
@@ -1953,9 +1978,7 @@ var PluginRuntime = class {
|
|
|
1953
1978
|
}
|
|
1954
1979
|
/** Returns registered outputs sorted by path for a deterministic build. */
|
|
1955
1980
|
collectGeneratedOutputs() {
|
|
1956
|
-
return
|
|
1957
|
-
(a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0
|
|
1958
|
-
);
|
|
1981
|
+
return this.generatedOutputs.all();
|
|
1959
1982
|
}
|
|
1960
1983
|
async collectDiagnostics(contentIndex) {
|
|
1961
1984
|
const tracer = this.observability().tracer;
|
|
@@ -2027,23 +2050,7 @@ var PluginRuntime = class {
|
|
|
2027
2050
|
};
|
|
2028
2051
|
}
|
|
2029
2052
|
generatedOutputSinkFor(plugin) {
|
|
2030
|
-
return
|
|
2031
|
-
emit: (output) => {
|
|
2032
|
-
const path4 = normalizeGeneratedOutputPath(output.path);
|
|
2033
|
-
const owner = this.generatedOutputOwners.get(path4);
|
|
2034
|
-
if (owner) {
|
|
2035
|
-
throw new Error(
|
|
2036
|
-
`Duplicate generated output path "${path4}" declared by "${owner}" and "${plugin.name}".`
|
|
2037
|
-
);
|
|
2038
|
-
}
|
|
2039
|
-
this.generatedOutputOwners.set(path4, plugin.name);
|
|
2040
|
-
this.generatedOutputs.push({
|
|
2041
|
-
path: path4,
|
|
2042
|
-
content: output.content,
|
|
2043
|
-
owner: plugin.name
|
|
2044
|
-
});
|
|
2045
|
-
}
|
|
2046
|
-
};
|
|
2053
|
+
return this.generatedOutputs.sinkFor(plugin.name);
|
|
2047
2054
|
}
|
|
2048
2055
|
cacheFor(plugin) {
|
|
2049
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
|
+
}
|
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",
|