@doki-land/live2d-loader 0.0.13 โ†’ 0.0.15

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 (2) hide show
  1. package/README.md +99 -1
  2. package/package.json +12 -10
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
1
  # @doki-land/live2d-loader
2
2
 
3
- live2d.ts package 0.0.13.
3
+ Source resolution and asset loading for the `live2d.ts` runtime.
4
+
5
+ This is an implementation package. Most applications should load models through `@doki-land/live2d`.
6
+
7
+ ## โœจ Features
8
+
9
+ - Local and remote model settings URLs.
10
+ - `npm:` model references resolved through a configurable CDN base.
11
+ - Model settings normalization for supported formats.
12
+ - Relative model, texture, and resource URL resolution.
13
+ - Byte and JSON fetching.
14
+ - Structured loading progress.
15
+ - Injectable asset resolvers for custom hosts.
16
+
17
+ ## ๐Ÿ“ฆ Installation
18
+
19
+ ```bash
20
+ pnpm add @doki-land/live2d-loader
21
+ ```
22
+
23
+ ## ๐Ÿš€ Source Resolution
24
+
25
+ ```ts
26
+ import { resolveModelSourceUrl } from "@doki-land/live2d-loader";
27
+
28
+ const url = resolveModelSourceUrl(
29
+ "npm:live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json",
30
+ );
31
+
32
+ console.log(url);
33
+ ```
34
+
35
+ Pin package versions in production so a remote registry or CDN cannot silently change the selected model assets.
36
+
37
+ ## ๐ŸŒ Remote Assets
38
+
39
+ Remote models usually include several requests:
40
+
41
+ ```text
42
+ model settings
43
+ -> MOC binary
44
+ -> textures
45
+ -> optional motions, expressions, physics, pose, and audio
46
+ ```
47
+
48
+ Every referenced resource must be reachable under the browser's CORS and content-security policies. A settings file being accessible does not guarantee that its textures or binary assets are accessible.
49
+
50
+ ## ๐Ÿ”Œ Custom Hosts
51
+
52
+ Game engines and constrained hosts can provide a custom `AssetResolver` instead of teaching the loader about every file system or package container.
53
+
54
+ Appropriate custom resolvers include:
55
+
56
+ - game-engine asset databases;
57
+ - hashed build manifests;
58
+ - mini-game package APIs;
59
+ - service-worker caches;
60
+ - authenticated asset gateways;
61
+ - offline bundles.
62
+
63
+ Host adapters should translate their resource system into the shared resolver contract. They should not duplicate model settings normalization or MOC parsing.
64
+
65
+ ## ๐Ÿ“ˆ Progress Reporting
66
+
67
+ Loading progress is divided into meaningful stages such as settings, binary data, decode, and textures. Consumers should display the stage and normalized progress rather than guessing progress from the number of completed `fetch` calls.
68
+
69
+ Byte totals may be unavailable when a server omits `Content-Length` or streams encoded content. Interfaces must tolerate an unknown total.
70
+
71
+ ## ๐Ÿ”’ Security
72
+
73
+ Remote model settings are untrusted input. Hosts should consider:
74
+
75
+ - allowed schemes and origins;
76
+ - maximum response sizes;
77
+ - request timeouts and cancellation;
78
+ - redirects;
79
+ - MIME validation;
80
+ - decompression and texture size limits;
81
+ - credential forwarding;
82
+ - content-security policy.
83
+
84
+ Do not attach privileged credentials to arbitrary model URLs.
85
+
86
+ ## ๐Ÿงช Development
87
+
88
+ ```bash
89
+ pnpm --filter @doki-land/live2d-loader typecheck
90
+ pnpm --filter @doki-land/live2d-loader test
91
+ ```
92
+
93
+ Resolution changes should include cases for scoped packages, explicit versions, nested paths, malformed specifiers, relative URLs, and query/hash preservation where supported.
94
+
95
+ ## ๐Ÿค Contributing
96
+
97
+ Keep loading separate from model evaluation and rendering. New source schemes should have a clear deployment use case and deterministic resolution rules.
98
+
99
+ ## ๐Ÿ“„ License
100
+
101
+ See the repository license.
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@doki-land/live2d-loader",
3
- "version": "0.0.13",
4
- "description": "Live2D asset resolve and model load pipeline",
3
+ "version": "0.0.15",
4
+ "description": "Fetch and normalize Live2D model.json/model3.json, resolve npm: URLs, AssetResolver for moc/textures.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "author": "Doki Land",
7
+ "homepage": "https://github.com/doki-land/live2d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/doki-land/live2d.ts.git",
11
+ "directory": "projects/live2d-loader"
12
+ },
8
13
  "keywords": [
9
14
  "live2d",
10
15
  "loader",
@@ -17,7 +22,8 @@
17
22
  },
18
23
  "files": [
19
24
  "dist",
20
- "src"
25
+ "src",
26
+ "README.md"
21
27
  ],
22
28
  "publishConfig": {
23
29
  "access": "public",
@@ -36,11 +42,7 @@
36
42
  "test": "vitest run"
37
43
  },
38
44
  "dependencies": {
39
- "@doki-land/live2d-core": "0.0.13"
45
+ "@doki-land/live2d-core": "0.0.15"
40
46
  },
41
- "sideEffects": false,
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/doki-land/live2d.ts.git"
45
- }
47
+ "sideEffects": false
46
48
  }