@cocos/ccbuild 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +14 -14
- package/lib/api-builder.js +1 -1
- package/lib/build-engine/engine-js/index.d.ts +2 -2
- package/lib/build-engine/engine-js/index.js +412 -412
- package/lib/build-engine/engine-js/index.js.map +1 -1
- package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.d.ts +43 -40
- package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.d.ts.map +1 -1
- package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.js +151 -92
- package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.js.map +1 -1
- package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.d.ts +2 -2
- package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.js +37 -37
- package/lib/build-engine/engine-js/rollup-plugins/ts-paths.d.ts +4 -4
- package/lib/build-engine/engine-js/rollup-plugins/ts-paths.js +42 -42
- package/lib/build-engine/engine-ts/engine-builder.d.ts +57 -57
- package/lib/build-engine/engine-ts/engine-builder.js +631 -631
- package/lib/build-engine/engine-ts/field-decorator-helper.d.ts +9 -9
- package/lib/build-engine/engine-ts/field-decorator-helper.js +54 -54
- package/lib/build-engine/engine-ts/index.d.ts +2 -2
- package/lib/build-engine/engine-ts/index.js +34 -34
- package/lib/build-engine/engine-ts/plugins/external-wasm-loader.d.ts +6 -6
- package/lib/build-engine/engine-ts/plugins/external-wasm-loader.js +65 -65
- package/lib/build-engine/engine-ts/plugins/interface.d.ts +20 -20
- package/lib/build-engine/engine-ts/plugins/interface.js +1 -1
- package/lib/build-engine/index.d.ts +130 -130
- package/lib/build-engine/index.js +138 -138
- package/lib/index.d.ts +4 -4
- package/lib/index.js +33 -33
- package/lib/module-resolver.d.ts +7 -7
- package/lib/module-resolver.js +28 -28
- package/lib/stats-query/config-interface.d.ts +129 -129
- package/lib/stats-query/config-interface.js +3 -3
- package/lib/stats-query/index.d.ts +163 -163
- package/lib/stats-query/index.js +531 -531
- package/lib/stats-query/path-utils.d.ts +2 -2
- package/lib/stats-query/path-utils.js +35 -35
- package/lib/transformer/babel.d.ts +5 -5
- package/lib/transformer/babel.js +34 -34
- package/lib/transformer/index.d.ts +2 -2
- package/lib/transformer/index.js +28 -28
- package/lib/utils.d.ts +3 -3
- package/lib/utils.js +19 -19
- package/package.json +2 -2
- package/static/helper-dynamic-constants.txt +13 -13
- package/static/helper-file-decorator.ts +20 -20
- package/static/helper-global-exporter.txt +8 -8
- package/static/lib.dom.d.ts +20227 -20227
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function normalizePath(path: string): string;
|
|
2
|
-
export declare function toExtensionLess(path: string): string;
|
|
1
|
+
export declare function normalizePath(path: string): string;
|
|
2
|
+
export declare function toExtensionLess(path: string): string;
|
|
3
3
|
//# sourceMappingURL=path-utils.d.ts.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.toExtensionLess = exports.normalizePath = void 0;
|
|
27
|
-
const ps = __importStar(require("path"));
|
|
28
|
-
function normalizePath(path) {
|
|
29
|
-
return path.replace(/\\/g, '/');
|
|
30
|
-
}
|
|
31
|
-
exports.normalizePath = normalizePath;
|
|
32
|
-
function toExtensionLess(path) {
|
|
33
|
-
return path.slice(0, -ps.extname(path).length);
|
|
34
|
-
}
|
|
35
|
-
exports.toExtensionLess = toExtensionLess;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.toExtensionLess = exports.normalizePath = void 0;
|
|
27
|
+
const ps = __importStar(require("path"));
|
|
28
|
+
function normalizePath(path) {
|
|
29
|
+
return path.replace(/\\/g, '/');
|
|
30
|
+
}
|
|
31
|
+
exports.normalizePath = normalizePath;
|
|
32
|
+
function toExtensionLess(path) {
|
|
33
|
+
return path.slice(0, -ps.extname(path).length);
|
|
34
|
+
}
|
|
35
|
+
exports.toExtensionLess = toExtensionLess;
|
|
36
36
|
//# sourceMappingURL=path-utils.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as core from '@babel/core';
|
|
2
|
-
import * as parser from '@babel/parser';
|
|
3
|
-
import * as traverse from '@babel/traverse';
|
|
4
|
-
import * as presetEnv from '@babel/preset-env';
|
|
5
|
-
export { core, parser, traverse, presetEnv, };
|
|
1
|
+
import * as core from '@babel/core';
|
|
2
|
+
import * as parser from '@babel/parser';
|
|
3
|
+
import * as traverse from '@babel/traverse';
|
|
4
|
+
import * as presetEnv from '@babel/preset-env';
|
|
5
|
+
export { core, parser, traverse, presetEnv, };
|
|
6
6
|
//# sourceMappingURL=babel.d.ts.map
|
package/lib/transformer/babel.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.presetEnv = exports.traverse = exports.parser = exports.core = void 0;
|
|
27
|
-
const core = __importStar(require("@babel/core"));
|
|
28
|
-
exports.core = core;
|
|
29
|
-
const parser = __importStar(require("@babel/parser"));
|
|
30
|
-
exports.parser = parser;
|
|
31
|
-
const traverse = __importStar(require("@babel/traverse"));
|
|
32
|
-
exports.traverse = traverse;
|
|
33
|
-
const presetEnv = __importStar(require("@babel/preset-env"));
|
|
34
|
-
exports.presetEnv = presetEnv;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.presetEnv = exports.traverse = exports.parser = exports.core = void 0;
|
|
27
|
+
const core = __importStar(require("@babel/core"));
|
|
28
|
+
exports.core = core;
|
|
29
|
+
const parser = __importStar(require("@babel/parser"));
|
|
30
|
+
exports.parser = parser;
|
|
31
|
+
const traverse = __importStar(require("@babel/traverse"));
|
|
32
|
+
exports.traverse = traverse;
|
|
33
|
+
const presetEnv = __importStar(require("@babel/preset-env"));
|
|
34
|
+
exports.presetEnv = presetEnv;
|
|
35
35
|
//# sourceMappingURL=babel.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as babel from './babel';
|
|
2
|
-
export { babel };
|
|
1
|
+
import * as babel from './babel';
|
|
2
|
+
export { babel };
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/transformer/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.babel = void 0;
|
|
27
|
-
const babel = __importStar(require("./babel"));
|
|
28
|
-
exports.babel = babel;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.babel = void 0;
|
|
27
|
+
const babel = __importStar(require("./babel"));
|
|
28
|
+
exports.babel = babel;
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function asserts(expr: unknown, message?: string): boolean;
|
|
2
|
-
export declare function filePathToModuleRequest(path: string): string;
|
|
3
|
-
export declare function isThenable(value: any): boolean;
|
|
1
|
+
export declare function asserts(expr: unknown, message?: string): boolean;
|
|
2
|
+
export declare function filePathToModuleRequest(path: string): string;
|
|
3
|
+
export declare function isThenable(value: any): boolean;
|
|
4
4
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isThenable = exports.filePathToModuleRequest = exports.asserts = void 0;
|
|
4
|
-
function asserts(expr, message) {
|
|
5
|
-
if (!expr) {
|
|
6
|
-
throw new Error(message);
|
|
7
|
-
}
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
exports.asserts = asserts;
|
|
11
|
-
function filePathToModuleRequest(path) {
|
|
12
|
-
return path.replace(/\\/g, '\\\\');
|
|
13
|
-
}
|
|
14
|
-
exports.filePathToModuleRequest = filePathToModuleRequest;
|
|
15
|
-
function isThenable(value) {
|
|
16
|
-
// https://stackoverflow.com/a/53955664/10602525
|
|
17
|
-
return Boolean(value && typeof value.then === 'function');
|
|
18
|
-
}
|
|
19
|
-
exports.isThenable = isThenable;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isThenable = exports.filePathToModuleRequest = exports.asserts = void 0;
|
|
4
|
+
function asserts(expr, message) {
|
|
5
|
+
if (!expr) {
|
|
6
|
+
throw new Error(message);
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
exports.asserts = asserts;
|
|
11
|
+
function filePathToModuleRequest(path) {
|
|
12
|
+
return path.replace(/\\/g, '\\\\');
|
|
13
|
+
}
|
|
14
|
+
exports.filePathToModuleRequest = filePathToModuleRequest;
|
|
15
|
+
function isThenable(value) {
|
|
16
|
+
// https://stackoverflow.com/a/53955664/10602525
|
|
17
|
+
return Boolean(value && typeof value.then === 'function');
|
|
18
|
+
}
|
|
19
|
+
exports.isThenable = isThenable;
|
|
20
20
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocos/ccbuild",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "The next generation of build tool for Cocos engine.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"resolve": "^1.22.1",
|
|
71
71
|
"rollup": "^2.79.1",
|
|
72
72
|
"rollup-plugin-terser": "^7.0.2",
|
|
73
|
-
"typescript": "^4.
|
|
73
|
+
"typescript": "^4.3.5"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function defined (name) {
|
|
2
|
-
const _global = typeof window === 'undefined' ? global : window;
|
|
3
|
-
return typeof _global[name] === 'object';
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
|
|
7
|
-
export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
|
|
8
|
-
export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
|
|
9
|
-
export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
|
|
10
|
-
export const NATIVE = JSB;
|
|
11
|
-
export const HTML5 = !(EDITOR && NATIVE);
|
|
12
|
-
export const DEV = tryDefineGlobal('CC_DEV', true);
|
|
13
|
-
export const EDITOR_NOT_IN_PREVIEW = EDITOR && !tryDefineGlobal('isPreviewProcess',false);
|
|
1
|
+
function defined (name) {
|
|
2
|
+
const _global = typeof window === 'undefined' ? global : window;
|
|
3
|
+
return typeof _global[name] === 'object';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
|
|
7
|
+
export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
|
|
8
|
+
export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
|
|
9
|
+
export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
|
|
10
|
+
export const NATIVE = JSB;
|
|
11
|
+
export const HTML5 = !(EDITOR && NATIVE);
|
|
12
|
+
export const DEV = tryDefineGlobal('CC_DEV', true);
|
|
13
|
+
export const EDITOR_NOT_IN_PREVIEW = EDITOR && !tryDefineGlobal('isPreviewProcess',false);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* TsPropertyDecorator cannot access the property descriptor, sometimes we need to access the initializer in property descriptor.
|
|
4
|
-
* This helper helps receive the initializer from EngineCompiler, and generate a BabelPropertyDecorator in runtime.
|
|
5
|
-
* @param decoratorOrFactory A TsPropertyDecorator or a decorator factory
|
|
6
|
-
* @param initializer the property initializer generate from engine compiler
|
|
7
|
-
* @param factoryArgs if `decoratorOrFactory` is a factory, then we may need some arguments for this factory method.
|
|
8
|
-
* @returns BabelPropertyDecorator
|
|
9
|
-
*/
|
|
10
|
-
export function CCBuildTsFieldDecoratorHelper (decoratorOrFactory: Function, initializer: Function, ...factoryArgs: any[]): PropertyDecorator {
|
|
11
|
-
if (factoryArgs.length > 0) {
|
|
12
|
-
const decorator = decoratorOrFactory(...factoryArgs);
|
|
13
|
-
return (target, propertyKey) => {
|
|
14
|
-
decorator(target, propertyKey, initializer);
|
|
15
|
-
};
|
|
16
|
-
} else {
|
|
17
|
-
return (target, propertyKey) => {
|
|
18
|
-
decoratorOrFactory(target, propertyKey, initializer);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* TsPropertyDecorator cannot access the property descriptor, sometimes we need to access the initializer in property descriptor.
|
|
4
|
+
* This helper helps receive the initializer from EngineCompiler, and generate a BabelPropertyDecorator in runtime.
|
|
5
|
+
* @param decoratorOrFactory A TsPropertyDecorator or a decorator factory
|
|
6
|
+
* @param initializer the property initializer generate from engine compiler
|
|
7
|
+
* @param factoryArgs if `decoratorOrFactory` is a factory, then we may need some arguments for this factory method.
|
|
8
|
+
* @returns BabelPropertyDecorator
|
|
9
|
+
*/
|
|
10
|
+
export function CCBuildTsFieldDecoratorHelper (decoratorOrFactory: Function, initializer: Function, ...factoryArgs: any[]): PropertyDecorator {
|
|
11
|
+
if (factoryArgs.length > 0) {
|
|
12
|
+
const decorator = decoratorOrFactory(...factoryArgs);
|
|
13
|
+
return (target, propertyKey) => {
|
|
14
|
+
decorator(target, propertyKey, initializer);
|
|
15
|
+
};
|
|
16
|
+
} else {
|
|
17
|
+
return (target, propertyKey) => {
|
|
18
|
+
decoratorOrFactory(target, propertyKey, initializer);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function tryDefineGlobal (name, value) {
|
|
2
|
-
const _global = typeof window === 'undefined' ? global : window;
|
|
3
|
-
if (typeof _global[name] === 'undefined') {
|
|
4
|
-
return (_global[name] = value);
|
|
5
|
-
} else {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
7
|
-
return _global[name];
|
|
8
|
-
}
|
|
1
|
+
function tryDefineGlobal (name, value) {
|
|
2
|
+
const _global = typeof window === 'undefined' ? global : window;
|
|
3
|
+
if (typeof _global[name] === 'undefined') {
|
|
4
|
+
return (_global[name] = value);
|
|
5
|
+
} else {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
7
|
+
return _global[name];
|
|
8
|
+
}
|
|
9
9
|
}
|