-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support @types/cc-ambient-types #16215
Conversation
update fix build-declaration wip wip finish fix
@PPpro ❗ There was an error during the execution of the tasks. Please check the logs for more details. |
"node": "./src/index.d.ts", | ||
"types": "./src/index.d.ts" | ||
}, | ||
"./query": "./scripts/query.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we add this query
export to provide some interface to query info of the module, such as getDtsFiles()
cocos-engine/scripts/compile-native-ts.js
Lines 88 to 89 in bb83a86
let dtsFiles = require('@types/cc-ambient-types/query').getDtsFiles(); | |
dtsFiles = dtsFiles.map(file => ps.join(buildOutput, ps.relative(engineRoot, file)).slice(0, -'.d.ts'.length)); |
/* eslint-disable @typescript-eslint/triple-slash-reference */ | ||
// default ambient types | ||
/// <reference path="../lib/consts.d.ts"/> | ||
/// <reference path="./editor-extends.d.ts"/> | ||
/// <reference path="./globals.d.ts"/> | ||
/// <reference path="./jsb.d.ts"/> | ||
/// <reference path="./webGL.extras.d.ts"/> | ||
/// <reference path="./webGL2.extras.d.ts"/> | ||
|
||
// node_modules types | ||
/// <reference path="../../../node_modules/@cocos/cannon/CANNON.d.ts"/> | ||
|
||
// pal types | ||
/// <reference path="./pal/audio.d.ts"/> | ||
/// <reference path="./pal/input.d.ts"/> | ||
/// <reference path="./pal/minigame.d.ts"/> | ||
/// <reference path="./pal/pacer.d.ts"/> | ||
/// <reference path="./pal/screen-adapter.d.ts"/> | ||
/// <reference path="./pal/system-info.d.ts"/> | ||
/// <reference path="./pal/wasm.d.ts"/> | ||
/// <reference path="./pal/image.d.ts"/> | ||
|
||
// external types | ||
/// <reference path="../../../native/external/emscripten/external-wasm.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/bullet/bullet.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/physx/physx.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/webgpu/webgpu.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/spine/spine.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/meshopt/meshopt_decoder.d.ts"/> | ||
/// <reference path="../../../native/external/emscripten/box2d/box2d.d.ts"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we add types reference here
static load (url: string, opts?: import('pal/audio/type').AudioLoadOptions): Promise<AudioPlayer>; | ||
static load (url: string, opts?: import('../../../../pal/audio/type').AudioLoadOptions): Promise<AudioPlayer>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these relative paths could be fixed after they are modularized
"./@types/pal/pacer", | ||
"./@types/pal/wasm", | ||
"./@types/pal/image", | ||
"cc-ambient-types", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we solve the relative path issue in this way, see https://www.typescriptlang.org/tsconfig#types
Re: #15910
Changelog
@types/cc-ambient-types
module to provide global types definition for all modulesWhy we need this module ?
Before, we reference all the types in one root
tsconfig.json
, now we have more and more separate modules and each module has their owntsconfig.json
, but thetypes
config cannot be extended from the roottsconfig.json
because the reference path is relative path.If we don't provide this
@types/cc-ambient-types
module, we need to configtypes
in each module'stsconfig.json
, which would be much more cumbersome.Breaking Change
npm run build-declaration
andnpm run build-const
workflow and merge them intonpm run build
workflownpm run build
doesn't build engine anymore which is meaninglessnpm run build
will automatically run afternpm i
npm run build
will run all the modules build task withturbo build
, and run the root build task withnpm run build-root
gulp build-debug-infos && npm run bundle-adapter && npm run fetch-ral
workflow, we only need onenpm run build
command to finish all the build tasks.CI Failed Analysis
The interface check failed because the diff content is out of the maximum of string 65536.
Here are the interface compare data, most of the diff comes from the private type which is named as path. We can ignore these diff.
before.zip
after.zip
the <Native>Generate Code failure is fix here #16214 d3231a1
Continuous Integration
This pull request:
Compatibility Check
This pull request: