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

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 +263 -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 +207 -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,344 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
20
+ Object.defineProperty(o, "default", {
21
+ enumerable: true,
22
+ value: v
23
+ });
24
+ } : function (o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = this && this.__importStar || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
35
+ function adopt(value) {
36
+ return value instanceof P ? value : new P(function (resolve) {
37
+ resolve(value);
38
+ });
39
+ }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) {
42
+ try {
43
+ step(generator.next(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ }
48
+ function rejected(value) {
49
+ try {
50
+ step(generator["throw"](value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ }
55
+ function step(result) {
56
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
57
+ }
58
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
59
+ });
60
+ };
61
+ var __importDefault = this && this.__importDefault || function (mod) {
62
+ return mod && mod.__esModule ? mod : {
63
+ "default": mod
64
+ };
65
+ };
66
+ Object.defineProperty(exports, "__esModule", {
67
+ value: true
68
+ });
69
+ exports.build = void 0;
70
+ const fs_extra_1 = __importDefault(require("fs-extra"));
71
+ const gift = __importStar(require("tfig"));
72
+ const stats_query_1 = require("../../stats-query/lib/index.js");
73
+ const utils_1 = require("../../utils/lib/index.js");
74
+ const transformer_1 = require("../../transformer/lib/index.js");
75
+ const modularize_1 = require("../../modularize/lib/index.js");
76
+ var ts = transformer_1.typescript.core;
77
+ const DEBUG = false;
78
+ const REMOVE_OLD = !DEBUG;
79
+ const RECOMPILE = !DEBUG;
80
+ const REMOVE_UNBUNDLED_CACHE = !DEBUG;
81
+ function build(options) {
82
+ var _a;
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ console.log(`Typescript version: ${ts.version}`);
85
+ const {
86
+ engine,
87
+ outDir
88
+ } = options;
89
+ yield fs_extra_1.default.ensureDir(outDir);
90
+ // TODO: should this be a build options ?
91
+ const withIndex = true;
92
+ const withExports = false;
93
+ const withEditorExports = true;
94
+ console.debug(`With index: ${withIndex}`);
95
+ console.debug(`With exports: ${withExports}`);
96
+ console.debug(`With editor exports: ${withEditorExports}`);
97
+ const statsQuery = yield stats_query_1.StatsQuery.create(engine);
98
+ const moduleQuery = new modularize_1.ModuleQuery({
99
+ engine,
100
+ platform: 'WEB_EDITOR' // what ever platform is OK
101
+ });
102
+
103
+ const allModules = yield moduleQuery.getAllModules();
104
+ const tsConfigPath = statsQuery.tsConfigPath;
105
+ const unbundledOutDir = utils_1.ps.join(outDir, '__before_bundle');
106
+ const parsedCommandLine = ts.getParsedCommandLineOfConfigFile(tsConfigPath, {
107
+ declaration: true,
108
+ noEmit: false,
109
+ emitDeclarationOnly: true,
110
+ outFile: undefined,
111
+ outDir: unbundledOutDir
112
+ }, {
113
+ onUnRecoverableConfigFileDiagnostic: () => {},
114
+ useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
115
+ readDirectory: ts.sys.readDirectory,
116
+ getCurrentDirectory: ts.sys.getCurrentDirectory,
117
+ fileExists: ts.sys.fileExists,
118
+ readFile: ts.sys.readFile
119
+ });
120
+ if (!parsedCommandLine) {
121
+ throw new Error(`Can not get 'parsedCommandLine'.`);
122
+ }
123
+ const unbundledOutDirNormalized = utils_1.ps.resolve(engine, parsedCommandLine.options.outDir);
124
+ console.debug(`Unbundled will write to: ${unbundledOutDirNormalized}`);
125
+ yield fs_extra_1.default.ensureDir(unbundledOutDirNormalized);
126
+ if (REMOVE_OLD) {
127
+ yield fs_extra_1.default.emptyDir(unbundledOutDirNormalized);
128
+ }
129
+ console.log(`Generating...`);
130
+ const featureUnits = statsQuery.getFeatureUnits().filter(m => m !== 'wait-for-ammo-instantiation');
131
+ const editorExportModules = statsQuery.getEditorPublicModules();
132
+ if (RECOMPILE) {
133
+ let fileNames = parsedCommandLine.fileNames;
134
+ if (withEditorExports) {
135
+ fileNames = fileNames.concat(editorExportModules.map(e => statsQuery.getEditorPublicModuleFile(e)));
136
+ }
137
+ const program = ts.createProgram(fileNames, parsedCommandLine.options);
138
+ const emitResult = program.emit(undefined,
139
+ // targetSourceFile
140
+ undefined,
141
+ // writeFile
142
+ undefined,
143
+ // cancellationToken,
144
+ true,
145
+ // emitOnlyDtsFiles
146
+ undefined);
147
+ const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
148
+ for (const diagnostic of allDiagnostics) {
149
+ let printer;
150
+ switch (diagnostic.category) {
151
+ case ts.DiagnosticCategory.Error:
152
+ printer = console.error;
153
+ break;
154
+ case ts.DiagnosticCategory.Warning:
155
+ printer = console.warn;
156
+ break;
157
+ case ts.DiagnosticCategory.Message:
158
+ case ts.DiagnosticCategory.Suggestion:
159
+ default:
160
+ printer = console.log;
161
+ break;
162
+ }
163
+ if (!printer) {
164
+ continue;
165
+ }
166
+ if (diagnostic.file && diagnostic.start !== undefined) {
167
+ const {
168
+ line,
169
+ character
170
+ } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
171
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine);
172
+ printer(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
173
+ } else {
174
+ printer(`${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
175
+ }
176
+ }
177
+ }
178
+ // HACK: fix comments generated on top level namespace
179
+ // // TODO:
180
+ // let code = fs.readFileSync(tscOutputDtsFile, 'utf8');
181
+ // const regExpRef = /(\/\/\/ <reference types.*)/g;
182
+ // const matches = code.match(regExpRef);
183
+ // code = code.replace(regExpRef, '');
184
+ // if (matches) {
185
+ // let outputUnbundledCode = matches.join('\n');
186
+ // outputUnbundledCode += '\ndeclare const __skip_reference__: never;\n';
187
+ // outputUnbundledCode += code;
188
+ // fs.outputFileSync(tscOutputDtsFile, outputUnbundledCode, 'utf8');
189
+ // }
190
+ const patchSpineCoreDtsSource = utils_1.ps.join(engine, 'cocos', 'spine', 'lib', 'spine-core.d.ts');
191
+ const patchSpineCoreDtsTarget = utils_1.ps.join(unbundledOutDirNormalized, 'cocos', 'spine', 'lib', 'spine-core.d.ts');
192
+ if (!(yield fs_extra_1.default.pathExists(patchSpineCoreDtsSource))) {
193
+ console.debug(`Does 'cocos/spine/lib/spine-core.d.ts' no longer existed? I have a patch for it.`);
194
+ } else {
195
+ console.debug(`It's ${new Date().toLocaleString()}, we're still doing the hack for spine-core.d.ts`);
196
+ yield fs_extra_1.default.ensureDir(utils_1.ps.dirname(patchSpineCoreDtsTarget));
197
+ yield fs_extra_1.default.copyFile(patchSpineCoreDtsSource, patchSpineCoreDtsTarget);
198
+ }
199
+ const giftInputs = [];
200
+ const types = (_a = parsedCommandLine.options.types) === null || _a === void 0 ? void 0 : _a.map(typeFile => `${typeFile}.d.ts`);
201
+ if (types) {
202
+ for (let file of types) {
203
+ const isBareSpecifier = !file.includes('/');
204
+ if (isBareSpecifier) {
205
+ file = require.resolve(`@types/${file.slice(0, -'.d.ts'.length)}`);
206
+ }
207
+ if (!utils_1.ps.isAbsolute(file)) {
208
+ file = utils_1.ps.join(utils_1.ps.dirname(tsConfigPath), file);
209
+ }
210
+ giftInputs.push(file);
211
+ }
212
+ }
213
+ const listGiftInputs = dir => __awaiter(this, void 0, void 0, function* () {
214
+ for (const file of yield fs_extra_1.default.readdir(dir)) {
215
+ const path = utils_1.ps.join(dir, file);
216
+ // eslint-disable-next-line no-await-in-loop
217
+ const stats = yield fs_extra_1.default.stat(path);
218
+ if (stats.isFile()) {
219
+ giftInputs.push(path);
220
+ } else if (stats.isDirectory()) {
221
+ // eslint-disable-next-line no-await-in-loop
222
+ yield listGiftInputs(path);
223
+ }
224
+ }
225
+ });
226
+ yield listGiftInputs(unbundledOutDirNormalized);
227
+ const giftEntries = {};
228
+ for (const moduleName of allModules) {
229
+ const moduleEntry = yield moduleQuery.resolveExport(moduleName);
230
+ if (moduleEntry) {
231
+ // update inputs
232
+ giftInputs.push(moduleEntry);
233
+ }
234
+ if (yield moduleQuery.hasEditorSpecificExport(moduleName)) {
235
+ const editorExport = moduleName + '/editor';
236
+ const editorEntry = yield moduleQuery.resolveExport(editorExport);
237
+ if (editorEntry) {
238
+ // update inputs
239
+ giftInputs.push(editorEntry);
240
+ }
241
+ }
242
+ }
243
+ const getModuleNameInTsOutFile = moduleFile => {
244
+ const path = utils_1.ps.relative(statsQuery.path, moduleFile);
245
+ const pathDts = path.replace(/\.ts$/, '.d.ts');
246
+ return utils_1.ps.join(unbundledOutDirNormalized, pathDts);
247
+ };
248
+ if (withExports) {
249
+ for (const exportEntry of featureUnits) {
250
+ giftEntries[exportEntry] = getModuleNameInTsOutFile(statsQuery.getFeatureUnitFile(exportEntry));
251
+ }
252
+ }
253
+ if (withEditorExports) {
254
+ for (const editorExportModule of editorExportModules) {
255
+ giftEntries[editorExportModule] = getModuleNameInTsOutFile(statsQuery.getEditorPublicModuleFile(editorExportModule));
256
+ }
257
+ for (const moduleName of allModules) {
258
+ if (yield moduleQuery.hasEditorSpecificExport(moduleName)) {
259
+ const editorExport = moduleName + '/editor';
260
+ const editorEntry = yield moduleQuery.resolveExport(editorExport);
261
+ const editorModuleName = transformToEditorModuleName(moduleName);
262
+ if (editorEntry) {
263
+ giftEntries[editorModuleName] = editorEntry;
264
+ }
265
+ }
266
+ }
267
+ }
268
+ let ccDtsFile;
269
+ if (withIndex && !withExports) {
270
+ ccDtsFile = utils_1.ps.join(unbundledOutDirNormalized, 'virtual-cc.d.ts');
271
+ giftEntries.cc = ccDtsFile;
272
+ giftInputs.push(ccDtsFile);
273
+ const code = `// Auto-generated\n${statsQuery.evaluateIndexModuleSource(featureUnits, featureUnit => getModuleNameInTsOutFile(statsQuery.getFeatureUnitFile(featureUnit)).replace(/\\/g, '/').replace(/\.d.ts$/, ''))}\n`;
274
+ yield fs_extra_1.default.writeFile(ccDtsFile, code, {
275
+ encoding: 'utf8'
276
+ });
277
+ }
278
+ console.log(`Bundling...`);
279
+ try {
280
+ const indexOutputPath = utils_1.ps.join(outDir, 'cc.d.ts');
281
+ const giftResult = gift.bundle({
282
+ input: giftInputs,
283
+ rootDir: unbundledOutDirNormalized,
284
+ name: 'cc',
285
+ rootModule: 'index',
286
+ entries: giftEntries,
287
+ priority: [...(ccDtsFile ? [ccDtsFile] : []) // Things should be exported to 'cc' as far as possible.
288
+ ],
289
+
290
+ privateJsDocTag: 'engineInternal',
291
+ groups: [{
292
+ test: /^cc\/editor.*$/,
293
+ path: utils_1.ps.join(outDir, 'cc.editor.d.ts')
294
+ }, {
295
+ test: /^cc\/.*$/,
296
+ path: utils_1.ps.join(outDir, 'index.d.ts')
297
+ }, {
298
+ test: /^cc.*$/,
299
+ path: indexOutputPath
300
+ }],
301
+ nonExportedSymbolDistribution: [{
302
+ sourceModule: /cocos\/animation\/marionette/,
303
+ targetModule: 'cc/editor/new-gen-anim'
304
+ }, {
305
+ sourceModule: /.*/,
306
+ targetModule: 'cc'
307
+ }]
308
+ });
309
+ yield Promise.all(giftResult.groups.map(group => __awaiter(this, void 0, void 0, function* () {
310
+ yield fs_extra_1.default.outputFile(group.path, group.code, {
311
+ encoding: 'utf8'
312
+ });
313
+ })));
314
+ if (withIndex && withExports) {
315
+ yield fs_extra_1.default.outputFile(indexOutputPath, buildIndexModule(featureUnits, statsQuery), {
316
+ encoding: 'utf8'
317
+ });
318
+ }
319
+ } catch (error) {
320
+ console.error(error);
321
+ return false;
322
+ } finally {
323
+ if (REMOVE_UNBUNDLED_CACHE) {
324
+ yield fs_extra_1.default.remove(unbundledOutDirNormalized);
325
+ }
326
+ }
327
+ return true;
328
+ });
329
+ }
330
+ exports.build = build;
331
+ function buildIndexModule(featureUnits, statsQuery) {
332
+ return `declare module "cc" {\n${statsQuery.evaluateIndexModuleSource(featureUnits).split('\n').map(line => ` ${line}`).join('\n')}\n}`;
333
+ }
334
+ /**
335
+ * '@cocos/moduleName' -> 'cc/editor/moduleName'
336
+ * '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
337
+ * 'moduleName' -> 'cc/editor/moduleName'
338
+ * @param moduleName
339
+ */
340
+ function transformToEditorModuleName(moduleName) {
341
+ const split = moduleName.split('/');
342
+ moduleName = split.length > 1 ? split[1] : split[0];
343
+ return `cc/editor/${moduleName}`;
344
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,2CAA6B;AAC7B,sDAAkD;AAClD,0CAAoC;AACpC,sDAAiE;AACjE,oDAAkD;AAGlD,IAAO,EAAE,GAAG,wBAAW,CAAC,IAAI,CAAC;AAE7B,MAAM,KAAK,GAAG,KAAK,CAAC;AACpB,MAAM,UAAU,GAAG,CAAC,KAAK,CAAC;AAC1B,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC;AACzB,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC;AAOtC,SAAsB,KAAK,CAAE,OAAgB;;;Q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CAAC,yBAAyB,CAAC,YAAY,CAAC;SAC7C,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC;SAC5B,IAAI,CAAC,IAAI,CAClB,KAAK,CAAC;AACV,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAAE,UAAkB;IACpD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,aAAa,UAAU,EAAE,CAAC;AACrC,CAAC"}
@@ -1,20 +1,3 @@
1
- export declare class MemoryFile {
2
- path: string;
3
- content: string;
4
- constructor(path: string, content: string);
5
- outputFile(): Promise<void>;
6
- }
7
- export declare namespace ModuleManager {
8
- interface InitOptions {
9
- pkgName: string;
10
- extendTsconfigPath: string;
11
- }
12
- interface ModuleInitResult {
13
- memoryFiles: MemoryFile[];
14
- }
15
- }
16
- export declare class ModuleManager {
17
- private _filesToCopy;
18
- private _filesToRender;
19
- initModule(modulePath: string, options: ModuleManager.InitOptions): Promise<ModuleManager.ModuleInitResult>;
20
- }
1
+ export * from './module-config';
2
+ export * from './module-query';
3
+ export * from './platform-config';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,qBAAa,UAAU;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAK7B,UAAU,IAAK,OAAO,CAAC,IAAI,CAAC;CAG5C;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACnC,UAAiB,WAAW;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,kBAAkB,EAAE,MAAM,CAAC;KAC9B;IAED,UAAiB,gBAAgB;QAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;KAC7B;CACJ;AAED,qBAAa,aAAa;IAEtB,OAAO,CAAC,YAAY,CAIlB;IAEF,OAAO,CAAC,cAAc,CAGpB;IAEI,UAAU,CAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC;CAgBrH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
@@ -1,82 +1,27 @@
1
1
  "use strict";
2
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);
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
22
11
  }
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
- };
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = this && this.__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
34
21
  };
35
22
  Object.defineProperty(exports, "__esModule", {
36
23
  value: true
37
24
  });
38
- exports.ModuleManager = exports.MemoryFile = void 0;
39
- const fs_extra_1 = __importDefault(require("fs-extra"));
40
- const path_1 = __importDefault(require("path"));
41
- const ejs_1 = __importDefault(require("ejs"));
42
- const utils_1 = require("../../utils/lib/index.js");
43
- const absolutePath = (0, utils_1.absolutePathFuncFactory)(__dirname);
44
- class MemoryFile {
45
- constructor(path, content) {
46
- this.path = path;
47
- this.content = content;
48
- }
49
- outputFile() {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- yield fs_extra_1.default.outputFile(this.path, this.content, 'utf8');
52
- });
53
- }
54
- }
55
- exports.MemoryFile = MemoryFile;
56
- class ModuleManager {
57
- constructor() {
58
- this._filesToCopy = ['../static/jest.config.js', '../static/api-extractor.json', '../static/.gitignore'];
59
- this._filesToRender = ['../static/package.ejson', '../static/tsconfig.ejson'];
60
- }
61
- initModule(modulePath, options) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const result = {
64
- memoryFiles: []
65
- };
66
- yield Promise.all(this._filesToRender.map(filePath => absolutePath(filePath)).map(filePath => __awaiter(this, void 0, void 0, function* () {
67
- const content = yield fs_extra_1.default.readFile(filePath, 'utf8');
68
- const targetContent = ejs_1.default.render(content, options);
69
- const targetFilePath = (0, utils_1.replaceExtname)((0, utils_1.rebasePath)(filePath, path_1.default.dirname(filePath), modulePath), '.json');
70
- options.extendTsconfigPath = (0, utils_1.formatPath)(path_1.default.relative(modulePath, options.extendTsconfigPath));
71
- result.memoryFiles.push(new MemoryFile(targetFilePath, targetContent));
72
- })));
73
- yield Promise.all(this._filesToCopy.map(filePath => absolutePath(filePath)).map(filePath => __awaiter(this, void 0, void 0, function* () {
74
- const content = yield fs_extra_1.default.readFile(filePath, 'utf8');
75
- const targetFilePath = (0, utils_1.rebasePath)(filePath, path_1.default.dirname(filePath), modulePath);
76
- result.memoryFiles.push(new MemoryFile(targetFilePath, content));
77
- })));
78
- return result;
79
- });
80
- }
81
- }
82
- exports.ModuleManager = ModuleManager;
25
+ __exportStar(require("./module-config"), exports);
26
+ __exportStar(require("./module-query"), exports);
27
+ __exportStar(require("./platform-config"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,gDAAsB;AACtB,8CAAsB;AACtB,0CAAiG;AAEjG,MAAM,YAAY,GAAG,IAAA,+BAAuB,EAAC,SAAS,CAAC,CAAC;AAExD,MAAa,UAAU;IAInB,YAAa,IAAY,EAAE,OAAe;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEY,UAAU;;YACnB,MAAM,kBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC;KAAA;CACJ;AAZD,gCAYC;AAaD,MAAa,aAAa;IAA1B;QAEY,iBAAY,GAAG;YACnB,0BAA0B;YAC1B,8BAA8B;YAC9B,sBAAsB;SACzB,CAAC;QAEM,mBAAc,GAAG;YACrB,yBAAyB;YACzB,0BAA0B;SAC7B,CAAC;IAkBN,CAAC;IAhBS,UAAU,CAAE,UAAkB,EAAE,OAAkC;;YACpE,MAAM,MAAM,GAAmC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;YACnE,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,C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{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC"}
@@ -0,0 +1,134 @@
1
+ import { MinigamePlatform, NativePlatform, WebPlatform } from './platform-config';
2
+ export type MinigamePlatformConfig = { [key in Lowercase<keyof typeof MinigamePlatform>]?: string };
3
+ export type NativePlatformConfig = { [key in Lowercase<keyof typeof NativePlatform>]?: string };
4
+ export type WebPlatformConfig = { [key in Lowercase<keyof typeof WebPlatform>]?: string };
5
+ export type PlatformType = Uppercase<keyof typeof WebPlatform | keyof typeof MinigamePlatform | keyof typeof NativePlatform> | 'HTML5' | 'NATIVE';
6
+ /**
7
+ * Abstract platform export, like `web`, `native` and `minigame`.
8
+ * Usually this is used for PAL modules.
9
+ * The build tools resolve the relative platform as entry according to the build platform config.
10
+ * - The value can be a `string` or a `object` which requires a default item.
11
+ * eg. { "web": "/path/to/index.ts" } is equals to { "web": { default: "/path/to/index.ts" } }.
12
+ * - We can also specify the exact platform like
13
+ * { "web": {default: "/path/to/index.ts", "web-desktop": "/path/to/index.ts" } }.
14
+ */
15
+ type AbstractPlatformExport<T> = ({
16
+ /**
17
+ * Default platform export for unspecified platforms.
18
+ */
19
+ default: string;
20
+ } & T) | string;
21
+ /**
22
+ * The export condition. `types` fields are required.
23
+ */
24
+ type ExportCondition<T> = {
25
+ /**
26
+ * This is the main module export condition.
27
+ * - The dts bundle tools resolve this condition as entry.
28
+ * - The API doc tools resolve this condition as entry.
29
+ * - If no platform export is specified, the build tools resolve this condition as entry.
30
+ */
31
+ types: string;
32
+ /**
33
+ * The custom condition, for example:
34
+ * - For gfx module: {"webgl1": "/path/to/webgl1/index.ts", "webgl2": "/path/to/webgl2/index.ts"}
35
+ * - For physics module {"cannon": "/path/to/cannon/index.ts", "physX": "/path/to/physX/index.ts"}
36
+ */
37
+ [customCondition: string]: string;
38
+ } & T;
39
+ interface ConditionalExports {
40
+ /**
41
+ * This is exported to the game runtime.
42
+ * Also we build the `cc.d.ts` with this export condition's `types` field.
43
+ * `node` field is required to resolve the path of package.json for build tools.
44
+ */
45
+ '.': ExportCondition<{
46
+ /**
47
+ * `node` should be specified as './package.json' to resolve the path of package.json for build tools.
48
+ */
49
+ node: './package.json';
50
+ minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
51
+ native?: AbstractPlatformExport<NativePlatformConfig>;
52
+ web?: AbstractPlatformExport<WebPlatformConfig>;
53
+ }>;
54
+ /**
55
+ * This is exported to the engine internal.
56
+ * It useful when we need to export some friend interfaces for internal engine modules.
57
+ */
58
+ './internal'?: ExportCondition<{
59
+ minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
60
+ native?: AbstractPlatformExport<NativePlatformConfig>;
61
+ web?: AbstractPlatformExport<WebPlatformConfig>;
62
+ }>;
63
+ /**
64
+ * This is exported to the editor, which is useful when we need to export some editor only interfaces.
65
+ * Also we build `cc.editor.d.ts` from this export condition's `types` field.
66
+ * If this is not specified, we use the '.' export condition by default for module editor export,
67
+ * otherwise, the build tools merges '.' and './editor' exports together for editor runtime environment.
68
+ * It is different with `web_editor` or `native_editor` platform export:
69
+ * - this condition exports some editor specific interfaces which is not cross-platform.
70
+ * - the `web_editor` or `native_editor` platform export is an editor version of implementation of interfaces defined in `types` field which should be cross-platform.
71
+ */
72
+ './editor'?: ExportCondition<{}>;
73
+ }
74
+ interface ModuleOverride {
75
+ /**
76
+ * The test string to evaluate.
77
+ */
78
+ test: string;
79
+ /**
80
+ * The override config, override mapping from key to value.
81
+ */
82
+ overrides: Record<string, string>;
83
+ }
84
+ export interface ModuleConfig {
85
+ [key: string]: unknown;
86
+ /**
87
+ * The module name.
88
+ */
89
+ name: string;
90
+ /**
91
+ * The version of module.
92
+ * It is useful when we change the module config, then we need to make some migration.
93
+ * This usually comes with the `cc.migrations` field.
94
+ */
95
+ version: string;
96
+ /**
97
+ * The config for conditional exports.
98
+ */
99
+ exports: ConditionalExports;
100
+ /**
101
+ * Specify the module dependencies is required if this module import another one.
102
+ * We need this field to generate the module dependency graph.
103
+ */
104
+ dependencies?: Record<string, string>;
105
+ /**
106
+ * Specify the dev dependencies, these dependencies are always used in `scripts` folder.
107
+ */
108
+ devDependencies?: Record<string, string>;
109
+ /**
110
+ * The dependencies between modules form a tree-structured dependency graph.
111
+ * The correct dependency relationship should be that the upper module depends on the lower module one-way, and the reverse is wrong.
112
+ * However, it is normal for modules at the same layer to depend on each other, and such dependencies should be declared as `peerDependencies`.
113
+ * Otherwise the Turbo pipeline will report an error due to module circular dependencies.
114
+ * see: https://github.com/vercel/turbo/issues/1480
115
+ */
116
+ peerDependencies?: Record<string, string>;
117
+ /**
118
+ * This is a CC-specific item difference from the node package.json standard specification.
119
+ */
120
+ cc?: {
121
+ /**
122
+ * The module asset dependencies, which is an array of asset uuid.
123
+ */
124
+ assetDependencies?: string[];
125
+ /**
126
+ * This is different with conditional exports.
127
+ * Sometimes we just want to override a script file instead of the whole module.
128
+ * Module override could support to do this job.
129
+ * - eg. { "test": "context.mode === 'BUILD'", "overrides": { "/path/to/dev.ts": "/path/to/build.ts" } }
130
+ */
131
+ moduleOverrides?: ModuleOverride[];
132
+ };
133
+ }
134
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-config.d.ts","sourceRoot":"","sources":["../src/module-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,MAAM,sBAAsB,GAAG;KAChC,GAAG,IAAI,SAAS,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM;CAC7D,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;KAC9B,GAAG,IAAI,SAAS,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM;CAC3D,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;KAC3B,GAAG,IAAI,SAAS,C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AAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;OAEG;IACH,EAAE,CAAC,EAAE;QACD;;WAEG;QACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC7B;;;;;WAKG;QACH,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;KActC,CAAC;CACL"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ // NOTE: This is the source code to generate module-config.schema.json
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-config.js","sourceRoot":"","sources":["../src/module-config.ts"],"names":[],"mappings":";AAAA,sEAAsE"}