@cocos/ccbuild 2.0.3-alpha.8 → 2.1.0

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 (53) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/README.md +1 -1
  3. package/lib/src/index.d.ts +3 -1
  4. package/lib/src/index.d.ts.map +1 -1
  5. package/lib/src/index.js +3 -1
  6. package/lib/src/index.js.map +1 -1
  7. package/modules/build-engine/lib/engine-js/index.d.ts.map +1 -1
  8. package/modules/build-engine/lib/engine-js/index.js +10 -10
  9. package/modules/build-engine/lib/engine-js/index.js.map +1 -1
  10. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts +4 -16
  11. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts.map +1 -1
  12. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js +14 -34
  13. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js.map +1 -1
  14. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.d.ts.map +1 -1
  15. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.js +8 -7
  16. package/modules/build-engine/lib/engine-js/rollup-plugins/ts-paths.js.map +1 -1
  17. package/modules/build-engine/lib/engine-ts/engine-builder.d.ts +2 -0
  18. package/modules/build-engine/lib/engine-ts/engine-builder.d.ts.map +1 -1
  19. package/modules/build-engine/lib/engine-ts/engine-builder.js +83 -9
  20. package/modules/build-engine/lib/engine-ts/engine-builder.js.map +1 -1
  21. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts +4 -0
  22. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts.map +1 -1
  23. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js +6 -23
  24. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js.map +1 -1
  25. package/modules/build-engine/lib/index.d.ts +5 -13
  26. package/modules/build-engine/lib/index.d.ts.map +1 -1
  27. package/modules/build-engine/lib/index.js.map +1 -1
  28. package/modules/dts-bundler/lib/index.d.ts +5 -0
  29. package/modules/dts-bundler/lib/index.d.ts.map +1 -0
  30. package/modules/dts-bundler/lib/index.js +357 -0
  31. package/modules/dts-bundler/lib/index.js.map +1 -0
  32. package/modules/modularize/lib/module-config.d.ts +13 -5
  33. package/modules/modularize/lib/module-config.d.ts.map +1 -1
  34. package/modules/modularize/lib/module-config.schema.json +12 -8
  35. package/modules/modularize/lib/module-query.d.ts +21 -2
  36. package/modules/modularize/lib/module-query.d.ts.map +1 -1
  37. package/modules/modularize/lib/module-query.js +122 -21
  38. package/modules/modularize/lib/module-query.js.map +1 -1
  39. package/modules/modularize/lib/platform-config.js +3 -3
  40. package/modules/modularize/lib/platform-config.js.map +1 -1
  41. package/modules/stats-query/lib/index.d.ts +2 -12
  42. package/modules/stats-query/lib/index.d.ts.map +1 -1
  43. package/modules/stats-query/lib/index.js +3 -3
  44. package/modules/stats-query/lib/index.js.map +1 -1
  45. package/modules/utils/lib/index.d.ts +1 -1
  46. package/modules/utils/lib/index.d.ts.map +1 -1
  47. package/modules/utils/lib/index.js +1 -7
  48. package/modules/utils/lib/index.js.map +1 -1
  49. package/modules/utils/lib/path.d.ts +3 -1
  50. package/modules/utils/lib/path.d.ts.map +1 -1
  51. package/modules/utils/lib/path.js +8 -3
  52. package/modules/utils/lib/path.js.map +1 -1
  53. package/package.json +4 -3
