@ranx729/ducktape-assets 1.2.0 → 1.4.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.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "assets": {
3
3
  "centaur-archer": {
4
+ "attribution": "Walters Art Museum W.102, fol. 82v",
4
5
  "categories": [
5
6
  "hybrids",
6
7
  "fantasy",
@@ -195,6 +196,7 @@
195
196
  "width": 720
196
197
  },
197
198
  "elephant-castle": {
199
+ "attribution": "Walters Art Museum W.102, fol. 28r",
198
200
  "categories": [
199
201
  "animals",
200
202
  "humans",
@@ -364,6 +366,7 @@
364
366
  "width": 270
365
367
  },
366
368
  "horse-flute-drum": {
369
+ "attribution": "Walters Art Museum W.102, fol. 74v",
367
370
  "categories": [
368
371
  "animals",
369
372
  "music",
@@ -518,6 +521,7 @@
518
521
  "width": 236
519
522
  },
520
523
  "rabbit-church-bells": {
524
+ "attribution": "Walters Art Museum W.102, fol. 81r",
521
525
  "categories": [
522
526
  "animals",
523
527
  "music",
@@ -730,11 +734,11 @@
730
734
  "width": 823
731
735
  }
732
736
  },
733
- "attribution": "Walters Art Museum W.102 (CC0-1.0)",
734
- "builtAt": "2026-10-27T17:29:52.282Z",
735
- "cdn": "https://cdn.jsdelivr.net/npm/@ranx729/ducktape-assets-walters-w102@1.0.1/",
737
+ "attribution": "Walters Art Museum W.102",
738
+ "builtAt": "2026-10-27T18:38:16.005Z",
739
+ "cdn": "https://cdn.jsdelivr.net/npm/@ranx729/ducktape-assets-walters-w102@1.0.2/",
736
740
  "contentHash": "sha256:af3a33a4e36be1b741107aef88b7abcd613fb23e5d951f334e97f1c8176b8947",
737
- "inputsHash": "sha256:905f4894698885139731e88e2e830b4795ddc673ab95c960e7f12cd45e787e86",
741
+ "inputsHash": "sha256:6a5c69cc4fa64c07754faefdf125f54bb9730d226ba767e6457c220575877109",
738
742
  "kind": "historical",
739
743
  "license": {
740
744
  "artwork": "CC0-1.0",
@@ -753,7 +757,7 @@
753
757
  "concurrency": 1,
754
758
  "libvips": "8.18.7",
755
759
  "sharp": "0.35.5",
756
- "tools": "0.1.0"
760
+ "tools": "0.2.0"
757
761
  },
758
- "version": "1.0.1"
762
+ "version": "1.0.2"
759
763
  }
package/src/generate.mjs CHANGED
@@ -91,7 +91,7 @@ function table(list) {
91
91
 
92
92
  const FLOWS = `1. **Paste a URL.** Any HTML, CSS or Markdown references one file on jsDelivr, for example \`https://cdn.jsdelivr.net/npm/@ranx729/ducktape-assets-walters-w102@1.2.0/webp/rabbit-church-bells-512.webp\`. Only that file is transferred. \`catalog.json\` lists the exact URL of every width and format, so nothing has to be guessed.
93
93
  2. **Pick and copy.** Keep a small \`ducktape.json\` listing the asset ids you want, with optional widths, formats and \`masters: true\`. \`npx @ranx729/ducktape-assets copy\` fetches exactly those files into the project (default \`src/assets/ducktape/\`), verifies every SHA-256 against the manifest, and writes \`ducktape.manifest.json\` beside them with type, dimensions (native and of the capped master), transparency, render geometry (tile axis, frame slice), thumbhash, licence and attribution per asset. \`masters: true\` alone copies only the lossless master (for apps that encode their own images); add \`formats\`, \`widths\` or \`max\` to copy ladder files as well. Re-running is idempotent.
94
- 3. **Resolve in code.** \`npm i @ranx729/ducktape-assets\` installs metadata and a resolver, zero images. \`assets.image(id, { width })\` returns \`src\`, \`srcset\`, \`sizes\`, width, height, thumbhash, licence, \`attribution\`, and \`file\` / \`files\` (path, bytes and sha256 of every referenced rung, for scripts that record or verify what they use). Bytes come from the CDN at request time, or from flow 2 when \`base\` points at the copied directory.
94
+ 3. **Resolve in code.** \`npm i @ranx729/ducktape-assets\` installs metadata and a resolver, zero images. \`assets.image(id, { width })\` returns \`src\`, \`srcset\`, \`sizes\`, width, height, thumbhash, \`license\`, \`attribution\` (the bare credit, licence kept separate), \`set\` / \`package\` / \`version\` (where the bytes come from), and \`file\` / \`files\` (path, bytes and sha256 of every referenced rung, for scripts that record or verify what they use). Bytes come from the CDN at request time, or from flow 2 when \`base\` points at the copied directory.
95
95
 
96
96
  Build-time recipe in Node, offline, no network:
97
97
 
@@ -174,7 +174,7 @@ ${URLS}
174
174
 
175
175
  ## Rules
176
176
 
177
- - Honour the licence block: show the \`attribution\` line when the asset's licence requires it.
177
+ - Honour the licence block: show the \`attribution\` credit together with \`license\` (SPDX id) when the licence requires it; \`attribution\` is the institution and object for historical sets, or the author for authored and imported ones, and never contains the licence.
178
178
  - Never use \`@latest\` or range URLs; always an exact version from \`index.json\` or \`catalog.json\`.
179
179
  - Never put a master on a page. Masters are for re-encoding in a build.
180
180
  - Images are decorative by default (\`alt=""\`); use \`description\` when the image carries meaning.
package/src/resolver.mjs CHANGED
@@ -115,6 +115,11 @@ export function createResolver({ index, base, formats = ['avif', 'webp'], pin =
115
115
  }
116
116
  if (!fallback) throw new Error(`${id}: none of the formats ${formats.join(', ')} is available`);
117
117
  const out = {
118
+ // Where the bytes come from, for scripts that record what they used: the set, its first package and the version
119
+ // the URLs point at (a pin overrides the index). Files in a volume part carry their own `package`.
120
+ set: setId,
121
+ package: entry.package,
122
+ version: pin[setId] ?? entry.version,
118
123
  src: urlOf(entry, fallback.src, setId),
119
124
  srcset: sources[sources.length - 1].srcset,
120
125
  sources,