@abraca/junis 2.95.0 → 2.97.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.
Files changed (38) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/JunBreadcrumbs.vue +40 -4
  3. package/dist/runtime/components/JunCampfireRoster.vue +4 -0
  4. package/dist/runtime/components/JunDocMenuHost.d.vue.ts +3 -0
  5. package/dist/runtime/components/JunDocMenuHost.vue +39 -0
  6. package/dist/runtime/components/JunDocMenuHost.vue.d.ts +3 -0
  7. package/dist/runtime/components/JunHorizontalTimeline.vue +5 -0
  8. package/dist/runtime/components/JunItemMenu.vue +51 -2
  9. package/dist/runtime/components/JunMosaicPane.client.d.vue.ts +11 -0
  10. package/dist/runtime/components/JunMosaicPane.client.vue +14 -2
  11. package/dist/runtime/components/JunMosaicPane.client.vue.d.ts +11 -0
  12. package/dist/runtime/components/JunNavDock.vue +3 -0
  13. package/dist/runtime/components/JunNavMenu.client.vue +4 -0
  14. package/dist/runtime/components/JunNavigation.vue +10 -0
  15. package/dist/runtime/components/JunNotFound.vue +4 -0
  16. package/dist/runtime/components/JunNoteLinks.vue +3 -0
  17. package/dist/runtime/components/JunSearch.client.vue +8 -0
  18. package/dist/runtime/components/JunSectionBar.vue +4 -0
  19. package/dist/runtime/components/JunTravellersChip.vue +3 -0
  20. package/dist/runtime/components/renderers/JunCourseRenderer.vue +8 -0
  21. package/dist/runtime/components/renderers/JunEntryRenderer.vue +4 -0
  22. package/dist/runtime/components/renderers/JunGardenRenderer.vue +94 -36
  23. package/dist/runtime/components/renderers/JunHomeRenderer.vue +4 -0
  24. package/dist/runtime/components/renderers/JunItemRenderer.vue +4 -0
  25. package/dist/runtime/components/renderers/JunMosaicRenderer.vue +1 -0
  26. package/dist/runtime/components/renderers/JunTrackRenderer.vue +3 -0
  27. package/dist/runtime/composables/useJunChrome.d.ts +14 -0
  28. package/dist/runtime/composables/useJunChrome.js +17 -0
  29. package/dist/runtime/composables/useJunDocLinkMenu.d.ts +69 -0
  30. package/dist/runtime/composables/useJunDocLinkMenu.js +99 -0
  31. package/dist/runtime/composables/useJunDocMenuHost.d.ts +18 -0
  32. package/dist/runtime/composables/useJunDocMenuHost.js +26 -0
  33. package/dist/runtime/composables/useJunSurface.d.ts +13 -0
  34. package/dist/runtime/composables/useJunSurface.js +4 -0
  35. package/dist/runtime/layouts/jun.vue +7 -0
  36. package/dist/runtime/server/plugins/jun-bootstrap.js +46 -2
  37. package/dist/runtime/server/utils/junServiceFetch.js +22 -10
  38. package/package.json +1 -1
@@ -342,15 +342,59 @@ function defaultTree(typeIds) {
342
342
  // Real, keyless references so a fresh deployment shows genuine figures
343
343
  // rather than an empty grid — and so a broken adapter is visible on the
344
344
  // first boot rather than the first time an owner tries one.
345
+ //
346
+ // ONE PER ADAPTER, and that is the point of the list rather than a
347
+ // preference for variety. The seed carried `github-repo` and `npm`
348
+ // only, so five of the seven adapters were never exercised by anything:
349
+ // not the demo, not `pnpm parity`, not a first boot. The npm one was
350
+ // broken for every package whose registry document is over a megabyte
351
+ // — `nuxt`, `react`, `typescript`, the three most likely things anybody
352
+ // would put on this page — and it presented as "sometimes it works",
353
+ // because the seeded package (`yjs`) is small.
354
+ //
355
+ // `group` sorts them into headings, which is also the only thing that
356
+ // exercises that field.
345
357
  {
346
358
  label: "nuxt/nuxt",
347
359
  type: "doc",
348
- meta: { provider: "github-repo", ref: "nuxt/nuxt" }
360
+ meta: { provider: "github-repo", ref: "nuxt/nuxt", group: "Code" }
361
+ },
362
+ {
363
+ label: "nuxt",
364
+ type: "doc",
365
+ meta: { provider: "github-user", ref: "nuxt", group: "Code" }
349
366
  },
350
367
  {
351
368
  label: "yjs",
352
369
  type: "doc",
353
- meta: { provider: "npm", ref: "yjs" }
370
+ meta: { provider: "npm", ref: "yjs", group: "Packages" }
371
+ },
372
+ // The package the 1 MB body cap used to break. It is seeded precisely
373
+ // so that regression cannot come back unnoticed.
374
+ {
375
+ label: "nuxt (npm)",
376
+ type: "doc",
377
+ meta: { provider: "npm", ref: "nuxt", group: "Packages" }
378
+ },
379
+ {
380
+ label: "serde",
381
+ type: "doc",
382
+ meta: { provider: "crates", ref: "serde", group: "Packages" }
383
+ },
384
+ {
385
+ label: "The Nuxt blog",
386
+ type: "doc",
387
+ meta: { provider: "rss", ref: "https://nuxt.com/blog/rss.xml", group: "Feeds" }
388
+ },
389
+ {
390
+ label: "nuxt.com",
391
+ type: "doc",
392
+ meta: { provider: "http", ref: "https://nuxt.com", group: "Watching" }
393
+ },
394
+ {
395
+ label: "Nuxt",
396
+ type: "doc",
397
+ meta: { provider: "og", ref: "https://nuxt.com", group: "Watching" }
354
398
  }
355
399
  ]