@@ -0,0 +1,357 @@
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',
101
+ customExportConditions: ['types']
102
+ });
103
+ const moduleExportMap = yield moduleQuery.getExportMap();
104
+ // NOTE: to record the imported modules, we only bundle the imported modules, not all engine modules.
105
+ const importedModules = [];
106
+ const tsConfigPath = statsQuery.tsConfigPath;
107
+ const unbundledOutDir = utils_1.ps.join(outDir, '__before_bundle');
108
+ const parsedCommandLine = ts.getParsedCommandLineOfConfigFile(tsConfigPath, {
109
+ declaration: true,
110
+ noEmit: false,
111
+ emitDeclarationOnly: true,
112
+ outFile: undefined,
113
+ outDir: unbundledOutDir
114
+ }, {
115
+ onUnRecoverableConfigFileDiagnostic: () => {},
116
+ useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
117
+ readDirectory: ts.sys.readDirectory,
118
+ getCurrentDirectory: ts.sys.getCurrentDirectory,
119
+ fileExists: ts.sys.fileExists,
120
+ readFile: ts.sys.readFile
121
+ });
122
+ if (!parsedCommandLine) {
123
+ throw new Error(`Can not get 'parsedCommandLine'.`);
124
+ }
125
+ const unbundledOutDirNormalized = utils_1.ps.resolve(engine, parsedCommandLine.options.outDir);
126
+ console.debug(`Unbundled will write to: ${unbundledOutDirNormalized}`);
127
+ yield fs_extra_1.default.ensureDir(unbundledOutDirNormalized);
128
+ if (REMOVE_OLD) {
129
+ yield fs_extra_1.default.emptyDir(unbundledOutDirNormalized);
130
+ }
131
+ console.log(`Generating...`);
132
+ const featureUnits = statsQuery.getFeatureUnits().filter(m => m !== 'wait-for-ammo-instantiation');
133
+ const editorExportModules = statsQuery.getEditorPublicModules();
134
+ if (RECOMPILE) {
135
+ let fileNames = parsedCommandLine.fileNames;
136
+ if (withEditorExports) {
137
+ fileNames = fileNames.concat(editorExportModules.map(e => statsQuery.getEditorPublicModuleFile(e)));
138
+ }
139
+ const host = ts.createCompilerHost(parsedCommandLine.options);
140
+ host.resolveModuleNames = (moduleNames, importer) => {
141
+ const resolvedModules = [];
142
+ for (const moduleName of moduleNames) {
143
+ const exportPath = moduleExportMap[moduleName];
144
+ if (exportPath) {
145
+ if (!importedModules.includes(moduleName)) {
146
+ importedModules.push(moduleName);
147
+ }
148
+ resolvedModules.push({
149
+ resolvedFileName: exportPath
150
+ });
151
+ } else {
152
+ const resolvedRes = ts.resolveModuleName(moduleName, importer, parsedCommandLine.options, host);
153
+ if (resolvedRes.resolvedModule) {
154
+ resolvedModules.push({
155
+ resolvedFileName: resolvedRes.resolvedModule.resolvedFileName
156
+ });
157
+ } else {
158
+ // Cannot resolve module, treat it as external.
159
+ resolvedModules.push(undefined);
160
+ }
161
+ }
162
+ }
163
+ return resolvedModules;
164
+ };
165
+ const program = ts.createProgram(fileNames, parsedCommandLine.options, host);
166
+ const emitResult = program.emit(undefined,
167
+ // targetSourceFile
168
+ undefined,
169
+ // writeFile
170
+ undefined,
171
+ // cancellationToken,
172
+ true,
173
+ // emitOnlyDtsFiles
174
+ undefined);
175
+ const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
176
+ for (const diagnostic of allDiagnostics) {
177
+ let printer;
178
+ switch (diagnostic.category) {
179
+ case ts.DiagnosticCategory.Error:
180
+ printer = console.error;
181
+ break;
182
+ case ts.DiagnosticCategory.Warning:
183
+ printer = console.warn;
184
+ break;
185
+ case ts.DiagnosticCategory.Message:
186
+ case ts.DiagnosticCategory.Suggestion:
187
+ default:
188
+ printer = console.log;
189
+ break;
190
+ }
191
+ if (!printer) {
192
+ continue;
193
+ }
194
+ if (diagnostic.file && diagnostic.start !== undefined) {
195
+ const {
196
+ line,
197
+ character
198
+ } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
199
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine);
200
+ printer(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
201
+ } else {
202
+ printer(`${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
203
+ }
204
+ }
205
+ }
206
+ const patchSpineCoreDtsSource = utils_1.ps.join(engine, 'cocos', 'spine', 'lib', 'spine-core.d.ts');
207
+ const patchSpineCoreDtsTarget = utils_1.ps.join(unbundledOutDirNormalized, 'cocos', 'spine', 'lib', 'spine-core.d.ts');
208
+ if (!(yield fs_extra_1.default.pathExists(patchSpineCoreDtsSource))) {
209
+ console.debug(`Does 'cocos/spine/lib/spine-core.d.ts' no longer existed? I have a patch for it.`);
210
+ } else {
211
+ console.debug(`It's ${new Date().toLocaleString()}, we're still doing the hack for spine-core.d.ts`);
212
+ yield fs_extra_1.default.ensureDir(utils_1.ps.dirname(patchSpineCoreDtsTarget));
213
+ yield fs_extra_1.default.copyFile(patchSpineCoreDtsSource, patchSpineCoreDtsTarget);
214
+ }
215
+ const rebasedModuleExportMap = {};
216
+ for (const [moduleName, modulePath] of Object.entries(moduleExportMap)) {
217
+ let rebasedPath = utils_1.ps.rebasePath(modulePath, engine, unbundledOutDirNormalized);
218
+ if (!rebasedPath.endsWith('.d.ts')) {
219
+ rebasedPath = utils_1.ps.replaceExtname(rebasedPath, '.ts', '.d.ts');
220
+ }
221
+ rebasedModuleExportMap[moduleName] = rebasedPath;
222
+ }
223
+ const giftInputs = [];
224
+ const types = (_a = parsedCommandLine.options.types) === null || _a === void 0 ? void 0 : _a.map(typeFile => `${typeFile}.d.ts`);
225
+ if (types) {
226
+ for (let file of types) {
227
+ const isBareSpecifier = !file.includes('/');
228
+ if (isBareSpecifier) {
229
+ file = require.resolve(`@types/${file.slice(0, -'.d.ts'.length)}`, {
230
+ paths: [engine]
231
+ });
232
+ }
233
+ if (!utils_1.ps.isAbsolute(file)) {
234
+ file = utils_1.ps.join(utils_1.ps.dirname(tsConfigPath), file);
235
+ }
236
+ giftInputs.push(file);
237
+ }
238
+ }
239
+ const listGiftInputs = dir => __awaiter(this, void 0, void 0, function* () {
240
+ for (const file of yield fs_extra_1.default.readdir(dir)) {
241
+ const path = utils_1.ps.join(dir, file);
242
+ // eslint-disable-next-line no-await-in-loop
243
+ const stats = yield fs_extra_1.default.stat(path);
244
+ if (stats.isFile()) {
245
+ giftInputs.push(path);
246
+ } else if (stats.isDirectory()) {
247
+ // eslint-disable-next-line no-await-in-loop
248
+ yield listGiftInputs(path);
249
+ }
250
+ }
251
+ });
252
+ yield listGiftInputs(unbundledOutDirNormalized);
253
+ const giftEntries = {};
254
+ for (const [moduleName, modulePath] of Object.entries(rebasedModuleExportMap)) {
255
+ if (importedModules.includes(moduleName)) {
256
+ giftInputs.push(modulePath);
257
+ }
258
+ }
259
+ const getModuleNameInTsOutFile = moduleFile => {
260
+ const path = utils_1.ps.relative(statsQuery.path, moduleFile);
261
+ const pathDts = path.replace(/\.ts$/, '.d.ts');
262
+ return utils_1.ps.join(unbundledOutDirNormalized, pathDts);
263
+ };
264
+ if (withExports) {
265
+ for (const exportEntry of featureUnits) {
266
+ giftEntries[exportEntry] = getModuleNameInTsOutFile(statsQuery.getFeatureUnitFile(exportEntry));
267
+ }
268
+ }
269
+ if (withEditorExports) {
270
+ for (const editorExportModule of editorExportModules) {
271
+ giftEntries[editorExportModule] = getModuleNameInTsOutFile(statsQuery.getEditorPublicModuleFile(editorExportModule));
272
+ }
273
+ for (const [moduleName, modulePath] of Object.entries(rebasedModuleExportMap)) {
274
+ if (moduleName.endsWith('/editor') && importedModules.includes(moduleName)) {
275
+ const editorModuleName = transformToEditorModuleName(moduleName);
276
+ giftEntries[editorModuleName] = modulePath;
277
+ }
278
+ }
279
+ }
280
+ let ccDtsFile;
281
+ if (withIndex && !withExports) {
282
+ ccDtsFile = utils_1.ps.join(unbundledOutDirNormalized, 'virtual-cc.d.ts');
283
+ giftEntries.cc = ccDtsFile;
284
+ giftInputs.push(ccDtsFile);
285
+ const code = `// Auto-generated\n${statsQuery.evaluateIndexModuleSource(featureUnits, featureUnit => getModuleNameInTsOutFile(statsQuery.getFeatureUnitFile(featureUnit)).replace(/\\/g, '/').replace(/\.d.ts$/, ''))}\n`;
286
+ yield fs_extra_1.default.writeFile(ccDtsFile, code, {
287
+ encoding: 'utf8'
288
+ });
289
+ }
290
+ console.log(`Bundling...`);
291
+ try {
292
+ const indexOutputPath = utils_1.ps.join(outDir, 'cc.d.ts');
293
+ const giftResult = gift.bundle({
294
+ input: giftInputs,
295
+ rootDir: unbundledOutDirNormalized,
296
+ name: 'cc',
297
+ rootModule: 'index',
298
+ entries: giftEntries,
299
+ priority: [...(ccDtsFile ? [ccDtsFile] : []) // Things should be exported to 'cc' as far as possible.
300
+ ],
301
+
302
+ privateJsDocTag: 'engineInternal',
303
+ groups: [{
304
+ test: /^cc\/editor.*$/,
305
+ path: utils_1.ps.join(outDir, 'cc.editor.d.ts')
306
+ }, {
307
+ test: /^cc\/.*$/,
308
+ path: utils_1.ps.join(outDir, 'index.d.ts')
309
+ }, {
310
+ test: /^cc.*$/,
311
+ path: indexOutputPath
312
+ }],
313
+ nonExportedSymbolDistribution: [{
314
+ sourceModule: /cocos\/animation\/marionette/,
315
+ targetModule: 'cc/editor/new-gen-anim'
316
+ }, {
317
+ sourceModule: /.*/,
318
+ targetModule: 'cc'
319
+ }],
320
+ moduleMap: rebasedModuleExportMap
321
+ });
322
+ yield Promise.all(giftResult.groups.map(group => __awaiter(this, void 0, void 0, function* () {
323
+ yield fs_extra_1.default.outputFile(group.path, group.code, {
324
+ encoding: 'utf8'
325
+ });
326
+ })));
327
+ if (withIndex && withExports) {
328
+ yield fs_extra_1.default.outputFile(indexOutputPath, buildIndexModule(featureUnits, statsQuery), {
329
+ encoding: 'utf8'
330
+ });
331
+ }
332
+ } catch (error) {
333
+ console.error(error);
334
+ return false;
335
+ } finally {
336
+ if (REMOVE_UNBUNDLED_CACHE) {
337
+ yield fs_extra_1.default.remove(unbundledOutDirNormalized);
338
+ }
339
+ }
340
+ return true;
341
+ });
342
+ }
343
+ exports.build = build;
344
+ function buildIndexModule(featureUnits, statsQuery) {
345
+ return `declare module "cc" {\n${statsQuery.evaluateIndexModuleSource(featureUnits).split('\n').map(line => ` ${line}`).join('\n')}\n}`;
346
+ }
347
+ /**
348
+ * '@cocos/moduleName' -> 'cc/editor/moduleName'
349
+ * '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
350
+ * 'moduleName' -> 'cc/editor/moduleName'
351
+ * @param moduleName
352
+ */
353
+ function transformToEditorModuleName(moduleName) {
354
+ const split = moduleName.split('/');
355
+ moduleName = split.length > 1 ? split[1] : split[0];
356
+ return `cc/editor/${moduleName}`;
357
+ }
@@ -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;;;QACzC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,CAAC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K,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"}
@@ -43,10 +43,6 @@ interface ConditionalExports {
43
43
  * `node` field is required to resolve the path of package.json for build tools.
44
44
  */
45
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
46
  minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
51
47
  native?: AbstractPlatformExport<NativePlatformConfig>;
52
48
  web?: AbstractPlatformExport<WebPlatformConfig>;
@@ -70,6 +66,10 @@ interface ConditionalExports {
70
66
  * - 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
67
  */
72
68
  './editor'?: ExportCondition<{}>;
69
+ /**
70
+ * This export provide a the path of javascript module which exports some method to query the info of module.
71
+ */
72
+ './query'?: string;
73
73
  }
74
74
  interface ModuleOverride {
75
75
  /**
@@ -96,7 +96,7 @@ export interface ModuleConfig {
96
96
  /**
97
97
  * The config for conditional exports.
98
98
  */
99
- exports: ConditionalExports;
99
+ exports?: ConditionalExports;
100
100
  /**
101
101
  * Specify the module dependencies is required if this module import another one.
102
102
  * We need this field to generate the module dependency graph.
@@ -106,6 +106,14 @@ export interface ModuleConfig {
106
106
  * Specify the dev dependencies, these dependencies are always used in `scripts` folder.
107
107
  */
108
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>;
109
117
  /**
110
118
  * This is a CC-specific item difference from the node package.json standard specification.
111
119
  */
@@ -1 +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,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM;CACxD,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,OAAO,WAAW,GAAG,MAAM,OAAO,gBAAgB,GAAG,MAAM,OAAO,cAAc,CAAC,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElJ;;;;;;;;GAQG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;AAEhB;;GAEG;AACH,KAAK,eAAe,CAAC,CAAC,IAAI;IACtB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC,GAAG,CAAC,CAAC;AAEN,UAAU,kBAAkB;IACxB;;;;OAIG;IACH,GAAG,EAAE,eAAe,CAAC;QACjB;;WAEG;QACH,IAAI,EAAE,gBAAgB,CAAC;QACvB,QAAQ,CAAC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AE,eAAe,CAAC;QAC3B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAC;QAC1D,MAAM,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;QACtD,GAAG,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;KACnD,CAAC,CAAC;IACH;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAkBD,UAAU,cAAc;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;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,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;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"}
@@ -176,11 +176,6 @@
176
176
  ],
177
177
  "description": "Abstract platform export, like `web`, `native` and `minigame`. Usually this is used for PAL modules. The build tools resolve the relative platform as entry according to the build platform config.\n- The value can be a `string` or a `object` which requires a default item. eg. { \"web\": \"/path/to/index.ts\" } is equals to { \"web\": { default: \"/path/to/index.ts\" } }.\n- We can also specify the exact platform like { \"web\": {default: \"/path/to/index.ts\", \"web-desktop\": \"/path/to/index.ts\" } }."
178
178
  },
