@gltf-transform/core
Advanced tools
Comparing version 0.12.12 to 0.12.13
{ | ||
"name": "@gltf-transform/core", | ||
"version": "0.12.12", | ||
"version": "0.12.13", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -43,3 +43,3 @@ "homepage": "https://gltf-transform.donmccurdy.com/", | ||
}, | ||
"gitHead": "a07b4df67a1cb252f12025754eadc4db5af82212" | ||
"gitHead": "24c09b23b1be836461bbc54a577e43dde852126a" | ||
} |
@@ -111,2 +111,3 @@ import { Format } from '../constants'; | ||
const jsonDoc = this._binaryToJSON(arrayBuffer); | ||
// Read external resources first, before Data URIs are replaced. | ||
this._readResourcesExternal(jsonDoc, this._path.dirname(uri)); | ||
@@ -123,2 +124,3 @@ this._readResourcesInternal(jsonDoc); | ||
const jsonDoc = {json: JSON.parse(jsonContent), resources: {}} as JSONDocument; | ||
// Read external resources first, before Data URIs are replaced. | ||
this._readResourcesExternal(jsonDoc, this._path.dirname(uri)); | ||
@@ -125,0 +127,0 @@ this._readResourcesInternal(jsonDoc); |
@@ -102,3 +102,3 @@ import { Format, GLB_BUFFER, VertexLayout } from '../constants'; | ||
/** Converts glTF-formatted JSON and a resource map to a {@link Document}. */ | ||
public readJSON (jsonDoc: JSONDocument): Document { | ||
public readJSON(jsonDoc: JSONDocument): Document { | ||
this._readResourcesInternal(jsonDoc); | ||
@@ -113,3 +113,3 @@ return GLTFReader.read(jsonDoc, { | ||
/** Converts a {@link Document} to glTF-formatted JSON and a resource map. */ | ||
public writeJSON (doc: Document, _options: Partial<WriterOptions> = {}): JSONDocument { | ||
public writeJSON(doc: Document, _options: Partial<WriterOptions> = {}): JSONDocument { | ||
if (_options.format === Format.GLB && doc.getRoot().listBuffers().length > 1) { | ||
@@ -116,0 +116,0 @@ throw new Error('GLB must have 0–1 buffers.'); |
@@ -71,3 +71,3 @@ import { Document } from '../document'; | ||
const uri = resource.uri; | ||
if (!uri) return Promise.resolve(); | ||
if (!uri || uri.match(/data:/)) return Promise.resolve(); | ||
@@ -94,4 +94,5 @@ return fetch(_resolve(dir, uri), this._fetchConfig) | ||
jsonDoc.json = json; | ||
// Read external resources first, before Data URIs are replaced. | ||
await this._readResourcesExternal(jsonDoc, _dirname(uri)); | ||
this._readResourcesInternal(jsonDoc); | ||
await this._readResourcesExternal(jsonDoc, _dirname(uri)); | ||
return jsonDoc; | ||
@@ -107,4 +108,5 @@ }); | ||
const jsonDoc = this._binaryToJSON(arrayBuffer); | ||
// Read external resources first, before Data URIs are replaced. | ||
await this._readResourcesExternal(jsonDoc, _dirname(uri)); | ||
this._readResourcesInternal(jsonDoc); | ||
await this._readResourcesExternal(jsonDoc, _dirname(uri)); | ||
return jsonDoc; | ||
@@ -111,0 +113,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1280387
11043