[ts] Fix spine-ts build for TSC 4.4.2

This commit is contained in:
Mario Zechner 2022-01-21 16:36:47 +01:00
parent 72f3ad3fb0
commit 28727aff22
22 changed files with 93 additions and 31 deletions

1
.gitignore vendored
View File

@ -139,3 +139,4 @@ spine-ue4/SpineUE4.sln
spine-ue4/SpineUE4.VC.db spine-ue4/SpineUE4.VC.db
spine-ue4/.vs/ spine-ue4/.vs/
spine-ue4/SpineUE4.VC.VC.opendb spine-ue4/SpineUE4.VC.VC.opendb
node_modules

39
package-lock.json generated Normal file
View File

@ -0,0 +1,39 @@
{
"name": "spine-runtimes",
"version": "3.5.35",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "spine-runtimes",
"version": "3.5.35",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@types/offscreencanvas": "^2019.6.4",
"@types/webvr-api": "^0.0.36"
}
},
"node_modules/@types/offscreencanvas": {
"version": "2019.6.4",
"resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.6.4.tgz",
"integrity": "sha512-u8SAgdZ8ROtkTF+mfZGOscl0or6BSj9A4g37e6nvxDc+YB/oDut0wHkK2PBBiC2bNR8TS0CPV+1gAk4fNisr1Q=="
},
"node_modules/@types/webvr-api": {
"version": "0.0.36",
"resolved": "https://registry.npmjs.org/@types/webvr-api/-/webvr-api-0.0.36.tgz",
"integrity": "sha512-fGXlG8KA8cHOGR2BG7w40nSEKgAqg9h7cUm6zW1dSI7DCba7RvJNKGt0sgJzAXXvNzAAOcIGY6OpHEnKGhhjsQ=="
}
},
"dependencies": {
"@types/offscreencanvas": {
"version": "2019.6.4",
"resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.6.4.tgz",
"integrity": "sha512-u8SAgdZ8ROtkTF+mfZGOscl0or6BSj9A4g37e6nvxDc+YB/oDut0wHkK2PBBiC2bNR8TS0CPV+1gAk4fNisr1Q=="
},
"@types/webvr-api": {
"version": "0.0.36",
"resolved": "https://registry.npmjs.org/@types/webvr-api/-/webvr-api-0.0.36.tgz",
"integrity": "sha512-fGXlG8KA8cHOGR2BG7w40nSEKgAqg9h7cUm6zW1dSI7DCba7RvJNKGt0sgJzAXXvNzAAOcIGY6OpHEnKGhhjsQ=="
}
}
}

View File

@ -25,5 +25,9 @@
"bugs": { "bugs": {
"url": "https://github.com/EsotericSoftware/spine-runtimes/issues" "url": "https://github.com/EsotericSoftware/spine-runtimes/issues"
}, },
"homepage": "https://github.com/EsotericSoftware/spine-runtimes#readme" "homepage": "https://github.com/EsotericSoftware/spine-runtimes#readme",
"dependencies": {
"@types/offscreencanvas": "^2019.6.4",
"@types/webvr-api": "^0.0.36"
}
} }

View File