179
- "node": {
180
- "const": "./package.json",
181
- "description": "`node` should be specified as './package.json' to resolve the path of package.json for build tools.",
182
- "type": "string"
183
- },
184
179
  "types": {
185
180
  "description": "This is the main module export condition.\n- The dts bundle tools resolve this condition as entry.\n- The API doc tools resolve this condition as entry.\n- If no platform export is specified, the build tools resolve this condition as entry.",
186
181
  "type": "string"
@@ -217,7 +212,6 @@
217
212
  }
218
213
  },
219
214
  "required": [
220
- "node",
221
215
  "types"
222
216
  ],
223
217
  "type": "object"
@@ -391,6 +385,10 @@
391
385
  "types"
392
386
  ],
393
387
  "type": "object"
388
+ },
389
+ "./query": {
390
+ "description": "This export provide a the path of javascript module which exports some method to query the info of module.",
391
+ "type": "string"
394
392
  }
395
393
  },
396
394
  "required": [
@@ -402,6 +400,13 @@
402
400
  "description": "The module name.",
403
401
  "type": "string"
404
402
  },
403
+ "peerDependencies": {
404
+ "additionalProperties": {
405
+ "type": "string"
406
+ },
407
+ "description": "The dependencies between modules form a tree-structured dependency graph. The correct dependency relationship should be that the upper module depends on the lower module one-way, and the reverse is wrong. However, it is normal for modules at the same layer to depend on each other, and such dependencies should be declared as `peerDependencies`. Otherwise the Turbo pipeline will report an error due to module circular dependencies. see: https://github.com/vercel/turbo/issues/1480",
408
+ "type": "object"
409
+ },
405
410
  "version": {
406
411
  "description": "The version of module. It is useful when we change the module config, then we need to make some migration. This usually comes with the `cc.migrations` field.",
407
412
  "type": "string"
@@ -409,8 +414,7 @@
409
414
  },
