Skip to content

Dragonbones phaser library build broken? #161

@lackhand

Description

@lackhand

When I attempt to build dragonbones locally against the phaser 3.50 library, I get many errors:

$ pwd ; npm run build
/.../src/DragonBonesJS/Phaser/3.x

> dragonbones-phaser@5.6.2 build /.../src/DragonBonesJS/Phaser/3.x
> tsc && uglifyjs ./out/dragonBones.js -o ./out/dragonBones.min.js -m

src/dragonBones/phaser/display/Slot.ts:200:45 - error TS2339: Property 'setDisplayOrigin' does not exist on type 'SlotMesh | SlotImage | SlotSprite'.
  Property 'setDisplayOrigin' does not exist on type 'SlotMesh'.

200                         this._renderDisplay.setDisplayOrigin(this._pivotX, this._pivotY);
                                                ~~~~~~~~~~~~~~~~


src/dragonBones/phaser/display/Slot.ts:211:17 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((key: string, frame?: string | number) => SlotImage) | ((key: string, frame?: string | number) =...' has no compatible call signatures.

211                 this._renderDisplay.setTexture(undefined);
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:8:32 - error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'string | Texture'.
  Type 'number[]' is not assignable to type 'Texture'.
    Property 'manager' is missing in type 'number[]'.

8             super(scene, x, y, vertices, uv, colors, alphas, texture, frame);
                                 ~~~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:22:18 - error TS2339: Property 'uv' does not exist on type 'SlotMesh'.

22             this.uv = new Float32Array(fakeIndices.length * 2) as any;
                    ~~


src/dragonBones/phaser/display/SlotMesh.ts:23:18 - error TS2551: Property 'alphas' does not exist on type 'SlotMesh'. Did you mean 'alpha'?

23             this.alphas = new Uint32Array(fakeIndices.length) as any;
                    ~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:24:18 - error TS2339: Property 'colors' does not exist on type 'SlotMesh'.

24             this.colors = new Uint32Array(fakeIndices.length) as any;
                    ~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:27:17 - error TS2322: Type 'number' is not assignable to type 'Vertex'.

27                 this.vertices[i * 2] = fakeVertices[fakeIndices[i] * 2];
                   ~~~~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:28:17 - error TS2322: Type 'number' is not assignable to type 'Vertex'.

28                 this.vertices[i * 2 + 1] = fakeVertices[fakeIndices[i] * 2 + 1];
                   ~~~~~~~~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:30:22 - error TS2339: Property 'uv' does not exist on type 'SlotMesh'.

30                 this.uv[i * 2] = fakeUvs[fakeIndices[i] * 2];
                        ~~


src/dragonBones/phaser/display/SlotMesh.ts:31:22 - error TS2339: Property 'uv' does not exist on type 'SlotMesh'.

31                 this.uv[i * 2 + 1] = fakeUvs[fakeIndices[i] * 2 + 1];
                        ~~


src/dragonBones/phaser/display/SlotMesh.ts:33:22 - error TS2551: Property 'alphas' does not exist on type 'SlotMesh'. Did you mean 'alpha'?

33                 this.alphas[i] = 1.0;
                        ~~~~~~


src/dragonBones/phaser/display/SlotMesh.ts:34:22 - error TS2339: Property 'colors' does not exist on type 'SlotMesh'.

34                 this.colors[i] = 0xFFFFFF;
                        ~~~~~~


src/dragonBones/phaser/Factory.ts:39:44 - error TS2339: Property 'dragonbone' does not exist on type 'Scene'.

39             const rawDisplay = this._scene.dragonbone.createSlotDisplayPlaceholder();
                                              ~~~~~~~~~~


src/dragonBones/phaser/Factory.ts:40:45 - error TS2339: Property 'dragonbone' does not exist on type 'Scene'.

40             const meshDisplay = this._scene.dragonbone.createMeshDisplayPlaceholder();
                                               ~~~~~~~~~~


src/dragonBones/phaser/pipeline/TextureTintPipeline.ts:15:27 - error TS2551: Property 'setPipeline' does not exist on type 'WebGLRenderer'. Did you mean 'pipelines'?

15             this.renderer.setPipeline(this);
                             ~~~~~~~~~~~


src/dragonBones/phaser/pipeline/TextureTintPipeline.ts:123:13 - error TS2554: Expected 0-1 arguments, but got 2.

123             this.setTexture2D(texture, 0);
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/pipeline/TextureTintPipeline.ts:127:13 - error TS2554: Expected 18-20 arguments, but got 17.

127             this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:8:42 - error TS2304: Cannot find name 'XHRSettingsObject'.

8                     textureXhrSettings?: XHRSettingsObject,
                                           ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:8:42 - error TS4063: Parameter 'textureXhrSettings' of constructor from exported class has or is using private name 'XHRSettingsObject'.

8                     textureXhrSettings?: XHRSettingsObject,
                                           ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:9:40 - error TS2304: Cannot find name 'XHRSettingsObject'.

9                     atlasXhrSettings?: XHRSettingsObject,
                                         ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:9:40 - error TS4063: Parameter 'atlasXhrSettings' of constructor from exported class has or is using private name 'XHRSettingsObject'.

9                     atlasXhrSettings?: XHRSettingsObject,
                                         ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:10:39 - error TS2304: Cannot find name 'XHRSettingsObject'.

10                     boneXhrSettings?: XHRSettingsObject) {
                                         ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:10:39 - error TS4063: Parameter 'boneXhrSettings' of constructor from exported class has or is using private name 'XHRSettingsObject'.

10                     boneXhrSettings?: XHRSettingsObject) {
                                         ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesFile.ts:21:127 - error TS2304: Cannot find name 'XHRSettingsObject'.

21             const createBoneFileByType = (loader: Phaser.Loader.LoaderPlugin, key: string, boneURL: string, boneXhrSettings?: XHRSettingsObject): Phaser.Loader.File => {
                                                                                                                                 ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesPlugin.ts:16:31 - error TS2551: Property 'hasPipeline' does not exist on type 'WebGLRenderer'. Did you mean 'pipelines'?

16                 if (!renderer.hasPipeline('PhaserTextureTintPipeline'))
                                 ~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesPlugin.ts:17:30 - error TS2551: Property 'addPipeline' does not exist on type 'WebGLRenderer'. Did you mean 'pipelines'?

17                     renderer.addPipeline('PhaserTextureTintPipeline', new pipeline.TextureTintPipeline({ game, renderer }));
                                ~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesPlugin.ts:109:34 - error TS2304: Cannot find name 'XHRSettingsObject'.

109             textureXhrSettings?: XHRSettingsObject,
                                     ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesPlugin.ts:110:32 - error TS2304: Cannot find name 'XHRSettingsObject'.

110             atlasXhrSettings?: XHRSettingsObject,
                                   ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/plugin/DragonBonesPlugin.ts:111:31 - error TS2304: Cannot find name 'XHRSettingsObject'.

111             boneXhrSettings?: XHRSettingsObject) {
                                  ~~~~~~~~~~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:5:35 - error TS2339: Property 'skewX' does not exist on type 'object'.

5             this.decomposedMatrix.skewX = 0;
                                    ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:6:35 - error TS2339: Property 'skewY' does not exist on type 'object'.

6             this.decomposedMatrix.skewY = 0;
                                    ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:22:39 - error TS2339: Property 'rotation' does not exist on type 'object'.

22                 this.decomposedMatrix.rotation = skewY;
                                         ~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:24:43 - error TS2339: Property 'rotation' does not exist on type 'object'.

24                     this.decomposedMatrix.rotation += (this.decomposedMatrix.rotation <= 0) ? Math.PI : -Math.PI;
                                             ~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:24:78 - error TS2339: Property 'rotation' does not exist on type 'object'.

24                     this.decomposedMatrix.rotation += (this.decomposedMatrix.rotation <= 0) ? Math.PI : -Math.PI;
                                                                                ~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:26:39 - error TS2339: Property 'skewX' does not exist on type 'object'.

26                 this.decomposedMatrix.skewX = this.decomposedMatrix.skewY = 0;
                                         ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:26:69 - error TS2339: Property 'skewY' does not exist on type 'object'.

26                 this.decomposedMatrix.skewX = this.decomposedMatrix.skewY = 0;
                                                                       ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:28:39 - error TS2339: Property 'rotation' does not exist on type 'object'.

28                 this.decomposedMatrix.rotation = 0;
                                         ~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:29:39 - error TS2339: Property 'skewX' does not exist on type 'object'.

29                 this.decomposedMatrix.skewX = skewX;
                                         ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:30:39 - error TS2339: Property 'skewY' does not exist on type 'object'.

30                 this.decomposedMatrix.skewY = skewY;
                                         ~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:34:35 - error TS2339: Property 'scaleX' does not exist on type 'object'.

34             this.decomposedMatrix.scaleX = Math.sqrt((a * a) + (b * b));
                                     ~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:35:35 - error TS2339: Property 'scaleY' does not exist on type 'object'.

35             this.decomposedMatrix.scaleY = Math.sqrt((c * c) + (d * d));
                                     ~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:38:35 - error TS2339: Property 'translateX' does not exist on type 'object'.

38             this.decomposedMatrix.translateX = this.tx;
                                     ~~~~~~~~~~


src/dragonBones/phaser/util/TransformMatrix.ts:39:35 - error TS2339: Property 'translateY' does not exist on type 'object'.

39             this.decomposedMatrix.translateY = this.ty;
                                     ~~~~~~~~~~


types/phaser.d.ts:9393:54 - error TS2304: Cannot find name 'ActiveXObject'.

9393         function ParseXML(data: string): DOMParser | ActiveXObject;
                                                          ~~~~~~~~~~~~~


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dragonbones-phaser@5.6.2 build: `tsc && uglifyjs ./out/dragonBones.js -o ./out/dragonBones.min.js -m`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dragonbones-phaser@5.6.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.../.npm/_logs/2021-01-07T22_01_49_527Z-debug.log

$

My build is https://github.com/browndragon/DragonBonesJS/tree/try_update -- including various patches from @MadDogMayCry0 -- to try to update the library.

Good luck, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions