Skip to content

Commit f7f704c

Browse files
committed
noEmitHelpers __decorate()
1 parent f43f279 commit f7f704c

File tree

12 files changed

+68
-37
lines changed

12 files changed

+68
-37
lines changed

@types/base/globals.d.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export declare const CREATE = "create", AUTO = "AutoExpose", INIT = "init", PRE = "pre", POST = "post", REMOVE = "remove", DescriptorsAllTrue: PropertyDescriptor;
2+
export default function __decorate(decors: Function[], o: object, k?: PropertyKey, desc?: PropertyDescriptor): object | undefined;
23
//# sourceMappingURL=globals.d.mts.map

@types/base/globals.d.mts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

@types/classes/ball.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* P5js Library Template (v2.0.0)
2+
* P5js Library Template (v2.0.1)
33
* GoToLoop (2022-Apr-08)
44
*
55
* https://Discourse.Processing.org/t/

dist/base/globals.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@ export const CREATE = 'create', AUTO = 'AutoExpose', INIT = 'init', PRE = 'pre',
33
configurable: true,
44
enumerable: true
55
};
6+
// https://GitHub.com/microsoft/tslib
7+
export default function __decorate(decors, o, k, desc) {
8+
const c = arguments.length;
9+
var d, i = decors.length, r = c < 3 ? o : desc !== null ? desc : Object.getOwnPropertyDescriptor(o, k);
10+
while (i--)
11+
if (d = decors[i])
12+
r = (c < 3 ? d(r) : c > 3 ? d(o, k, r) : d(o, k)) || r;
13+
return c > 3 && r && Object.defineProperty(o, k, r), r;
14+
}
15+
globalThis.__decorate ||= __decorate;

dist/classes/ball.mjs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* P5js Library Template (v2.0.0)
2+
* P5js Library Template (v2.0.1)
33
* GoToLoop (2022-Apr-08)
44
*
55
* https://Discourse.Processing.org/t/
@@ -8,12 +8,6 @@
88
* https://GitHub.com/GoToLoop/P5JS-Library-Template
99
* https://GoToLoop.GitHub.io/P5JS-Library-Template
1010
*/
11-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
12-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
15-
return c > 3 && r && Object.defineProperty(target, key, r), r;
16-
};
1711
var Ball_1;
1812
import InjectToP5js from "../decorators/p5jsClassInjection.mjs";
1913
let Ball = Ball_1 = class Ball {

dist/decorators/p5jsClassInjection.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ function InjectToP5js(isP5ParamLast, createPrefix = CREATE, scriptTagAttrName =
1717
return new c(this, ...arguments);
1818
};
1919
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
20-
function exposeClassGlobally() {
21-
name in globalThis || Object.defineProperty(globalThis, name, {
22-
value: c,
23-
...DescriptorsAllTrue
24-
});
25-
}
2620
function applyInjections() {
2721
if (isGlobalMode() || checkScriptsForAttr(attrib))
2822
exposeClassGlobally();
@@ -31,5 +25,11 @@ function InjectToP5js(isP5ParamLast, createPrefix = CREATE, scriptTagAttrName =
3125
...DescriptorsAllTrue
3226
});
3327
}
28+
function exposeClassGlobally() {
29+
name in globalThis || Object.defineProperty(globalThis, name, {
30+
value: c,
31+
...DescriptorsAllTrue
32+
});
33+
}
3434
}
3535
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5js-library-template",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Sorta template to develop p5js library addons in TS",
55
"author": "GoToLoop",
66
"license": "Unlicense",

src/base/globals.mts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,25 @@ export const
77
configurable: true,
88
enumerable: true
99
};
10+
11+
// https://GitHub.com/microsoft/tslib
12+
export default function __decorate(
13+
decors: Function[],
14+
o: object,
15+
k?: PropertyKey,
16+
desc?: PropertyDescriptor)
17+
{
18+
const c = arguments.length;
19+
20+
var
21+
d: Function,
22+
i = decors.length,
23+
r = c < 3? o : desc !== null? desc : Object.getOwnPropertyDescriptor(o, k!);
24+
25+
while (i--) if (d = decors[i])
26+
r = (c < 3? d(r) : c > 3? d(o, k, r) : d(o, k)) || r;
27+
28+
return c > 3 && r && Object.defineProperty(o, k!, r), r;
29+
}
30+
31+
globalThis.__decorate ||= __decorate;

src/classes/ball.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* P5js Library Template (v2.0.0)
2+
* P5js Library Template (v2.0.1)
33
* GoToLoop (2022-Apr-08)
44
*
55
* https://Discourse.Processing.org/t/

src/decorators/p5jsClassInjection.mts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function InjectToP5js(
1919
function InjectToP5js(
2020
isP5ParamLast?: boolean | Class,
2121
createPrefix = CREATE,
22-
scriptTagAttrName = AUTO) {
23-
22+
scriptTagAttrName = AUTO)
23+
{
2424
if (typeof isP5ParamLast == 'function') InjectClassDecor(isP5ParamLast);
2525
else return InjectClassDecor; // @InjectToP5js()
2626

@@ -41,13 +41,6 @@ function InjectToP5js(
4141

4242
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
4343

44-
function exposeClassGlobally() {
45-
name in globalThis || Object.defineProperty(globalThis, name, {
46-
value: c,
47-
...DescriptorsAllTrue
48-
});
49-
}
50-
5144
function applyInjections(this: p5) {
5245
if (isGlobalMode() || checkScriptsForAttr(attrib)) exposeClassGlobally();
5346

@@ -56,5 +49,12 @@ function InjectToP5js(
5649
...DescriptorsAllTrue
5750
});
5851
}
52+
53+
function exposeClassGlobally() {
54+
name in globalThis || Object.defineProperty(globalThis, name, {
55+
value: c,
56+
...DescriptorsAllTrue
57+
});
58+
}
5959
}
6060
}

0 commit comments

Comments
 (0)