@markless/bundler 0.4.0 → 0.6.0
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/dev-error-2hi-Icjn.js +176 -0
- package/dist/dev-error.d.ts +16 -16
- package/dist/dev-error.js +2 -174
- package/dist/execution-log-BL-7a77M.d.ts +17 -0
- package/dist/optimized-deps-BfzxSm6C.js +89 -0
- package/dist/preload.d.ts +44 -7
- package/dist/preload.js +3 -2
- package/dist/repeat-runtime-BDnaUYXM.js +71 -0
- package/dist/rolldown-DHkCX7vL.js +9267 -0
- package/dist/rolldown.d.ts +37 -17
- package/dist/rolldown.js +3 -3
- package/dist/roster-resume-CpphsFl_.js +427 -0
- package/dist/route-pack-groups-BXc755qH.js +2744 -0
- package/dist/shared-seed-slot-ihIVCD2S.js +113 -0
- package/dist/{types-BuooJg32.d.ts → types-iOUoceJ-.d.ts} +49 -10
- package/dist/vite.d.ts +5 -6
- package/dist/vite.js +673 -171
- package/package.json +7 -7
- package/dist/rolldown-CB2Xpf-E.js +0 -4828
- package/dist/source-module-DI20i0ZG.js +0 -1168
- package/dist/source-module-XFgOFX1c.d.ts +0 -8
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { deserializeGraphValueForClient } from "@markless/serializer/decode-client";
|
|
2
|
+
//#region ../web/src/repeat-runtime.ts
|
|
3
|
+
var KeyedRepeatRuntimeError = class extends Error {
|
|
4
|
+
code = "MARKLESS_REPEAT_KEY_DUPLICATE";
|
|
5
|
+
severity = "error";
|
|
6
|
+
phase = "runtime";
|
|
7
|
+
repeatId;
|
|
8
|
+
keyPath;
|
|
9
|
+
collidingValue;
|
|
10
|
+
docsUrl;
|
|
11
|
+
constructor(diagnostic) {
|
|
12
|
+
super(diagnostic.message);
|
|
13
|
+
Object.defineProperty(this, "message", {
|
|
14
|
+
value: diagnostic.message,
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true
|
|
17
|
+
});
|
|
18
|
+
this.name = "KeyedRepeatRuntimeError";
|
|
19
|
+
this.repeatId = diagnostic.repeatId;
|
|
20
|
+
this.keyPath = diagnostic.keyPath;
|
|
21
|
+
this.collidingValue = diagnostic.collidingValue;
|
|
22
|
+
this.docsUrl = diagnostic.docsUrl;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function validateKeyedRepeatGraphKeys(graph, view) {
|
|
26
|
+
for (const repeat of view.keyedRepeats ?? []) assertUniqueRepeatKeys(repeat, readKeyedRepeatCollection(graph, repeat));
|
|
27
|
+
}
|
|
28
|
+
async function validateKeyedRepeatPayloadKeys(input) {
|
|
29
|
+
const entries = await Promise.all(input.state.cells.map(async (cell) => [cell.graphNodeId, cell.value === void 0 ? void 0 : await deserializeGraphValueForClient(cell.value)]));
|
|
30
|
+
const cells = new Map(entries);
|
|
31
|
+
validateKeyedRepeatGraphKeys({ read(graphNodeId, path = []) {
|
|
32
|
+
return readPath(cells.get(graphNodeId), path);
|
|
33
|
+
} }, input.view);
|
|
34
|
+
}
|
|
35
|
+
function readKeyedRepeatCollection(graph, repeat) {
|
|
36
|
+
if (!repeat.collectionGraphNodeId) return [];
|
|
37
|
+
const value = graph.read(repeat.collectionGraphNodeId, repeat.collectionPath);
|
|
38
|
+
if (Array.isArray(value)) return value;
|
|
39
|
+
return Array.from(value ?? []);
|
|
40
|
+
}
|
|
41
|
+
function repeatItemKey(item, repeat) {
|
|
42
|
+
return readPath(item, repeat.keyPath);
|
|
43
|
+
}
|
|
44
|
+
function assertUniqueRepeatKeys(repeat, items) {
|
|
45
|
+
const seen = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const item of items) {
|
|
47
|
+
const key = repeatItemKey(item, repeat);
|
|
48
|
+
if (seen.has(key)) throw duplicateRepeatKeyError(repeat, key);
|
|
49
|
+
seen.set(key, true);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function duplicateRepeatKeyError(repeat, key) {
|
|
53
|
+
const source = `${repeat.itemName}.${repeat.keyPath.join(".")}`;
|
|
54
|
+
return new KeyedRepeatRuntimeError({
|
|
55
|
+
message: `MARKLESS_REPEAT_KEY_DUPLICATE: Duplicate @for key ${JSON.stringify(key)} from ${source}.`,
|
|
56
|
+
repeatId: repeat.id,
|
|
57
|
+
keyPath: repeat.keyPath,
|
|
58
|
+
collidingValue: key,
|
|
59
|
+
docsUrl: "https://markless.dev/errors/MARKLESS_REPEAT_KEY_DUPLICATE"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function readPath(value, path) {
|
|
63
|
+
let cursor = value;
|
|
64
|
+
for (const key of path) {
|
|
65
|
+
if (cursor == null) return void 0;
|
|
66
|
+
cursor = cursor[key];
|
|
67
|
+
}
|
|
68
|
+
return cursor;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { validateKeyedRepeatPayloadKeys };
|