410
415
  "required": [
411
416
  "name",
412
- "version",
413
- "exports"
417
+ "version"
414
418
  ],
415
419
  "type": "object"
416
420
  }
@@ -24,17 +24,30 @@ export interface ModuleQueryContext {
24
24
  */
25
25
  export declare class ModuleQuery {
26
26
  private _context;
27
- private _cachedAllModules?;
27
+ private _cachedModuleName2PkgJson?;
28
28
  private _resolvedCache;
29
+ private _cachedHasEditorSpecificExport;
29
30
  constructor(context: ModuleQueryContext);
30
31
  /**
31
32
  * Get all modules' name defined in engine workspaces.
32
33
  */
33
34
  getAllModules(): Promise<string[]>;
35
+ /**
36
+ * Get modules' all exports by module name.
37
+ */
38
+ getExports(moduleName: string): Promise<string[]>;
39
+ /**
40
+ * Get all the modules' exports.
41
+ */
42
+ getAllExports(): Promise<string[]>;
43
+ /**
44
+ * Get the map from module name to module path.
45
+ */
46
+ getExportMap(): Promise<Record<string, string>>;
34
47
  /**
35
48
  * Resolve module package.json path by module name.
36
49
  */
37
- resolvePackageJson(moduleName: string): string;
50
+ resolvePackageJson(moduleName: string): Promise<string>;
38
51
  /**
39
52
  * Get module config by module name.
40
53
  */
@@ -43,6 +56,12 @@ export declare class ModuleQuery {
43
56
  * Resolve module entry path by import source.
44
57
  */
45
58
  resolveExport(source: string): Promise<string | void>;
59
+ /**
60
+ * To detect whether the module has a './editor' export.
61
+ * @param moduleName
62
+ */
63
+ hasEditorSpecificExport(moduleName: string): Promise<boolean>;
64
+ private _ensureModuleName2PkgJson;
46
65
  private _isWebPlatform;
47
66
  private _isMiniGamePlatform;
48
67
  private _isNativePlatform;
@@ -1 +1 @@
1
- {"version":3,"file":"module-query.d.ts","sourceRoot":"","sources":["../src/module-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,YAAY,EAAwB,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAM9H,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,iBAAiB,CAAC,CAAW;IACrC,OAA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