Files
cocos4/scripts/build-const.js
llsansun 2157fd176d Multithreading (#322)
* worker pool

* opt

* backup

* worker and worker backend

* worker fallback

* opt

* opt

* remove meta

* opt

* worker export

* testcase fix

* worker js template

* worker pal

* worker opt

* test

* Replace error messages with error codes

* Package size reduction

* Package size reduction

* revert

* Restore editor asset .meta files to the base branch state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HAtWwr4dy5azfpccweh1g

* bugfix

* Split into two features: Worker and Worker Pool

* worker option

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 16:35:14 +08:00

25 lines
972 B
JavaScript

require('./ensure-pal.cjs')();
const { StatsQuery } = require('@cocos/ccbuild');
const { join } = require('path');
const { outputFileSync } = require('fs-extra');
const { magenta, green } = require('chalk');
const engineRoot = join(__dirname, '../');
const targetConstFile = join(engineRoot, `./@types/consts.d.ts`);
const prefix = ''.padStart(20, '=');
console.log(magenta(`${prefix} Build const ${prefix}`));
StatsQuery.create(engineRoot).then((statsQuery) => {
const ic = statsQuery.constantManager.genInternalConstants();
const source = `/**\n`
+ ` * This is an auto-generated declaration file for constants internally used in engine.\n`
+ ` * You may regenerate it by running cli command \`npm run build-const\`.\n`
+ ` */\n`
+ `\n${
ic.replace(/\t/g, ' ')}`;
outputFileSync(targetConstFile, source, 'utf8');
console.log(green(`\nGenerate consts.d.ts: ${targetConstFile}\n`));
});