@doki-land/live2d-loader 0.0.15 → 0.0.17

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.
package/README.md CHANGED
@@ -45,11 +45,13 @@ model settings
45
45
  -> optional motions, expressions, physics, pose, and audio
46
46
  ```
47
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.
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.
49
50
 
50
51
  ## 🔌 Custom Hosts
51
52
 
52
- Game engines and constrained hosts can provide a custom `AssetResolver` instead of teaching the loader about every file system or package container.
53
+ Game engines and constrained hosts can provide a custom `AssetResolver` instead of teaching the loader about every file
54
+ system or package container.
53
55
 
54
56
  Appropriate custom resolvers include:
55
57
 
@@ -60,13 +62,16 @@ Appropriate custom resolvers include:
60
62
  - authenticated asset gateways;
61
63
  - offline bundles.
62
64
 
63
- Host adapters should translate their resource system into the shared resolver contract. They should not duplicate model settings normalization or MOC parsing.
65
+ Host adapters should translate their resource system into the shared resolver contract. They should not duplicate model
66
+ settings normalization or MOC parsing.
64
67
 
65
68
  ## 📈 Progress Reporting
66
69
 
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.
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.
68
72
 
69
- Byte totals may be unavailable when a server omits `Content-Length` or streams encoded content. Interfaces must tolerate an unknown total.
73
+ Byte totals may be unavailable when a server omits `Content-Length` or streams encoded content. Interfaces must tolerate
74
+ an unknown total.
70
75
 
71
76
  ## 🔒 Security
72
77
 
@@ -90,11 +95,13 @@ pnpm --filter @doki-land/live2d-loader typecheck
90
95
  pnpm --filter @doki-land/live2d-loader test
91
96
  ```
92
97
 
93
- Resolution changes should include cases for scoped packages, explicit versions, nested paths, malformed specifiers, relative URLs, and query/hash preservation where supported.
98
+ Resolution changes should include cases for scoped packages, explicit versions, nested paths, malformed specifiers,
99
+ relative URLs, and query/hash preservation where supported.
94
100
 
95
101
  ## 🤝 Contributing
96
102
 
97
- Keep loading separate from model evaluation and rendering. New source schemes should have a clear deployment use case and deterministic resolution rules.
103
+ Keep loading separate from model evaluation and rendering. New source schemes should have a clear deployment use case
104
+ and deterministic resolution rules.
98
105
 
99
106
  ## 📄 License
100
107
 
package/dist/index.d.ts CHANGED
@@ -64,6 +64,11 @@ declare function resolveModelSourceUrl(source: string, options?: ResolveModelSou
64
64
 
65
65
  /**
66
66
  * `@doki-land/live2d-loader` — model JSON fetch and load pipeline.
67
+ *
68
+ * Layout:
69
+ * - `fetch/` — progress-aware fetch helpers
70
+ * - `pipeline/` — normalize settings + load middleware
71
+ * - `resolve/` — npm: / URL source resolution
67
72
  */
68
73
 
69
74
  declare const LIVE2D_LOADER_VERSION: "0.0.0";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/fetch-progress.ts
1
+ // src/fetch/index.ts
2
2
  function safeProgress(onProgress, update) {
3
3
  if (!onProgress) return;
4
4
  try {
@@ -55,7 +55,7 @@ async function fetchJsonWithProgress(url, onProgress) {
55
55
  return JSON.parse(text);
56
56
  }
57
57
 
58
- // src/pipeline.ts
58
+ // src/pipeline/index.ts
59
59
  import { detectModelSettingsFormat } from "@doki-land/live2d-core";
60
60
  function resolveAssetUrl(baseUrl, relative) {
61
61
  if (/^(?:[a-z]+:)?\/\//i.test(relative) || relative.startsWith("data:")) {
@@ -197,7 +197,7 @@ function normalizeModelSettings(json, url) {
197
197
  };
198
198
  }
199
199
 
200
- // src/resolve-source.ts
200
+ // src/resolve/index.ts
201
201
  var DEFAULT_NPM_CDN = "https://cdn.jsdelivr.net/npm";
202
202
  function resolveNpmSpecifier(spec, cdnBase = DEFAULT_NPM_CDN) {
203
203
  const trimmed = spec.trim().replace(/^\/+/, "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doki-land/live2d-loader",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
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",
@@ -42,7 +42,7 @@
42
42
  "test": "vitest run"
43
43
  },
44
44
  "dependencies": {
45
- "@doki-land/live2d-core": "0.0.15"
45
+ "@doki-land/live2d-core": "0.0.17"
46
46
  },
47
47
  "sideEffects": false
48
48
  }
package/src/index.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * `@doki-land/live2d-loader` — model JSON fetch and load pipeline.
3
+ *
4
+ * Layout:
5
+ * - `fetch/` — progress-aware fetch helpers
6
+ * - `pipeline/` — normalize settings + load middleware
7
+ * - `resolve/` — npm: / URL source resolution
3
8
  */
4
9
 
5
10
  export {
6
11
  type FetchProgressHandler,
7
12
  fetchArrayBufferWithProgress,
8
13
  fetchJsonWithProgress,
9
- } from "./fetch-progress.js";
14
+ } from "./fetch/index.js";
10
15
  export {
11
16
  createUrlAssetResolver,
12
17
  detectModelFormat,
@@ -17,12 +22,12 @@ export {
17
22
  resolveAssetUrl,
18
23
  runLoadPipeline,
19
24
  type UrlAssetResolverOptions,
20
- } from "./pipeline.js";
25
+ } from "./pipeline/index.js";
21
26
  export {
22
27
  DEFAULT_NPM_CDN,
23
28
  type ResolveModelSourceOptions,
24
29
  resolveModelSourceUrl,
25
30
  resolveNpmSpecifier,
26
- } from "./resolve-source.js";
31
+ } from "./resolve/index.js";
27
32
 
28
33
  export const LIVE2D_LOADER_VERSION = "0.0.0" as const;
@@ -11,7 +11,7 @@ import { detectModelSettingsFormat } from "@doki-land/live2d-core";
11
11
  import {
12
12
  fetchArrayBufferWithProgress,
13
13
  fetchJsonWithProgress,
14
- } from "./fetch-progress.js";
14
+ } from "../fetch/index.js";
15
15
 
16
16
  /** Resolve a relative asset URL against the model settings URL. */
17
17
  export function resolveAssetUrl(baseUrl: string, relative: string): string {
File without changes
File without changes