356
400
  });
@@ -84,34 +84,37 @@ async function safeFetch(url, init = {}) {
84
84
  target = new URL(location, u).toString();
85
85
  continue;
86
86
  }
87
- const text = await readCapped(res);
88
- return { status: res.status, text, ms: Date.now() - started };
87
+ const { text, truncated } = await readCapped(res);
88
+ return { status: res.status, text, ms: Date.now() - started, truncated };
89
89
  }
90
90
  throw new JunServiceError("Too many redirects");
91
91
  }
92
92
  async function readCapped(res) {
93
93
  const reader = res.body?.getReader();
94
- if (!reader) return "";
94
+ if (!reader) return { text: "", truncated: false };
95
95
  const decoder = new TextDecoder();
96
96
  let out = "";
97
97
  let total = 0;
98
+ let truncated = false;
98
99
  for (; ; ) {
99
100
  const { done, value } = await reader.read();
100
101
  if (done) break;
101
102
  total += value.byteLength;
102
103
  if (total > MAX_BYTES) {
104
+ truncated = true;
103
105
  void reader.cancel();
104
106
  break;
105
107
  }
106
108
  out += decoder.decode(value, { stream: true });
107
109
  }
108
- return out;
110
+ return { text: out, truncated };
109
111
  }
110
112
  async function fetchJson(url, headers) {
111
- const { status, text } = await safeFetch(url, { accept: "application/json", headers });
113
+ const { status, text, truncated } = await safeFetch(url, { accept: "application/json", headers });
112
114
  if (status === 404) throw new JunServiceError("Not found", 404);
113
115
  if (status === 403 || status === 429) throw new JunServiceError("Rate limited", 429);
114
116
  if (status >= 400) throw new JunServiceError(`Upstream said ${status}`);
117
+ if (truncated) throw new JunServiceError("That answer was too large to read");
115
118
  try {
116
119
  return JSON.parse(text);
117
120
  } catch {
@@ -169,7 +172,7 @@ const GITHUB_USER = async (ref, ctx) => {
169
172
  const NPM = async (ref) => {
170
173
  if (!/^(?:@[\w.-]+\/)?[\w.-]+$/.test(ref)) throw new JunServiceError("Expected a package name", 400);
171
174
  const encoded = ref.replace("/", "%2F");
172
- const pkg = await fetchJson(`https://registry.npmjs.org/${encoded}`);
175
+ const pkg = await fetchJson(`https://registry.npmjs.org/${encoded}/latest`);
173
176
  let weekly = "\u2014";
174
177
  try {
175
178
  const dl = await fetchJson(
@@ -178,7 +181,16 @@ const NPM = async (ref) => {
178
181
  weekly = compact(dl.downloads);
179
182
  } catch {
180
183
  }
181
- const latest = pkg["dist-tags"]?.latest ?? "";
184
+ let modified;
185
+ try {
186
+ const abbreviated = await fetchJson(
187
+ `https://registry.npmjs.org/${encoded}`,
188
+ { accept: "application/vnd.npm.install-v1+json" }
189
+ );
190
+ modified = abbreviated.modified;
191
+ } catch {
192
+ }
193
+ const licence = typeof pkg.license === "string" ? pkg.license : pkg.license?.type ?? "\u2014";
182
194
  return {
183
195
  provider: "npm",
184
196
  ref,
@@ -186,11 +198,11 @@ const NPM = async (ref) => {
186
198
  subtitle: pkg.description ?? "",
187
199
  url: `https://www.npmjs.com/package/${ref}`,
188
200
  stats: [
189
- { label: "version", value: latest || "\u2014" },
201
+ { label: "version", value: pkg.version || "\u2014" },
190
202
  { label: "weekly", value: weekly },
191
- { label: "licence", value: pkg.license ?? "\u2014" }
203
+ { label: "licence", value: licence || "\u2014" }
192
204
  ],
193
- timestamp: latest ? pkg.time?.[latest] : pkg.time?.modified,
205
+ timestamp: modified,
194
206
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
195
207
  };
196
208
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/junis",
3
- "version": "2.95.0",
3
+ "version": "2.97.0",
4
4
  "description": "Website-builder Nuxt module for the Abracadabra CRDT platform — page-type renderers, presence chrome, studio editing and SSR, all driven by documents",
5
5
  "repository": "abracadabra/jun-is",
6
6
  "license": "MIT",