@cocos/ccbuild 2.0.3-alpha.1 → 2.0.3-alpha.11

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +269 -0
  2. package/README.md +16 -37
  3. package/lib/src/index.d.ts +5 -1
  4. package/lib/src/index.d.ts.map +1 -1
  5. package/lib/src/index.js +5 -1
  6. package/lib/src/index.js.map +1 -1
  7. package/modules/build-engine/lib/build-dts.d.ts +7 -0
  8. package/modules/build-engine/lib/build-dts.d.ts.map +1 -0
  9. package/modules/build-engine/lib/build-dts.js +297 -0
  10. package/modules/build-engine/lib/build-dts.js.map +1 -0
  11. package/modules/build-engine/lib/engine-js/index.d.ts.map +1 -1
  12. package/modules/build-engine/lib/engine-js/index.js +11 -2
  13. package/modules/build-engine/lib/engine-js/index.js.map +1 -1
  14. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts +33 -33
  15. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts.map +1 -1
  16. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js +72 -43
  17. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js.map +1 -1
  18. package/modules/build-engine/lib/engine-js/rollup-plugins/module-query-plugin.d.ts +4 -0
  19. package/modules/build-engine/lib/engine-js/rollup-plugins/module-query-plugin.d.ts.map +1 -0
  20. package/modules/build-engine/lib/engine-js/rollup-plugins/module-query-plugin.js +43 -0
  21. package/modules/build-engine/lib/engine-js/rollup-plugins/module-query-plugin.js.map +1 -0
  22. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.d.ts.map +1 -1
  23. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.js +8 -7
  24. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.js.map +1 -1
  25. package/modules/build-engine/lib/engine-ts/engine-builder.d.ts +0 -1
  26. package/modules/build-engine/lib/engine-ts/engine-builder.d.ts.map +1 -1
  27. package/modules/build-engine/lib/engine-ts/engine-builder.js +28 -47
  28. package/modules/build-engine/lib/engine-ts/engine-builder.js.map +1 -1
  29. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts.map +1 -1
  30. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js +20 -3
  31. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js.map +1 -1
  32. package/modules/build-engine/lib/engine-ts/plugins/interface.d.ts +14 -14
  33. package/modules/build-engine/lib/engine-ts/plugins/module-query-plugin.d.ts +3 -0
  34. package/modules/build-engine/lib/engine-ts/plugins/module-query-plugin.d.ts.map +1 -0
  35. package/modules/build-engine/lib/engine-ts/plugins/module-query-plugin.js +52 -0
  36. package/modules/build-engine/lib/engine-ts/plugins/module-query-plugin.js.map +1 -0
  37. package/modules/build-engine/lib/index.d.ts +98 -86
  38. package/modules/build-engine/lib/index.d.ts.map +1 -1
  39. package/modules/build-engine/lib/index.js +69 -38
  40. package/modules/build-engine/lib/index.js.map +1 -1
  41. package/modules/dts-bundler/lib/index.d.ts +5 -0
  42. package/modules/dts-bundler/lib/index.d.ts.map +1 -0
  43. package/modules/dts-bundler/lib/index.js +344 -0
  44. package/modules/dts-bundler/lib/index.js.map +1 -0
  45. package/modules/modularize/lib/index.d.ts +3 -20
  46. package/modules/modularize/lib/index.d.ts.map +1 -1
  47. package/modules/modularize/lib/index.js +20 -75
  48. package/modules/modularize/lib/index.js.map +1 -1
  49. package/modules/modularize/lib/module-config.d.ts +134 -0
  50. package/modules/modularize/lib/module-config.d.ts.map +1 -0
  51. package/modules/modularize/lib/module-config.js +6 -0
  52. package/modules/modularize/lib/module-config.js.map +1 -0
  53. package/modules/modularize/lib/module-config.schema.json +425 -0
  54. package/modules/modularize/lib/module-query.d.ts +55 -0
  55. package/modules/modularize/lib/module-query.d.ts.map +1 -0
  56. package/modules/modularize/lib/module-query.js +212 -0
  57. package/modules/modularize/lib/module-query.js.map +1 -0
  58. package/modules/modularize/lib/platform-config.d.ts +43 -0
  59. package/modules/modularize/lib/platform-config.d.ts.map +1 -0
  60. package/modules/modularize/lib/platform-config.js +52 -0
  61. package/modules/modularize/lib/platform-config.js.map +1 -0
  62. package/modules/stats-query/lib/cc.config.schema.json +216 -0
  63. package/modules/stats-query/lib/config-interface.d.ts +61 -61
  64. package/modules/stats-query/lib/config-interface.js +1 -1
  65. package/modules/stats-query/lib/config-interface.js.map +1 -1
  66. package/modules/stats-query/lib/index.d.ts +62 -73
  67. package/modules/stats-query/lib/index.d.ts.map +1 -1
  68. package/modules/stats-query/lib/index.js +43 -38
  69. package/modules/stats-query/lib/index.js.map +1 -1
  70. package/modules/transformer/lib/babel/plugins.d.ts +1 -0
  71. package/modules/transformer/lib/babel/plugins.d.ts.map +1 -1
  72. package/modules/transformer/lib/babel/plugins.js +2 -4
  73. package/modules/transformer/lib/babel/plugins.js.map +1 -1
  74. package/modules/transformer/lib/index.d.ts +2 -1
  75. package/modules/transformer/lib/index.d.ts.map +1 -1
  76. package/modules/transformer/lib/index.js +4 -2
  77. package/modules/transformer/lib/index.js.map +1 -1
  78. package/modules/transformer/lib/typescript/index.d.ts +2 -0
  79. package/modules/transformer/lib/typescript/index.d.ts.map +1 -0
  80. package/modules/transformer/lib/typescript/index.js +39 -0
  81. package/modules/transformer/lib/typescript/index.js.map +1 -0
  82. package/modules/transformer/static/types-polyfill.d.ts +18 -0
  83. package/modules/utils/lib/index.d.ts +3 -1
  84. package/modules/utils/lib/index.d.ts.map +1 -1
  85. package/modules/utils/lib/index.js +61 -4
  86. package/modules/utils/lib/index.js.map +1 -1
  87. package/modules/utils/lib/path.d.ts +5 -0
  88. package/modules/utils/lib/path.d.ts.map +1 -1
  89. package/modules/utils/lib/path.js +21 -4
  90. package/modules/utils/lib/path.js.map +1 -1
  91. package/package.json +26 -20
  92. package/static/helper-dynamic-constants.txt +13 -13
  93. package/static/helper-file-decorator.ts +20 -20
  94. package/static/helper-global-exporter.txt +8 -8
  95. package/static/lib.dom.d.ts +2330 -2330
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = this && this.__importDefault || function (mod) {
31
+ return mod && mod.__esModule ? mod : {
32
+ "default": mod
33
+ };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", {
36
+ value: true
37
+ });
38
+ exports.ModuleQuery = void 0;
39
+ const fs_extra_1 = __importDefault(require("fs-extra"));
40
+ const platform_config_1 = require("./platform-config");
41
+ const glob_1 = __importDefault(require("glob"));
42
+ const utils_1 = require("../../utils/lib/index.js");
43
+ /**
44
+ * The module info manager.
45
+ */
46
+ class ModuleQuery {
47
+ constructor(context) {
48
+ this._resolvedCache = {}; // module name to module entry file path
49
+ this._cachedHasEditorSpecificExport = {};
50
+ this._context = context;
51
+ }
52
+ /**
53
+ * Get all modules' name defined in engine workspaces.
54
+ */
55
+ getAllModules() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ if (this._cachedAllModules) {
58
+ return this._cachedAllModules;
59
+ }
60
+ const enginePkg = yield fs_extra_1.default.readJson(utils_1.ps.join(this._context.engine, 'package.json'));
61
+ let pkgFiles = [];
62
+ if (enginePkg.workspaces) {
63
+ for (const ws of enginePkg.workspaces) {
64
+ pkgFiles.push(...glob_1.default.sync(utils_1.ps.join(this._context.engine, ws), {
65
+ ignore: '**/node_modules/**/*'
66
+ }));
67
+ }
68
+ }
69
+ pkgFiles = pkgFiles.map(file => {
70
+ if (fs_extra_1.default.statSync(file).isDirectory()) {
71
+ const pkgFile = utils_1.ps.join(file, 'package.json');
72
+ if (fs_extra_1.default.existsSync(pkgFile)) {
73
+ return pkgFile;
74
+ }
75
+ }
76
+ return file;
77
+ });
78
+ pkgFiles = pkgFiles.filter(file => file.endsWith('package.json'));
79
+ pkgFiles = pkgFiles.filter((file, index) => pkgFiles.indexOf(file) === index);
80
+ pkgFiles = pkgFiles.filter(file => {
81
+ var _a;
82
+ const pkgJson = fs_extra_1.default.readJSONSync(file);
83
+ return ((_a = pkgJson.exports) === null || _a === void 0 ? void 0 : _a['.'].node) === './package.json';
84
+ });
85
+ const moduleNames = [];
86
+ for (const pkg of pkgFiles) {
87
+ const name = (yield fs_extra_1.default.readJson(pkg)).name;
88
+ moduleNames.push(name);
89
+ }
90
+ return this._cachedAllModules = moduleNames;
91
+ });
92
+ }
93
+ /**
94
+ * Resolve module package.json path by module name.
95
+ */
96
+ resolvePackageJson(moduleName) {
97
+ return require.resolve(moduleName, {
98
+ paths: [this._context.engine]
99
+ });
100
+ }
101
+ /**
102
+ * Get module config by module name.
103
+ */
104
+ getConfig(moduleName) {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ const modulePath = this.resolvePackageJson(moduleName);
107
+ return yield fs_extra_1.default.readJson(modulePath);
108
+ });
109
+ }
110
+ /**
111
+ * Resolve module entry path by import source.
112
+ */
113
+ resolveExport(source) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ if (this._resolvedCache[source]) {
116
+ return this._resolvedCache[source];
117
+ }
118
+ if (source.startsWith('.')) {
119
+ // no relative path resolve
120
+ return;
121
+ }
122
+ const allModules = yield this.getAllModules();
123
+ const moduleName = allModules.find(moduleName => source.startsWith(moduleName));
124
+ if (!moduleName) {
125
+ return;
126
+ }
127
+ let exportPort = '.';
128
+ if (utils_1.ps.relative(moduleName, source) !== '') {
129
+ exportPort = './' + utils_1.ps.relative(moduleName, source);
130
+ }
131
+ const moduleRootDir = utils_1.ps.dirname(this.resolvePackageJson(moduleName));
132
+ const config = yield this.getConfig(moduleName);
133
+ // NOTE: '.' export port can cover all export ports.
134
+ const rootExport = config.exports[exportPort];
135
+ if (!rootExport) {
136
+ return;
137
+ }
138
+ // custom condition
139
+ if (this._context.customExportConditions) {
140
+ for (const condition of this._context.customExportConditions) {
141
+ if (typeof rootExport[condition] === 'string') {
142
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport[condition]);
143
+ }
144
+ }
145
+ }
146
+ // platform condition
147
+ const platform = this._context.platform.toLowerCase();
148
+ if (this._isWebPlatform(platform)) {
149
+ if (typeof rootExport.web === 'string') {
150
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.web);
151
+ } else if (typeof rootExport.web === 'object') {
152
+ if (typeof rootExport.web[platform] === 'string') {
153
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.web[platform]);
154
+ } else if (typeof rootExport.web.default === 'string') {
155
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.web.default);
156
+ }
157
+ }
158
+ } else if (this._isMiniGamePlatform(platform)) {
159
+ if (typeof rootExport.minigame === 'string') {
160
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.minigame);
161
+ } else if (typeof rootExport.minigame === 'object') {
162
+ if (typeof rootExport.minigame[platform] === 'string') {
163
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.minigame[platform]);
164
+ } else if (typeof rootExport.minigame.default === 'string') {
165
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.minigame.default);
166
+ }
167
+ }
168
+ } else if (this._isNativePlatform(platform)) {
169
+ if (typeof rootExport.native === 'string') {
170
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.native);
171
+ } else if (typeof rootExport.native === 'object') {
172
+ if (typeof rootExport.native[platform] === 'string') {
173
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.native[platform]);
174
+ } else if (typeof rootExport.native.default === 'string') {
175
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.native.default);
176
+ }
177
+ }
178
+ }
179
+ // types condition
180
+ if (typeof rootExport.types === 'string') {
181
+ return this._resolvedCache[source] = utils_1.ps.join(moduleRootDir, rootExport.types);
182
+ } else {
183
+ throw new Error(`Please specify a least a types export for module: '${source}'.`);
184
+ }
185
+ });
186
+ }
187
+ /**
188
+ * To detect whether the module has a './editor' export.
189
+ * @param moduleName
190
+ */
191
+ hasEditorSpecificExport(moduleName) {
192
+ var _a;
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ if (typeof this._cachedHasEditorSpecificExport[moduleName] === 'boolean') {
195
+ return this._cachedHasEditorSpecificExport[moduleName];
196
+ }
197
+ const pkgJson = this.resolvePackageJson(moduleName);
198
+ const pkg = yield fs_extra_1.default.readJson(pkgJson);
199
+ return this._cachedHasEditorSpecificExport[moduleName] = typeof ((_a = pkg.exports) === null || _a === void 0 ? void 0 : _a['./editor']) !== 'undefined';
200
+ });
201
+ }
202
+ _isWebPlatform(platform) {
203
+ return platform.toUpperCase() in platform_config_1.WebPlatform || platform.toUpperCase() === 'HTML5';
204
+ }
205
+ _isMiniGamePlatform(platform) {
206
+ return platform.toUpperCase() in platform_config_1.MinigamePlatform;
207
+ }
208
+ _isNativePlatform(platform) {
209
+ return platform.toUpperCase() in platform_config_1.NativePlatform || platform.toUpperCase() === 'NATIVE';
210
+ }
211
+ }
212
+ exports.ModuleQuery = ModuleQuery;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-query.js","sourceRoot":"","sources":["../src/module-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wDAA0B;AAC1B,uDAAkF;AAClF,gDAAwB;AACxB,0CAAoC;AAuBpC;;GAEG;AACH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GAME = 7,
13
+ OPPO = 8,
14
+ VIVO = 9,
15
+ HUAWEI = 10,
16
+ /**
17
+ * @deprecated this platform has been removed.
18
+ */
19
+ COCOSPLAY = 11,
20
+ /**
21
+ * @deprecated this platform has been removed.
22
+ */
23
+ QTT = 12,
24
+ /**
25
+ * @deprecated this platform has been removed.
26
+ */
27
+ LINKSURE = 13,
28
+ }
29
+ export declare enum NativePlatform {
30
+ NATIVE_EDITOR = 0,
31
+ ANDROID = 1,
32
+ WINDOWS = 2,
33
+ IOS = 3,
34
+ MAC = 4,
35
+ OHOS = 5,
36
+ OPEN_HARMONY = 6,
37
+ LINUX = 7,
38
+ }
39
+ export declare enum WebPlatform {
40
+ WEB_EDITOR = 0,
41
+ WEB_MOBILE = 1,
42
+ WEB_DESKTOP = 2,
43
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-config.d.ts","sourceRoot":"","sources":["../src/platform-config.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IACxB,MAAM,IAAA;IACN,mBAAmB,IAAA;IACnB;;OAEG;IACH,KAAK,IAAA;IACL,SAAS,IAAA;IACT,MAAM,IAAA;IACN,MAAM,IAAA;IACN,MAAM,IAAA;IACN,eAAe,IAAA;IACf,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,MAAM,KAAA;IACN;;OAEG;IACH,SAAS,KAAA;IACT;;OAEG;IACH,GAAG,KAAA;IACH;;OAEG;IACH,QAAQ,KAAA;CACX;AAED,oBAAY,cAAc;IACtB,aAAa,IAAA;IACb,OAAO,IAAA;IACP,OAAO,IAAA;IACP,GAAG,IAAA;IACH,GAAG,IAAA;IACH,IAAI,IAAA;IACJ,YAAY,IAAA;IACZ,KAAK,IAAA;CACR;AAED,oBAAY,WAAW;IACnB,UAAU,IAAA;IACV,UAAU,IAAA;IACV,WAAW,IAAA;CACd"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WebPlatform = exports.NativePlatform = exports.MinigamePlatform = void 0;
7
+ var MinigamePlatform;
8
+ (function (MinigamePlatform) {
9
+ MinigamePlatform[MinigamePlatform["WECHAT"] = 0] = "WECHAT";
10
+ MinigamePlatform[MinigamePlatform["WECHAT_MINI_PROGRAM"] = 1] = "WECHAT_MINI_PROGRAM";
11
+ /**
12
+ * @deprecated this platform has been removed.
13
+ */
14
+ MinigamePlatform[MinigamePlatform["BAIDU"] = 2] = "BAIDU";
15
+ MinigamePlatform[MinigamePlatform["BYTEDANCE"] = 3] = "BYTEDANCE";
16
+ MinigamePlatform[MinigamePlatform["XIAOMI"] = 4] = "XIAOMI";
17
+ MinigamePlatform[MinigamePlatform["ALIPAY"] = 5] = "ALIPAY";
18
+ MinigamePlatform[MinigamePlatform["TAOBAO"] = 6] = "TAOBAO";
19
+ MinigamePlatform[MinigamePlatform["TAOBAO_MINIGAME"] = 7] = "TAOBAO_MINIGAME";
20
+ MinigamePlatform[MinigamePlatform["OPPO"] = 8] = "OPPO";
21
+ MinigamePlatform[MinigamePlatform["VIVO"] = 9] = "VIVO";
22
+ MinigamePlatform[MinigamePlatform["HUAWEI"] = 10] = "HUAWEI";
23
+ /**
24
+ * @deprecated this platform has been removed.
25
+ */
26
+ MinigamePlatform[MinigamePlatform["COCOSPLAY"] = 11] = "COCOSPLAY";
27
+ /**
28
+ * @deprecated this platform has been removed.
29
+ */
30
+ MinigamePlatform[MinigamePlatform["QTT"] = 12] = "QTT";
31
+ /**
32
+ * @deprecated this platform has been removed.
33
+ */
34
+ MinigamePlatform[MinigamePlatform["LINKSURE"] = 13] = "LINKSURE";
35
+ })(MinigamePlatform = exports.MinigamePlatform || (exports.MinigamePlatform = {}));
36
+ var NativePlatform;
37
+ (function (NativePlatform) {
38
+ NativePlatform[NativePlatform["NATIVE_EDITOR"] = 0] = "NATIVE_EDITOR";
39
+ NativePlatform[NativePlatform["ANDROID"] = 1] = "ANDROID";
40
+ NativePlatform[NativePlatform["WINDOWS"] = 2] = "WINDOWS";
41
+ NativePlatform[NativePlatform["IOS"] = 3] = "IOS";
42
+ NativePlatform[NativePlatform["MAC"] = 4] = "MAC";
43
+ NativePlatform[NativePlatform["OHOS"] = 5] = "OHOS";
44
+ NativePlatform[NativePlatform["OPEN_HARMONY"] = 6] = "OPEN_HARMONY";
45
+ NativePlatform[NativePlatform["LINUX"] = 7] = "LINUX";
46
+ })(NativePlatform = exports.NativePlatform || (exports.NativePlatform = {}));
47
+ var WebPlatform;
48
+ (function (WebPlatform) {
49
+ WebPlatform[WebPlatform["WEB_EDITOR"] = 0] = "WEB_EDITOR";
50
+ WebPlatform[WebPlatform["WEB_MOBILE"] = 1] = "WEB_MOBILE";
51
+ WebPlatform[WebPlatform["WEB_DESKTOP"] = 2] = "WEB_DESKTOP";
52
+ })(WebPlatform = exports.WebPlatform || (exports.WebPlatform = {}));
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-config.js","sourceRoot":"","sources":["../src/platform-config.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBA2BX;AA3BD,WAAY,gBAAgB;IACxB,2DAAM,CAAA;IACN,qFAAmB,CAAA;IACnB;;OAEG;IACH,yDAAK,CAAA;IACL,iEAAS,CAAA;IACT,2DAAM,CAAA;IACN,2DAAM,CAAA;IACN,2DAAM,CAAA;IACN,6EAAe,CAAA;IACf,uDAAI,CAAA;IACJ,uDAAI,CAAA;IACJ,4DAAM,CAAA;IACN;;OAEG;IACH,kEAAS,CAAA;IACT;;OAEG;IACH,sDAAG,CAAA;IACH;;OAEG;IACH,gEAAQ,CAAA;AACZ,CAAC,EA3BW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QA2B3B;AAED,IAAY,cASX;AATD,WAAY,cAAc;IACtB,qEAAa,CAAA;IACb,yDAAO,CAAA;IACP,yDAAO,CAAA;IACP,iDAAG,CAAA;IACH,iDAAG,CAAA;IACH,mDAAI,CAAA;IACJ,mEAAY,CAAA;IACZ,qDAAK,CAAA;AACT,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,2DAAW,CAAA;AACf,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB"}
@@ -0,0 +1,216 @@
1
+ {
2
+ "$ref": "#/definitions/Config",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "Config": {
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "constants": {
9
+ "$ref": "#/definitions/IConstantConfig",
10
+ "description": "The constants config for engine and user."
11
+ },
12
+ "features": {
13
+ "additionalProperties": {
14
+ "$ref": "#/definitions/Feature"
15
+ },
16
+ "description": "Engine features. Keys are feature IDs.",
17
+ "type": "object"
18
+ },
19
+ "includes": {
20
+ "description": "Included files for quick-compiler.",
21
+ "items": {
22
+ "type": "string"
23
+ },
24
+ "type": "array"
25
+ },
26
+ "index": {
27
+ "$ref": "#/definitions/IndexConfig",
28
+ "description": "Describe how to generate the index module `'cc'`. Currently not used."
29
+ },
30
+ "moduleOverrides": {
31
+ "items": {
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "isVirtualModule": {
35
+ "type": "boolean"
36
+ },
37
+ "overrides": {
38
+ "additionalProperties": {
39
+ "type": "string"
40
+ },
41
+ "type": "object"
42
+ },
43
+ "test": {
44
+ "$ref": "#/definitions/Test"
45
+ }
46
+ },
47
+ "required": [
48
+ "test",
49
+ "overrides",
50
+ "isVirtualModule"
51
+ ],
52
+ "type": "object"
53
+ },
54
+ "type": "array"
55
+ },
56
+ "optimizeDecorators": {
57
+ "$ref": "#/definitions/IOptimizeDecorators",
58
+ "description": "The decorators to be optimize when build engine."
59
+ }
60
+ },
61
+ "required": [
62
+ "features",
63
+ "includes",
64
+ "constants",
65
+ "optimizeDecorators"
66
+ ],
67
+ "type": "object"
68
+ },
69
+ "ConstantTypeName": {
70
+ "enum": [
71
+ "boolean",
72
+ "number"
73
+ ],
74
+ "type": "string"
75
+ },
76
+ "Feature": {
77
+ "additionalProperties": false,
78
+ "description": "An engine feature.",
79
+ "properties": {
80
+ "dependentAssets": {
81
+ "description": "List of uuid that the feature depend on.",
82
+ "items": {
83
+ "type": "string"
84
+ },
85
+ "type": "array"
86
+ },
87
+ "dependentModules": {
88
+ "description": "List of module that the feature depend on.",
89
+ "items": {
90
+ "type": "string"
91
+ },
92
+ "type": "array"
93
+ },
94
+ "intrinsicFlags": {
95
+ "additionalProperties": {},
96
+ "description": "Flags to set when this feature is enabled.",
97
+ "type": "object"
98
+ },
99
+ "isNativeOnly": {
100
+ "default": false,
101
+ "description": "Whether it is a native only feature, default is false.",
102
+ "type": "boolean"
103
+ },
104
+ "modules": {
105
+ "description": "Modules to be included in this feature in their IDs. The ID of a module is its relative path(no extension) under /exports/.",
106
+ "items": {
107
+ "type": "string"
108
+ },
109
+ "type": "array"
110
+ }
111
+ },
112
+ "required": [
113
+ "modules"
114
+ ],
115
+ "type": "object"
116
+ },
117
+ "IConstantConfig": {
118
+ "additionalProperties": {
119
+ "$ref": "#/definitions/IConstantInfo"
120
+ },
121
+ "type": "object"
122
+ },
123
+ "IConstantInfo": {
124
+ "additionalProperties": false,
125
+ "properties": {
126
+ "ccGlobal": {
127
+ "default": false,
128
+ "description": "Whether exported to global as a `CC_XXXX` constant. eg. WECHAT is exported to global.CC_WECHAT NOTE: this is a feature of compatibility with Cocos 2.x engine. Default is false.",
129
+ "type": "boolean"
130
+ },
131
+ "comment": {
132
+ "description": "The comment of the constant. Which is used to generate the consts.d.ts file.",
133
+ "type": "string"
134
+ },
135
+ "dynamic": {
136
+ "default": false,
137
+ "description": "Some constant can't specify the value in the Editor, Preview or Test environment, so we need to dynamically judge them in runtime. These values are specified in a helper called `helper-dynamic-constants.ts`. Default is false.",
138
+ "type": "boolean"
139
+ },
140
+ "internal": {
141
+ "description": "Whether exported to developer. If true, it's only exported to engine.",
142
+ "type": "boolean"
143
+ },
144
+ "type": {
145
+ "$ref": "#/definitions/ConstantTypeName",
146
+ "description": "The type of the constant for generating consts.d.ts file."
147
+ },
148
+ "value": {
149
+ "description": "The default value of the constant. It can be a boolean, number or string. When it's a string type, the value is the result of eval().",
150
+ "type": [
151
+ "boolean",
152
+ "string",
153
+ "number"
154
+ ]
155
+ }
156
+ },
157
+ "required": [
158
+ "comment",
159
+ "type",
160
+ "value",
161
+ "internal"
162
+ ],
163
+ "type": "object"
164
+ },
165
+ "IOptimizeDecorators": {
166
+ "additionalProperties": false,
167
+ "properties": {
168
+ "editorDecorators": {
169
+ "description": "The decorators which should be removed directly when they only work in Cocos Creator editor.",
170
+ "items": {
171
+ "type": "string"
172
+ },
173
+ "type": "array"
174
+ },
175
+ "fieldDecorators": {
176
+ "description": "The decorators which should be optimized when they only decorate class fields.",
177
+ "items": {
178
+ "type": "string"
179
+ },
180
+ "type": "array"
181
+ }
182
+ },
183
+ "required": [
184
+ "fieldDecorators",
185
+ "editorDecorators"
186
+ ],
187
+ "type": "object"
188
+ },
189
+ "IndexConfig": {
190
+ "additionalProperties": false,
191
+ "properties": {
192
+ "modules": {
193
+ "additionalProperties": {
194
+ "additionalProperties": false,
195
+ "properties": {
196
+ "deprecated": {
197
+ "description": "If `true`, accesses the exports of this module from `'cc'` will be marked as deprecated.",
198
+ "type": "boolean"
199
+ },
200
+ "ns": {
201
+ "description": "If specified, export contents of the module into a namespace specified by `ns` and then export that namespace into `'cc'`. If not specified, contents of the module will be directly exported into `'cc'`.",
202
+ "type": "string"
203
+ }
204
+ },
205
+ "type": "object"
206
+ },
207
+ "type": "object"
208
+ }
209
+ },
210
+ "type": "object"
211
+ },
212
+ "Test": {
213
+ "type": "string"
214
+ }
215
+ }
216
+ }