Parcourir la source

Add types ref to export in package.json for packages.

master
Palash Bansal il y a 1 an
Parent
révision
8be3756c7d
Aucun compte lié à l'adresse e-mail de l'auteur

+ 2
- 1
plugins/blend-importer/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-blend-importer", "name": "@threepipe/plugin-blend-importer",
"description": "Basic importer for .blend file", "description": "Basic importer for .blend file",
"version": "0.0.3",
"version": "0.0.4",
"devDependencies": { "devDependencies": {
}, },
"dependencies": { "dependencies": {
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 2
- 1
plugins/blueprintjs/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-blueprintjs", "name": "@threepipe/plugin-blueprintjs",
"description": "Blueprint.js UI Plugin for ThreePipe", "description": "Blueprint.js UI Plugin for ThreePipe",
"version": "0.3.2",
"version": "0.3.3",
"devDependencies": { "devDependencies": {
"uiconfig-blueprint": "0.1.0-dev.5", "uiconfig-blueprint": "0.1.0-dev.5",
"uiconfig.js": "^0.1.3" "uiconfig.js": "^0.1.3"
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 2
- 1
plugins/configurator/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-configurator", "name": "@threepipe/plugin-configurator",
"description": "Plugins for creating material and object configurators in threepipe.", "description": "Plugins for creating material and object configurators in threepipe.",
"version": "0.1.2",
"version": "0.1.3",
"devDependencies": { "devDependencies": {
}, },
"dependencies": { "dependencies": {
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 2
- 1
plugins/extra-importers/package.json Voir le fichier

{ {
"name": "@threepipe/plugins-extra-importers", "name": "@threepipe/plugins-extra-importers",
"description": "Extra Threepipe plugins for importing several file types.", "description": "Extra Threepipe plugins for importing several file types.",
"version": "0.2.2",
"version": "0.2.3",
"devDependencies": { "devDependencies": {
}, },
"dependencies": { "dependencies": {
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js" "import": "./dist/index.js"
}, },
"./dist/": { "./dist/": {

+ 2
- 1
plugins/gltf-transform/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-gltf-transform", "name": "@threepipe/plugin-gltf-transform",
"description": "Utility plugins for threepipe using gltf-transform to optimize/compress glTF files.", "description": "Utility plugins for threepipe using gltf-transform to optimize/compress glTF files.",
"version": "0.1.2",
"version": "0.1.3",
"devDependencies": { "devDependencies": {
"@gltf-transform/core": "3.2.1", "@gltf-transform/core": "3.2.1",
"@gltf-transform/extensions": "3.2.1" "@gltf-transform/extensions": "3.2.1"
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 37
- 30
plugins/gltf-transform/src/GLTFDracoExporter.ts Voir le fichier



} }


async parseAsync(obj: any, {compress = false, dracoOptions, ...options}: {compress: boolean, dracoOptions?: EncoderOptions} & GLTFExporter2Options): Promise<Blob> {
async parseAsync(obj: any, {compress = false, dracoOptions, ...options}: {compress: boolean, dracoOptions?: EncoderOptions} & GLTFExporter2Options, throwOnError = false): Promise<Blob> {
if (!this.loader) { if (!this.loader) {
console.error('GLTFDracoExporter: No DRACOLoader2 instance provided') console.error('GLTFDracoExporter: No DRACOLoader2 instance provided')
return super.parseAsync(obj, options) return super.parseAsync(obj, options)
const uncompressedBlob = await super.parseAsync(uncompressed, ops) const uncompressedBlob = await super.parseAsync(uncompressed, ops)
if (!compress) return uncompressedBlob if (!compress) return uncompressedBlob


if (!uncompressed) throw new Error('GLTFDracoExporter: gltf is null')
try {
if (!uncompressed) throw new Error('GLTFDracoExporter: gltf is null')


let gltf = uncompressed
let gltf = uncompressed


const bytes = (gltf as ArrayBuffer).byteLength || Infinity
const bytes = (gltf as ArrayBuffer).byteLength || Infinity


const iDocument = await (typeof gltf === 'object' && !(gltf as any).byteLength ? this._io.readJSON({
json: gltf as GLTF.IGLTF,
resources: {},
}) : this._io.readBinary(new Uint8Array(gltf as ArrayBuffer)))
const iDocument = await (typeof gltf === 'object' && !(gltf as any).byteLength ? this._io.readJSON({
json: gltf as GLTF.IGLTF,
resources: {},
}) : this._io.readBinary(new Uint8Array(gltf as ArrayBuffer)))


// iDocument.createExtension(GLTFViewerConfigExtensionGP)
iDocument.createExtension(KHRDracoMeshCompression)
.setRequired(true)
.setEncoderOptions({...this._encoderOptions, ...dracoOptions ?? {}})
// iDocument.createExtension(GLTFViewerConfigExtensionGP)
iDocument.createExtension(KHRDracoMeshCompression)
.setRequired(true)
.setEncoderOptions({...this._encoderOptions, ...dracoOptions ?? {}})


if (ops.exportExt === 'glb') {
gltf = await this._io.writeBinary(iDocument)
if (isFinite(bytes)) {
console.log('DRACO Compression ratio: ' + ((gltf as ArrayBuffer).byteLength / bytes).toFixed(5))
}
} else {
const jDoc = await this._io.writeJSON(iDocument)
gltf = jDoc.json
if (Object.values(jDoc.resources).filter(v => v).length > 0) {
console.warn('DRACOExporter: extra resources in resources not supported properly')
;(gltf as any).resources = jDoc.resources
if (ops.exportExt === 'glb') {
gltf = await this._io.writeBinary(iDocument)
if (isFinite(bytes)) {
console.log('DRACO Compression ratio: ' + ((gltf as ArrayBuffer).byteLength / bytes).toFixed(5))
}
} else {
const jDoc = await this._io.writeJSON(iDocument)
gltf = jDoc.json
if (Object.values(jDoc.resources).filter(v => v).length > 0) {
console.warn('DRACOExporter: extra resources in resources not supported properly')
;(gltf as any).resources = jDoc.resources
}
} }
}


gltf.__isGLTFOutput = true
const blob = await super.parseAsync(gltf, ops) as any // this will just convert it to blob because __isGLTFOutput is set (checked in GLTFExporter2)
if (!blob) throw new Error('GLTFDracoExporter: blob is null')
blob.ext = 'glb'
;(blob as any).__uncompressed = uncompressedBlob
return blob
gltf.__isGLTFOutput = true
const blob = await super.parseAsync(gltf, ops) as any // this will just convert it to blob because __isGLTFOutput is set (checked in GLTFExporter2)
if (!blob) throw new Error('GLTFDracoExporter: blob is null')
blob.ext = 'glb'
;(blob as any).__uncompressed = uncompressedBlob
return blob
} catch (e) {
if (throwOnError) throw e
console.error('Unable to compress glb with DRACO extension, fallback to uncompressed')
console.error(e)
return uncompressedBlob
}
} }


addExtension(extension: typeof Extension): this { addExtension(extension: typeof Extension): this {

+ 2
- 1
plugins/network/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-network", "name": "@threepipe/plugin-network",
"description": "Network/AWS/Cloud related plugins for threepipe", "description": "Network/AWS/Cloud related plugins for threepipe",
"version": "0.1.1",
"version": "0.1.2",
"devDependencies": { "devDependencies": {
}, },
"dependencies": { "dependencies": {
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 1
- 0
plugins/plugin-template-rollup/package.json Voir le fichier

}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 1
- 0
plugins/plugin-template-vite/package.json Voir le fichier

}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

+ 2
- 1
plugins/svg-renderer/package.json Voir le fichier

{ {
"name": "@threepipe/plugin-svg-renderer", "name": "@threepipe/plugin-svg-renderer",
"description": "Plugins for SVG Rendering of 3d objects for Threepipe", "description": "Plugins for SVG Rendering of 3d objects for Threepipe",
"version": "0.2.2",
"version": "0.2.3",
"devDependencies": { "devDependencies": {
"@svgdotjs/svg.js": "^3.2.0", "@svgdotjs/svg.js": "^3.2.0",
"@svgdotjs/svg.topath.js": "^2.0.3", "@svgdotjs/svg.topath.js": "^2.0.3",
}, },
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.js" "require": "./dist/index.js"
}, },

Chargement…
Annuler
Enregistrer