minimojs 1.0.0-alpha.31 → 1.0.0-alpha.32

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.
@@ -255,10 +255,18 @@ export class AssetSystem {
255
255
  throw new Error(`MinimoJS: ${caller} cannot use the key "${safeKey}", which an asset file declares. Keys must be unique in the whole game.`);
256
256
  }
257
257
  }
258
- /** @internal */
258
+ /**
259
+ * Loads one image with a CORS request, as `fetch` loads sounds, so an image
260
+ * from another origin never taints the canvas and the game can still read
261
+ * its pixels or export it. A host that does not answer with CORS fails the
262
+ * image instead.
263
+ *
264
+ * @internal
265
+ */
259
266
  loadImage(src) {
260
267
  return new Promise((resolve, reject) => {
261
268
  const image = new Image();
269
+ image.crossOrigin = "anonymous";
262
270
  image.onload = () => resolve(image);
263
271
  image.onerror = () => {
264
272
  reject(new Error(`MinimoJS: Failed to load image "${src}".`));
package/dist/minimo.d.ts CHANGED
@@ -1534,6 +1534,10 @@ export declare class Game {
1534
1534
  * `loadImage` may only be called from within {@link Game.onPreload} or a
1535
1535
  * scene's {@link IScene.onPreload}.
1536
1536
  *
1537
+ * Images are requested with CORS, as sounds are, so the canvas stays
1538
+ * readable and exportable. An image on another origin loads only when its
1539
+ * host answers with CORS headers.
1540
+ *
1537
1541
  * @param key - Stable key used later by {@link BackgroundLayer.imageKey} or {@link Game.getImage}.
1538
1542
  * @param src - Image URL or relative path.
1539
1543
  *
package/dist/minimo.js CHANGED
@@ -1682,6 +1682,10 @@ export class Game {
1682
1682
  * `loadImage` may only be called from within {@link Game.onPreload} or a
1683
1683
  * scene's {@link IScene.onPreload}.
1684
1684
  *
1685
+ * Images are requested with CORS, as sounds are, so the canvas stays
1686
+ * readable and exportable. An image on another origin loads only when its
1687
+ * host answers with CORS headers.
1688
+ *
1685
1689
  * @param key - Stable key used later by {@link BackgroundLayer.imageKey} or {@link Game.getImage}.
1686
1690
  * @param src - Image URL or relative path.
1687
1691
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimojs",
3
- "version": "1.0.0-alpha.31",
3
+ "version": "1.0.0-alpha.32",
4
4
  "description": "MinimoJS v1 — ultra-minimal, flat, deterministic 2D web game engine. Image-first sprites with emoji as a zero-asset alternative, rAF loop, TypeScript-first, LLM-friendly.",
5
5
  "type": "module",
6
6
  "main": "dist/minimo.js",