@doki-land/live2d-loader 0.0.14 โ†’ 0.0.16

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 +106 -1
  2. package/package.json +12 -10
package/README.md CHANGED
@@ -1,3 +1,108 @@
1
1
  # @doki-land/live2d-loader
2
2
 
3
- live2d.ts package 0.0.14.
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
49
+ being accessible does not guarantee that its textures or binary assets are accessible.
50
+
51
+ ## ๐Ÿ”Œ Custom Hosts
52
+
53
+ Game engines and constrained hosts can provide a custom `AssetResolver` instead of teaching the loader about every file
54
+ system or package container.
55
+
56
+ Appropriate custom resolvers include:
57
+
58
+ - game-engine asset databases;
59
+ - hashed build manifests;
60
+ - mini-game package APIs;
61
+ - service-worker caches;
62
+ - authenticated asset gateways;
63
+ - offline bundles.
64
+
65
+ Host adapters should translate their resource system into the shared resolver contract. They should not duplicate model
66
+ settings normalization or MOC parsing.
67
+
68
+ ## ๐Ÿ“ˆ Progress Reporting
69
+
70
+ Loading progress is divided into meaningful stages such as settings, binary data, decode, and textures. Consumers should
71
+ display the stage and normalized progress rather than guessing progress from the number of completed `fetch` calls.
72
+
73
+ Byte totals may be unavailable when a server omits `Content-Length` or streams encoded content. Interfaces must tolerate
74
+ an unknown total.
75
+
76
+ ## ๐Ÿ”’ Security
77
+
78
+ Remote model settings are untrusted input. Hosts should consider:
79
+
80
+ - allowed schemes and origins;
81
+ - maximum response sizes;
82
+ - request timeouts and cancellation;
83
+ - redirects;
84
+ - MIME validation;
85
+ - decompression and texture size limits;
86
+ - credential forwarding;
87
+ - content-security policy.
88
+
89
+ Do not attach privileged credentials to arbitrary model URLs.
90
+
91
+ ## ๐Ÿงช Development
92
+
93
+ ```bash
94
+ pnpm --filter @doki-land/live2d-loader typecheck
95
+ pnpm --filter @doki-land/live2d-loader test
96
+ ```
97
+
98
+ Resolution changes should include cases for scoped packages, explicit versions, nested paths, malformed specifiers,
99
+ relative URLs, and query/hash preservation where supported.
100
+
101
+ ## ๐Ÿค Contributing
102
+
103
+ Keep loading separate from model evaluation and rendering. New source schemes should have a clear deployment use case
104
+ and deterministic resolution rules.
105
+
106
+ ## ๐Ÿ“„ License
107
+
108
+ 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.14",
4
- "description": "Live2D asset resolve and model load pipeline",
3
+ "version": "0.0.16",
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.14"
45
+ "@doki-land/live2d-core": "0.0.16"
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
  }