@ -104,6 +104,7 @@ The spine-ts runtime and the various backends are implemented in TypeScript for
2. On the command line, Install the TypeScript compiler via `npm install -g typescript`. 2. On the command line, Install the TypeScript compiler via `npm install -g typescript`.
3. Install [Visual Studio Code](https://code.visualstudio.com/). 3. Install [Visual Studio Code](https://code.visualstudio.com/).
4. On the command line, change into the `spine-ts` directory. 4. On the command line, change into the `spine-ts` directory.
5. Install the offscreen types package via `npm install @types/offscreencanvas`.
5. Start the TypeScript compiler in watcher mode for the backend you want to work on: 5. Start the TypeScript compiler in watcher mode for the backend you want to work on:
* **Core**: `tsc -w -p tsconfig.core.json`, builds `core/src`, outputs `build/spine-core.js|d.ts|js.map`. * **Core**: `tsc -w -p tsconfig.core.json`, builds `core/src`, outputs `build/spine-core.js|d.ts|js.map`.
* **WebGL**: `tsc -w -p tsconfig.webgl.json`, builds `core/src` and `webgl/src`, outputs `build/spine-webgl.js|d.ts|js.map`. * **WebGL**: `tsc -w -p tsconfig.webgl.json`, builds `core/src` and `webgl/src`, outputs `build/spine-webgl.js|d.ts|js.map`.

View File

@ -9,6 +9,7 @@ else
fi fi
echo "Building spine-ts $BRANCH artifacts" echo "Building spine-ts $BRANCH artifacts"
npm install @types/offscreencanvas
tsc -p tsconfig.json tsc -p tsconfig.json
tsc -p tsconfig.core.json tsc -p tsconfig.core.json
tsc -p tsconfig.webgl.json tsc -p tsconfig.webgl.json

View File

@ -1,3 +1,4 @@
/// <reference types="offscreencanvas" />
declare module spine { declare module spine {
class Animation { class Animation {
name: string; name: string;
@ -1402,7 +1403,7 @@ declare module spine.webgl {
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean; static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean); constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void; setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear; static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void; setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
update(useMipMaps: boolean): void; update(useMipMaps: boolean): void;
restore(): void; restore(): void;

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;
@ -8300,9 +8302,7 @@ var spine;
} }
ctx.scale(1, -1); ctx.scale(1, -1);
ctx.translate(-w / 2, -h / 2); ctx.translate(-w / 2, -h / 2);
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { ctx.globalAlpha = color.a;
ctx.globalAlpha = color.a;
}
ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h); ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h);
if (this.debugRendering) if (this.debugRendering)
ctx.strokeRect(0, 0, w, h); ctx.strokeRect(0, 0, w, h);
@ -8348,9 +8348,7 @@ var spine;
var color = this.tempColor; var color = this.tempColor;
color.set(skeletonColor.r * slotColor.r * attachmentColor.r, skeletonColor.g * slotColor.g * attachmentColor.g, skeletonColor.b * slotColor.b * attachmentColor.b, alpha); color.set(skeletonColor.r * slotColor.r * attachmentColor.r, skeletonColor.g * slotColor.g * attachmentColor.g, skeletonColor.b * slotColor.b * attachmentColor.b, alpha);
var ctx = this.ctx; var ctx = this.ctx;
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { ctx.globalAlpha = color.a;
ctx.globalAlpha = color.a;
}
for (var j = 0; j < triangles.length; j += 3) { for (var j = 0; j < triangles.length; j += 3) {
var t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8; var t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8;
var x0 = vertices[t1], y0 = vertices[t1 + 1], u0 = vertices[t1 + 6], v0 = vertices[t1 + 7]; var x0 = vertices[t1], y0 = vertices[t1 + 1], u0 = vertices[t1 + 6], v0 = vertices[t1 + 7];

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;
@ -8467,4 +8469,4 @@ var spine;
canvas.SkeletonRenderer = SkeletonRenderer; canvas.SkeletonRenderer = SkeletonRenderer;
})(canvas = spine.canvas || (spine.canvas = {})); })(canvas = spine.canvas || (spine.canvas = {}));
})(spine || (spine = {})); })(spine || (spine = {}));
//# sourceMappingURL=spine-canvas.js.map //# sourceMappingURL=spine-canvas.js.map

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
/// <reference types="offscreencanvas" />
declare module spine { declare module spine {
class Animation { class Animation {
name: string; name: string;
@ -1371,7 +1372,7 @@ declare module spine.webgl {
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean; static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean); constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void; setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear; static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void; setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
update(useMipMaps: boolean): void; update(useMipMaps: boolean): void;
restore(): void; restore(): void;

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
/// <reference types="offscreencanvas" />
declare module spine { declare module spine {
class Animation { class Animation {
name: string; name: string;
@ -1371,7 +1372,7 @@ declare module spine.webgl {
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean; static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean); constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void; setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear; static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void; setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
update(useMipMaps: boolean): void; update(useMipMaps: boolean): void;
restore(): void; restore(): void;

View File

@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b); return extendStatics(d, b);
}; };
return function (d, b) { return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b); extendStatics(d, b);
function __() { this.constructor = d; } function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@ -696,7 +698,7 @@ var spine;
.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) {
slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
}; };
return AttachmentTimeline; return AttachmentTimeline;
}()); }());
@ -1496,7 +1498,7 @@ var spine;
var slot = slots[i]; var slot = slots[i];
if (slot.attachmentState == setupState) { if (slot.attachmentState == setupState) {
var attachmentName = slot.data.attachmentName; var attachmentName = slot.data.attachmentName;
slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); slot.setAttachment(attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));
} }
} }
this.unkeyedState += 2; this.unkeyedState += 2;

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,12 @@
"preserveConstEnums": true, "preserveConstEnums": true,
"outFile": "build/spine-all.js", "outFile": "build/spine-all.js",
"sourceMap": true, "sourceMap": true,
"declaration": true "declaration": true,
"lib": [
"DOM",
"ES2015",
"WebWorker.ImportScripts"
]
}, },
"include": [ "include": [
"core/src/**/*", "core/src/**/*",

View File

@ -6,7 +6,7 @@
"preserveConstEnums": true, "preserveConstEnums": true,
"outFile": "build/spine-threejs.js", "outFile": "build/spine-threejs.js",
"sourceMap": true, "sourceMap": true,
"declaration": true, "declaration": true
}, },
"include": [ "include": [
"core/src/**/*", "core/src/**/*",