diff --git a/.gitignore b/.gitignore index d0661f683..3eb35364d 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ profiles/cocos.config.json # performance profiling artifacts perf/ + +static/scene-runtime/ diff --git a/docs/zh/scene-editor-extraction.md b/docs/zh/scene-editor-extraction.md index 05778dddf..06d25a8d3 100644 --- a/docs/zh/scene-editor-extraction.md +++ b/docs/zh/scene-editor-extraction.md @@ -56,3 +56,25 @@ CLI 场景 Worker 启用引擎的烘焙能力,同时设置引擎预览行为 私有包使用 CLI 明确列出的 `cocos-cli/host/...` 出口并要求精确匹配版本,已取消 `host/*` 通配导出。源码已迁入独立仓库,目标 IDE 仍需更新导入入口并做实际预览验收。新的内核和资源接口见 [场景 runtime 契约](scene-runtime-contract.md)。迁仓不移除 CLI 既有 Git 历史中的源码,独立仓库的访问权限需单独管理。 CLI 中立服务接口仍描述宿主可注册的 Camera/Gizmo 等通信契约,便于复用 RPC 和服务容器;CLI 单独启动时不注册这些可视化实现。接口类型的存在不代表服务可直接调用,宿主应先加载私有包的 `scene-entry`。 + +## 编辑器类型声明 + +编辑器类型统一扩展 `@cocos/cocos-cli-types` 现有领域声明。能力契约从 `scene` 入口导入: + +```ts +import type { HostCapabilities, BrowserCapabilities, BrowserHost, Editor } from '@cocos/cocos-cli-types/scene'; + +type SceneSessionDescriptor = Editor.Browser.SceneSessionProtocol.SceneSessionDescriptor; +``` + +原 `@cocos/scene-editor-types` 和 `@cocos/cocos-cli-types/scene-editor` 类型入口已移除。消费方应删除旧类型包和 `scene-editor/*` 的 TypeScript `paths` 配置,改用现有领域入口。每个领域的独有编辑器类型通过 `Editor.Host`、`Editor.Browser` 命名空间提供;模块标识按路径片段首字母大写并拼接,例如资产模块为 `assets` 入口的 `Editor.Host.CoreAssetsIndex`,场景会话协议为 `scene` 入口的 `Editor.Browser.SceneSessionProtocol`。原有公共类型继续直接从对应领域导入。本地源码联调可将 `@cocos/cocos-cli-types/*` 映射到 `packages/cocos-cli-types/*`。 + +`npm run generate:dts`(以及 `generate:dts:ci`)统一生成公共 API 并扩展编辑器声明。日常 `npm run compile` 也执行完整类型生成,保证每次从公共 API 的干净声明开始合并,避免重复叠加扩展。已有 `dist/**/*.d.ts` 时可直接运行 `npm run generate:dts:ci`;不再提供独立的编辑器类型生成命令。这些步骤整理已有声明,不会再次编译 TypeScript 源码。 + +生成器按原始编译符号和完整声明识别可复用的公共类型,剩余声明及必要依赖由 API Extractor 按领域合并到原有 `.d.ts`。编辑器全局扩展并入共用的 `cc.editor.d.ts`,`scene.d.ts` 引用这份引擎声明。类型包不再包含 `scene-editor/` 目录、`scene-editor.d.ts` 或内部模块路径兼容层。生成时的临时依赖图在完成后清理,不参与发布。 + +浏览器实际执行的 JavaScript 仍由 `npm run build:scene-runtime` 生成到 `dist/scene-runtime/`。 + +运行时打包和编辑器声明共用 `workflow/scene-api-entries.json`:`host` 定义宿主类型入口,`browser` 定义浏览器模块到实际实现的映射,`browserOptions` 描述默认导出、仅类型导出及副作用入口。普通实现路径相对 `src`,`cc/...` 保留引擎模块标识。 + +`workflow/scene-browser-api.js` 据此自动生成 `dist/core/scene/runtime/browser` 下的兼容 JS 和声明,保持 `cocos-cli/browser/*` 包出口与浏览器运行时入口不变;`prepare-dts`、运行时构建和编辑器类型生成都会准备这份产物。源码中不再维护 `src/core/scene/runtime/browser` 转发文件。配置入口直接复用 `scene-configs`,由 `typeOnly` 选项生成类型导出,运行时不加载宿主配置实例。`runtime/browser-assets` 中的宿主适配器、加载器等实际实现继续保留。 diff --git a/eslint.config.js b/eslint.config.js index afd98ec28..1af56ecb6 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -98,6 +98,15 @@ export default [ '@typescript-eslint/no-duplicate-enum-values': 'off', }, }, + { + files: ['packages/cocos-cli-types/*.d.ts'], + rules: { + // Generated ambient declarations preserve mutable namespace members + // and path references that load the engine's global augmentations. + 'no-var': 'off', + '@typescript-eslint/triple-slash-reference': 'off', + }, + }, { ignores: [ 'dist/**', @@ -107,6 +116,7 @@ export default [ '*.min.js', '*.bundle.js', 'packages/cocos-cli-types/cc.d.ts', + 'packages/cocos-cli-types/cc.editor.d.ts', ], }, ]; diff --git a/package-lock.json b/package-lock.json index 3eba8bcda..05cfd9988 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,6 +101,10 @@ "cocos": "dist/cli.js" }, "devDependencies": { + "@rollup/plugin-commonjs": "26.0.3", + "@rollup/plugin-json": "6.1.0", + "@rollup/plugin-node-resolve": "13.3.0", + "@rollup/plugin-virtual": "3.0.2", "@types/cli-progress": "^3.11.6", "@types/commander": "^2.12.5", "@types/compression": "^1.8.1", @@ -127,20 +131,28 @@ "7zip-bin": "^5.2.0", "baseline-browser-mapping": "^2.9.11", "basic-ftp": "^5.0.5", + "core-js-bundle": "3.46.0", "eslint": "^9.34.0", + "events": "2.1.0", "globals": "^16.3.0", "gulp": "^5.0.1", "ignore": "^5.3.2", "jest": "^29.7.0", "jest-html-reporter": "^4.3.0", "jiti": "^2.5.1", + "os-browserify": "0.3.0", "patch-package": "^8.0.1", + "path-browserify": "0.0.1", + "regenerator-runtime": "0.13.11", + "rollup": "2.79.2", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsx": "^4.19.2", "typescript": "^5.4.5", "typescript-eslint": "^8.42.0", - "typescript-json-schema": "^0.65.1" + "typescript-json-schema": "^0.65.1", + "url": "0.11.4", + "util": "0.10.4" }, "engines": { "electron": "42.3.0", diff --git a/package.json b/package.json index 274479b02..277910b16 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "build:simulator:native": "node workflow/build-simulator.js", "build:simulator:runtime": "node workflow/build-simulator-runtime.js", "build:simulator": "npm run build:simulator:native && npm run build:simulator:runtime", - "build": "npm run build:asset-db && npm run build:clear && node workflow/prepare-dts.js && tsc -b && node workflow/generate-schema.js && npm run generate:dts && npm run build:platform-views", - "compile": "npm run build:asset-db && npm run build:clear && node workflow/prepare-dts.js && tsc -b && npm run build:platform-views && node workflow/generate-schema.js", + "build": "npm run build:asset-db && npm run build:clear && node workflow/prepare-dts.js && tsc -b && node workflow/generate-schema.js && npm run generate:dts && npm run build:platform-views && npm run build:scene-runtime", + "compile": "npm run build:asset-db && npm run build:clear && node workflow/prepare-dts.js && tsc -b && npm run build:platform-views && node workflow/generate-schema.js && npm run build:scene-runtime && npm run generate:dts:ci", "build:clear": "node workflow/build-clear.js", "build:watch": "tsc -b --watch", "postinstall": "node workflow/postinstall.js", @@ -54,7 +54,8 @@ "start:mcp-inspector": "npx @modelcontextprotocol/inspector", "cli": "node ./dist/cli.js", "rebuild": "node workflow/electron-rebuild.js", - "rebuild:node-gyp": "node workflow/node-gyp-rebuild.js" + "rebuild:node-gyp": "node workflow/node-gyp-rebuild.js", + "build:scene-runtime": "node workflow/build-scene-runtime.js" }, "author": "COCOS", "files": [ @@ -113,7 +114,19 @@ "tsx": "^4.19.2", "typescript": "^5.4.5", "typescript-eslint": "^8.42.0", - "typescript-json-schema": "^0.65.1" + "typescript-json-schema": "^0.65.1", + "rollup": "2.79.2", + "@rollup/plugin-commonjs": "26.0.3", + "@rollup/plugin-virtual": "3.0.2", + "@rollup/plugin-json": "6.1.0", + "@rollup/plugin-node-resolve": "13.3.0", + "events": "2.1.0", + "path-browserify": "0.0.1", + "os-browserify": "0.3.0", + "util": "0.10.4", + "url": "0.11.4", + "core-js-bundle": "3.46.0", + "regenerator-runtime": "0.13.11" }, "dependencies": { "@babel/core": "7.22.20", @@ -579,6 +592,182 @@ "./host/core/scene/scene-process/service/node/prefab-canvas-mutation": { "types": "./dist/core/scene/scene-process/service/node/prefab-canvas-mutation.d.ts", "default": "./dist/core/scene/scene-process/service/node/prefab-canvas-mutation.js" + }, + "./browser/scene": { + "types": "./dist/core/scene/runtime/browser/scene.d.ts", + "default": "./dist/core/scene/runtime/browser/scene.js" + }, + "./browser/scene/context": { + "types": "./dist/core/scene/runtime/browser/scene/context.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/context.js" + }, + "./browser/scene/common": { + "types": "./dist/core/scene/runtime/browser/scene/common.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/common.js" + }, + "./browser/scene/config": { + "types": "./dist/core/scene/runtime/browser/scene/config.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/config.js" + }, + "./browser/scene/i18n": { + "types": "./dist/core/scene/runtime/browser/scene/i18n.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/i18n.js" + }, + "./browser/scene/rpc": { + "types": "./dist/core/scene/runtime/browser/scene/rpc.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/rpc.js" + }, + "./browser/scene/light-probe-normal-reset": { + "types": "./dist/core/scene/runtime/browser/scene/light-probe-normal-reset.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/light-probe-normal-reset.js" + }, + "./browser/scene/animation/property-commit-event": { + "types": "./dist/core/scene/runtime/browser/scene/animation/property-commit-event.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/animation/property-commit-event.js" + }, + "./browser/scene/editor-session": { + "types": "./dist/core/scene/runtime/browser/scene/editor-session.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/editor-session.js" + }, + "./browser/scene/dump": { + "types": "./dist/core/scene/runtime/browser/scene/dump.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/dump.js" + }, + "./browser/scene/engine": { + "types": "./dist/core/scene/runtime/browser/scene/engine.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/engine.js" + }, + "./browser/scene/message": { + "types": "./dist/core/scene/runtime/browser/scene/message.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/message.js" + }, + "./browser/scene/node": { + "types": "./dist/core/scene/runtime/browser/scene/node.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/node.js" + }, + "./browser/scene/node/node-create": { + "types": "./dist/core/scene/runtime/browser/scene/node/node-create.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/node/node-create.js" + }, + "./browser/scene/node/node-type-config": { + "types": "./dist/core/scene/runtime/browser/scene/node/node-type-config.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/node/node-type-config.js" + }, + "./browser/scene/node/node-utils": { + "types": "./dist/core/scene/runtime/browser/scene/node/node-utils.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/node/node-utils.js" + }, + "./browser/scene/node/prefab-canvas-mutation": { + "types": "./dist/core/scene/runtime/browser/scene/node/prefab-canvas-mutation.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/node/prefab-canvas-mutation.js" + }, + "./browser/scene/operation/types": { + "types": "./dist/core/scene/runtime/browser/scene/operation/types.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/operation/types.js" + }, + "./browser/scene/prefab/prefab-editor-utils": { + "types": "./dist/core/scene/runtime/browser/scene/prefab/prefab-editor-utils.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/prefab/prefab-editor-utils.js" + }, + "./browser/scene/reference-image": { + "types": "./dist/core/scene/runtime/browser/scene/reference-image.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/reference-image.js" + }, + "./browser/scene/scene/light-probe-snapshot": { + "types": "./dist/core/scene/runtime/browser/scene/scene/light-probe-snapshot.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/scene/light-probe-snapshot.js" + }, + "./browser/scene/scene/light-probe-transform": { + "types": "./dist/core/scene/runtime/browser/scene/scene/light-probe-transform.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/scene/light-probe-transform.js" + }, + "./browser/scene/scene/utils": { + "types": "./dist/core/scene/runtime/browser/scene/scene/utils.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/scene/utils.js" + }, + "./browser/scene/service-manager": { + "types": "./dist/core/scene/runtime/browser/scene/service-manager.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/service-manager.js" + }, + "./browser/scene/utils/asset-reload": { + "types": "./dist/core/scene/runtime/browser/scene/utils/asset-reload.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/utils/asset-reload.js" + }, + "./browser/scene/utils/editor-node": { + "types": "./dist/core/scene/runtime/browser/scene/utils/editor-node.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/utils/editor-node.js" + }, + "./browser/scene/utils/state-machine/finite-state-machine": { + "types": "./dist/core/scene/runtime/browser/scene/utils/state-machine/finite-state-machine.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/utils/state-machine/finite-state-machine.js" + }, + "./browser/scene/utils/state-machine/state-interface": { + "types": "./dist/core/scene/runtime/browser/scene/utils/state-machine/state-interface.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/utils/state-machine/state-interface.js" + }, + "./browser/scene/session/client": { + "types": "./dist/core/scene/runtime/browser/scene/session/client.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/session/client.js" + }, + "./browser/scene/session/methods": { + "types": "./dist/core/scene/runtime/browser/scene/session/methods.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/session/methods.js" + }, + "./browser/scene/session/protocol": { + "types": "./dist/core/scene/runtime/browser/scene/session/protocol.d.ts", + "default": "./dist/core/scene/runtime/browser/scene/session/protocol.js" + }, + "./browser/engine/editor-extends": { + "types": "./dist/core/scene/runtime/browser/engine/editor-extends.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/editor-extends.js" + }, + "./browser/engine/node-path": { + "types": "./dist/core/scene/runtime/browser/engine/node-path.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/node-path.js" + }, + "./browser/engine/serialize": { + "types": "./dist/core/scene/runtime/browser/engine/serialize.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/serialize.js" + }, + "./browser/engine/deserialize": { + "types": "./dist/core/scene/runtime/browser/engine/deserialize.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/deserialize.js" + }, + "./browser/engine/geometry": { + "types": "./dist/core/scene/runtime/browser/engine/geometry.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/geometry.js" + }, + "./browser/engine/prefab": { + "types": "./dist/core/scene/runtime/browser/engine/prefab.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/prefab.js" + }, + "./browser/engine/graphics-config": { + "types": "./dist/core/scene/runtime/browser/engine/graphics-config.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/graphics-config.js" + }, + "./browser/engine/polyfill": { + "types": "./dist/core/scene/runtime/browser/engine/polyfill.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/polyfill.js" + }, + "./browser/engine/overwrite": { + "types": "./dist/core/scene/runtime/browser/engine/overwrite.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/overwrite.js" + }, + "./browser/engine/editor/2d-misc": { + "types": "./dist/core/scene/runtime/browser/engine/editor/2d-misc.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/editor/2d-misc.js" + }, + "./browser/engine/editor/new-gen-anim": { + "types": "./dist/core/scene/runtime/browser/engine/editor/new-gen-anim.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/editor/new-gen-anim.js" + }, + "./browser/engine/editor/lod-group-utils": { + "types": "./dist/core/scene/runtime/browser/engine/editor/lod-group-utils.d.ts", + "default": "./dist/core/scene/runtime/browser/engine/editor/lod-group-utils.js" + }, + "./scene-editor/host": { + "types": "./dist/core/scene/runtime/plugin-host.d.ts", + "default": "./dist/core/scene/runtime/plugin-host.js" } } } diff --git a/packages/cc-module/statics/cc-template.d.ts b/packages/cc-module/statics/cc-template.d.ts index 3847b053d..fa8f5acca 100644 --- a/packages/cc-module/statics/cc-template.d.ts +++ b/packages/cc-module/statics/cc-template.d.ts @@ -18,6 +18,11 @@ declare const CC_PHYSICS_AMMO: boolean; declare const CC_PHYSICS_BUILTIN: boolean; declare const cc: any; +declare module 'cc/overwrite' { + function overwrite(engine: typeof import('cc')): void; + export = overwrite; +} + // polyfills for editor declare module 'cc' { interface CCObject { diff --git a/packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap b/packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap index 78f2c3d33..837028004 100644 --- a/packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap +++ b/packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap @@ -1,7 +1,62 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DTS API compatibility assets.d.ts should match snapshot 1`] = ` -"export declare interface AnimationClipAssetUserData { +"import { AnimationGraphChangedEvent as AnimationGraphChangedEvent_2 } from './assets'; +import { AnimationGraphExpectedVersion as AnimationGraphExpectedVersion_2 } from './assets'; +import { AnimationGraphInspectorPropertyOperationRequest as AnimationGraphInspectorPropertyOperationRequest_2 } from './assets'; +import { AnimationGraphInspectorSnapshot as AnimationGraphInspectorSnapshot_2 } from './assets'; +import { AnimationGraphMotionPreviewData as AnimationGraphMotionPreviewData_2 } from './assets'; +import { AnimationGraphPoseGraphAssetDragHandlersEntry as AnimationGraphPoseGraphAssetDragHandlersEntry_2 } from './assets'; +import { AnimationGraphSnapshot as AnimationGraphSnapshot_2 } from './assets'; +import { AnimationGraphTarget as AnimationGraphTarget_2 } from './assets'; +import { AnimGraphVariantDump as AnimGraphVariantDump_2 } from './assets'; +import { AssetActionEnum } from './builder'; +import { AssetDBOptions as AssetDBOptions_3 } from './builder'; +import { AssetDBRefreshOptions } from './builder'; +import { AssetDBStartOptions } from './builder'; +import { AssetOperationOption as AssetOperationOption_2 } from './assets'; +import { AssetPropertySchemaMap as AssetPropertySchemaMap_2 } from './assets'; +import { AssetUserDataMap as AssetUserDataMap_2 } from './assets'; +import { CreateAssetByTypeOptions as CreateAssetByTypeOptions_2 } from './assets'; +import { CreateAssetOptions as CreateAssetOptions_2 } from './assets'; +import { CustomConsole } from './builder'; +import { DeleteAssetOptions as DeleteAssetOptions_2 } from './assets'; +import { DependencyManager } from './builder'; +import type { EffectAsset } from 'cc'; +import EventEmitter from 'events'; +import { ExecuteAnimationGraphCommandRequest as ExecuteAnimationGraphCommandRequest_2 } from './assets'; +import { FilterPluginOptions as FilterPluginOptions_2 } from './assets'; +import { IAssetConfig as IAssetConfig_2 } from './assets'; +import { IAssetDBInfo as IAssetDBInfo_2 } from './assets'; +import { IAssetDeleteOptions as IAssetDeleteOptions_2 } from './assets'; +import { IAssetFileSystemProvider as IAssetFileSystemProvider_2 } from './assets'; +import { IAssetInfo as IAssetInfo_2 } from './assets'; +import { IAssetMeta as IAssetMeta_2 } from './assets'; +import { IAssetOperationContext as IAssetOperationContext_2 } from './assets'; +import { IAssetOperationKind as IAssetOperationKind_2 } from './assets'; +import { IAssetOperationOrigin as IAssetOperationOrigin_2 } from './assets'; +import { IAssetRenameOptions as IAssetRenameOptions_2 } from './assets'; +import { IAssetType as IAssetType_2 } from './assets'; +import { IAssetWriteFileOptions as IAssetWriteFileOptions_2 } from './assets'; +import { ICreateMenuInfo as ICreateMenuInfo_2 } from './assets'; +import { IData } from './builder'; +import { IExportData } from './builder'; +import { InfoManager } from './builder'; +import { IPluginScriptInfo as IPluginScriptInfo_2 } from './assets'; +import { IProperty as IProperty_2 } from './assets'; +import { ISupportCreateType as ISupportCreateType_2 } from './assets'; +import { IUerDataConfigItem as IUerDataConfigItem_2 } from './assets'; +import { Meta } from './builder'; +import { MetaManager } from './builder'; +import { MissingAssetInfo } from './builder'; +import { ParallelQueue } from './builder'; +import { QueryAssetsOption as QueryAssetsOption_2 } from './assets'; +import { QueryAssetType as QueryAssetType_2 } from './assets'; +import { ReloadAnimationGraphOptions as ReloadAnimationGraphOptions_2 } from './assets'; +import { SetAnimationGraphInspectorPropertyRequest as SetAnimationGraphInspectorPropertyRequest_2 } from './assets'; +import { ThumbnailInfo as ThumbnailInfo_2 } from './assets'; +import { ThumbnailSize as ThumbnailSize_2 } from './assets'; +export declare interface AnimationClipAssetUserData { name: string; } export declare const animationGraph: { @@ -20,6 +75,83 @@ export declare const animationGraph: { reload(uuidOrUrlOrPath: string, options?: ReloadAnimationGraphOptions, sourceId?: string): Promise; onChanged(listener: (event: AnimationGraphChangedEvent) => void): () => void; }; +declare const animationGraph_2: AnimationGraphAssetService; +declare class AnimationGraphAssetService { + private readonly _documents; + private readonly _queues; + private readonly _listeners; + query(uuidOrUrlOrPath: string): Promise; + queryInspector(uuidOrUrlOrPath: string, target: AnimationGraphTarget_2): Promise; + queryMotionPreviewData(uuidOrUrlOrPath: string, target: Extract): Promise; + queryPoseGraphAssetDragHandlers(): Promise; + private _queryPoseGraphEditingMetadata; + queryStateMachineComponentTypes(): Promise; + setInspectorProperty(uuidOrUrlOrPath: string, request: SetAnimationGraphInspectorPropertyRequest_2): Promise; + resetInspectorProperty(uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest_2): Promise; + createInspectorProperty(uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest_2): Promise; + private _applyInspectorOperation; + execute(uuidOrUrlOrPath: string, request: ExecuteAnimationGraphCommandRequest_2): Promise; + save(uuidOrUrlOrPath: string, expected: AnimationGraphExpectedVersion_2, sourceId?: string): Promise; + reload(uuidOrUrlOrPath: string, options?: ReloadAnimationGraphOptions_2, sourceId?: string): Promise; + onChanged(listener: AnimationGraphChangeListener): () => void; + runExternalWrite(uuidOrUrlOrPath: string, write: () => Promise): Promise; + runExternalWrites(uuids: string[], write: () => Promise): Promise; + assertExternalWriteAllowed(uuidOrUrlOrPath: string): void; + private _getOrLoad; + private _loadDocument; + private _loadProjectScripts; + private _queryAnimationGraphAsset; + private _readFingerprint; + private _refreshExternalState; + private _assertSourceUnchanged; + private _assertExpectedVersion; + private _markChanged; + private _emitChanged; + private _version; + private _snapshot; + private _inspectorSnapshot; + private _queryGraph; + private _queryGraphVariables; + private _queryLayer; + private _queryStateMachine; + private _queryState; + private _queryTransition; + private _queryTransitionCondition; + private _queryMotion; + private _queryPoseGraph; + private _resolveInspectorBinding; + private _createStateBinding; + private _createTransitionBinding; + private _createMotionBinding; + private _createPoseInputBinding; + private _encodePoseInputValue; + private _getLayer; + private _getLayerStateMachine; + private _getStateMachineByContext; + private _getStateMachineForAddress; + private _resolveState; + private _resolveTransition; + private _resolveMotion; + private _resolvePoseGraph; + private _getPoseGraphByContext; + private _resolvePoseNode; + private _nodeId; + private _executeCommand; + private _createMotion; + private _removeMotion; + private _createAssetReference; + private _serialize; + private _deserializeGraph; + private _cloneDocumentForMutation; + private _commitMutation; + private _collectPoseNodes; + private _commandPath; + private _targetNotFound; + private _nameConflict; + private _enqueue; +} export declare interface AnimationGraphChangedEvent { uuid: string; reason: 'inspector' | 'structure' | 'save' | 'reload' | 'external'; @@ -27,6 +159,7 @@ export declare interface AnimationGraphChangedEvent { sourceId?: string; changedPaths?: string[]; } +declare type AnimationGraphChangeListener = (event: AnimationGraphChangedEvent_2) => void; export declare type AnimationGraphCommand = | { type: 'add-layer'; name?: string } | { type: 'remove-layer'; layerIndex: number } @@ -302,6 +435,29 @@ export declare const animationGraphVariant: { change(uuid: string, dump: AnimGraphVariantDump): Promise; save(uuid: string): Promise; }; +declare const animationGraphVariant_2: AnimationGraphVariantAssetService; +declare class AnimationGraphVariantAssetService { + private _pendingEdits; + query(uuid: string): Promise; + change(uuid: string, dump: AnimGraphVariantDump_2): Promise; + save(uuid: string): Promise; + private _applyChange; + private _encodeVariant; + private _resetDump; + private _entryOverrides; + private _loadAnimationGraphVariant; + private _loadAnimationGraphByUuid; + private _readSerializedAsset; + private _deserializeWithAssetPlaceholders; + private _queryTypedAsset; + private _queryAssetUuid; + private _createAssetReference; + private _querySourceMtime; + private _snapshotGraph; + private _assertSourceUnchanged; + private _assertGraphUnchanged; + private _cloneDump; +} export declare interface AnimationGraphVersion extends AnimationGraphExpectedVersion { persistedRevision: number; dirty: boolean; @@ -362,7 +518,163 @@ export declare interface AnimGraphVariantDump { clips: Record; invalids?: Record; } +declare function applyEncodedPropertyOperation(owner: any, key: string, current: IProperty_2, attributes: any, operation: EncodedPropertyOperation): void; +declare function applyEncodedPropertyPatch(owner: any, key: string, current: IProperty_2, patch: IProperty_2 | unknown): Promise; +declare function applyPropertyObjectOperation(instance: any, path: string, operation: EncodedPropertyOperation): void; +declare function applyPropertyObjectPatch(instance: any, path: string, patch: IProperty_2 | unknown): Promise; +declare class Asset extends VirtualAsset_2 { + _source: string; + get source(): string; + _url: string; + get url(): string; + extname: string; + basename: string; + constructor(source: string, meta: Meta, assetDB: AssetDB); + updateUrl(): void; + save(): Promise; + isDirectory(): boolean; +} +declare class Asset_2 extends Asset { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} export declare const ASSET_HANDLER_TYPES: readonly ["directory", "unknown", "text", "json", "spine-data", "dragonbones", "dragonbones-atlas", "terrain", "javascript", "typescript", "scene", "prefab", "sprite-frame", "tiled-map", "buffer", "image", "sign-image", "alpha-image", "texture", "texture-cube", "erp-texture-cube", "render-texture", "texture-cube-face", "rt-sprite-frame", "gltf", "gltf-mesh", "gltf-animation", "gltf-skeleton", "gltf-material", "gltf-scene", "gltf-embeded-image", "fbx", "material", "physics-material", "effect", "effect-header", "audio-clip", "animation-clip", "animation-graph", "animation-graph-variant", "animation-mask", "ttf-font", "bitmap-font", "particle", "sprite-atlas", "auto-atlas", "label-atlas", "render-pipeline", "render-stage", "render-flow", "instantiation-material", "instantiation-mesh", "instantiation-skeleton", "instantiation-animation", "video-clip", "*", "database"]; +declare class AssetDB extends EventEmitter { + static readonly version = "1.0.1"; + options: AssetDBOptions_3; + flag: { + starting: boolean; + started: boolean; + }; + path2asset: Map; + uuid2asset: Map; + importerManager: any; + metaManager: MetaManager; + console: CustomConsole; + infoManager: InfoManager; + dependencyManager: DependencyManager; + taskManager: ParallelQueue; + dataManager: DataManager; + _lock: boolean; + _waitLockHandler: Function[]; + cachePath: string; + get assetProgressInfo(): { + current: number; + total: number; + wait: any; + }; + private lock; + private unlock; + constructor(options: AssetDBOptions_3); + preImporterHandler?(file: string): boolean; + private prepareStart; + start(options?: AssetDBStartOptions): Promise; + startWithCache(): Promise; + updateInfoManager(): Promise; + private _generateRecordInfo; + save(): Promise; + private restoreFromCache; + stop(): Promise; + pathToUuid(path: string): string | null; + uuidToPath(uuid: string): string | null; + getAsset(uuid: string): VirtualAsset_2 | null; + reimport(fileOrUUID: string): Promise; + refresh(path: string, options?: AssetDBRefreshOptions): Promise; + private _replaceUUID; + private _updateAssetPathCase; + private _checkAssetsStatSync; + private _checkAssetStat; +} +declare namespace assetdb { + export { + create, + forEach, + setDefaultUserData, + Importer_2 as Importer, + Migrate, + AssetActionEnum, + Asset, + VirtualAsset_2 as VirtualAsset, + AssetDB, + AssetDBOptions_3 as AssetDBOptions, + IAssetDeleteOptions_2 as IAssetDeleteOptions, + IAssetFileSystemProvider_2 as IAssetFileSystemProvider, + IAssetOperationContext_2 as IAssetOperationContext, + IAssetOperationKind_2 as IAssetOperationKind, + IAssetOperationOrigin_2 as IAssetOperationOrigin, + IAssetRenameOptions_2 as IAssetRenameOptions, + IAssetWriteFileOptions_2 as IAssetWriteFileOptions, + IAssetFileStat, + isSubPath, + nameToId, + Utils, + get, + queryAsset, + queryMissingInfo, + queryUrl_2 as queryUrl, + queryPath_2 as queryPath, + queryUUID_2 as queryUUID, + reimport, + refresh_2 as refresh, + getFileSystemProvider, + resetFileSystemProvider, + setFileSystemProvider_2 as setFileSystemProvider + } +} +declare class AssetDBManager extends EventEmitter { + assetDBMap: Record; + globalInternalLibrary: boolean; + setFileSystemProvider(provider: IAssetFileSystemProvider_2): void; + private hasPause; + private startPause; + get isPause(): boolean; + ready: boolean; + private waitPauseHandle?; + private waitPausePromiseTask?; + private state; + assetDBInfo: Record; + private waitingTaskQueue; + private waitingRefreshAsset; + private pendingAutoRefreshResolves; + private autoRefreshTimer?; + private get assetBusy(); + private reimportCheck; + private assetBusyTask; + private pluginManager; + private assetHandlerManager; + static useCache: boolean; + static libraryRoot: string; + static tempRoot: string; + get free(): boolean; + init(): Promise; + start(): Promise; + private _start; + private _startDirectly; + private _startFromCache; + isBusy(): boolean; + hasDB(name: string): boolean; + private startDB; + path2url(path: string, dbName?: string): string; + private _createDB; + private _preStartDB; + private _startupDB; + _startDB(name: string): Promise; + addDB(info: AssetDBRegisterInfo): Promise; + removeDB(name: string): Promise; + private _operate; + private _removeDB; + refresh(): Promise; + private _refresh; + autoRefreshAssetLazy(pathOrUrlOrUUID: string): Promise; + resume(): Promise; + addTask(func: Function, args: any[]): Promise; + private _addTaskToQueue; + step(): Promise; + pause(source?: string): Promise; +} +declare const assetDBManager: AssetDBManager; export declare interface AssetDBOptions { name: string; target: string; @@ -390,6 +702,98 @@ export declare interface AssetDBOptions_2 { }; importConcurrency?: number; } +declare interface AssetDBRegisterInfo { + name: string; + target: string; + readonly: boolean; + visible: boolean; + globList?: string[]; + preImportExtList?: string[]; + library?: string; + temp?: string; +} +declare type AssetHandler = AssetHandlerBase | CustomAssetHandler; +declare interface AssetHandlerBase extends CustomHandlerBase { + displayName?: string; + description?: string; + docURL?: string; + validate?(asset: IAsset): Promise; + importer: Importer; + exporter?: Exporter; + destroy?: (asset: IAsset) => Promise; + assetType?: IAssetType_2; + propertySchemaConfig?: AssetPropertySchemaMap_2; + userDataConfig?: { + default: Record; + generate?(asset: IAsset): Promise>; + }; + createInfo?: { + generateMenuInfo?(): ICreateMenuInfo_2[] | Promise; + create?(option: CreateAssetOptions_2): Promise; + save?(asset: IAsset, content: string | Buffer | JSON): boolean | Promise; + preventDefaultTemplateMenu?: boolean; + }; + instantiation?: string; + generateThumbnail?(asset: IAsset, size?: ThumbnailSize_2): Promise; +} +declare interface AssetHandlerInfo { + name: string; + extensions: string[]; + load: () => AssetHandler | Promise; +} +declare class AssetHandlerManager { + static createTemplateRoot: string; + name2handler: Record; + type2handler: Record; + name2importer: Record; + importer2OperateRecord: { + [importer: string]: { + [operate: string]: AssetHandler | CustomHandler; + }; + }; + extname2registerInfo: Record; + name2registerInfo: Record; + name2custom: Record; + importer2custom: Record; + _userDataCache: Record; + _defaultUserData: Record; + clear(): void; + compileEffect(_force: boolean): void; + startAutoGenEffectBin(): void; + getEffectBinPath(): Promise; + init(): Promise; + activateRegisterAll(): Promise; + private ensureHandler; + private activateRegister; + register(pkgName: string, assetHandlerInfos: AssetHandlerInfo[], internal: boolean): void; + unregister(pkgName: string, assetHandlerInfos: AssetHandlerInfo[]): void; + findImporter(asset: IAsset, withoutDefaultImporter?: boolean): Promise; + getDefaultImporter(asset: IAsset): Promise; + _findImporterInRegisterInfo(asset: IAsset, registerInfos: HandlerInfo[]): Promise; + add(assetHandler: AssetHandler, extensions: string[]): void; + getCreateMap(): Promise; + getCreateMenuByName(importer: string): Promise; + createAssetTemplate(importer: string, templatePath: string, target: string): Promise; + createAsset(options: CreateAssetOptions_2): Promise; + destroyAsset(asset: IAsset): Promise; + saveAsset(asset: IAsset, content: string | Buffer): Promise; + generateExportData(asset: IAsset, options?: IExportOptions): Promise; + outputExportData(handler: string, src: IExportData, dest: IExportData): Promise; + queryRawAssetConfigMap(): Promise>; + queryAssetConfigMap(): Promise>; + queryThumbnailHandlers(): string[]; + generateThumbnail(asset: IAsset, size?: ThumbnailSize_2): Promise; + queryUserDataConfig(asset: IAsset): Promise | undefined>; + queryUserDataConfigDefault(importer: string): Promise | undefined>; + queryPropertySchema(importer: string): Promise; + runImporterHook(asset: IAsset, hookName: 'before' | 'after'): Promise; + _findOperateHandler(importer: string, operate: keyof AssetHandler): CustomHandler | AssetHandler | null; + queryAllImporter(): string[]; + queryAllAssetTypes(): unknown[]; + updateDefaultUserData(handler: string, key: string, value: any): Promise; + private _updateDefaultUserDataToHandler; +} +declare const assetHandlerManager: AssetHandlerManager; export declare type AssetHandlerType = | typeof ASSET_HANDLER_TYPES[number] | (string & {}); @@ -414,6 +818,163 @@ export declare interface AssetInfo extends IAssetInfo { imported: boolean; invalid: boolean; } +declare class AssetManager extends EventEmitter { + queryAssets: (options?: QueryAssetsOption_2) => IAsset[]; + queryAssetDependencies: (uuidOrURL: string, type?: QueryAssetType_2) => Promise; + queryAssetUsers: (uuidOrURL: string, type?: QueryAssetType_2) => Promise; + queryAsset: (uuidOrURLOrPath: string) => IAsset | null; + queryAssetInfo: (urlOrUUIDOrPath: string, dataKeys?: readonly (keyof IAssetInfo_2)[]) => IAssetInfo_2 | null; + queryAssetInfoByUUID: (uuid: string, dataKeys?: readonly (keyof IAssetInfo_2)[]) => IAssetInfo_2 | null; + queryAssetInfos: (options?: QueryAssetsOption_2, dataKeys?: readonly (keyof IAssetInfo_2)[]) => IAssetInfo_2[]; + querySortedPlugins: (filterOptions?: FilterPluginOptions_2) => IPluginScriptInfo_2[]; + queryUUID: (urlOrPath: string) => string | null; + queryPath: (urlOrUuid: string) => string; + queryUrl: (uuidOrPath: string) => string; + generateAvailableURL: (url: string) => string; + queryDBAssetInfo: (name: string) => IAssetInfo_2 | null; + encodeAsset: (asset: IAsset, dataKeys?: readonly (keyof IAssetInfo_2)[], invalid?: boolean) => IAssetInfo_2; + queryAssetProperty: (asset: IAsset, property: (keyof IAssetInfo_2 | "depends" | "dependScripts" | "dependedScripts")) => any; + queryAssetMeta: (uuidOrURLOrPath: string) => IAssetMeta_2 | null; + querySubAssetName: (mainUuid: string, subId: string) => string | null; + queryAssetMtime: (uuid: string) => number | null; + importAsset: (source: string, target: string, options?: AssetOperationOption_2) => Promise; + copyAsset: (source: string, target: string, options?: AssetOperationOption_2) => Promise; + saveAssetMeta: (uuid: string, meta: IAssetMeta_2, asset?: IAsset) => Promise; + saveAsset: (uuidOrURLOrPath: string, content: string | Buffer) => Promise; + createAsset: (options: CreateAssetOptions_2) => Promise; + refreshAsset: (pathOrUrlOrUUID: string) => Promise; + refreshAssetOnly: (pathOrUrlOrUUID: string) => Promise; + reimportAsset: (pathOrUrlOrUUID: string) => Promise; + renameAsset: (source: string, newName: string, option?: AssetOperationOption_2) => Promise; + removeAsset: (uuidOrURLOrPath: string, options?: DeleteAssetOptions_2) => Promise; + moveAsset: (source: string, target: string, option?: AssetOperationOption_2) => Promise; + generateExportData: (asset: Asset, options?: IExportOptions) => Promise; + outputExportData: (handler: string, src: IExportData, dest: IExportData) => Promise; + createAssetByType: (type: ISupportCreateType_2, dirOrUrl: string, baseName: string, options?: CreateAssetByTypeOptions_2) => Promise; + updateUserData: (uuidOrURLOrPath: string, userData: AssetUserDataMap_2[T]) => Promise; + updateUserDataByPath: (uuidOrURLOrPath: string, path: string, value: any) => Promise; + querySerializedData: typeof serializedData_2.querySerializedData; + saveSerializedData: typeof serializedData_2.saveSerializedData; + queryMaterial: typeof materialService.queryMaterial; + queryMaterialEffect: typeof materialService.queryEffect; + queryMaterialAllEffects: typeof materialService.queryAllEffects; + saveMaterial: typeof materialService.saveMaterial; + queryAnimationGraph: (uuidOrUrlOrPath: string) => Promise; + queryAnimationGraphInspector: (uuidOrUrlOrPath: string, target: AnimationGraphTarget_2) => Promise; + queryAnimationGraphMotionPreviewData: (uuidOrUrlOrPath: string, target: Extract) => Promise; + queryAnimationGraphPoseGraphAssetDragHandlers: () => Promise; + queryAnimationGraphStateMachineComponentTypes: () => Promise; + setAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: SetAnimationGraphInspectorPropertyRequest_2) => Promise; + resetAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest_2) => Promise; + createAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest_2) => Promise; + executeAnimationGraphCommand: (uuidOrUrlOrPath: string, request: ExecuteAnimationGraphCommandRequest_2) => Promise; + saveAnimationGraph: (uuidOrUrlOrPath: string, expected: AnimationGraphExpectedVersion_2, sourceId?: string) => Promise; + reloadAnimationGraph: (uuidOrUrlOrPath: string, options?: ReloadAnimationGraphOptions_2, sourceId?: string) => Promise; + onAnimationGraphChanged: (listener: (event: AnimationGraphChangedEvent_2) => void) => () => void; + queryAnimationGraphVariant: (uuid: string) => Promise; + changeAnimationGraphVariant: (uuid: string, dump: AnimGraphVariantDump_2) => Promise; + saveAnimationGraphVariant: (uuid: string) => Promise; + queryAssetConfigMap: () => Promise>; + queryPropertySchema: (importer: string) => Promise; + updateDefaultUserData: (handler: string, key: string, value: any) => Promise; + getCreateMap: () => Promise; + queryAssetUserDataConfig: (asset: IAsset) => Promise | undefined>; + queryThumbnailHandlers: () => string[]; + generateThumbnail(urlOrUUIDOrPath: string, size?: ThumbnailSize_2): Promise; + extractImagePixels(urlOrUUIDOrPath: string, options: IImagePixelExtractionOptions): Promise; + getEffectBinPath(): Promise; + url2uuid(url: string): string; + url2path(url: string): string; + path2url(url: string, dbName?: string): string; + onAssetAdded(listener: (info: IAssetInfo_2) => void): () => void; + onAssetChanged(listener: (info: IAssetInfo_2) => void): () => void; + onAssetRemoved(listener: (info: IAssetInfo_2) => void): () => void; + init(): Promise; + destroyed(): void; + private _extractAssetChangeInfo; + private _snapshotAssetChangeInfo; + _onAssetDBCreated(db: AssetDB): void; + _onAssetDBRemoved(db: AssetDB): void; + private _removeProgressListeners; + private _getImportState; + private _emitProgress; + _onAssetAdd: (asset: IAsset) => Promise; + _onAssetChange: (asset: IAsset) => Promise; + _onAssetDelete: (asset: IAsset) => Promise; + _onAssetAdded: (asset: IAsset) => Promise; + _onAssetChanged: (asset: IAsset) => Promise; + _onAssetDeleted: (asset: IAsset) => Promise; + onReady(listener: () => void): () => void; + onDBReady(listener: (dbInfo: IAssetDBInfo_2) => void): () => void; + onProgress(listener: (current: number, total: number, url: string, state: 'processing' | 'success' | 'failed') => void): () => void; +} +declare const assetManager: AssetManager; +declare interface AssetManagerEvents { + 'asset-add': (asset: IAsset) => void; + 'asset-change': (asset: IAsset) => void; + 'asset-delete': (asset: IAsset) => void; + 'onAssetAdded': (info: IAssetInfo_2) => void; + 'onAssetChanged': (info: IAssetInfo_2) => void; + 'onAssetRemoved': (info: IAssetInfo_2) => void; + 'progress': (current: number, total: number, url: string, state: 'processing' | 'success' | 'failed') => void; + 'db-ready': (dbInfo: IAssetDBInfo_2) => void; + 'ready': () => void; +} +declare class AssetOperation extends EventEmitter { + private readonly _importTaskByTargetPath; + private readonly _reservedImportTargetPaths; + _checkReadonly(asset: IAsset): void; + _checkExists(path: string): void; + _checkOverwrite(path: string, option?: AssetOperationOption_2, isOccupied?: (path: string) => boolean): string; + _checkRenameNewName(asset: IAsset, newName: string): void; + saveAssetMeta(uuid: string, meta: IAssetMeta_2, asset?: IAsset): Promise; + updateUserData(uuidOrURLOrPath: string, userData: AssetUserDataMap_2[T]): Promise; + updateUserDataByPath(uuidOrURLOrPath: string, path: string, value: any): Promise; + saveAsset(uuidOrURLOrPath: string, content: string | Buffer): Promise; + saveAnimationGraphDocument(uuidOrURLOrPath: string, content: string | Buffer): Promise; + private _saveAssetContent; + private _validateAssetContentBeforeSave; + private _validateScriptContentBeforeSave; + private _validateSceneOrPrefabContentBeforeSave; + checkValidUrl(urlOrPath: string): boolean; + createAsset(options: CreateAssetOptions_2): Promise; + createAssetByType(type: ISupportCreateType_2, dirOrUrl: string, baseName: string, options?: CreateAssetByTypeOptions_2): Promise; + private _resolveCreateAssetDir; + importAsset(source: string, target: string, options?: AssetOperationOption_2): Promise; + private _importAsset; + private _queueImportByTargetPath; + private _isPathOccupied; + private _reserveImportTargetPath; + private _getImportTargetKey; + copyAsset(source: string, target: string, options?: AssetOperationOption_2): Promise; + private _copyAsset; + private _copyAssetSource; + generateExportData(asset: Asset, options?: IExportOptions): Promise; + outputExportData(handler: string, src: IExportData, dest: IExportData): Promise; + refreshAsset(pathOrUrlOrUUID: string): Promise; + refreshAssetOnly(pathOrUrlOrUUID: string): Promise; + private _refreshAsset; + private _pathToDbUrlIfInsideAssetDB; + private _isSameFilesystemPath; + private _dirnameForRefresh; + reimportAsset(pathOrUrlOrUUID: string): Promise; + private _reimportAsset; + moveAsset(source: string, target: string, option?: AssetOperationOption_2): Promise; + private _moveAsset; + renameAsset(source: string, newName: string, option?: AssetOperationOption_2): Promise; + private _renameAsset; + removeAsset(uuidOrURLOrPath: string, options?: DeleteAssetOptions_2): Promise; + private _runAnimationGraphExternalWrite; + private _queryAnimationGraphAssetsAt; + private _isAssetDirectory; + private _isAssetInDatabase; + private _isAnimationGraphAsset; + private _runAnimationGraphExternalWrites; + private _removeAsset; +} +declare const assetOperation: AssetOperation; export declare interface AssetOperationOption { overwrite?: boolean; rename?: boolean; @@ -423,6 +984,28 @@ export declare interface AssetOperationOption { rename?: boolean; } export declare type AssetPropertySchemaMap = Record; +declare const assetQuery_2: AssetQueryManager; +declare class AssetQueryManager { + queryAssetDependencies(uuidOrURL: string, type?: QueryAssetType_2): Promise; + queryAssetUsers(uuidOrURL: string, type?: QueryAssetType_2): Promise; + queryAsset(uuidOrURLOrPath: string): IAsset | null; + queryAssetInfo(urlOrUUIDOrPath: string, dataKeys?: readonly (keyof IAssetInfo_2)[]): IAssetInfo_2 | null; + queryAssetInfoByUUID(uuid: string, dataKeys?: readonly (keyof IAssetInfo_2)[]): IAssetInfo_2 | null; + queryAssetInfos(options?: QueryAssetsOption_2, dataKeys?: readonly (keyof IAssetInfo_2)[]): IAssetInfo_2[]; + queryAssets(options?: QueryAssetsOption_2): IAsset[]; + querySortedPlugins(filterOptions?: FilterPluginOptions_2): IPluginScriptInfo_2[]; + encodeAsset(asset: IAsset, dataKeys?: readonly (keyof IAssetInfo_2)[], invalid?: boolean): IAssetInfo_2; + queryAssetProperty(asset: IAsset, property: (keyof IAssetInfo_2 | 'depends' | 'dependScripts' | 'dependedScripts')): any; + queryAssetMeta(uuidOrURLOrPath: string): IAssetMeta_2 | null; + querySubAssetName(mainUuid: string, subId: string): string | null; + private _findSubAssetNameFromMeta; + queryAssetMtime(uuid: string): number | null; + queryUUID(urlOrPath: string): string | null; + queryDBAssetInfo(name: string): IAssetInfo_2 | null; + queryUrl(uuidOrPath: string): string; + queryPath(urlOrUuid: string): string; + generateAvailableURL(url: string): string; +} export declare interface AssetUserDataMap { 'animation-clip': AnimationClipAssetUserData; 'auto-atlas': AutoAtlasAssetUserData; @@ -487,6 +1070,16 @@ export declare interface BitmapFontAssetUserData { textureUuid: string; } export declare function copyAsset(source: string, target: string, options?: AssetOperationOption): Promise; +export declare namespace CoreAssetsIndex { + export { + initAssetDB, + startAssetDB, + stopAssetDB, + typedAssetManager as assetManager, + assetDBManager + } +} +declare function create(options: AssetDBOptions_3): AssetDB; export declare function createAsset(options: CreateAssetOptions): Promise; export declare function createAssetByType(ccType: ISupportCreateType, dirOrUrl: string, baseName: string, options?: CreateAssetByTypeOptions): Promise; export declare interface CreateAssetByTypeOptions extends AssetOperationOption { @@ -504,6 +1097,51 @@ export declare interface CreateAssetOptions { userData?: Record; customOptions?: Record; } +declare interface CustomAssetHandler extends Partial { + name: string; + extends: string; + importer?: ImporterHook | Importer; +} +declare interface CustomHandler extends CustomHandlerBase { + handlerList: string[]; + importer?: { + before: (asset: IAsset) => Promise; + after: (asset: IAsset) => Promise; + }; + importer?: ImporterHook; + customOperationMap?: Record; +} +declare interface CustomHandlerBase { + name: string; + open?(asset: IAsset): boolean | Promise; + customOperationMap?: Record; +} +declare class CustomImporter extends Importer_2 { + constructor(extensions: string[], assetHandler: AssetHandler); +} +declare interface CustomOperator { + label?: string; + operator: (...args: any[]) => any | Promise; + public?: boolean; +} +declare class DataManager { + file: string | undefined; + dataMap: { + [uuid: string]: IData; + }; + _saveTimer: any; + private console; + constructor(customConsole: CustomConsole); + setRecordJSON(json: string): Promise; + save(): void; + saveImmediate(): void; + has(asset: VirtualAsset_2): boolean; + empty(asset: VirtualAsset_2): void; + update(asset: VirtualAsset_2): void; + setValue(asset: VirtualAsset_2, key: string, value: any): void; + getValue(asset: VirtualAsset_2, key: string): any; + get(asset: VirtualAsset_2, key?: keyof IData): null | any; +} export declare function deleteAsset(dbPath: string, options?: DeleteAssetOptions): Promise; export declare interface DeleteAssetOptions { useTrash?: boolean; @@ -514,10 +1152,24 @@ export declare interface DirectoryAssetUserData { bundleName?: string; priority?: number; } +export declare namespace Editor { + export { + Host + } +} export declare interface EffectAssetUserData { combinations?: any; editor?: any; } +declare type EncodedPropertyOperation = 'reset' | 'create'; +declare interface EncodedPropertyOperationCapabilities { + set: boolean; + reset: boolean; + create: boolean; +} +declare function encodeEffect(effect: EffectAsset, effectUuid?: string): MaterialTechniqueDump_2[]; +declare function encodePropertyObject(instance: any, name?: string): IProperty_2; +declare function encodeSerializedObject(object: any, attributes: any, owner?: any, objectKey?: string, isTemplate?: boolean): IProperty_2; export declare interface ExecuteAnimationGraphCommandRequest { command: AnimationGraphCommand; expected: AnimationGraphExpectedVersion; @@ -529,6 +1181,10 @@ export declare interface ExecuteAssetDBScriptMethodOptions { args?: any[]; } export declare function exportAssetPackage(urls: string[], destination: string, includeDependencies?: boolean): Promise; +declare interface Exporter { + generateExportData?: (asset: IAsset, options?: Partial) => IExportData | Promise; + outputExportData?: (src: IExportData, dest: IExportData) => boolean | Promise; +} export declare interface FileNameCheckConfig { regStr: string; failedType: 'error' | 'warn' | 'info', @@ -562,7 +1218,12 @@ export declare interface FontDef { export declare interface FontDefDictionary { [charId: number]: FontDef; } +declare function forEach(handler: Function): void; export declare function generateThumbnail(urlOrUUIDOrPath: string, size?: ThumbnailSize): Promise; +declare function get(name: string): AssetDB; +declare function getDefaultValueByType(type: string, data?: any): any; +declare function getEncodedPropertyOperationCapabilities(current: IProperty_2, attributes: any): EncodedPropertyOperationCapabilities; +declare function getFileSystemProvider(): IAssetFileSystemProvider_2; export declare interface GltfAnimationAssetUserData { gltfIndex: number; events: Array<{ @@ -636,6 +1297,16 @@ export declare interface GlTFUserData { options: LODsOption[]; }; } +declare interface HandlerInfo extends AssetHandlerInfo { + pkgName: string; + internal: boolean; +} +export declare namespace Host { + export { + CoreAssetsIndex + } +} +declare type IAsset = VirtualAsset | Asset_2; export declare interface IAssetConfig { displayName?: string; description?: string; @@ -651,6 +1322,10 @@ export declare interface IAssetDeleteOptions extends IAssetOperationOptionsBase recursive?: boolean; useTrash?: boolean; } +declare interface IAssetFileStat { + mtimeMs: number; + isDirectory(): boolean; +} export declare interface IAssetFileSystemProvider { readFile?(path: string, encoding?: BufferEncoding): Promise | Buffer | string; writeFile?(path: string, content: Buffer | string | Uint8Array, options?: IAssetWriteFileOptions): Promise | void; @@ -782,6 +1457,18 @@ export declare interface ICreateMenuInfo { group?: string; fileNameCheckConfigs?: FileNameCheckConfig[]; } +declare interface IExportOptions { + debug: boolean; + compressUUID: boolean; + stripDefault: boolean; + canUseCache: boolean; +} +declare interface IExtractedImagePixels { + dataBase64: string; + width: number; + height: number; + channels: number; +} export declare interface IFbxSetting { unitConversion?: 'geometry-level' | 'hierarchy-level' | 'disabled'; animationBakeRate?: 0 | 24 | 25 | 30 | 60; @@ -789,6 +1476,15 @@ export declare interface IFbxSetting { smartMaterialEnabled?: boolean; matchMeshNames?: boolean; } +declare interface IImagePixelExtractionOptions { + rect: { + left: number; + top: number; + width: number; + height: number; + }; + rotation?: 0 | 90; +} export declare interface ImageAssetUserData { type: ImageImportType; flipVertical?: boolean; @@ -808,7 +1504,41 @@ export declare interface ImageMeta { remap?: string; } export declare function importAsset(source: string, target: string, options?: AssetOperationOption): Promise; +declare interface Importer { + version: string; + versionCode?: number; + import(asset: VirtualAsset | Asset_2): Promise; + migrations?: Migrate[]; + afterSubAssetsImport?(asset: Asset_2): Promise; + force?(asset: VirtualAsset | Asset_2): Promise; +} +declare class Importer_2 { + _name: string; + _version: string; + _versionCode: number; + _migrationHook: MigrateHook; + _migrations: Migrate[]; + get version(): string; + get versionCode(): number; + extnames: string[]; + flag: { + [name: string]: boolean; + }; + get migrations(): Migrate[]; + get migrationHook(): MigrateHook; + get name(): string; + validate(asset: VirtualAsset_2 | Asset): Promise; + force(asset: VirtualAsset_2 | Asset): Promise; + import(asset: VirtualAsset_2 | Asset): Promise; + afterSubAssetsImport?(asset: VirtualAsset_2 | Asset): Promise; + checkAwake?(asset: VirtualAsset_2 | Asset): Promise; +} +declare interface ImporterHook { + before?: (asset: IAsset) => Promise; + after?: (asset: IAsset) => Promise; +} export declare function init(): Promise; +declare function initAssetDB(): Promise; export declare interface IPluginScriptInfo extends PluginScriptInfo { url: string; } @@ -874,6 +1604,7 @@ export declare interface IRedirectInfo { type: string; uuid: string; } +declare function isSubPath(candidate: string, root: string): boolean; export declare type ISupportCreateCCType = | 'cc.AnimationClip' | 'cc.Script' @@ -971,12 +1702,23 @@ export declare interface MaterialDump { technique: number; data: MaterialTechniqueDump[]; } +declare interface MaterialDump_2 { + effect: string; + technique: number; + data: MaterialTechniqueDump_2[]; +} export declare interface MaterialEffectInfo { uuid: string; name: string; hideInEditor?: boolean; assetPath: string; } +declare interface MaterialEffectInfo_2 { + uuid: string; + name: string; + hideInEditor?: boolean; + assetPath: string; +} export declare interface MaterialPassDump { index: number; name?: string; @@ -987,10 +1729,37 @@ export declare interface MaterialPassDump { defines: IProperty[]; states: IProperty; } +declare interface MaterialPassDump_2 { + index: number; + name?: string; + phase?: string; + switch?: IProperty_2; + propertyIndex: IProperty_2; + props: IProperty_2[]; + defines: IProperty_2[]; + states: IProperty_2; +} +declare namespace materialService { + export { + queryAllEffects, + queryEffect, + queryMaterial_2 as queryMaterial, + saveMaterial_2 as saveMaterial, + encodeEffect, + MaterialEffectInfo_2 as MaterialEffectInfo, + MaterialPassDump_2 as MaterialPassDump, + MaterialTechniqueDump_2 as MaterialTechniqueDump, + MaterialDump_2 as MaterialDump + } +} export declare interface MaterialTechniqueDump { name?: string; passes: MaterialPassDump[]; } +declare interface MaterialTechniqueDump_2 { + name?: string; + passes: MaterialPassDump_2[]; +} export declare interface MeshClusterOptions { enable: boolean; coneCluster?: boolean; @@ -1020,7 +1789,16 @@ export declare interface MeshSimplifyOptions { errorRate?: number; lockBoundary?: boolean; } +declare interface Migrate { + version: string; + migrate?: Function; +} +declare interface MigrateHook { + pre(asset: Asset | VirtualAsset_2): any; + post(asset: Asset | VirtualAsset_2, num: number): any; +} export declare function moveAsset(source: string, target: string, options?: AssetOperationOption): Promise; +declare function nameToId(name: string, extend?: number): string; export declare enum NormalImportSetting { optional = 0, exclude = 1, @@ -1094,6 +1872,8 @@ export declare interface PrefabAssetUserData { persistent?: boolean; syncNodeName?: string; } +declare function queryAllEffects(): Promise>; +declare function queryAsset(uuid_url_path: string): Asset | VirtualAsset_2 | null; export declare function queryAssetConfigMap(): Promise>; export declare function queryAssetDBInfos(): Promise>; export declare function queryAssetDependencies(uuidOrUrl: string, type?: QueryAssetType): Promise; @@ -1113,18 +1893,28 @@ export declare type QueryAssetType = 'asset' | 'script' | 'all'; export declare function queryAssetUserDataConfig(urlOrUuidOrPath: string): Promise | undefined>; export declare function queryAssetUsers(uuidOrUrl: string, type?: QueryAssetType): Promise; export declare function queryCreateMap(): Promise; +declare function queryEffect(effectNameOrUuid: string): Promise; export declare function queryMaterial(uuidOrUrlOrPath: string): Promise; +declare function queryMaterial_2(uuidOrUrlOrPath: string): Promise; export declare function queryMaterialAllEffects(): Promise>; export declare function queryMaterialEffect(effectNameOrUuid: string): Promise; +declare function queryMissingInfo(uuid: string): MissingAssetInfo | null; export declare function queryPath(urlOrUuid: string): Promise; +declare function queryPath_2(uuid_url: string): string; +declare function queryPropertyObjectOperationCapabilities(instance: any, rootDump?: IProperty_2): Record; export declare function queryPropertySchema(importer: string): Promise; export declare function querySerializedData(uuidOrUrlOrPath: string): Promise; +declare function querySerializedData_2(uuidOrUrlOrPath: string): Promise; export declare function querySortedPlugins(filterOptions?: FilterPluginOptions): Promise; export declare function queryThumbnailHandlers(): string[]; export declare function queryUrl(uuidOrPath: string): Promise; +declare function queryUrl_2(uuid_path: string): string; export declare function queryUUID(urlOrPath: string): Promise; +declare function queryUUID_2(url_path: string): string; export declare function reconcileLocalizationRuntimeMount(): Promise; export declare function refresh(dir: string): Promise; +declare function refresh_2(uuid_url_path: string): Promise; +declare function reimport(uuid_url_path: string): Promise; export declare function reimportAsset(pathOrUrlOrUUID: string): Promise; export declare interface ReloadAnimationGraphOptions { expected?: AnimationGraphExpectedVersion; @@ -1135,6 +1925,7 @@ export declare interface RenderTextureAssetUserData extends TextureBaseAssetUser width: number; height: number; } +declare function resetFileSystemProvider(): void; export declare interface RtSpriteFrameAssetUserData { imageUuidOrDatabaseUri: string; width?: number; @@ -1142,11 +1933,14 @@ export declare interface RtSpriteFrameAssetUserData { } export declare function saveAsset(pathOrUrlOrUUID: string, data: string | Buffer): Promise; export declare function saveMaterial(uuidOrUrlOrPath: string, dump: MaterialDump): Promise; +declare function saveMaterial_2(uuidOrUrlOrPath: string, dump: MaterialDump_2): Promise; export declare function saveSerializedData(uuidOrUrlOrPath: string, patch: SerializedAssetPatch): Promise; +declare function saveSerializedData_2(uuidOrUrlOrPath: string, patch: SerializedAssetPatch_2): Promise; export declare interface ScriptModuleUserData { isPlugin: false; } export declare type SerializedAssetDump = Record | IProperty; +declare type SerializedAssetDump_2 = Record | IProperty_2; export declare interface SerializedAssetFinder { meshes?: Array; animations?: Array; @@ -1156,6 +1950,7 @@ export declare interface SerializedAssetFinder { scenes?: Array; } export declare type SerializedAssetPatch = SerializedAssetDump | Partial>; +declare type SerializedAssetPatch_2 = SerializedAssetDump_2 | Partial>; export declare interface SerializedAssetQueryResult { uuid: string; url: string; @@ -1163,14 +1958,43 @@ export declare interface SerializedAssetQueryResult { importer: string; dump: SerializedAssetDump; } +declare interface SerializedAssetQueryResult_2 { + uuid: string; + url: string; + type: string; + importer: string; + dump: SerializedAssetDump_2; +} export declare const serializedData: { query: typeof querySerializedData; save: typeof saveSerializedData; }; +declare namespace serializedData_2 { + export { + querySerializedData_2 as querySerializedData, + saveSerializedData_2 as saveSerializedData, + encodePropertyObject, + applyPropertyObjectPatch, + applyEncodedPropertyPatch, + applyPropertyObjectOperation, + applyEncodedPropertyOperation, + queryPropertyObjectOperationCapabilities, + getEncodedPropertyOperationCapabilities, + encodeSerializedObject, + getDefaultValueByType, + SerializedAssetDump_2 as SerializedAssetDump, + SerializedAssetPatch_2 as SerializedAssetPatch, + EncodedPropertyOperation, + EncodedPropertyOperationCapabilities, + SerializedAssetQueryResult_2 as SerializedAssetQueryResult + } +} export declare interface SetAnimationGraphInspectorPropertyRequest extends AnimationGraphInspectorPropertyOperationRequest { patch: IProperty | unknown; } +declare function setDefaultUserData(name: string, userData: any): void; export declare function setFileSystemProvider(provider: IAssetFileSystemProvider): void; +declare function setFileSystemProvider_2(nextProvider: IAssetFileSystemProvider_2): void; export declare interface SimplifyOptions { targetRatio?: number; enableSmartLink?: boolean; @@ -1224,6 +2048,8 @@ export declare interface SpriteFrameVertices { maxPos: number[]; } export declare function start(): Promise; +declare function startAssetDB(): Promise; +declare function stopAssetDB(): Promise; export declare const SUPPORT_CREATE_TYPES: readonly ["animation-clip", "typescript", "auto-atlas", "effect", "scene", "prefab", "material", "texture-cube", "terrain", "physics-material", "label-atlas", "render-texture", "directory", "effect-header"]; export declare enum TangentImportSetting { exclude = 0, @@ -1261,9 +2087,98 @@ export declare interface ThumbnailInfo { value: string; } export declare type ThumbnailSize = 'large' | 'small' | 'middle' | 'origin'; +declare interface TypedAssetManager extends EventEmitter { + on(event: K, listener: AssetManagerEvents[K]): this; + once(event: K, listener: AssetManagerEvents[K]): this; + emit(event: K, ...args: Parameters): boolean; + removeListener(event: K, listener: AssetManagerEvents[K]): this; + removeAllListeners(event?: K): this; + listeners(event: K): Function[]; + listenerCount(event: K): number; + onAssetAdded(listener: (info: IAssetInfo_2) => void): () => void; + onAssetChanged(listener: (info: IAssetInfo_2) => void): () => void; + onAssetRemoved(listener: (info: IAssetInfo_2) => void): () => void; + queryAssets: typeof assetQuery_2.queryAssets; + queryAssetDependencies: typeof assetQuery_2.queryAssetDependencies; + queryAssetUsers: typeof assetQuery_2.queryAssetUsers; + queryAsset: typeof assetQuery_2.queryAsset; + queryAssetInfo: typeof assetQuery_2.queryAssetInfo; + queryAssetInfoByUUID: typeof assetQuery_2.queryAssetInfoByUUID; + queryAssetInfos: typeof assetQuery_2.queryAssetInfos; + querySortedPlugins: typeof assetQuery_2.querySortedPlugins; + queryUUID: typeof assetQuery_2.queryUUID; + queryPath: typeof assetQuery_2.queryPath; + queryUrl: typeof assetQuery_2.queryUrl; + generateAvailableURL: typeof assetQuery_2.generateAvailableURL; + queryDBAssetInfo: typeof assetQuery_2.queryDBAssetInfo; + encodeAsset: typeof assetQuery_2.encodeAsset; + queryAssetProperty: typeof assetQuery_2.queryAssetProperty; + queryAssetMeta: typeof assetQuery_2.queryAssetMeta; + querySubAssetName: typeof assetQuery_2.querySubAssetName; + queryAssetMtime: typeof assetQuery_2.queryAssetMtime; + importAsset: typeof assetOperation.importAsset; + copyAsset: typeof assetOperation.copyAsset; + saveAssetMeta: typeof assetOperation.saveAssetMeta; + saveAsset: typeof assetOperation.saveAsset; + createAsset: typeof assetOperation.createAsset; + refreshAsset: typeof assetOperation.refreshAsset; + refreshAssetOnly: typeof assetOperation.refreshAssetOnly; + reimportAsset: typeof assetOperation.reimportAsset; + renameAsset: typeof assetOperation.renameAsset; + removeAsset: typeof assetOperation.removeAsset; + moveAsset: typeof assetOperation.moveAsset; + generateExportData: typeof assetOperation.generateExportData; + outputExportData: typeof assetOperation.outputExportData; + createAssetByType: typeof assetOperation.createAssetByType; + updateUserData: typeof assetOperation.updateUserData; + updateUserDataByPath: typeof assetOperation.updateUserDataByPath; + querySerializedData: typeof serializedData_2.querySerializedData; + saveSerializedData: typeof serializedData_2.saveSerializedData; + queryMaterial: typeof materialService.queryMaterial; + queryMaterialEffect: typeof materialService.queryEffect; + queryMaterialAllEffects: typeof materialService.queryAllEffects; + saveMaterial: typeof materialService.saveMaterial; + queryAnimationGraph: typeof animationGraph_2.query; + queryAnimationGraphInspector: typeof animationGraph_2.queryInspector; + queryAnimationGraphMotionPreviewData: typeof animationGraph_2.queryMotionPreviewData; + queryAnimationGraphPoseGraphAssetDragHandlers: typeof animationGraph_2.queryPoseGraphAssetDragHandlers; + queryAnimationGraphStateMachineComponentTypes: typeof animationGraph_2.queryStateMachineComponentTypes; + setAnimationGraphInspectorProperty: typeof animationGraph_2.setInspectorProperty; + resetAnimationGraphInspectorProperty: typeof animationGraph_2.resetInspectorProperty; + createAnimationGraphInspectorProperty: typeof animationGraph_2.createInspectorProperty; + executeAnimationGraphCommand: typeof animationGraph_2.execute; + saveAnimationGraph: typeof animationGraph_2.save; + reloadAnimationGraph: typeof animationGraph_2.reload; + onAnimationGraphChanged: typeof animationGraph_2.onChanged; + queryAnimationGraphVariant: typeof animationGraphVariant_2.query; + changeAnimationGraphVariant: typeof animationGraphVariant_2.change; + saveAnimationGraphVariant: typeof animationGraphVariant_2.save; + queryAssetConfigMap: typeof assetHandlerManager.queryAssetConfigMap; + queryPropertySchema: typeof assetHandlerManager.queryPropertySchema; + updateDefaultUserData: typeof assetHandlerManager.updateDefaultUserData; + getCreateMap: typeof assetHandlerManager.getCreateMap; + queryAssetUserDataConfig: typeof assetHandlerManager.queryUserDataConfig; + queryThumbnailHandlers: typeof assetHandlerManager.queryThumbnailHandlers; + getEffectBinPath: typeof assetHandlerManager.getEffectBinPath; + generateThumbnail(urlOrUUIDOrPath: string, size?: ThumbnailSize_2): Promise; + extractImagePixels(urlOrUUIDOrPath: string, options: IImagePixelExtractionOptions): Promise; + onReady: typeof assetManager.onReady; + onDBReady: typeof assetManager.onDBReady; + onProgress: typeof assetManager.onProgress; + url2uuid(url: string): string; + url2path(url: string): string; + path2url(url: string, dbName?: string): string; + init(): Promise; + destroyed(): void; +} +declare const typedAssetManager: TypedAssetManager; export declare function updateAssetUserData(urlOrUuidOrPath: string, userData: Record): Promise; export declare function updateAssetUserDataByPath(urlOrUuidOrPath: string, path: string, value: any): Promise; export declare function updateDefaultUserData(handler: string, path: string, value: any): Promise; +declare const Utils: { + nameToId: typeof nameToId; + isSubPath: typeof isSubPath; +}; export declare interface Vec2 { x: number; y: number; @@ -1279,27 +2194,441 @@ export declare interface Vec4 { z: number; w: number; } +declare class VirtualAsset extends VirtualAsset_2 { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} +declare class VirtualAsset_2 { + versionCode: number; + _init: boolean; + importError: Error | any; + get init(): boolean; + set init(bool: boolean); + _waitInitHandle: Function[]; + waitInit(): Promise; + action: AssetActionEnum; + task: number; + invalid: boolean; + uuid2recycle: { + [index: string]: Meta; + }; + get source(): string; + get url(): string; + get library(): string; + get temp(): string; + get uuid(): string; + get displayName(): string; + getData(key: string): any; + setData(key: string, value: any): void; + generate(): void; + meta: Meta; + subAssets: { + [name: string]: VirtualAsset_2; + }; + set imported(imported: boolean); + get imported(): boolean; + _lock: boolean; + _waitLockHandler: Function[]; + lock(): Promise; + unlock(): void; + _assetDB: AssetDB; + _parent: VirtualAsset_2 | Asset | null; + _name: string; + _id: string; + _swapSpace: any; + _isDirectory?: boolean; + get parent(): Asset | VirtualAsset_2 | null; + get userData(): { + [index: string]: any; + }; + constructor(meta: Meta, name: string, id: string, assetDB: AssetDB); + assignUserData(json: Object, overwrite?: boolean): void; + save(): any; + reset(): Promise; + getFilePath(extOrFile: string): string; + saveToLibrary(extOrFile: string, buffer: Buffer | string): Promise; + copyToLibrary(extOrFile: string, target: string): Promise; + deleteFromLibrary(extOrFile: string): Promise; + existsInLibrary(extOrFile: string): Promise; + isDirectory(): boolean; + createSubAsset(name: string, importer: string, options?: { + displayName?: string; + id?: string; + }): Promise; + depend(fileOrUuidOrUrl: string): void; + getSwapSpace(): T; +} export declare type WrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat'; export { } " `; exports[`DTS API compatibility base.d.ts should match snapshot 1`] = ` -"export declare function init(projectPath: string): Promise; +"import { Command } from 'commander'; +import type { i18n } from 'i18next'; +declare abstract class BaseCommand { + protected program: Command; + constructor(program: Command); + abstract register(): void; + protected validateProjectPath(projectPath: string): string; + protected readLocalConfigProject(): string | undefined; + protected getGlobalOptions(): any; +} +export declare namespace CommandsBase { + export { + BaseCommand, + CommandUtils + } +} +declare class CommandUtils { + static showBuildInfo(projectPath: string, platform: string): void; + static showMcpServerInfo(projectPath: string, port: number): void; +} +declare function compressHex(hexString: string, reservedHeadLength: number): string; +declare function compressUUID(uuid: string, min: boolean): string; +export declare namespace CoreBaseEditorShim { + export { + ensureEditorProjectPath + } +} +export declare namespace CoreBaseI18n { + export { + I18n, + _default as default + } +} +export declare namespace CoreBaseUtilsUuid { + export { + compressUUID, + compressHex, + decompressUUID, + isUUID, + getUuidFromLibPath, + generate, + nameToSubId, + NonUuidMark + } +} +declare function decompressUUID(uuid: string): string; +declare const _default: I18n; +export declare namespace Editor { + export { + Host + } +} +declare function ensureEditorProjectPath(projectPath: string): any; +declare function generate(compress?: boolean): string; +declare function getUuidFromLibPath(path: string): string; +export declare namespace Host { + export { + CommandsBase, + CoreBaseEditorShim, + CoreBaseI18n, + CoreBaseUtilsUuid + } +} +declare class I18n { + _lang: string; + private _instance; + constructor(instance: i18n); + get instance(): i18n; + setLanguage(language: string): Promise; + t(key: I18nKeys, obj?: { + [key: string]: string; + }): string; + transI18nName(name: string): string; + getBundle(): { + lang: string; + data: Record>; + }; + registerLanguagePatch(language: string, patchPath: string, languageData: Record): void; +} +declare type I18nKeys = 'assets.title' | 'assets.description' | 'assets.deprecated_tip' | 'assets.global_readonly_tip' | 'assets.debug_mode' | 'assets.asset_d_b_pause_tips' | 'assets.asset_d_b_init_error' | 'assets.save_asset.fail.unknown' | 'assets.save_asset.fail.uuid' | 'assets.save_asset.fail.asset' | 'assets.save_asset.fail.content' | 'assets.save_asset.fail.readonly' | 'assets.save_asset_meta.fail.unknown' | 'assets.save_asset_meta.fail.uuid' | 'assets.save_asset_meta.fail.content' | 'assets.save_asset_meta.fail.readonly' | 'assets.rename_asset.fail.source' | 'assets.rename_asset.fail.include' | 'assets.rename_asset.fail.parent' | 'assets.rename_asset.warn.overwrite' | 'assets.init.no_asset_db_list' | 'assets.operation.invalid_url' | 'assets.operation.exists_url' | 'assets.operation.readonly' | 'assets.operation.overwrite' | 'assets.delete_asset.fail.unknown' | 'assets.delete_asset.fail.url' | 'assets.delete_asset.fail.unexist' | 'assets.delete_asset.fail.readonly' | 'assets.create_asset.title' | 'assets.create_asset.fail.unknown' | 'assets.create_asset.fail.type' | 'assets.create_asset.fail.url' | 'assets.create_asset.fail.exist' | 'assets.create_asset.fail.drop' | 'assets.create_asset.fail.to_url' | 'assets.create_asset.fail.uuid' | 'assets.import_asset.meta_exists' | 'assets.open_asset.preference_program_warning' | 'assets.open_asset.fail.no_asset' | 'assets.copy_asset.fail.unknown' | 'assets.copy_asset.fail.url' | 'assets.restore_asset_d_b_from_cache_in_valid.upgrade' | 'assets.restore_asset_d_b_from_cache_in_valid.no_library_path' | 'assets.preferences.log_level' | 'assets.preferences.log_level_debug' | 'assets.preferences.log_level_log' | 'assets.preferences.log_level_warn' | 'assets.preferences.log_level_error' | 'assets.preferences.ignore_glob' | 'assets.preferences.ignore_changed' | 'builder.title' | 'builder.description' | 'builder.create_user_template' | 'builder.build_config' | 'builder.build' | 'builder.compile' | 'builder.open_log_file' | 'builder.generate_engine' | 'builder.require' | 'builder.new_build_task' | 'builder.empty_task_holder' | 'builder.empty_scene' | 'builder.empty_platforms' | 'builder.reveal_in_explorer' | 'builder.view_build_config' | 'builder.recompile' | 'builder.confirm' | 'builder.use_splash_screen' | 'builder.bundle_common_chunk' | 'builder.bundle_common_chunk_tips' | 'builder.bundleCommonChunk' | 'builder.bundleCommonChunkTips' | 'builder.off' | 'builder.options.platform' | 'builder.options.name' | 'builder.options.polyfills' | 'builder.options.polyfills_tips' | 'builder.options.async_functions' | 'builder.options.async_functions_tips' | 'builder.options.core_js' | 'builder.options.core_js_tips' | 'builder.options.buildScriptTargets' | 'builder.options.buildScriptTargetsTips' | 'builder.options.remote_server_address' | 'builder.options.remote_server_address_tips' | 'builder.options.sourceMap' | 'builder.options.sourceMapTips' | 'builder.options.sourceMapsInline' | 'builder.options.standaloneSourceMaps' | 'builder.options.experimental_erase_modules' | 'builder.options.experimental_erase_modules_tips' | 'builder.options.includeBundles' | 'builder.options.build_path' | 'builder.options.debug' | 'builder.options.debugTips' | 'builder.options.mangleProperties' | 'builder.options.manglePropertiesTip' | 'builder.options.inlineEnum' | 'builder.options.inlineEnumTip' | 'builder.options.md5_cache' | 'builder.options.md5CacheTips' | 'builder.options.main_bundle_is_remote' | 'builder.options.main_bundle_compression_type' | 'builder.options.pack_autoAtlas' | 'builder.options.start_scene' | 'builder.options.startSceneTips' | 'builder.options.start_scene_asset_bundle' | 'builder.options.start_scene_asset_bundle_tips' | 'builder.options.scenes' | 'builder.options.skip_compress_texture' | 'builder.options.bin_group_config' | 'builder.options.enable_cconb_group' | 'builder.options.enable_cconb_group_tips' | 'builder.tips.enter_name' | 'builder.tips.task_name' | 'builder.tips.build_path' | 'builder.tips.build_scenes' | 'builder.tips.set_start_scene' | 'builder.tips.atlas_in_resources' | 'builder.tips.use_texture_in_atlas' | 'builder.tips.use_image_in_atlas' | 'builder.tips.task_exist' | 'builder.tips.task_busy' | 'builder.tips.platform_missing' | 'builder.tips.conflict_platform' | 'builder.tips.waiting_for_remove_task' | 'builder.tips.waiting_for_db_ready' | 'builder.tips.waiting_for_plugin_ready' | 'builder.tips.waiting_for_worker_ready' | 'builder.tips.waiting_for_data_ready' | 'builder.tips.scene_in_bundle' | 'builder.tips.create_application_template_success' | 'builder.tips.create_application_template_overwrite' | 'builder.tips.application_ejs_version' | 'builder.tips.set_splash_setting' | 'builder.tips.build_task_canceled' | 'builder.tips.pause_asset_import' | 'builder.tips.disable_platform' | 'builder.tips.disable_platform_for_build_command' | 'builder.tips.disable_register_platform_info' | 'builder.tips.platform_information_invalid' | 'builder.tips.create_template_success' | 'builder.tips.template_version_warning' | 'builder.tips.build_package_missing' | 'builder.error.build_error' | 'builder.error.build_dir_not_exists' | 'builder.error.build_path_contains_space' | 'builder.error.build_path_contains_chinese_and_symbol' | 'builder.error.can_not_empty' | 'builder.error.project_name_not_legal' | 'builder.error.package_name_not_legal' | 'builder.error.package_name_start_with_number' | 'builder.error.select_scenes_to_build' | 'builder.error.path_too_long_title' | 'builder.error.path_too_long_desc' | 'builder.error.keep_raw_texture_of_atlas' | 'builder.error.run_hooks_failed' | 'builder.error.cache_compress_texture_missing' | 'builder.error.deserialize_failed' | 'builder.error.missing_import_files' | 'builder.error.required_asset_missing' | 'builder.error.missing_asset' | 'builder.error.check_options_failed' | 'builder.error.unknown_platform' | 'builder.error.asset_import_failed' | 'builder.error.get_asset_json_failed' | 'builder.error.builder_crash' | 'builder.error.texture_compress_failed' | 'builder.error.missing_splash_tips' | 'builder.error.invalid_start_scene' | 'builder.error.missing_scenes' | 'builder.error.bundle_configs' | 'builder.error.platform_register_error' | 'builder.error.check_failed' | 'builder.error.engine_modules_config_key_missing' | 'builder.warn.no_defined_in_i18n' | 'builder.warn.no_serialized_json' | 'builder.warn.same_load_url' | 'builder.warn.atlas_in_resources' | 'builder.warn.path_not_exist' | 'builder.warn.http' | 'builder.warn.required' | 'builder.warn.no_chinese' | 'builder.warn.check_failed_with_new_value' | 'builder.warn.compress_rgb_a' | 'builder.warn.asset_bundle_is_remote_invalid' | 'builder.warn.require_mipmaps' | 'builder.warn.invalid_custom_splash' | 'builder.warn.invalid_remove_splash' | 'builder.warn.exception_remove_splash' | 'builder.warn.deprecated_tip' | 'builder.warn.resources_remote_lock_waring' | 'builder.warn.repeat_atlas_in_bundle' | 'builder.warn.engine_modules_fall_back_tip' | 'builder.warn.invalid_option_in_separate_engine' | 'builder.warn.separate_engine_with_custom_engine' | 'builder.warn.invalid_version_in_separate_engine' | 'builder.tasks.build_asset' | 'builder.tasks.build_engine' | 'builder.tasks.build_img' | 'builder.tasks.build_json' | 'builder.tasks.build_atlas' | 'builder.tasks.build_script' | 'builder.tasks.build_project_script' | 'builder.tasks.build_suffix' | 'builder.tasks.build_template' | 'builder.tasks.build_zip_bundle' | 'builder.tasks.load_script' | 'builder.tasks.sort_asset' | 'builder.tasks.build_import_map' | 'builder.tasks.sort_import_map' | 'builder.tasks.sort_asset_bundle' | 'builder.tasks.sort_image' | 'builder.tasks.sort_script' | 'builder.tasks.sort_sprite_frame' | 'builder.tasks.sort_texture' | 'builder.tasks.sort_json' | 'builder.tasks.settings.cache' | 'builder.tasks.settings.options' | 'builder.tasks.settings.design_resolution' | 'builder.tasks.settings.group' | 'builder.tasks.settings.md5' | 'builder.tasks.settings.scene' | 'builder.tasks.settings.script' | 'builder.tasks.settings.init' | 'builder.tasks.settings.macro' | 'builder.tasks.postprocess.compress' | 'builder.tasks.postprocess.save_config' | 'builder.tasks.postprocess.save_settings' | 'builder.asset_bundle.is_bundle' | 'builder.asset_bundle.bundle_name' | 'builder.asset_bundle.priority' | 'builder.asset_bundle.priority_tooltip' | 'builder.asset_bundle.compression_type' | 'builder.asset_bundle.compression_type_tooltip' | 'builder.asset_bundle.target_platform' | 'builder.asset_bundle.target_platform_tooltip' | 'builder.asset_bundle.is_remote_bundle' | 'builder.asset_bundle.remote_bundle_invalid_tooltip' | 'builder.asset_bundle.none' | 'builder.asset_bundle.none_tooltip' | 'builder.asset_bundle.subpackage' | 'builder.asset_bundle.subpackage_tooltip' | 'builder.asset_bundle.merge_dep' | 'builder.asset_bundle.merge_dep_tooltip' | 'builder.asset_bundle.merge_all_json' | 'builder.asset_bundle.merge_all_json_tooltip' | 'builder.asset_bundle.zip' | 'builder.asset_bundle.zip_tooltip' | 'builder.asset_bundle.duplicate_name_message' | 'builder.asset_bundle.duplicate_name_messaged_auto_rename' | 'builder.asset_bundle.duplicate_reserved_keyword_message' | 'builder.asset_bundle.nest_bundle' | 'builder.asset_bundle.filter_config.title' | 'builder.asset_bundle.filter_config.add' | 'builder.asset_bundle.filter_config.preview' | 'builder.asset_bundle.filter_config.add_asset' | 'builder.asset_bundle.filter_config.include' | 'builder.asset_bundle.filter_config.exclude' | 'builder.asset_bundle.filter_config.asset' | 'builder.asset_bundle.filter_config.url' | 'builder.asset_bundle.filter_config.glob' | 'builder.asset_bundle.filter_config.glob_tips' | 'builder.asset_bundle.filter_config.begin_with' | 'builder.asset_bundle.filter_config.end_with' | 'builder.asset_bundle.filter_config.contain' | 'builder.asset_bundle.filter_config.empty_config' | 'builder.asset_bundle.filter_config.preview_list' | 'builder.asset_bundle.filter_config.preview_tips' | 'builder.asset_bundle.filter_config.empty_preview_list' | 'builder.asset_bundle.empty_bundle' | 'builder.asset_bundle.bundle_build_tips' | 'builder.asset_bundle.bundle_build_platform_tips' | 'builder.asset_bundle.build_bundle' | 'builder.asset_bundle.publish_config' | 'builder.asset_bundle.build_bundle_i_n_process' | 'builder.asset_bundle.bundle_build_close_tip' | 'builder.asset_bundle.build_bundle_busy' | 'builder.asset_bundle.build_bundle_params' | 'builder.asset_bundle.bundle_config' | 'builder.asset_bundle.export_bundle_build_config' | 'builder.asset_bundle.preferred_options' | 'builder.asset_bundle.preferred_options_tips' | 'builder.asset_bundle.fallback_options' | 'builder.asset_bundle.fallback_options_tips' | 'builder.asset_bundle.platform_override' | 'builder.asset_bundle.platform_override_empty_tip' | 'builder.asset_bundle.default_config' | 'builder.asset_bundle.native' | 'builder.asset_bundle.web' | 'builder.asset_bundle.minigame' | 'builder.asset_bundle.import_config' | 'builder.asset_bundle.export_config' | 'builder.asset_bundle.preview_setting' | 'builder.asset_bundle.platform' | 'builder.asset_bundle.platform_config' | 'builder.asset_bundle.edit_config' | 'builder.asset_bundle.add_config' | 'builder.asset_bundle.delete_config' | 'builder.asset_bundle.is_remote_fallback_tips' | 'builder.asset_bundle.reset' | 'builder.asset_bundle.reset_uni' | 'builder.asset_bundle.separate_config' | 'builder.asset_bundle.all_mini_games' | 'builder.asset_bundle.uni_config' | 'builder.asset_bundle.true' | 'builder.asset_bundle.false' | 'builder.asset_bundle.overwrite' | 'builder.asset_bundle.merge' | 'builder.project.texture_compress.title' | 'builder.project.texture_compress.compress_preset' | 'builder.project.texture_compress.custom_format' | 'builder.project.texture_compress.same_config_name' | 'builder.project.texture_compress.add_config' | 'builder.project.texture_compress.edit_config_name' | 'builder.project.texture_compress.export_config' | 'builder.project.texture_compress.import_config' | 'builder.project.texture_compress.import_config_options' | 'builder.project.texture_compress.merge' | 'builder.project.texture_compress.preset_name' | 'builder.project.texture_compress.add_format' | 'builder.project.texture_compress.compress_format' | 'builder.project.texture_compress.mipmap.no_power_of_two' | 'builder.project.texture_compress.tips.require_object' | 'builder.project.texture_compress.tips.require_name' | 'builder.project.texture_compress.tips.xx_require_object' | 'builder.project.texture_compress.tips.platform_err' | 'builder.project.texture_compress.tips.texture_type_err' | 'builder.project.texture_compress.tips.options_quality_type_err' | 'builder.project.texture_compress.tips.number_quality_type_err' | 'builder.project.texture_compress.tips.import_failed' | 'builder.project.texture_compress.tips.user_preset_err' | 'builder.project.texture_compress.tips.enter_config_name_to_add' | 'builder.project.texture_compress.tips.input_config_name_to_search' | 'builder.project.splash_setting.title' | 'builder.project.splash_setting.confirm' | 'builder.project.splash_setting.settings.total_time' | 'builder.project.splash_setting.settings.display_ratio' | 'builder.project.splash_setting.settings.auto_fit' | 'builder.project.splash_setting.settings.watermark_location' | 'builder.project.splash_setting.settings.logo.title' | 'builder.project.splash_setting.settings.logo.default' | 'builder.project.splash_setting.settings.logo.none' | 'builder.project.splash_setting.settings.logo.custom' | 'builder.project.splash_setting.settings.background.title' | 'builder.project.splash_setting.settings.background.default' | 'builder.project.splash_setting.settings.background.color' | 'builder.project.splash_setting.settings.background.custom' | 'builder.project.splash_setting.settings.background.custom_tips' | 'builder.project.splash_setting.custom' | 'builder.project.splash_setting.default' | 'builder.project.splash_setting.disabled' | 'builder.project.splash_setting.watermark_location_config.top' | 'builder.project.splash_setting.watermark_location_config.bottom' | 'builder.project.splash_setting.watermark_location_config.left' | 'builder.project.splash_setting.watermark_location_config.right' | 'builder.project.splash_setting.watermark_location_config.center' | 'builder.project.splash_setting.preview' | 'builder.project.splash_setting.total_time_tips' | 'builder.project.splash_setting.display_ratio_tips' | 'builder.project.splash_setting.tips' | 'builder.project.splash_setting.select_image' | 'builder.project.splash_setting.use_default_tip' | 'builder.project.splash_setting.enable_custom_splash' | 'builder.project.splash_setting.reset' | 'builder.project.splash_setting.preview_in_browser' | 'builder.project.splash_setting.information_dialog_unusual' | 'builder.example' | 'builder.platforms.native.title' | 'builder.platforms.native.options.make' | 'builder.platforms.native.options.run' | 'builder.platforms.native.options.encrypted' | 'builder.platforms.native.options.xxtea_key' | 'builder.platforms.native.options.compress_zip' | 'builder.platforms.native.encrypt.disable_tips' | 'builder.platforms.mac.title' | 'builder.platforms.mac.error.m1_with_physic_x' | 'common.loading' | 'common.success' | 'common.error' | 'common.warning' | 'common.info' | 'common.confirm' | 'common.cancel' | 'common.ok' | 'common.yes' | 'common.no' | 'common.save' | 'common.delete' | 'common.edit' | 'common.create' | 'common.update' | 'common.refresh' | 'common.close' | 'common.open' | 'common.back' | 'common.next' | 'common.previous' | 'common.finish' | 'common.start' | 'common.stop' | 'common.pause' | 'common.resume' | 'common.deprecated_tip' | 'common.preview.device.design_resolution' | 'common.preview.device.full_screen' | 'common.preview.device.webpage_full_screen' | 'configuration.builder.common.title' | 'configuration.builder.useCache.title' | 'configuration.builder.useCache.serializeData.title' | 'configuration.builder.useCache.engine.title' | 'configuration.builder.useCache.textureCompress.title' | 'configuration.builder.useCache.autoAtlas.title' | 'configuration.builder.textureCompressConfig.title' | 'configuration.builder.textureCompressConfig.description' | 'configuration.builder.bundleConfig.title' | 'configuration.builder.bundleConfig.description' | 'configuration.builder.platform.configSuffix' | 'configuration.builder.platform.outputName.title' | 'configuration.builder.platform.outputName.description' | 'configuration.builder.platform.packageOptions.title' | 'configuration.import.title' | 'configuration.import.globList.title' | 'configuration.import.globList.description' | 'configuration.import.globList.itemTitle' | 'configuration.import.restoreAssetDBFromCache.title' | 'configuration.import.createTemplateRoot.title' | 'configuration.import.userDataTemplate.title' | 'configuration.import.userDataTemplate.description' | 'configuration.import.fbx.title' | 'configuration.import.fbx.legacyFbxImporter.title' | 'configuration.import.fbx.legacyFbxImporter.visible.title' | 'configuration.import.fbx.material.title' | 'configuration.import.fbx.material.smart.title' | 'configuration.scene.tick.title' | 'configuration.scene.tick.description' | 'configuration.script.title' | 'configuration.script.useDefineForClassFields.title' | 'configuration.script.allowDeclareFields.title' | 'configuration.script.loose.title' | 'configuration.script.guessCommonJsExports.title' | 'configuration.script.guessCommonJsExports.description' | 'configuration.script.exportsConditions.title' | 'configuration.script.sortingPlugin.title' | 'configuration.script.sortingPlugin.description' | 'configuration.script.sortingPlugin.itemTitle' | 'configuration.script.preserveSymlinks.title' | 'configuration.script.importMap.title' | 'configuration.script.previewBrowserslistConfigFile.title' | 'configuration.script.updateAutoUpdateImportConfig.title' | 'configuration.engine.dynamic.includeModules.title' | 'configuration.engine.dynamic.includeModules.description' | 'configuration.engine.dynamic.includeModules.itemTitle' | 'configuration.engine.dynamic.flags.title' | 'configuration.engine.dynamic.flags.description' | 'configuration.engine.physicsConfig.title' | 'configuration.engine.physicsConfig.gravity.title' | 'configuration.engine.physicsConfig.gravity.description' | 'configuration.engine.physicsConfig.allowSleep.title' | 'configuration.engine.physicsConfig.allowSleep.description' | 'configuration.engine.physicsConfig.sleepThreshold.title' | 'configuration.engine.physicsConfig.sleepThreshold.description' | 'configuration.engine.physicsConfig.autoSimulation.title' | 'configuration.engine.physicsConfig.autoSimulation.description' | 'configuration.engine.physicsConfig.fixedTimeStep.title' | 'configuration.engine.physicsConfig.fixedTimeStep.description' | 'configuration.engine.physicsConfig.maxSubSteps.title' | 'configuration.engine.physicsConfig.maxSubSteps.description' | 'configuration.engine.physicsConfig.useNodeChains.title' | 'configuration.engine.physicsConfig.physicsEngine.title' | 'configuration.engine.physicsConfig.physicsEngine.description' | 'configuration.engine.physicsConfig.collisionMatrix.title' | 'configuration.engine.physicsConfig.collisionMatrix.description' | 'configuration.engine.physicsConfig.defaultMaterial.title' | 'configuration.engine.physicsConfig.defaultMaterial.description' | 'configuration.engine.physicsConfig.physX.title' | 'configuration.engine.physicsConfig.physX.description' | 'configuration.engine.designResolution.title' | 'configuration.engine.designResolution.width.title' | 'configuration.engine.designResolution.height.title' | 'configuration.engine.designResolution.fitWidth.title' | 'configuration.engine.designResolution.fitHeight.title' | 'configuration.engine.designResolution.highQuality.title' | 'configuration.engine.designResolution.downloadMaxConcurrency.title' | 'configuration.engine.splashScreen.title' | 'configuration.engine.splashScreen.displayRatio.title' | 'configuration.engine.splashScreen.totalTime.title' | 'configuration.engine.splashScreen.watermarkLocation.title' | 'configuration.engine.splashScreen.watermarkLocation.options.default' | 'configuration.engine.splashScreen.watermarkLocation.options.topLeft' | 'configuration.engine.splashScreen.watermarkLocation.options.topRight' | 'configuration.engine.splashScreen.watermarkLocation.options.topCenter' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomLeft' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomCenter' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomRight' | 'configuration.engine.splashScreen.autoFit.title' | 'configuration.engine.splashScreen.logo.title' | 'configuration.engine.splashScreen.background.title' | 'configuration.engine.moduleConfig.title' | 'configuration.engine.moduleConfig.noDeprecatedFeatures.title' | 'configuration.engine.moduleConfig.noDeprecatedFeatures.description' | 'configuration.engine.graphics.title' | 'configuration.engine.graphics.pipeline.title' | 'configuration.engine.graphics.pipeline.options.custom' | 'configuration.engine.graphics.pipeline.options.legacy' | 'configuration.engine.graphics.pipelineName.title' | 'configuration.engine.graphics.customPipelinePostProcess.title' | 'configuration.engine.graphics.renderPipeline.title' | 'configuration.engine.jointTextureLayout.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.itemTitle' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.textureLength.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.textureLength.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.itemTitle' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.skeleton.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.skeleton.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.itemTitle' | 'configuration.engine.macroConfig.title' | 'configuration.engine.macroConfig.macroCustom.title' | 'configuration.engine.macroConfig.macroCustom.description' | 'configuration.engine.macroConfig.macroCustom.itemTitle' | 'configuration.engine.macroConfig.macroCustom.key.title' | 'configuration.engine.macroConfig.macroCustom.value.title' | 'configuration.engine.layers.title' | 'configuration.engine.layers.customLayers.title' | 'configuration.engine.layers.customLayers.description' | 'configuration.engine.layers.sortingLayers.title' | 'configuration.engine.layers.sortingLayers.description' | 'configuration.engine.projectConfig.title' | 'configuration.engine.projectConfig.globalConfigKey.title' | 'configuration.engine.projectConfig.configs.title' | 'configuration.engine.projectConfig.configItem.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.value.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.version.title' | 'importer.invalid_node_data' | 'importer.node' | 'importer.component' | 'importer.sharp_error' | 'importer.gltf.gltf_asset_group_mesh' | 'importer.gltf.gltf_asset_group_animation' | 'importer.gltf.gltf_asset_group_node' | 'importer.gltf.gltf_asset_group_skin' | 'importer.gltf.gltf_asset_group_sampler' | 'importer.gltf.gltf_asset' | 'importer.gltf.gltf_asset_no_name' | 'importer.gltf.unsupported_alpha_mode' | 'importer.gltf.unsupported_texture_parameter' | 'importer.gltf.texture_parameter_min_filter' | 'importer.gltf.texture_parameter_mag_filter' | 'importer.gltf.unsupported_channel_path' | 'importer.gltf.reference_skin_in_different_scene' | 'importer.gltf.disallow_cubic_spline_channel_split' | 'importer.gltf.failed_to_calculate_tangents_due_to_lack_of_normals' | 'importer.gltf.failed_to_calculate_tangents_due_to_lack_of_uvs' | 'importer.gltf.empty_morph' | 'importer.gltf.unsupported_extension' | 'importer.gltf.failed_to_load_image' | 'importer.gltf.image_uri_should_be_file_url' | 'importer.gltf.failed_to_convert_tga' | 'importer.fbx.failed_to_convert_fbx_file' | 'importer.fbx.no_available_fbx_temp_dir' | 'importer.fbx.fbx2gltf_exists_with_non_zero_code' | 'importer.fbx.fbx_gltf_conv.bad_cpu' | 'importer.fbx.fbx_gltf_conv.missing_dll' | 'importer.fbx.fbx_gltf_conv.unsupported_inherit_type' | 'importer.fbx.fbx_gltf_conv.multi_material_layers' | 'importer.fbx.fbx_gltf_conv.skin_merge_error' | 'importer.dragonbones_atlas.texture_not_imported' | 'importer.dragonbones_atlas.texture_not_found' | 'importer.script.invalid_class_name' | 'importer.script.find_class_name_from_file_name_failed' | 'importer.script.transform_failure' | 'importer.property_schema.auto_atlas.max_width' | 'importer.property_schema.auto_atlas.max_width_description' | 'importer.property_schema.auto_atlas.max_height' | 'importer.property_schema.auto_atlas.max_height_description' | 'importer.property_schema.auto_atlas.padding' | 'importer.property_schema.auto_atlas.padding_description' | 'importer.property_schema.auto_atlas.allow_rotation' | 'importer.property_schema.auto_atlas.allow_rotation_description' | 'importer.property_schema.auto_atlas.force_squared' | 'importer.property_schema.auto_atlas.force_squared_description' | 'importer.property_schema.auto_atlas.power_of_two' | 'importer.property_schema.auto_atlas.power_of_two_description' | 'importer.property_schema.auto_atlas.algorithm' | 'importer.property_schema.auto_atlas.algorithm_description' | 'importer.property_schema.auto_atlas.max_rects' | 'importer.property_schema.auto_atlas.format' | 'importer.property_schema.auto_atlas.format_description' | 'importer.property_schema.auto_atlas.png' | 'importer.property_schema.auto_atlas.jpg' | 'importer.property_schema.auto_atlas.quality' | 'importer.property_schema.auto_atlas.quality_description' | 'importer.property_schema.auto_atlas.contour_bleed' | 'importer.property_schema.auto_atlas.contour_bleed_description' | 'importer.property_schema.auto_atlas.padding_bleed' | 'importer.property_schema.auto_atlas.padding_bleed_description' | 'importer.property_schema.auto_atlas.filter_unused' | 'importer.property_schema.auto_atlas.filter_unused_description' | 'importer.property_schema.auto_atlas.remove_texture_in_bundle' | 'importer.property_schema.auto_atlas.remove_texture_in_bundle_description' | 'importer.property_schema.auto_atlas.remove_image_in_bundle' | 'importer.property_schema.auto_atlas.remove_image_in_bundle_description' | 'importer.property_schema.auto_atlas.remove_sprite_atlas_in_bundle' | 'importer.property_schema.auto_atlas.remove_sprite_atlas_in_bundle_description' | 'importer.property_schema.auto_atlas.texture_setting' | 'importer.property_schema.auto_atlas.texture_setting_description' | 'importer.property_schema.texture.use_uuid' | 'importer.property_schema.texture.use_uuid_description' | 'importer.property_schema.texture.image_uuid_or_database_uri_description' | 'importer.property_schema.texture.wrap_repeat' | 'importer.property_schema.texture.wrap_clamp_to_edge' | 'importer.property_schema.texture.wrap_mirrored_repeat' | 'importer.property_schema.texture.filter_none' | 'importer.property_schema.texture.filter_nearest' | 'importer.property_schema.texture.filter_linear' | 'importer.property_schema.image.type_raw' | 'importer.property_schema.image.type_texture' | 'importer.property_schema.image.type_normal_map' | 'importer.property_schema.image.type_sprite_frame' | 'importer.property_schema.image.type_texture_cube' | 'importer.property_schema.sprite_frame.trim_type_auto' | 'importer.property_schema.sprite_frame.trim_type_custom' | 'importer.property_schema.sprite_frame.trim_type_none' | 'importer.property_schema.sprite_frame.mesh_type_rect' | 'importer.property_schema.sprite_frame.mesh_type_polygon' | 'importer.property_schema.gltf.mesh_optimizer' | 'importer.property_schema.gltf.mesh_optimizer_description' | 'importer.property_schema.gltf.mesh_optimizer_enable' | 'importer.property_schema.gltf.mesh_optimizer_enable_description' | 'importer.property_schema.gltf.mesh_optimizer_algorithm' | 'importer.property_schema.gltf.mesh_optimizer_algorithm_description' | 'importer.property_schema.gltf.mesh_optimizer_simplify' | 'importer.property_schema.gltf.mesh_optimizer_gltfpack' | 'importer.property_schema.gltf.simplify_options' | 'importer.property_schema.gltf.simplify_options_description' | 'importer.property_schema.gltf.enable_smart_link' | 'importer.property_schema.gltf.enable_smart_link_description' | 'importer.property_schema.gltf.agressiveness' | 'importer.property_schema.gltf.agressiveness_description' | 'importer.property_schema.gltf.max_iteration_count' | 'importer.property_schema.gltf.max_iteration_count_description' | 'importer.property_schema.gltf.mount_all_animations_on_prefab_description' | 'importer.property_schema.gltf.target_ratio_description' | 'importer.property_schema.fbx.unit_conversion' | 'importer.property_schema.fbx.unit_conversion_description' | 'importer.property_schema.fbx.unit_conversion_geometry_level' | 'importer.property_schema.fbx.unit_conversion_hierarchy_level' | 'importer.property_schema.fbx.unit_conversion_disabled' | 'importer.property_schema.fbx.match_mesh_names' | 'importer.property_schema.fbx.match_mesh_names_description' | 'importer.property_schema.fbx.fbx_description' | 'importer.texture.anisotropy' | 'importer.texture.anisotropy_tip' | 'importer.texture.filter_mode' | 'importer.texture.filter_mode_tip' | 'importer.texture.minfilter' | 'importer.texture.minfilter_tip' | 'importer.texture.magfilter' | 'importer.texture.magfilter_tip' | 'importer.texture.generate_mipmaps' | 'importer.texture.generate_mipmaps_tip' | 'importer.texture.mipfilter' | 'importer.texture.mipfilter_tip' | 'importer.texture.wrap_mode' | 'importer.texture.wrap_mode_tip' | 'importer.texture.wrap_mode_s' | 'importer.texture.wrap_mode_s_tip' | 'importer.texture.wrap_mode_t' | 'importer.texture.wrap_mode_t_tip' | 'importer.texture.mode_warn' | 'importer.texture.filter_diffenent'; +export declare function init(projectPath: string): Promise; +declare function isUUID(str: string): boolean; +declare function nameToSubId(name: string, extend?: number): string; +declare const NonUuidMark = "."; export { } " `; exports[`DTS API compatibility builder.d.ts should match snapshot 1`] = ` -"import EventEmitter from 'events'; +"import { AllTextureCompressConfig as AllTextureCompressConfig_2 } from './builder'; +import { appTemplateData as appTemplateData_2 } from './builder'; +import { ArrayItem as ArrayItem_2 } from './builder'; +import { AssetActionEnum as AssetActionEnum_2 } from './builder'; +import { AssetDBOptions as AssetDBOptions_2 } from './builder'; +import { AssetDBRefreshOptions as AssetDBRefreshOptions_2 } from './builder'; +import { AssetDBStartOptions as AssetDBStartOptions_2 } from './builder'; +import { AssetHandlers as AssetHandlers_2 } from './builder'; +import { AssetInfoArr as AssetInfoArr_2 } from './builder'; +import { AssetSerializeOptions as AssetSerializeOptions_2 } from './builder'; +import { BabelPluginItem as BabelPluginItem_2 } from './builder'; +import { BreakType as BreakType_2 } from './builder'; +import { BuildCacheScope as BuildCacheScope_2 } from './builder'; +import { BuildCheckResult as BuildCheckResult_2 } from './builder'; +import { BuildConfiguration as BuildConfiguration_2 } from './builder'; +import { BuilderCache as BuilderCache_2 } from './builder'; +import { BuildExitCode as BuildExitCode_2 } from './builder'; +import { BuildHook as BuildHook_2 } from './builder'; +import { BuildPlugin as BuildPlugin_2 } from './builder'; +import { BuildResult as BuildResult_2 } from './builder'; +import { BuildStageProgressCallback as BuildStageProgressCallback_2 } from './builder'; +import { BuildStageTask as BuildStageTask_2 } from './builder'; +import { BuildTaskBase as BuildTaskBase_2 } from './builder'; +import { BuildTemplate as BuildTemplate_2 } from './builder'; +import { BuildTemplateConfig as BuildTemplateConfig_2 } from './builder'; +import { BuiltinBundleName as BuiltinBundleName_3 } from './builder'; +import { BundleCompressionType as BundleCompressionType_2 } from './builder'; +import { BundleCompressionTypes as BundleCompressionTypes_3 } from './builder'; +import { BundleConfigItem as BundleConfigItem_2 } from './builder'; +import { BundleConfigItemMap as BundleConfigItemMap_2 } from './builder'; +import { BundleConfigProperty as BundleConfigProperty_2 } from './builder'; +import { BundleFilterConfig as BundleFilterConfig_2 } from './builder'; +import { BundlePlatformType as BundlePlatformType_2 } from './builder'; +import { BundleQueryConfig as BundleQueryConfig_2 } from './builder'; +import { BundleRenderConfig as BundleRenderConfig_2 } from './builder'; +import { ClearCacheOptions as ClearCacheOptions_2 } from './builder'; +import { ClearCacheResult as ClearCacheResult_2 } from './builder'; +import { CompressCacheInfo as CompressCacheInfo_2 } from './builder'; +import { CompressedInfo as CompressedInfo_2 } from './builder'; +import { CompressExecuteInfo as CompressExecuteInfo_2 } from './builder'; +import { ConfigType as ConfigType_2 } from './builder'; +import { CustomBundleConfig as CustomBundleConfig_2 } from './builder'; +import { CustomBundleConfigItem as CustomBundleConfigItem_2 } from './builder'; +import { CustomConsole as CustomConsole_2 } from './builder'; +import { DependencyManager as DependencyManager_2 } from './builder'; +import { EventEmitter } from 'events'; import { EventEmitter as EventEmitter_2 } from 'stream'; -import { IAssetDeleteOptions, IAssetWriteFileOptions } from '@cocos/asset-db'; +import { ExecuteHookTaskOption as ExecuteHookTaskOption_2 } from './builder'; +import { fileMap as fileMap_2 } from './builder'; +import { IAssetDeleteOptions as IAssetDeleteOptions_2 } from '@cocos/asset-db'; +import { IAssetGroupItem as IAssetGroupItem_2 } from './builder'; +import { IAssetGroupMap as IAssetGroupMap_2 } from './builder'; +import { IAssetGroupOptions as IAssetGroupOptions_2 } from './builder'; +import { IAssetInfo as IAssetInfo_3 } from './builder'; +import { IAssetInfoMap as IAssetInfoMap_2 } from './builder'; +import { IAssetPathInfo as IAssetPathInfo_2 } from './builder'; +import { IAssetWriteFileOptions as IAssetWriteFileOptions_2 } from '@cocos/asset-db'; +import { IASTCQuality as IASTCQuality_2 } from './builder'; +import { IAtlasInfo as IAtlasInfo_2 } from './builder'; +import { IAtlasResult as IAtlasResult_2 } from './builder'; +import { IAutoAtlasUserData as IAutoAtlasUserData_2 } from './builder'; +import { IBaseHooks as IBaseHooks_2 } from './builder'; +import { IBinGroupConfig as IBinGroupConfig_2 } from './builder'; +import { IBuildAssetHandlerInfo as IBuildAssetHandlerInfo_2 } from './builder'; +import { IBuildCacheUseConfig as IBuildCacheUseConfig_2 } from './builder'; +import { IBuildCommandOption as IBuildCommandOption_2 } from './builder'; +import { IBuildCommonOptions as IBuildCommonOptions_2 } from './builder'; +import { IBuildEngineParam as IBuildEngineParam_2 } from './builder'; +import { IBuilder as IBuilder_2 } from './builder'; +import { IBuilderConfigItem as IBuilderConfigItem_2 } from './builder'; +import { IBuilderRegisterInfo as IBuilderRegisterInfo_2 } from './builder'; +import { IBuildHooksInfo as IBuildHooksInfo_2 } from './builder'; +import { IBuildIconItem as IBuildIconItem_2 } from './builder'; +import { IBuildManager as IBuildManager_2 } from './builder'; +import { IBuildOptionBase as IBuildOptionBase_2 } from './builder'; +import { IBuildPanel as IBuildPanel_2 } from './builder'; +import { IBuildPaths as IBuildPaths_2 } from './builder'; +import { IBuildPlugin as IBuildPlugin_2 } from './builder'; +import { IBuildPluginConfig as IBuildPluginConfig_2 } from './builder'; +import { IBuildPluginProfile as IBuildPluginProfile_2 } from './builder'; +import { IBuildProcessInfo as IBuildProcessInfo_2 } from './builder'; +import { IBuildResult as IBuildResult_2 } from './builder'; +import { IBuildResultData as IBuildResultData_2 } from './builder'; +import { IBuildResultFailed as IBuildResultFailed_2 } from './builder'; +import { IBuildResultSuccess as IBuildResultSuccess_2 } from './builder'; +import { IBuildSceneItem as IBuildSceneItem_2 } from './builder'; +import { IBuildScriptParam as IBuildScriptParam_2 } from './builder'; +import { IBuildSeparateEngineCacheOptions as IBuildSeparateEngineCacheOptions_2 } from './builder'; +import { IBuildSeparateEngineOptions as IBuildSeparateEngineOptions_2 } from './builder'; +import { IBuildSeparateEngineResult as IBuildSeparateEngineResult_2 } from './builder'; +import { IBuildStage as IBuildStage_2 } from './builder'; +import { IBuildStageHooks as IBuildStageHooks_2 } from './builder'; +import { IBuildStageItem as IBuildStageItem_2 } from './builder'; +import { IBuildStageOptions as IBuildStageOptions_2 } from './builder'; +import { IBuildStagesInfo as IBuildStagesInfo_2 } from './builder'; +import { IBuildStageTask as IBuildStageTask_2 } from './builder'; +import { IBuildSystemJsOption as IBuildSystemJsOption_2 } from './builder'; +import { IBuildTask as IBuildTask_2 } from './builder'; +import { IBuildTaskItemJSON as IBuildTaskItemJSON_2 } from './builder'; +import { IBuildTaskOption as IBuildTaskOption_2 } from './builder'; +import { IBuildTemplate as IBuildTemplate_2 } from './builder'; +import { IBuildUtils as IBuildUtils_2 } from './builder'; +import { IBuildVerificationFunc as IBuildVerificationFunc_2 } from './builder'; +import { IBuildWorkerPluginInfo as IBuildWorkerPluginInfo_2 } from './builder'; +import { IBundle as IBundle_2 } from './builder'; +import { IBundleBuildOptions as IBundleBuildOptions_2 } from './builder'; +import { IBundleConfig as IBundleConfig_2 } from './builder'; +import { IBundleInitOptions as IBundleInitOptions_2 } from './builder'; +import { IBundleInternalOptions as IBundleInternalOptions_2 } from './builder'; +import { IBundleManager as IBundleManager_2 } from './builder'; +import { IBundleOptions as IBundleOptions_2 } from './builder'; +import { IBundleTaskItemJSON as IBundleTaskItemJSON_2 } from './builder'; +import { IBundleTaskOption as IBundleTaskOption_2 } from './builder'; +import { ICollisionMatrix as ICollisionMatrix_3 } from './builder'; +import { ICommandInfo as ICommandInfo_2 } from './builder'; +import { ICompressConfig as ICompressConfig_2 } from './builder'; +import { ICompressImageResult as ICompressImageResult_2 } from './builder'; +import { ICompressOptions as ICompressOptions_2 } from './builder'; +import { IconConfig as IconConfig_2 } from './builder'; +import { IConfigGroups as IConfigGroups_2 } from './builder'; +import { IConfigGroupsInfo as IConfigGroupsInfo_2 } from './builder'; +import { IConsoleMessage as IConsoleMessage_2 } from './builder'; +import { IConsoleType as IConsoleType_2 } from './builder'; +import { ICustomBuildIconInfo as ICustomBuildIconInfo_2 } from './builder'; +import { ICustomBuildStageDisplayItem as ICustomBuildStageDisplayItem_2 } from './builder'; +import { ICustomConfig as ICustomConfig_2 } from './builder'; +import { ICustomConsoleType as ICustomConsoleType_2 } from './builder'; +import { IData as IData_2 } from './builder'; +import { IDefaultGroup as IDefaultGroup_2 } from './builder'; +import { IDisplayOptions as IDisplayOptions_2 } from './builder'; +import { IEngineCachePaths as IEngineCachePaths_2 } from './builder'; +import { IEngineFeatureQuery as IEngineFeatureQuery_2 } from './builder'; +import { IEnvLimitModule as IEnvLimitModule_2 } from './builder'; +import { IETCQuality as IETCQuality_2 } from './builder'; +import { IExportData as IExportData_2 } from './builder'; +import { IGroup as IGroup_2 } from './builder'; +import { IGroupType as IGroupType_2 } from './builder'; +import { IHandlerInfo as IHandlerInfo_2 } from './builder'; +import { IImageTaskInfo as IImageTaskInfo_2 } from './builder'; +import { IImportAssetPathInfo as IImportAssetPathInfo_2 } from './builder'; +import { IImportMapOptions as IImportMapOptions_2 } from './builder'; +import { IInstanceMap as IInstanceMap_2 } from './builder'; +import { IInterBuildTaskOption as IInterBuildTaskOption_2 } from './builder'; +import { IInternalBaseHooks as IInternalBaseHooks_2 } from './builder'; +import { IInternalBuildOptions as IInternalBuildOptions_2 } from './builder'; +import { IInternalBuildPluginConfig as IInternalBuildPluginConfig_2 } from './builder'; +import { IInternalBuildUtils as IInternalBuildUtils_2 } from './builder'; +import { IInternalBundleBaseHooks as IInternalBundleBaseHooks_2 } from './builder'; +import { IInternalBundleBuildOptions as IInternalBundleBuildOptions_2 } from './builder'; +import { IInternalHook as IInternalHook_2 } from './builder'; +import { IInternalPackOptions as IInternalPackOptions_2 } from './builder'; +import { IInternalStageTaskHooks as IInternalStageTaskHooks_2 } from './builder'; +import { IInternalVerificationFunc as IInternalVerificationFunc_2 } from './builder'; +import { IInternalVerificationRule as IInternalVerificationRule_2 } from './builder'; +import { IJSONGroupItem as IJSONGroupItem_2 } from './builder'; +import { IJsonGroupMap as IJsonGroupMap_2 } from './builder'; +import { IJSONGroupType as IJSONGroupType_2 } from './builder'; +import { IJsonMap as IJsonMap_2 } from './builder'; +import { IJsonPathInfo as IJsonPathInfo_2 } from './builder'; +import { ImageCompressTask as ImageCompressTask_2 } from './builder'; +import { IMD5Map as IMD5Map_2 } from './builder'; +import { IMD5Options as IMD5Options_2 } from './builder'; +import { IMetaMap as IMetaMap_2 } from './builder'; +import { IModules as IModules_2 } from './builder'; +import { ImportMap as ImportMap_2 } from './builder'; +import { ImportMapOptions as ImportMapOptions_2 } from './builder'; +import { ImportMapWithImports as ImportMapWithImports_2 } from './builder'; +import { InfoManager as InfoManager_2 } from './builder'; +import { InternalBuildResult as InternalBuildResult_3 } from './builder'; +import { InternalPlatform as InternalPlatform_2 } from './builder'; +import { IOrientation as IOrientation_3 } from './builder'; +import { IPacInfo as IPacInfo_2 } from './builder'; +import { IPackageInfo as IPackageInfo_2 } from './builder'; +import { IPackageRegisterInfo as IPackageRegisterInfo_2 } from './builder'; +import { IPackOptions as IPackOptions_2 } from './builder'; +import { IPackResult as IPackResult_2 } from './builder'; +import { IPhysicsConfig as IPhysicsConfig_3 } from './builder'; +import { IPhysicsMaterial as IPhysicsMaterial_2 } from './builder'; +import { IPlatformBuildPluginConfig as IPlatformBuildPluginConfig_2 } from './builder'; +import { IPlatformConfig as IPlatformConfig_2 } from './builder'; +import { IPlatformInfo as IPlatformInfo_2 } from './builder'; +import { IPlatformRegisterInfo as IPlatformRegisterInfo_2 } from './builder'; +import { IPlatformSupportPlatformsConfig as IPlatformSupportPlatformsConfig_2 } from './builder'; +import { IPlatformType as IPlatformType_2 } from './builder'; +import { IPluginHook as IPluginHook_2 } from './builder'; +import { IPluginHookName as IPluginHookName_2 } from './builder'; +import { IPluginRegisterInfo as IPluginRegisterInfo_2 } from './builder'; +import { IPluginScriptInfo as IPluginScriptInfo_2 } from './assets'; +import { IPolyFills as IPolyFills_2 } from './builder'; +import { IPreviewSettingsResult as IPreviewSettingsResult_2 } from './builder'; +import { IProcessingFunc as IProcessingFunc_2 } from './builder'; +import { IPVRQuality as IPVRQuality_2 } from './builder'; +import { IQuickSpawnOption as IQuickSpawnOption_2 } from './builder'; +import { IRawAssetPathInfo as IRawAssetPathInfo_2 } from './builder'; +import { IRecompileConfig as IRecompileConfig_2 } from './builder'; +import { IScriptInfo as IScriptInfo_2 } from './builder'; +import { IScriptOptions as IScriptOptions_2 } from './builder'; +import { IScriptProjectOption as IScriptProjectOption_2 } from './builder'; +import { ISerializedOptions as ISerializedOptions_2 } from './builder'; +import { ISettings as ISettings_2 } from './builder'; +import { ISettingsDesignResolution as ISettingsDesignResolution_2 } from './builder'; +import { ISignatureConfig as ISignatureConfig_2 } from './builder'; +import { ISortType as ISortType_2 } from './builder'; +import { ISpriteFrameInfo as ISpriteFrameInfo_2 } from './builder'; +import { IStageTaskItemJSON as IStageTaskItemJSON_2 } from './builder'; +import { IStorePackInfo as IStorePackInfo_2 } from './builder'; +import { ISubTaskBuildOutput as ISubTaskBuildOutput_2 } from './builder'; +import { ISuffixMap as ISuffixMap_2 } from './builder'; +import { ISupportFormat as ISupportFormat_2 } from './builder'; +import { ITaskItemJSON as ITaskItemJSON_2 } from './builder'; +import { ITaskState as ITaskState_2 } from './builder'; +import { ITextureCompressConfig as ITextureCompressConfig_2 } from './builder'; +import { ITextureCompressConfigs as ITextureCompressConfigs_2 } from './builder'; +import { ITextureCompressFormatType as ITextureCompressFormatType_2 } from './builder'; +import { ITextureCompressPlatform as ITextureCompressPlatform_2 } from './builder'; +import { ITextureCompressType as ITextureCompressType_2 } from './builder'; +import { ITextureFormatConfig as ITextureFormatConfig_2 } from './builder'; +import { ITextureFormatInfo as ITextureFormatInfo_2 } from './builder'; +import { ITransformOptions as ITransformOptions_2 } from './builder'; +import { ITransformTarget as ITransformTarget_2 } from './builder'; +import { ITrimInfo as ITrimInfo_2 } from './builder'; +import { IUpdateInfo as IUpdateInfo_2 } from './builder'; +import { IUpdateType as IUpdateType_2 } from './builder'; +import { IUrl as IUrl_2 } from './builder'; +import { IUuidDependMap as IUuidDependMap_2 } from './builder'; +import { IVec3Like as IVec3Like_3 } from './builder'; +import { IVerificationFunc as IVerificationFunc_2 } from './builder'; +import { IVerificationRule as IVerificationRule_2 } from './builder'; +import { IVerificationRuleMap as IVerificationRuleMap_2 } from './builder'; +import { IVersionMap as IVersionMap_2 } from './builder'; +import { MakeRequired as MakeRequired_2 } from './builder'; +import { Md5GlobbyPathInfo as Md5GlobbyPathInfo_2 } from './builder'; +import { Meta as Meta_2 } from './builder'; +import { MetaManager as MetaManager_2 } from './builder'; +import { ModulePreservation as ModulePreservation_2 } from './builder'; +import { nativeOptions as nativeOptions_2 } from './builder'; +import { OverwriteCommonOption as OverwriteCommonOption_2 } from './builder'; +import { OverwriteProjectSettings as OverwriteProjectSettings_2 } from './builder'; +import { PacInfo as PacInfo_2 } from './builder'; +import { PacStoreInfo as PacStoreInfo_2 } from './builder'; +import { ParallelQueue as ParallelQueue_2 } from './builder'; +import { Physics as Physics_2 } from './builder'; +import { Platform as Platform_2 } from './builder'; +import { PlatformBuildSchema as PlatformBuildSchema_2 } from './builder'; +import { PlatformBundleConfig as PlatformBundleConfig_2 } from './builder'; +import { PlatformCompressConfig as PlatformCompressConfig_2 } from './builder'; +import { PlatformConfigItem as PlatformConfigItem_2 } from './builder'; +import { PlatformPackageOptionMap as PlatformPackageOptionMap_2 } from './builder'; +import { PlatformPackageOptions as PlatformPackageOptions_2 } from './builder'; +import { PlatformTextureCompressConfig as PlatformTextureCompressConfig_2 } from './builder'; +import { PlatformTypeInfo as PlatformTypeInfo_2 } from './builder'; import type { PluginItem } from '@babel/core'; +import { PreviewPackResult as PreviewPackResult_2 } from './builder'; +import { ScriptAssetUserData as ScriptAssetUserData_2 } from './builder'; +import { ScriptBuilder as ScriptBuilder_3 } from './builder'; import { SpriteFrame } from 'cc'; +import { TaskAddResult as TaskAddResult_2 } from './builder'; +import { TaskManager as TaskManager_2 } from './builder'; +import { TextureCompress as TextureCompress_3 } from './builder'; +import { TextureCompressFullRenderConfig as TextureCompressFullRenderConfig_2 } from './builder'; +import { TextureCompressRenderConfig as TextureCompressRenderConfig_2 } from './builder'; +import { TransformOptions as TransformOptions_2 } from './builder'; +import { Url as Url_2 } from './builder'; +import { UserCompressConfig as UserCompressConfig_2 } from './builder'; +import { UUID as UUID_2 } from './builder'; +import { WebDesktopBuildOptions as WebDesktopBuildOptions_2 } from './builder'; +import { webDesktopOptions as webDesktopOptions_2 } from './builder'; +import { WebMobileBuildOptions as WebMobileBuildOptions_2 } from './builder'; +import { webMobileOptions as webMobileOptions_2 } from './builder'; +import { windowsOptions as windowsOptions_2 } from './builder'; export declare interface AcornNode { - end: number; - start: number; - type: string; + end: number; + start: number; + type: string; } export declare type AddonHook = string | AddonHookFunction; export declare type AddonHookFunction = (this: PluginContext) => string | Promise; @@ -1313,22 +2642,22 @@ export declare interface AllTextureCompressConfig { textureFormatConfigs: Record; } export declare type AmdOptions = ( - | { - autoId?: false; - id: string; - } - | { - autoId: true; - basePath?: string; - id?: undefined; - } - | { - autoId?: false; - id?: undefined; - } + | { + autoId?: false; + id: string; + } + | { + autoId: true; + basePath?: string; + id?: undefined; + } + | { + autoId?: false; + id?: undefined; + } ) & { - define?: string; - forceJsExtensionForImports?: boolean; + define?: string; + forceJsExtensionForImports?: boolean; }; export declare interface AnimationClipAssetUserData { name: string; @@ -1375,7 +2704,7 @@ export declare type ArrayItem = { labelI18nKey?: string; value: string; }; -export declare class Asset extends VirtualAsset { +export declare class Asset extends VirtualAsset_2 { _source: string; get source(): string; _url: string; @@ -1387,12 +2716,36 @@ export declare class Asset extends VirtualAsset { save(): Promise; isDirectory(): boolean; } -export declare const ASSET_HANDLER_TYPES: readonly ["directory", "unknown", "text", "json", "spine-data", "dragonbones", "dragonbones-atlas", "terrain", "javascript", "typescript", "scene", "prefab", "sprite-frame", "tiled-map", "buffer", "image", "sign-image", "alpha-image", "texture", "texture-cube", "erp-texture-cube", "render-texture", "texture-cube-face", "rt-sprite-frame", "gltf", "gltf-mesh", "gltf-animation", "gltf-skeleton", "gltf-material", "gltf-scene", "gltf-embeded-image", "fbx", "material", "physics-material", "effect", "effect-header", "audio-clip", "animation-clip", "animation-graph", "animation-graph-variant", "animation-mask", "ttf-font", "bitmap-font", "particle", "sprite-atlas", "auto-atlas", "label-atlas", "render-pipeline", "render-stage", "render-flow", "instantiation-material", "instantiation-mesh", "instantiation-skeleton", "instantiation-animation", "video-clip", "*", "database"]; -export declare enum AssetActionEnum { - 'add' = 0, - 'change' = 1, - 'delete' = 2, - 'none' = 3 +export declare class Asset_2 extends Asset { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} +declare class Asset_3 extends VirtualAsset_4 { + _source: string; + get source(): string; + _url: string; + get url(): string; + extname: string; + basename: string; + constructor(source: string, meta: Meta_2, assetDB: AssetDB_2); + updateUrl(): void; + save(): Promise; + isDirectory(): boolean; +} +declare class Asset_4 extends Asset_3 { + getData(name: 'output'): IExportData_2; + getData(name: string): any; + setData(name: 'output', data: IExportData_2): void; + setData(name: string, data: any): void; +} +export declare const ASSET_HANDLER_TYPES: readonly ["directory", "unknown", "text", "json", "spine-data", "dragonbones", "dragonbones-atlas", "terrain", "javascript", "typescript", "scene", "prefab", "sprite-frame", "tiled-map", "buffer", "image", "sign-image", "alpha-image", "texture", "texture-cube", "erp-texture-cube", "render-texture", "texture-cube-face", "rt-sprite-frame", "gltf", "gltf-mesh", "gltf-animation", "gltf-skeleton", "gltf-material", "gltf-scene", "gltf-embeded-image", "fbx", "material", "physics-material", "effect", "effect-header", "audio-clip", "animation-clip", "animation-graph", "animation-graph-variant", "animation-mask", "ttf-font", "bitmap-font", "particle", "sprite-atlas", "auto-atlas", "label-atlas", "render-pipeline", "render-stage", "render-flow", "instantiation-material", "instantiation-mesh", "instantiation-skeleton", "instantiation-animation", "video-clip", "*", "database"]; +export declare enum AssetActionEnum { + 'add' = 0, + 'change' = 1, + 'delete' = 2, + 'none' = 3 } export declare class AssetDB extends EventEmitter { static readonly version = "1.0.1"; @@ -1408,7 +2761,7 @@ export declare class AssetDB extends EventEmitter { console: CustomConsole; infoManager: InfoManager; dependencyManager: DependencyManager; - taskManager: ParallelQueue; + taskManager: ParallelQueue; dataManager: DataManager; _lock: boolean; _waitLockHandler: Function[]; @@ -1432,14 +2785,60 @@ export declare class AssetDB extends EventEmitter { stop(): Promise; pathToUuid(path: string): string | null; uuidToPath(uuid: string): string | null; - getAsset(uuid: string): VirtualAsset | null; - reimport(fileOrUUID: string): Promise; + getAsset(uuid: string): VirtualAsset_2 | null; + reimport(fileOrUUID: string): Promise; refresh(path: string, options?: AssetDBRefreshOptions): Promise; private _replaceUUID; private _updateAssetPathCase; private _checkAssetsStatSync; private _checkAssetStat; } +declare class AssetDB_2 extends EventEmitter { + static readonly version = "1.0.1"; + options: AssetDBOptions_2; + flag: { + starting: boolean; + started: boolean; + }; + path2asset: Map; + uuid2asset: Map; + importerManager: any; + metaManager: MetaManager_2; + console: CustomConsole_2; + infoManager: InfoManager_2; + dependencyManager: DependencyManager_2; + taskManager: ParallelQueue_2; + dataManager: DataManager_2; + _lock: boolean; + _waitLockHandler: Function[]; + cachePath: string; + get assetProgressInfo(): { + current: number; + total: number; + wait: any; + }; + private lock; + private unlock; + constructor(options: AssetDBOptions_2); + preImporterHandler?(file: string): boolean; + private prepareStart; + start(options?: AssetDBStartOptions_2): Promise; + startWithCache(): Promise; + updateInfoManager(): Promise; + private _generateRecordInfo; + save(): Promise; + private restoreFromCache; + stop(): Promise; + pathToUuid(path: string): string | null; + uuidToPath(uuid: string): string | null; + getAsset(uuid: string): VirtualAsset_4 | null; + reimport(fileOrUUID: string): Promise; + refresh(path: string, options?: AssetDBRefreshOptions_2): Promise; + private _replaceUUID; + private _updateAssetPathCase; + private _checkAssetsStatSync; + private _checkAssetStat; +} export declare interface AssetDBOptions { name: string; target: string; @@ -1556,10 +2955,12 @@ export declare interface BitmapFontAssetUserData { } export declare type BreakType = 'cancel' | 'crashed' | 'refreshed' | 'interrupted' | ''; export declare function build

(platform: P, options?: IBuildCommandOption): Promise; +declare function build_2

(platform: P, options?: IBuildCommandOption_2): Promise; export declare interface BuildBundleConfiguration { custom: CustomBundleConfigMap; } export declare function buildBundleOnly(bundleOptions: IBundleBuildOptions): Promise; +declare function buildBundleOnly_2(bundleOptions: IBundleBuildOptions_2): Promise; export declare type BuildCacheScope = 'project' | 'global' | 'all'; export declare interface BuildCheckResult { valid: boolean; @@ -1602,6 +3003,31 @@ export declare class BuilderAssetCache implements BuilderCache { forEach(type: string, handle: Function): Promise; getInstance(uuid: string): Promise; } +declare class BuilderAssetCache_2 implements BuilderCache_2 { + readonly scenes: Array; + readonly scriptUuids: Array; + assetUuids: Array; + private readonly instanceMap; + private readonly _task?; + constructor(task?: IBuilder_2); + init(): Promise; + hasAsset(uuid: string): Promise; + addAsset(asset: IAsset_2, type?: string): void; + private addSingleAsset; + removeAsset(uuid: string, type?: string): void; + getAssetInfo(uuid: string): IAssetInfo_3; + addInstance(instance: any): void; + clearAsset(uuid: string): void; + getMeta(uuid: string): Promise; + addMeta(uuid: string, meta: any): Promise; + getDependUuids(uuid: string): Promise; + getDependUuidsDeep(uuid: string): Promise; + getLibraryJSON(uuid: string): Promise; + getSerializedJSON(uuid: string, options: ISerializedOptions_2): Promise; + outputAssetJson(uuid: string, destDir: string, options: IInternalBuildOptions_2): Promise; + forEach(type: string, handle: Function): Promise; + getInstance(uuid: string): Promise; +} export declare interface BuilderCache { readonly scenes: Array; readonly scriptUuids: Array; @@ -1623,7 +3049,7 @@ export declare interface BuilderCache { getInstance: (uuid: string) => Promise; outputAssetJson: (uuid: string, destDir: string, options: IInternalBuildOptions) => Promise; } -export declare const enum BuildExitCode { +export declare enum BuildExitCode { PARAM_ERROR = 32, BUILD_FAILED = 34, BUILD_SUCCESS = 0, @@ -1729,6 +3155,55 @@ export declare class BuildTask extends BuildTaskBase implements IBuilder { onError(error: Error, throwError?: boolean): void; runErrorHook(): Promise; } +declare class BuildTask_2 extends BuildTaskBase_2 implements IBuilder_2 { + cache: BuilderAssetCache_2; + result: InternalBuildResult_4; + buildTemplate: BuildTemplate_2; + buildResult?: BuildResult_2; + options: IInternalBuildOptions_2; + hooksInfo: IBuildHooksInfo_2; + taskManager: TaskManager_2; + private mainTaskWeight; + static isCommandBuild: boolean; + private currentStageTask?; + private currentSubTask?; + private subTaskBuildOptions; + bundleManager: BundleManager_2; + hookMap: Record; + pipeline: (string | Function | IBuildTask_2[])[]; + private taskResMap; + static utils: IBuildUtils_2; + get utils(): IBuildUtils_2; + constructor(id: string, options: IBuildOptionBase_2); + get stage(): string; + getTaskResult(name: keyof ITaskResultMap_3): { + projectJs: string; + systemJs: string; + polyfillsJs: string | null; + } | IBuildPacResult_3 | undefined; + init(): Promise; + run(): Promise; + buildBundleOnly(): Promise; + private postBuild; + private runSubTaskBuilds; + private syncSubTaskPackageOptions; + private createSubTaskOptions; + private getCompileConfigOptions; + private handleBuildStageTask; + private getStagePlatforms; + private createChildStageOptions; + private runStageForPlatform; + private initBundleManager; + break(reason: string): void; + lockAssetDB(): Promise; + unLockAssetDB(): void; + getPreviewSettings(): Promise; + private initOptions; + private runBuildTask; + handleHook(func: Function, internal: boolean, ...args: any[]): Promise; + onError(error: Error, throwError?: boolean): void; + runErrorHook(): Promise; +} export declare abstract class BuildTaskBase extends EventEmitter { breakReason?: string; name: string; @@ -1788,7 +3263,7 @@ export declare interface BuildTemplateConfig { pkgName?: string; dirname?: string; } -export declare const enum BuiltinBundleName { +export declare enum BuiltinBundleName { RESOURCES = "resources", MAIN = "main", START_SCENE = "start-scene", @@ -1800,8 +3275,14 @@ export declare enum BuiltinBundleName_2 { START_SCENE = "start-scene", INTERNAL = "internal" } +declare enum BuiltinBundleName_4 { + RESOURCES = "resources", + MAIN = "main", + START_SCENE = "start-scene", + INTERNAL = "internal" +} export declare type BundleCompressionType = 'none' | 'merge_dep' | 'merge_all_json' | 'subpackage' | 'zip'; -export declare const enum BundleCompressionTypes { +export declare enum BundleCompressionTypes { NONE = "none", MERGE_DEP = "merge_dep", MERGE_ALL_JSON = "merge_all_json", @@ -1815,6 +3296,13 @@ export declare enum BundleCompressionTypes_2 { SUBPACKAGE = "subpackage", ZIP = "zip" } +declare enum BundleCompressionTypes_4 { + NONE = "none", + MERGE_DEP = "merge_dep", + MERGE_ALL_JSON = "merge_all_json", + SUBPACKAGE = "subpackage", + ZIP = "zip" +} export declare interface BundleConfigItem { isRemote?: boolean; compressionType: BundleCompressionType; @@ -1893,6 +3381,67 @@ export declare class BundleManager extends BuildTaskBase implements IBundleManag runAllTask(): Promise; runBuildTask(handle: Function, increment: number): Promise; } +declare class BundleManager_2 extends BuildTaskBase_2 implements IBundleManager_2 { + static BuiltinBundleName: typeof BuiltinBundleName_4; + static BundleConfigs: Record>; + private _task?; + options: IInternalBundleBuildOptions_2; + destDir: string; + hooksInfo: IBuildHooksInfo_2; + bundleMap: Record; + bundles: IBundle_2[]; + _pacAssets: string[]; + _bundleGroupInPriority?: Array; + imageCompressManager?: TextureCompress_4; + scriptBuilder: ScriptBuilder_4; + packResults: PacInfo_2[]; + cache: BuilderAssetCache_2; + hookMap: { + onBeforeBundleInit: string; + onAfterBundleInit: string; + onBeforeBundleDataTask: string; + onAfterBundleDataTask: string; + onBeforeBundleBuildTask: string; + onAfterBundleBuildTask: string; + }; + pipeline: (string | Function)[]; + get bundleGroupInPriority(): IBundle_2[][]; + static internalBundlePriority: Record; + private constructor(); + static create(options: IBuildOptionBase_2, task?: IBuilder_2): Promise; + loadScript(scriptUuids: string[], pluginScripts: IPluginScriptInfo_2[]): Promise; + static initStaticBundleConfig(): Promise; + getUserConfig(ID?: string): { + isRemote: boolean; + compressionType: BundleCompressionTypes_4; + } | null; + initOptions(): Promise; + clearBundleDest(): void; + initAsset(): Promise; + initBundleConfig(): Promise; + buildAsset(): Promise; + run(): Promise; + outputBundle(): Promise; + private addBundle; + private getDefaultBundleConfig; + initBundle(): Promise; + private initInternalBundleConfigs; + private patchProjectBundleConfig; + private initBundleRootAssets; + private addSceneEditorAssets; + private initBundleShareAssets; + bundleDataTask(): Promise; + private compressImage; + private packImage; + buildScript(): Promise; + private outputAssets; + handleHook(func: Function, internal: boolean, ...args: any[]): Promise; + runAllTask(): Promise; + runBuildTask(handle: Function, increment: number): Promise; +} export declare type BundlePlatformType = 'native' | 'miniGame' | 'web'; export declare interface BundleQueryConfig { displayName: string; @@ -1904,33 +3453,45 @@ export declare interface BundleRenderConfig { maxOptionList: Record; minOptionList?: Record; } +declare function calcValidOutputName(root: string, dirName: string, platform: string, id?: string): Promise; export declare type CCEnvConstants = StatsQuery.ConstantManager.CCEnvConstants; export declare type ChangeEvent = 'create' | 'update' | 'delete'; +declare function checkBuildCommonOptions(options: any): Promise>; +declare function checkBuildCommonOptionsByKey(key: string, value: any, options: IBuildTaskOption_2): Promise; export declare function checkBuildOption(platform: string, key: string, value: unknown, options: IBuildTaskOption): Promise; +declare function checkBuildOption_2(platform: string, key: string, value: unknown, options: IBuildTaskOption_2): Promise; export declare function checkBuildOptions(platform: string, options: IBuildTaskOption): Promise>; +declare function checkBuildOptions_2(platform: string, options: IBuildTaskOption_2): Promise>; +declare function checkBuildPathIsInvalid(path: string): boolean; +declare function checkBundleCompressionSetting(value: BundleCompressionType_2, supportedCompressionTypes: BundleCompressionType_2[]): BuildCheckResult_2; +declare function checkConflict(buildPath: string, outputName: string, buildPathDict: Record): boolean; +declare function checkProjectSetting(options: IInternalBuildOptions_2 | IInternalBundleBuildOptions_2): Promise; +declare function checkScenes(scenes: IBuildSceneItem_2[]): boolean | Error; +declare function checkStartScene(uuidOrUrl: string): boolean | Error; export declare interface ChokidarOptions { - alwaysStat?: boolean; - atomic?: boolean | number; - awaitWriteFinish?: - | { - pollInterval?: number; - stabilityThreshold?: number; - } - | boolean; - binaryInterval?: number; - cwd?: string; - depth?: number; - disableGlobbing?: boolean; - followSymlinks?: boolean; - ignoreInitial?: boolean; - ignorePermissionErrors?: boolean; - ignored?: any; - interval?: number; - persistent?: boolean; - useFsEvents?: boolean; - usePolling?: boolean; + alwaysStat?: boolean; + atomic?: boolean | number; + awaitWriteFinish?: + | { + pollInterval?: number; + stabilityThreshold?: number; + } + | boolean; + binaryInterval?: number; + cwd?: string; + depth?: number; + disableGlobbing?: boolean; + followSymlinks?: boolean; + ignoreInitial?: boolean; + ignorePermissionErrors?: boolean; + ignored?: any; + interval?: number; + persistent?: boolean; + useFsEvents?: boolean; + usePolling?: boolean; } export declare function clearCache(options: ClearCacheOptions): Promise; +declare function clearCache_2(options: ClearCacheOptions_2): Promise; export declare interface ClearCacheOptions { scope: BuildCacheScope; } @@ -1996,7 +3557,7 @@ export declare interface Config { treeShake?: ITreeShakeConfig; } export declare namespace ConfigInterface { - export { + export { Config, IndexConfig, Test, @@ -2016,10 +3577,312 @@ export declare interface Context { platform?: string; buildTimeConstants?: object; } +export declare namespace CoreBuilderIndex { + export { + init_2 as init, + createBuildTask_2 as createBuildTask, + build_2 as build, + createBundleBuildTask_2 as createBundleBuildTask, + buildBundleOnly_2 as buildBundleOnly, + createBuildStageTask_2 as createBuildStageTask, + executeBuildStageTask_2 as executeBuildStageTask, + getPreviewSettings_2 as getPreviewSettings, + queryBuildConfig_2 as queryBuildConfig, + queryBundleConfig_2 as queryBundleConfig, + queryTextureCompressConfig_2 as queryTextureCompressConfig, + queryPlatformConfig_2 as queryPlatformConfig, + getPlatformBuildSchema_2 as getPlatformBuildSchema, + refreshDisplayI18nFields_2 as refreshDisplayI18nFields, + createBuildTemplate_2 as createBuildTemplate, + checkBuildOption_2 as checkBuildOption, + checkBuildOptions_2 as checkBuildOptions, + queryAssetsInBundle_2 as queryAssetsInBundle, + getRegisteredPlatforms_2 as getRegisteredPlatforms, + queryDefaultBuildConfigByPlatform_2 as queryDefaultBuildConfigByPlatform, + clearCache_2 as clearCache, + BuildCacheScope_2 as BuildCacheScope, + ClearCacheOptions_2 as ClearCacheOptions, + ClearCacheResult_2 as ClearCacheResult + } +} +export declare namespace CoreBuilderPlatformsWebCommonUtils { + export { + getBuidPath, + getPreviewUrl_2 as getPreviewUrl, + openUrlAsync, + run_2 as run, + injectBridgeScripts, + IWebBridgeScriptOptions + } +} +export declare namespace CoreBuilderShareCommonOptionsValidator { + export { + checkScenes, + checkStartScene, + calcValidOutputName, + checkConflict, + generateNewOutputName, + checkBuildPathIsInvalid, + getDefaultScenes, + getDefaultStartScene, + checkBuildCommonOptionsByKey, + checkBuildCommonOptions, + checkBundleCompressionSetting, + handleOverwriteProjectSettings, + fillIncludeModulesFromProjectConfig, + checkProjectSetting, + overwriteModuleConfig + } +} +export declare namespace CoreBuilderTypesProtected { + export { + BuilderCache_2 as BuilderCache, + IUrl_2 as IUrl, + IAssetInfoMap_2 as IAssetInfoMap, + IUuidDependMap_2 as IUuidDependMap, + IJsonGroupMap_2 as IJsonGroupMap, + IAssetGroupMap_2 as IAssetGroupMap, + IMetaMap_2 as IMetaMap, + IJsonMap_2 as IJsonMap, + IInstanceMap_2 as IInstanceMap, + ICompressOptions_2 as ICompressOptions, + IAssetGroupItem_2 as IAssetGroupItem, + IJSONGroupItem_2 as IJSONGroupItem, + IAssetGroupOptions_2 as IAssetGroupOptions, + IGroupType_2 as IGroupType, + IUpdateType_2 as IUpdateType, + IUpdateInfo_2 as IUpdateInfo, + ImportMap_2 as ImportMap, + ImportMapWithImports_2 as ImportMapWithImports, + IPlatformType_2 as IPlatformType, + BabelPluginItem_2 as BabelPluginItem, + IModules_2 as IModules, + ITransformOptions_2 as ITransformOptions, + IBundleInternalOptions_2 as IBundleInternalOptions, + ScriptAssetUserData_2 as ScriptAssetUserData, + fileMap_2 as fileMap, + Physics_2 as Physics, + Url_2 as Url, + AssetInfoArr_2 as AssetInfoArr, + TaskAddResult_2 as TaskAddResult, + IBundleInitOptions_2 as IBundleInitOptions, + IBuildScriptParam_2 as IBuildScriptParam, + ModulePreservation_2 as ModulePreservation, + AssetSerializeOptions_2 as AssetSerializeOptions, + ISerializedOptions_2 as ISerializedOptions, + IBundleBuildOptions_2 as IBundleBuildOptions, + TransformOptions_2 as TransformOptions, + Md5GlobbyPathInfo_2 as Md5GlobbyPathInfo, + IMD5Options_2 as IMD5Options, + IScriptOptions_2 as IScriptOptions, + IImportMapOptions_2 as IImportMapOptions, + IInternalBundleBuildOptions_2 as IInternalBundleBuildOptions, + IBuildCommandOption_2 as IBuildCommandOption, + IInternalBuildOptions_2 as IInternalBuildOptions, + appTemplateData_2 as appTemplateData, + IEngineCachePaths_2 as IEngineCachePaths, + ISignatureConfig_2 as ISignatureConfig, + IBuildSeparateEngineResult_2 as IBuildSeparateEngineResult, + IBuildSeparateEngineOptions_2 as IBuildSeparateEngineOptions, + IEnvLimitModule_2 as IEnvLimitModule, + IEngineFeatureQuery_2 as IEngineFeatureQuery, + IBuildSeparateEngineCacheOptions_2 as IBuildSeparateEngineCacheOptions, + IBuildEngineParam_2 as IBuildEngineParam, + ITransformTarget_2 as ITransformTarget, + IAssetInfo_3 as IAssetInfo, + IRecompileConfig_2 as IRecompileConfig, + IStageTaskItemJSON_2 as IStageTaskItemJSON, + IBundleTaskItemJSON_2 as IBundleTaskItemJSON, + IBuildStageOptions_2 as IBuildStageOptions, + BuildStageProgressCallback_2 as BuildStageProgressCallback, + BuildExitCode_2 as BuildExitCode, + IBuildResultSuccess_2 as IBuildResultSuccess, + IBuildResultFailed_2 as IBuildResultFailed, + IBuildResultData_2 as IBuildResultData, + ExecuteHookTaskOption_2 as ExecuteHookTaskOption, + TextureCompress_3 as TextureCompress, + ScriptBuilder_3 as ScriptBuilder, + IBundleManager_2 as IBundleManager, + IBuildTemplate_2 as IBuildTemplate, + InternalBuildResult_3 as InternalBuildResult, + ImageCompressTask_2 as ImageCompressTask, + IImageTaskInfo_2 as IImageTaskInfo, + ISuffixMap_2 as ISuffixMap, + IVersionMap_2 as IVersionMap, + IMD5Map_2 as IMD5Map, + IAtlasResult_2 as IAtlasResult, + IBuildUtils_2 as IBuildUtils, + IBuilder_2 as IBuilder, + IBuildStageTask_2 as IBuildStageTask, + IBuildHooksInfo_2 as IBuildHooksInfo, + IBundle_2 as IBundle, + ICompressImageResult_2 as ICompressImageResult, + IGroup_2 as IGroup, + IJSONGroupType_2 as IJSONGroupType, + IDefaultGroup_2 as IDefaultGroup, + IPreviewSettingsResult_2 as IPreviewSettingsResult, + IQuickSpawnOption_2 as IQuickSpawnOption, + IPackageRegisterInfo_2 as IPackageRegisterInfo, + IBuilderRegisterInfo_2 as IBuilderRegisterInfo, + PlatformBuildSchema_2 as PlatformBuildSchema, + PlatformConfigItem_2 as PlatformConfigItem, + IPlatformRegisterInfo_2 as IPlatformRegisterInfo, + IPluginRegisterInfo_2 as IPluginRegisterInfo, + IInternalBuildUtils_2 as IInternalBuildUtils, + IProcessingFunc_2 as IProcessingFunc, + IBuildManager_2 as IBuildManager, + IBuildProcessInfo_2 as IBuildProcessInfo, + IScriptInfo_2 as IScriptInfo, + IBuildPanel_2 as IBuildPanel, + IBuildWorkerPluginInfo_2 as IBuildWorkerPluginInfo, + IBuildStagesInfo_2 as IBuildStagesInfo, + IBuildAssetHandlerInfo_2 as IBuildAssetHandlerInfo, + IPluginHookName_2 as IPluginHookName, + IPluginHook_2 as IPluginHook, + IInternalHook_2 as IInternalHook, + PlatformPackageOptions_2 as PlatformPackageOptions, + IInternalBaseHooks_2 as IInternalBaseHooks, + IInternalStageTaskHooks_2 as IInternalStageTaskHooks, + IInternalBundleBaseHooks_2 as IInternalBundleBaseHooks, + IBuildTask_2 as IBuildTask, + OverwriteCommonOption_2 as OverwriteCommonOption, + IBuildStageItem_2 as IBuildStageItem, + IconConfig_2 as IconConfig, + IPlatformInfo_2 as IPlatformInfo, + IBuildIconItem_2 as IBuildIconItem, + ICustomBuildIconInfo_2 as ICustomBuildIconInfo, + IBuilderConfigItem_2 as IBuilderConfigItem, + IInternalBuildPluginConfig_2 as IInternalBuildPluginConfig, + IPlatformSupportPlatformsConfig_2 as IPlatformSupportPlatformsConfig, + IPlatformBuildPluginConfig_2 as IPlatformBuildPluginConfig, + BuildTemplateConfig_2 as BuildTemplateConfig, + ICustomBuildStageDisplayItem_2 as ICustomBuildStageDisplayItem, + BuildCheckResult_2 as BuildCheckResult, + IBuildVerificationFunc_2 as IBuildVerificationFunc, + BundlePlatformType_2 as BundlePlatformType, + BundleConfigProperty_2 as BundleConfigProperty, + BundleCompressionTypes_3 as BundleCompressionTypes, + BuiltinBundleName_3 as BuiltinBundleName, + PlatformBundleConfig_2 as PlatformBundleConfig, + BundleRenderConfig_2 as BundleRenderConfig, + BundleQueryConfig_2 as BundleQueryConfig, + PlatformTypeInfo_2 as PlatformTypeInfo, + BundleConfigItemMap_2 as BundleConfigItemMap, + CustomBundleConfigItem_2 as CustomBundleConfigItem, + CustomBundleConfig_2 as CustomBundleConfig, + BundleConfigItem_2 as BundleConfigItem, + ISettings_2 as ISettings, + IPackageInfo_2 as IPackageInfo, + ISettingsDesignResolution_2 as ISettingsDesignResolution, + IRawAssetPathInfo_2 as IRawAssetPathInfo, + IAssetPathInfo_2 as IAssetPathInfo, + IJsonPathInfo_2 as IJsonPathInfo, + IImportAssetPathInfo_2 as IImportAssetPathInfo, + IBuildPaths_2 as IBuildPaths, + IBuildResult_2 as IBuildResult, + IBundleConfig_2 as IBundleConfig, + ICompressConfig_2 as ICompressConfig, + IBuildPluginConfig_2 as IBuildPluginConfig, + IBuildPluginProfile_2 as IBuildPluginProfile, + IVerificationFunc_2 as IVerificationFunc, + IInternalVerificationFunc_2 as IInternalVerificationFunc, + IVerificationRuleMap_2 as IVerificationRuleMap, + IVerificationRule_2 as IVerificationRule, + IInternalVerificationRule_2 as IInternalVerificationRule, + IDisplayOptions_2 as IDisplayOptions, + ArrayItem_2 as ArrayItem, + IBuildPlugin_2 as IBuildPlugin, + IBaseHooks_2 as IBaseHooks, + IBuildStageHooks_2 as IBuildStageHooks, + BuildPlugin_2 as BuildPlugin, + BuildHook_2 as BuildHook, + AssetHandlers_2 as AssetHandlers, + ITextureCompressType_2 as ITextureCompressType, + ITextureCompressPlatform_2 as ITextureCompressPlatform, + ITextureCompressFormatType_2 as ITextureCompressFormatType, + IHandlerInfo_2 as IHandlerInfo, + ITextureFormatConfig_2 as ITextureFormatConfig, + ITextureCompressConfig_2 as ITextureCompressConfig, + AllTextureCompressConfig_2 as AllTextureCompressConfig, + UserCompressConfig_2 as UserCompressConfig, + PlatformCompressConfig_2 as PlatformCompressConfig, + ICustomConfig_2 as ICustomConfig, + ICommandInfo_2 as ICommandInfo, + ITextureFormatInfo_2 as ITextureFormatInfo, + ISupportFormat_2 as ISupportFormat, + TextureCompressRenderConfig_2 as TextureCompressRenderConfig, + PlatformTextureCompressConfig_2 as PlatformTextureCompressConfig, + IConfigGroupsInfo_2 as IConfigGroupsInfo, + IConfigGroups_2 as IConfigGroups, + TextureCompressFullRenderConfig_2 as TextureCompressFullRenderConfig, + IPVRQuality_2 as IPVRQuality, + IETCQuality_2 as IETCQuality, + IASTCQuality_2 as IASTCQuality, + ConfigType_2 as ConfigType, + MakeRequired_2 as MakeRequired, + ISortType_2 as ISortType, + IPhysicsConfig_3 as IPhysicsConfig, + ICollisionMatrix_3 as ICollisionMatrix, + IVec3Like_3 as IVec3Like, + IPhysicsMaterial_2 as IPhysicsMaterial, + IConsoleType_2 as IConsoleType, + BreakType_2 as BreakType, + ICustomConsoleType_2 as ICustomConsoleType, + IConsoleMessage_2 as IConsoleMessage, + IPlatformConfig_2 as IPlatformConfig, + IBinGroupConfig_2 as IBinGroupConfig, + IBuildCacheUseConfig_2 as IBuildCacheUseConfig, + IBuildCommonOptions_2 as IBuildCommonOptions, + OverwriteProjectSettings_2 as OverwriteProjectSettings, + IBuildOptionBase_2 as IBuildOptionBase, + BundleFilterConfig_2 as BundleFilterConfig, + IBundleOptions_2 as IBundleOptions, + IBundleTaskOption_2 as IBundleTaskOption, + UUID_2 as UUID, + IBuildSceneItem_2 as IBuildSceneItem, + IPolyFills_2 as IPolyFills, + IBuildSystemJsOption_2 as IBuildSystemJsOption, + ITextureCompressConfigs_2 as ITextureCompressConfigs, + Platform_2 as Platform, + InternalPlatform_2 as InternalPlatform, + BundleCompressionType_2 as BundleCompressionType, + IBuildStage_2 as IBuildStage, + ITaskState_2 as ITaskState, + ITaskItemJSON_2 as ITaskItemJSON, + IBuildTaskItemJSON_2 as IBuildTaskItemJSON, + IOrientation_3 as IOrientation, + webDesktopOptions_2 as webDesktopOptions, + webMobileOptions_2 as webMobileOptions, + windowsOptions_2 as windowsOptions, + nativeOptions_2 as nativeOptions, + IBuildTaskOption_2 as IBuildTaskOption, + ISubTaskBuildOutput_2 as ISubTaskBuildOutput, + PlatformPackageOptionMap_2 as PlatformPackageOptionMap, + IInterBuildTaskOption_2 as IInterBuildTaskOption, + WebDesktopBuildOptions_2 as WebDesktopBuildOptions, + WebMobileBuildOptions_2 as WebMobileBuildOptions, + IPackOptions_2 as IPackOptions, + IPacInfo_2 as IPacInfo, + PacStoreInfo_2 as PacStoreInfo, + PreviewPackResult_2 as PreviewPackResult, + IInternalPackOptions_2 as IInternalPackOptions, + IAutoAtlasUserData_2 as IAutoAtlasUserData, + IAtlasInfo_2 as IAtlasInfo, + CompressedInfo_2 as CompressedInfo, + ISpriteFrameInfo_2 as ISpriteFrameInfo, + IPackResult_2 as IPackResult, + IStorePackInfo_2 as IStorePackInfo, + ITrimInfo_2 as ITrimInfo + } +} export declare function createBuildStageTask(taskId: string, stageName: string, options: IBuildStageOptions): Promise; +declare function createBuildStageTask_2(taskId: string, stageName: string, options: IBuildStageOptions_2): Promise; export declare function createBuildTask

(platform: P, options?: IBuildCommandOption): Promise; +declare function createBuildTask_2

(platform: P, options?: IBuildCommandOption_2): Promise; export declare function createBuildTemplate(nameOrPlatform: string): Promise; +declare function createBuildTemplate_2(nameOrPlatform: string): Promise; export declare function createBundleBuildTask(bundleOptions: IBundleBuildOptions): Promise; +declare function createBundleBuildTask_2(bundleOptions: IBundleBuildOptions_2): Promise; export declare interface CustomBundleConfig { displayName: string; configs: Record; @@ -2047,7 +3910,7 @@ export declare class CustomConsole { error: (...args: any[]) => void; } export declare interface CustomPluginOptions { - [plugin: string]: any; + [plugin: string]: any; } export declare class DataManager { file: string | undefined; @@ -2060,20 +3923,38 @@ export declare class DataManager { setRecordJSON(json: string): Promise; save(): void; saveImmediate(): void; - has(asset: VirtualAsset): boolean; - empty(asset: VirtualAsset): void; - update(asset: VirtualAsset): void; - setValue(asset: VirtualAsset, key: string, value: any): void; - getValue(asset: VirtualAsset, key: string): any; - get(asset: VirtualAsset, key?: keyof IData): null | any; + has(asset: VirtualAsset_2): boolean; + empty(asset: VirtualAsset_2): void; + update(asset: VirtualAsset_2): void; + setValue(asset: VirtualAsset_2, key: string, value: any): void; + getValue(asset: VirtualAsset_2, key: string): any; + get(asset: VirtualAsset_2, key?: keyof IData): null | any; +} +declare class DataManager_2 { + file: string | undefined; + dataMap: { + [uuid: string]: IData_2; + }; + _saveTimer: any; + private console; + constructor(customConsole: CustomConsole_2); + setRecordJSON(json: string): Promise; + save(): void; + saveImmediate(): void; + has(asset: VirtualAsset_4): boolean; + empty(asset: VirtualAsset_4): void; + update(asset: VirtualAsset_4): void; + setValue(asset: VirtualAsset_4, key: string, value: any): void; + getValue(asset: VirtualAsset_4, key: string): any; + get(asset: VirtualAsset_4, key?: keyof IData_2): null | any; } export declare type DecodedSourceMapOrMissing = - | { - mappings?: never; - missing: true; - plugin: string; - } - | ExistingDecodedSourceMap; + | { + mappings?: never; + missing: true; + plugin: string; + } + | ExistingDecodedSourceMap; export declare function defineConfig(options: RollupOptions): RollupOptions; export declare function defineConfig(options: RollupOptions[]): RollupOptions[]; export declare class DependencyManager { @@ -2112,6 +3993,11 @@ export declare interface DirectoryAssetUserData { bundleName?: string; priority?: number; } +export declare namespace Editor { + export { + Host + } +} export declare interface EffectAssetUserData { combinations?: any; editor?: any; @@ -2120,19 +4006,19 @@ export declare type EmitAsset = (name: string, source?: string | Uint8Array) => export declare type EmitChunk = (id: string, options?: { name?: string }) => string; export declare type EmitFile = (emittedFile: EmittedFile) => string; export declare interface EmittedAsset { - fileName?: string; - name?: string; - source?: string | Uint8Array; - type: 'asset'; + fileName?: string; + name?: string; + source?: string | Uint8Array; + type: 'asset'; } export declare interface EmittedChunk { - fileName?: string; - id: string; - implicitlyLoadedAfterOneOf?: string[]; - importer?: string; - name?: string; - preserveSignature?: PreserveEntrySignaturesOption; - type: 'chunk'; + fileName?: string; + id: string; + implicitlyLoadedAfterOneOf?: string[]; + importer?: string; + name?: string; + preserveSignature?: PreserveEntrySignaturesOption; + type: 'chunk'; } export declare type EmittedFile = EmittedAsset | EmittedChunk; export declare interface EngineInfo { @@ -2155,6 +4041,7 @@ export declare type EnumItem = string | { value: string | number; }; export declare function executeBuildStageTask(taskId: string, stageName: string, options: IBuildStageOptions, onProgress?: BuildStageProgressCallback): Promise; +declare function executeBuildStageTask_2(taskId: string, stageName: string, options: IBuildStageOptions_2, onProgress?: BuildStageProgressCallback_2): Promise; export declare interface ExecuteHookTaskOption { pkgName: string; hook: string; @@ -2162,28 +4049,28 @@ export declare interface ExecuteHookTaskOption { [x: string]: any; } export declare interface ExistingDecodedSourceMap { - file?: string; - mappings: SourceMapSegment[][]; - names: string[]; - sourceRoot?: string; - sources: string[]; - sourcesContent?: string[]; - version: number; + file?: string; + mappings: SourceMapSegment[][]; + names: string[]; + sourceRoot?: string; + sources: string[]; + sourcesContent?: string[]; + version: number; } export declare interface ExistingRawSourceMap { - file?: string; - mappings: string; - names: string[]; - sourceRoot?: string; - sources: string[]; - sourcesContent?: string[]; - version: number; + file?: string; + mappings: string; + names: string[]; + sourceRoot?: string; + sources: string[]; + sourcesContent?: string[]; + version: number; } export declare type ExternalOption = - | (string | RegExp)[] - | string - | RegExp - | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void); + | (string | RegExp)[] + | string + | RegExp + | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void); export declare interface Feature { modules: string[]; intrinsicFlags?: Record; @@ -2197,16 +4084,20 @@ export declare interface fileMap { src: string; dest: string; } +declare function fillIncludeModulesFromProjectConfig(options: { + includeModules?: string[]; + engineModulesConfigKey?: string; +}): Promise; export declare type Filter = 'none' | 'nearest' | 'linear'; export declare type FirstPluginHooks = - | 'load' - | 'renderDynamicImport' - | 'resolveAssetUrl' - | 'resolveDynamicImport' - | 'resolveFileUrl' - | 'resolveId' - | 'resolveImportMeta' - | 'shouldTransformCachedModule'; + | 'load' + | 'renderDynamicImport' + | 'resolveAssetUrl' + | 'resolveDynamicImport' + | 'resolveFileUrl' + | 'resolveId' + | 'resolveImportMeta' + | 'shouldTransformCachedModule'; export declare interface FntData { commonHeight?: number; fontSize?: number; @@ -2229,66 +4120,74 @@ export declare interface FontDefDictionary { [charId: number]: FontDef; } export declare interface FunctionPluginHooks { - augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void; - buildEnd: (this: PluginContext, err?: Error) => void; - buildStart: (this: PluginContext, options: NormalizedInputOptions) => void; - closeBundle: (this: PluginContext) => void; - closeWatcher: (this: PluginContext) => void; - generateBundle: ( - this: PluginContext, - options: NormalizedOutputOptions, - bundle: OutputBundle, - isWrite: boolean - ) => void; - load: LoadHook; - moduleParsed: ModuleParsedHook; - options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void; - outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void; - renderChunk: RenderChunkHook; - renderDynamicImport: ( - this: PluginContext, - options: { - customResolution: string | null; - format: InternalModuleFormat; - moduleId: string; - targetModuleId: string | null; - } - ) => { left: string; right: string } | null | void; - renderError: (this: PluginContext, err?: Error) => void; - renderStart: ( - this: PluginContext, - outputOptions: NormalizedOutputOptions, - inputOptions: NormalizedInputOptions - ) => void; - resolveAssetUrl: ResolveAssetUrlHook; - resolveDynamicImport: ResolveDynamicImportHook; - resolveFileUrl: ResolveFileUrlHook; - resolveId: ResolveIdHook; - resolveImportMeta: ResolveImportMetaHook; - shouldTransformCachedModule: ShouldTransformCachedModuleHook; - transform: TransformHook; - watchChange: WatchChangeHook; - writeBundle: ( - this: PluginContext, - options: NormalizedOutputOptions, - bundle: OutputBundle - ) => void; + augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void; + buildEnd: (this: PluginContext, err?: Error) => void; + buildStart: (this: PluginContext, options: NormalizedInputOptions) => void; + closeBundle: (this: PluginContext) => void; + closeWatcher: (this: PluginContext) => void; + generateBundle: ( + this: PluginContext, + options: NormalizedOutputOptions, + bundle: OutputBundle, + isWrite: boolean + ) => void; + load: LoadHook; + moduleParsed: ModuleParsedHook; + options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void; + outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void; + renderChunk: RenderChunkHook; + renderDynamicImport: ( + this: PluginContext, + options: { + customResolution: string | null; + format: InternalModuleFormat; + moduleId: string; + targetModuleId: string | null; + } + ) => { left: string; right: string } | null | void; + renderError: (this: PluginContext, err?: Error) => void; + renderStart: ( + this: PluginContext, + outputOptions: NormalizedOutputOptions, + inputOptions: NormalizedInputOptions + ) => void; + resolveAssetUrl: ResolveAssetUrlHook; + resolveDynamicImport: ResolveDynamicImportHook; + resolveFileUrl: ResolveFileUrlHook; + resolveId: ResolveIdHook; + resolveImportMeta: ResolveImportMetaHook; + shouldTransformCachedModule: ShouldTransformCachedModuleHook; + transform: TransformHook; + watchChange: WatchChangeHook; + writeBundle: ( + this: PluginContext, + options: NormalizedOutputOptions, + bundle: OutputBundle + ) => void; } export declare interface GeneratedCodeOptions extends Partial { - preset?: GeneratedCodePreset; + preset?: GeneratedCodePreset; } export declare type GeneratedCodePreset = 'es5' | 'es2015'; +declare function generateNewOutputName(buildPath: string, platform: string, buildPathDict: Record): string; +declare function getBuidPath(platform: string, name: string): Promise; +declare function getDefaultScenes(): IInternalBuildSceneItem_2[]; +declare function getDefaultStartScene(): string; export declare type GetInterop = (id: string | null) => InteropType; export declare type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | void; export declare interface GetManualChunkApi { - getModuleIds: () => IterableIterator; - getModuleInfo: GetModuleInfo; + getModuleIds: () => IterableIterator; + getModuleInfo: GetModuleInfo; } export declare type GetModuleInfo = (moduleId: string) => ModuleInfo | null; export declare function getPlatformBuildSchema(platform: Platform | string): Promise; +declare function getPlatformBuildSchema_2(platform: Platform_2 | string): PlatformBuildSchema_2; export declare function getPreviewSettings

(options?: IBuildTaskOption

): Promise; +declare function getPreviewSettings_2

(options?: IBuildTaskOption_2

): Promise; export declare function getPreviewUrl(dest: string, platform?: string): Promise; +declare function getPreviewUrl_2(dest: string, platform?: string): Promise; export declare function getRegisteredPlatforms(): Promise; +declare function getRegisteredPlatforms_2(): string[]; export declare type GlobalsOption = { [name: string]: string } | ((name: string) => string); export declare interface GltfAnimationAssetUserData { gltfIndex: number; @@ -2363,8 +4262,18 @@ export declare interface GlTFUserData { options: LODsOption[]; }; } +declare function handleOverwriteProjectSettings(options: IBuildTaskOption_2): void; export declare type HasModuleSideEffects = (id: string, external: boolean) => boolean; -export declare type IAsset = VirtualAsset | Asset; +export declare namespace Host { + export { + CoreBuilderTypesProtected, + CoreBuilderIndex, + CoreBuilderPlatformsWebCommonUtils, + CoreBuilderShareCommonOptionsValidator + } +} +export declare type IAsset = VirtualAsset | Asset_2; +declare type IAsset_2 = VirtualAsset_3 | Asset_4; export declare interface IAssetDeleteOptions extends IAssetOperationOptionsBase { recursive?: boolean; useTrash?: boolean; @@ -2668,6 +4577,11 @@ export declare interface IBuildPacResult_2 { textureToImage: Record; imageToPac: Record; } +declare interface IBuildPacResult_3 { + spriteToImage: Record; + textureToImage: Record; + imageToPac: Record; +} export declare interface IBuildPanel { Vue: any; validator: { @@ -3285,6 +5199,13 @@ export declare type IETCQuality = 'slow' | 'fast'; export declare interface IExportBuildOptions extends IBuildTaskOption { __version__: string; } +export declare interface IExportData { + import: { + type: 'buffer' | 'json'; + path: string; + }; + native?: Record; +} export declare interface IFbxSetting { unitConversion?: 'geometry-level' | 'hierarchy-level' | 'disabled'; animationBakeRate?: 0 | 24 | 25 | 30 | 60; @@ -3363,6 +5284,10 @@ export declare interface IInternalBuildSceneItem extends IBuildSceneItem { bundle: string; missing?: boolean; } +declare interface IInternalBuildSceneItem_2 extends IBuildSceneItem_2 { + bundle: string; + missing?: boolean; +} export declare interface IInternalBuildUtils extends IBuildUtils { getModuleFiles(result: InternalBuildResult): Promise; quickSpawn(command: string, cmdParams: string[], options?: IQuickSpawnOption): Promise; @@ -3532,31 +5457,33 @@ export declare class InfoManager { forEach(handler: Function): Promise; } export declare function init(platform?: string[]): Promise; +declare function init_2(platform?: string[]): Promise; +declare function injectBridgeScripts(html: string, options: IWebBridgeScriptOptions): string; export declare type InputOption = string | string[] | { [entryAlias: string]: string }; export declare interface InputOptions { - acorn?: Record; - acornInjectPlugins?: (() => unknown)[] | (() => unknown); - cache?: false | RollupCache; - context?: string; - experimentalCacheExpiry?: number; - external?: ExternalOption; - inlineDynamicImports?: boolean; - input?: InputOption; - makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource'; - manualChunks?: ManualChunksOption; - maxParallelFileOps?: number; - maxParallelFileReads?: number; - moduleContext?: ((id: string) => string | null | void) | { [id: string]: string }; - onwarn?: WarningHandlerWithDefault; - perf?: boolean; - plugins?: (Plugin_2 | null | false | undefined)[]; - preserveEntrySignatures?: PreserveEntrySignaturesOption; - preserveModules?: boolean; - preserveSymlinks?: boolean; - shimMissingExports?: boolean; - strictDeprecations?: boolean; - treeshake?: boolean | TreeshakingPreset | TreeshakingOptions; - watch?: WatcherOptions | false; + acorn?: Record; + acornInjectPlugins?: (() => unknown)[] | (() => unknown); + cache?: false | RollupCache; + context?: string; + experimentalCacheExpiry?: number; + external?: ExternalOption; + inlineDynamicImports?: boolean; + input?: InputOption; + makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource'; + manualChunks?: ManualChunksOption; + maxParallelFileOps?: number; + maxParallelFileReads?: number; + moduleContext?: ((id: string) => string | null | void) | { [id: string]: string }; + onwarn?: WarningHandlerWithDefault; + perf?: boolean; + plugins?: (Plugin_2 | null | false | undefined)[]; + preserveEntrySignatures?: PreserveEntrySignaturesOption; + preserveModules?: boolean; + preserveSymlinks?: boolean; + shimMissingExports?: boolean; + strictDeprecations?: boolean; + treeshake?: boolean | TreeshakingPreset | TreeshakingOptions; + watch?: WatcherOptions | false; } export declare type InputPluginHooks = Exclude; export declare interface InternalBuildResult { @@ -3594,6 +5521,25 @@ export declare class InternalBuildResult_2 extends EventEmitter implements Inter get dest(): string; constructor(task: IBuilder, preview: boolean); } +declare class InternalBuildResult_4 extends EventEmitter implements InternalBuildResult_3 { + settings: ISettings_2; + scriptPackages: string[]; + pluginVers: Record; + compressImageResult: ICompressImageResult_2; + importMap: ImportMapWithImports_2; + rawOptions: IBuildOptionBase_2; + paths: IBuildPaths_2; + compileOptions: any; + private __task; + pluginScripts: Array<{ + uuid: string; + url: string; + file: string; + }>; + separateEngineResult?: IBuildSeparateEngineResult_2; + get dest(): string; + constructor(task: IBuilder_2, preview: boolean); +} export declare type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd'; export declare type InternalNativePlatform = 'mac' | 'android' | 'google-play' | 'huawei-agc' | 'windows' | 'ios' | 'ohos' | 'harmonyos-next'; export declare interface InternalPackageInfo { @@ -3906,9 +5852,9 @@ export declare interface ISettingsDesignResolution { policy: number; } export declare type IsExternal = ( - source: string, - importer: string | undefined, - isResolved: boolean + source: string, + importer: string | undefined, + isResolved: boolean ) => boolean; export declare interface ISignatureConfig { md5: string; @@ -4023,6 +5969,14 @@ export declare interface ITaskResultMap_2 { }; 'build-task/pac'?: IBuildPacResult_2; } +declare interface ITaskResultMap_3 { + 'build-task/script'?: { + projectJs: string; + systemJs: string; + polyfillsJs: string | null; + }; + 'build-task/pac'?: IBuildPacResult_3; +} export declare type ITaskState = 'waiting' | 'success' | 'failure' | 'cancel' | 'processing' | 'none'; export declare interface ITextureCompressConfig { name: string; @@ -4103,6 +6057,10 @@ export declare interface IVirtualAssetUserData { }; [key: string]: any; } +declare interface IWebBridgeScriptOptions { + bridgeLink?: unknown; + bridgeBuildToken?: string; +} export declare type JavaScriptAssetUserData = ScriptModuleUserData | PluginScriptUserData; export declare interface JsonAssetUserData { json5?: boolean; @@ -4137,8 +6095,8 @@ export declare type MacroItem = { } export declare function make(platform: Platform, dest: string): Promise; export declare type MakeAsync = Fn extends (this: infer This, ...args: infer Args) => infer Return - ? (this: This, ...args: Args) => Return | Promise - : never; + ? (this: This, ...args: Args) => Return | Promise + : never; export declare type MakeRequired = T & Required>; export declare type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk; export declare interface Md5GlobbyPathInfo { @@ -4146,7 +6104,7 @@ export declare interface Md5GlobbyPathInfo { pattern: string; } export declare interface MergedRollupOptions extends InputOptions { - output: OutputOptions[]; + output: OutputOptions[]; } export declare interface MeshClusterOptions { enable: boolean; @@ -4206,8 +6164,8 @@ export declare class MetaManager { constructor(customConsole: CustomConsole); destroy(): void; read(path: string): boolean | undefined; - write(path: string, options?: IAssetWriteFileOptions): Promise; - remove(path: string, options?: IAssetDeleteOptions): Promise; + write(path: string, options?: IAssetWriteFileOptions_2): Promise; + remove(path: string, options?: IAssetDeleteOptions_2): Promise; get(path: string): Promise; move(pathA: string, pathB: string): void; updatePathCase(previousPath: string, nextPath: string): void; @@ -4228,43 +6186,47 @@ export declare enum MinigamePlatform { SUDV2 = 18, } export declare interface MinimalPluginContext { - meta: PluginContextMeta; + meta: PluginContextMeta; } export declare interface MissingAssetInfo { path: string; time: number; removeTime: number; } +declare interface ModuleConfig { + match: (module: string) => boolean; + default: string | boolean; +} export declare type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs'; export declare interface ModuleInfo extends ModuleOptions { - ast: AcornNode | null; - code: string | null; - dynamicImporters: readonly string[]; - dynamicallyImportedIdResolutions: readonly ResolvedId[]; - dynamicallyImportedIds: readonly string[]; - hasDefaultExport: boolean | null; - hasModuleSideEffects: boolean | 'no-treeshake'; - id: string; - implicitlyLoadedAfterOneOf: readonly string[]; - implicitlyLoadedBefore: readonly string[]; - importedIdResolutions: readonly ResolvedId[]; - importedIds: readonly string[]; - importers: readonly string[]; - isEntry: boolean; - isExternal: boolean; - isIncluded: boolean | null; + ast: AcornNode | null; + code: string | null; + dynamicImporters: readonly string[]; + dynamicallyImportedIdResolutions: readonly ResolvedId[]; + dynamicallyImportedIds: readonly string[]; + hasDefaultExport: boolean | null; + hasModuleSideEffects: boolean | 'no-treeshake'; + id: string; + implicitlyLoadedAfterOneOf: readonly string[]; + implicitlyLoadedBefore: readonly string[]; + importedIdResolutions: readonly ResolvedId[]; + importedIds: readonly string[]; + importers: readonly string[]; + isEntry: boolean; + isExternal: boolean; + isIncluded: boolean | null; } export declare interface ModuleJSON extends TransformModuleJSON, ModuleOptions { - ast: AcornNode; - dependencies: string[]; - id: string; - resolvedIds: ResolvedIdMap; - transformFiles: EmittedFile[] | undefined; + ast: AcornNode; + dependencies: string[]; + id: string; + resolvedIds: ResolvedIdMap; + transformFiles: EmittedFile[] | undefined; } export declare interface ModuleOptions { - meta: CustomPluginOptions; - moduleSideEffects: boolean | 'no-treeshake'; - syntheticNamedExports: boolean | string; + meta: CustomPluginOptions; + moduleSideEffects: boolean | 'no-treeshake'; + syntheticNamedExports: boolean | string; } export declare type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => void; export declare type ModulePreservation = 'erase' | 'preserve' | 'facade'; @@ -4307,178 +6269,180 @@ export declare enum NormalImportSetting { recalculate = 3 } export declare type NormalizedAmdOptions = ( - | { - autoId: false; - id?: string; - } - | { - autoId: true; - basePath: string; - } + | { + autoId: false; + id?: string; + } + | { + autoId: true; + basePath: string; + } ) & { - define: string; - forceJsExtensionForImports: boolean; + define: string; + forceJsExtensionForImports: boolean; }; export declare interface NormalizedGeneratedCodeOptions { - arrowFunctions: boolean; - constBindings: boolean; - objectShorthand: boolean; - reservedNamesAsProps: boolean; - symbols: boolean; + arrowFunctions: boolean; + constBindings: boolean; + objectShorthand: boolean; + reservedNamesAsProps: boolean; + symbols: boolean; } export declare interface NormalizedInputOptions { - acorn: Record; - acornInjectPlugins: (() => unknown)[]; - cache: false | undefined | RollupCache; - context: string; - experimentalCacheExpiry: number; - external: IsExternal; - inlineDynamicImports: boolean | undefined; - input: string[] | { [entryAlias: string]: string }; - makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource'; - manualChunks: ManualChunksOption | undefined; - maxParallelFileOps: number; - maxParallelFileReads: number; - moduleContext: (id: string) => string; - onwarn: WarningHandler; - perf: boolean; - plugins: Plugin_2[]; - preserveEntrySignatures: PreserveEntrySignaturesOption; - preserveModules: boolean | undefined; - preserveSymlinks: boolean; - shimMissingExports: boolean; - strictDeprecations: boolean; - treeshake: false | NormalizedTreeshakingOptions; + acorn: Record; + acornInjectPlugins: (() => unknown)[]; + cache: false | undefined | RollupCache; + context: string; + experimentalCacheExpiry: number; + external: IsExternal; + inlineDynamicImports: boolean | undefined; + input: string[] | { [entryAlias: string]: string }; + makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource'; + manualChunks: ManualChunksOption | undefined; + maxParallelFileOps: number; + maxParallelFileReads: number; + moduleContext: (id: string) => string; + onwarn: WarningHandler; + perf: boolean; + plugins: Plugin_2[]; + preserveEntrySignatures: PreserveEntrySignaturesOption; + preserveModules: boolean | undefined; + preserveSymlinks: boolean; + shimMissingExports: boolean; + strictDeprecations: boolean; + treeshake: false | NormalizedTreeshakingOptions; } export declare interface NormalizedOutputOptions { - amd: NormalizedAmdOptions; - assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string); - banner: () => string | Promise; - chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string); - compact: boolean; - dir: string | undefined; - dynamicImportFunction: string | undefined; - entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string); - esModule: boolean; - exports: 'default' | 'named' | 'none' | 'auto'; - extend: boolean; - externalLiveBindings: boolean; - file: string | undefined; - footer: () => string | Promise; - format: InternalModuleFormat; - freeze: boolean; - generatedCode: NormalizedGeneratedCodeOptions; - globals: GlobalsOption; - hoistTransitiveImports: boolean; - indent: true | string; - inlineDynamicImports: boolean; - interop: GetInterop; - intro: () => string | Promise; - manualChunks: ManualChunksOption; - minifyInternalExports: boolean; - name: string | undefined; - namespaceToStringTag: boolean; - noConflict: boolean; - outro: () => string | Promise; - paths: OptionsPaths; - plugins: OutputPlugin[]; - preferConst: boolean; - preserveModules: boolean; - preserveModulesRoot: string | undefined; - sanitizeFileName: (fileName: string) => string; - sourcemap: boolean | 'inline' | 'hidden'; - sourcemapBaseUrl: string | undefined; - sourcemapExcludeSources: boolean; - sourcemapFile: string | undefined; - sourcemapPathTransform: SourcemapPathTransformOption | undefined; - strict: boolean; - systemNullSetters: boolean; - validate: boolean; + amd: NormalizedAmdOptions; + assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string); + banner: () => string | Promise; + chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string); + compact: boolean; + dir: string | undefined; + dynamicImportFunction: string | undefined; + entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string); + esModule: boolean; + exports: 'default' | 'named' | 'none' | 'auto'; + extend: boolean; + externalLiveBindings: boolean; + file: string | undefined; + footer: () => string | Promise; + format: InternalModuleFormat; + freeze: boolean; + generatedCode: NormalizedGeneratedCodeOptions; + globals: GlobalsOption; + hoistTransitiveImports: boolean; + indent: true | string; + inlineDynamicImports: boolean; + interop: GetInterop; + intro: () => string | Promise; + manualChunks: ManualChunksOption; + minifyInternalExports: boolean; + name: string | undefined; + namespaceToStringTag: boolean; + noConflict: boolean; + outro: () => string | Promise; + paths: OptionsPaths; + plugins: OutputPlugin[]; + preferConst: boolean; + preserveModules: boolean; + preserveModulesRoot: string | undefined; + sanitizeFileName: (fileName: string) => string; + sourcemap: boolean | 'inline' | 'hidden'; + sourcemapBaseUrl: string | undefined; + sourcemapExcludeSources: boolean; + sourcemapFile: string | undefined; + sourcemapPathTransform: SourcemapPathTransformOption | undefined; + strict: boolean; + systemNullSetters: boolean; + validate: boolean; } export declare interface NormalizedTreeshakingOptions { - annotations: boolean; - correctVarValueBeforeDeclaration: boolean; - moduleSideEffects: HasModuleSideEffects; - propertyReadSideEffects: boolean | 'always'; - tryCatchDeoptimization: boolean; - unknownGlobalSideEffects: boolean; + annotations: boolean; + correctVarValueBeforeDeclaration: boolean; + moduleSideEffects: HasModuleSideEffects; + propertyReadSideEffects: boolean | 'always'; + tryCatchDeoptimization: boolean; + unknownGlobalSideEffects: boolean; } export declare type ObjectHook = T | ({ handler: T; order?: 'pre' | 'post' | null } & O); +declare function openUrlAsync(url: string): Promise; export declare type OptionsPaths = Record | ((id: string) => string); export declare interface OutputAsset extends PreRenderedAsset { - fileName: string; - isAsset: true; + fileName: string; + isAsset: true; } export declare interface OutputBundle { - [fileName: string]: OutputAsset | OutputChunk; + [fileName: string]: OutputAsset | OutputChunk; } export declare interface OutputChunk extends RenderedChunk { - code: string; + code: string; } export declare interface OutputOptions { - amd?: AmdOptions; - assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string); - banner?: string | (() => string | Promise); - chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); - compact?: boolean; - dir?: string; - dynamicImportFunction?: string; - entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); - esModule?: boolean; - exports?: 'default' | 'named' | 'none' | 'auto'; - extend?: boolean; - externalLiveBindings?: boolean; - file?: string; - footer?: string | (() => string | Promise); - format?: ModuleFormat; - freeze?: boolean; - generatedCode?: GeneratedCodePreset | GeneratedCodeOptions; - globals?: GlobalsOption; - hoistTransitiveImports?: boolean; - indent?: string | boolean; - inlineDynamicImports?: boolean; - interop?: InteropType | GetInterop; - intro?: string | (() => string | Promise); - manualChunks?: ManualChunksOption; - minifyInternalExports?: boolean; - name?: string; - namespaceToStringTag?: boolean; - noConflict?: boolean; - outro?: string | (() => string | Promise); - paths?: OptionsPaths; - plugins?: (OutputPlugin | null | false | undefined)[]; - preferConst?: boolean; - preserveModules?: boolean; - preserveModulesRoot?: string; - sanitizeFileName?: boolean | ((fileName: string) => string); - sourcemap?: boolean | 'inline' | 'hidden'; - sourcemapBaseUrl?: string; - sourcemapExcludeSources?: boolean; - sourcemapFile?: string; - sourcemapPathTransform?: SourcemapPathTransformOption; - strict?: boolean; - systemNullSetters?: boolean; - validate?: boolean; + amd?: AmdOptions; + assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string); + banner?: string | (() => string | Promise); + chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); + compact?: boolean; + dir?: string; + dynamicImportFunction?: string; + entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); + esModule?: boolean; + exports?: 'default' | 'named' | 'none' | 'auto'; + extend?: boolean; + externalLiveBindings?: boolean; + file?: string; + footer?: string | (() => string | Promise); + format?: ModuleFormat; + freeze?: boolean; + generatedCode?: GeneratedCodePreset | GeneratedCodeOptions; + globals?: GlobalsOption; + hoistTransitiveImports?: boolean; + indent?: string | boolean; + inlineDynamicImports?: boolean; + interop?: InteropType | GetInterop; + intro?: string | (() => string | Promise); + manualChunks?: ManualChunksOption; + minifyInternalExports?: boolean; + name?: string; + namespaceToStringTag?: boolean; + noConflict?: boolean; + outro?: string | (() => string | Promise); + paths?: OptionsPaths; + plugins?: (OutputPlugin | null | false | undefined)[]; + preferConst?: boolean; + preserveModules?: boolean; + preserveModulesRoot?: string; + sanitizeFileName?: boolean | ((fileName: string) => string); + sourcemap?: boolean | 'inline' | 'hidden'; + sourcemapBaseUrl?: string; + sourcemapExcludeSources?: boolean; + sourcemapFile?: string; + sourcemapPathTransform?: SourcemapPathTransformOption; + strict?: boolean; + systemNullSetters?: boolean; + validate?: boolean; } export declare interface OutputPlugin - extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, - Partial<{ [K in AddonHooks]: ObjectHook }> { - cacheKey?: string; - name: string; + extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, + Partial<{ [K in AddonHooks]: ObjectHook }> { + cacheKey?: string; + name: string; } export declare type OutputPluginHooks = - | 'augmentChunkHash' - | 'generateBundle' - | 'outputOptions' - | 'renderChunk' - | 'renderDynamicImport' - | 'renderError' - | 'renderStart' - | 'resolveAssetUrl' - | 'resolveFileUrl' - | 'resolveImportMeta' - | 'writeBundle'; + | 'augmentChunkHash' + | 'generateBundle' + | 'outputOptions' + | 'renderChunk' + | 'renderDynamicImport' + | 'renderError' + | 'renderStart' + | 'resolveAssetUrl' + | 'resolveFileUrl' + | 'resolveImportMeta' + | 'writeBundle'; export declare type OverwriteCommonOption = 'buildPath' | 'server' | 'polyfills' | 'mainBundleIsRemote' | 'name' | 'sourceMaps' | 'experimentalEraseModules' | 'buildStageGroup'; +declare const overwriteModuleConfig: Record; export declare interface OverwriteProjectSettings extends IEngineConfig { engineInfo: EngineInfo; } @@ -4516,8 +6480,8 @@ export declare interface PacStoreInfo { options: IPackOptions; } export declare type ParallelPluginHooks = Exclude< - keyof FunctionPluginHooks | AddonHooks, - FirstPluginHooks | SequentialPluginHooks + keyof FunctionPluginHooks | AddonHooks, + FirstPluginHooks | SequentialPluginHooks >; export declare class ParallelQueue { private _thread; @@ -4547,11 +6511,11 @@ export declare class ParallelQueue { resume(id: number): void; } export declare type PartialNull = { - [P in keyof T]: T[P] | null; + [P in keyof T]: T[P] | null; }; export declare interface PartialResolvedId extends Partial> { - external?: boolean | 'absolute' | 'relative'; - id: string; + external?: boolean | 'absolute' | 'relative'; + id: string; } export declare interface ParticleAssetUserData { totalParticles: number; @@ -4651,51 +6615,51 @@ export declare interface PlatformTypeInfo { displayName: string; } export declare interface Plugin_2 extends OutputPlugin, Partial { - api?: any; + api?: any; } export declare interface PluginCache { - delete(id: string): boolean; - get(id: string): T; - has(id: string): boolean; - set(id: string, value: T): void; + delete(id: string): boolean; + get(id: string): T; + has(id: string): boolean; + set(id: string, value: T): void; } export declare interface PluginContext extends MinimalPluginContext { - addWatchFile: (id: string) => void; - cache: PluginCache; - emitAsset: EmitAsset; - emitChunk: EmitChunk; - emitFile: EmitFile; - error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never; - getAssetFileName: (assetReferenceId: string) => string; - getChunkFileName: (chunkReferenceId: string) => string; - getFileName: (fileReferenceId: string) => string; - getModuleIds: () => IterableIterator; - getModuleInfo: GetModuleInfo; - getWatchFiles: () => string[]; - isExternal: IsExternal; - load: ( - options: { id: string; resolveDependencies?: boolean } & Partial> - ) => Promise; - moduleIds: IterableIterator; - parse: (input: string, options?: any) => AcornNode; - resolve: ( - source: string, - importer?: string, - options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean } - ) => Promise; - resolveId: (source: string, importer?: string) => Promise; - setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void; - warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void; + addWatchFile: (id: string) => void; + cache: PluginCache; + emitAsset: EmitAsset; + emitChunk: EmitChunk; + emitFile: EmitFile; + error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never; + getAssetFileName: (assetReferenceId: string) => string; + getChunkFileName: (chunkReferenceId: string) => string; + getFileName: (fileReferenceId: string) => string; + getModuleIds: () => IterableIterator; + getModuleInfo: GetModuleInfo; + getWatchFiles: () => string[]; + isExternal: IsExternal; + load: ( + options: { id: string; resolveDependencies?: boolean } & Partial> + ) => Promise; + moduleIds: IterableIterator; + parse: (input: string, options?: any) => AcornNode; + resolve: ( + source: string, + importer?: string, + options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean } + ) => Promise; + resolveId: (source: string, importer?: string) => Promise; + setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void; + warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void; } export declare interface PluginContextMeta { - rollupVersion: string; - watchMode: boolean; + rollupVersion: string; + watchMode: boolean; } export declare type PluginHooks = { - [K in keyof FunctionPluginHooks]: ObjectHook< - K extends AsyncPluginHooks ? MakeAsync : FunctionPluginHooks[K], - K extends ParallelPluginHooks ? { sequential?: boolean } : {} - >; + [K in keyof FunctionPluginHooks]: ObjectHook< + K extends AsyncPluginHooks ? MakeAsync : FunctionPluginHooks[K], + K extends ParallelPluginHooks ? { sequential?: boolean } : {} + >; }; export declare type PluginImpl = (options?: O) => Plugin_2; export declare class PluginManager extends EventEmitter { @@ -4794,21 +6758,21 @@ export declare interface PrefabAssetUserData { syncNodeName?: string; } export declare interface PreRenderedAsset { - name: string | undefined; - source: string | Uint8Array; - type: 'asset'; + name: string | undefined; + source: string | Uint8Array; + type: 'asset'; } export declare interface PreRenderedChunk { - exports: string[]; - facadeModuleId: string | null; - isDynamicEntry: boolean; - isEntry: boolean; - isImplicitEntry: boolean; - modules: { - [id: string]: RenderedModule; - }; - name: string; - type: 'chunk'; + exports: string[]; + facadeModuleId: string | null; + isDynamicEntry: boolean; + isEntry: boolean; + isImplicitEntry: boolean; + modules: { + [id: string]: RenderedModule; + }; + name: string; + type: 'chunk'; } export declare type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only'; export declare interface PreviewPackResult { @@ -4824,91 +6788,98 @@ export declare interface PreviewPackResult { export declare function publish(platform: Platform, dest: string): Promise; export declare type PureModulesOption = boolean | string[] | IsPureModule; export declare function queryAssetsInBundle(uuid: string, bundleFilterConfig?: BundleFilterConfig[]): Promise; +declare function queryAssetsInBundle_2(uuid: string, bundleFilterConfig?: BundleFilterConfig_2[]): Promise; export declare function queryAutoAtlasFileCache(pacUuid: string): Promise; export declare function queryBuildConfig(): Promise; +declare function queryBuildConfig_2(): Promise; export declare function queryBundleConfig(): Promise>; +declare function queryBundleConfig_2(): Record; export declare function queryDefaultBuildConfigByPlatform(platform: Platform): Promise>; +declare function queryDefaultBuildConfigByPlatform_2(platform: Platform_2): Promise>; export declare function queryPlatformConfig(): Promise; +declare function queryPlatformConfig_2(): PlatformConfigItem_2[]; export declare function queryTextureCompressConfig(): Promise; +declare function queryTextureCompressConfig_2(): TextureCompressFullRenderConfig_2; export declare function refreshDisplayI18nFields(): Promise; +declare function refreshDisplayI18nFields_2(): void; export declare type RenderChunkHook = ( - this: PluginContext, - code: string, - chunk: RenderedChunk, - options: NormalizedOutputOptions + this: PluginContext, + code: string, + chunk: RenderedChunk, + options: NormalizedOutputOptions ) => { code: string; map?: SourceMapInput } | string | null | undefined; export declare interface RenderedChunk extends PreRenderedChunk { - code?: string; - dynamicImports: string[]; - fileName: string; - implicitlyLoadedBefore: string[]; - importedBindings: { - [imported: string]: string[]; - }; - imports: string[]; - map?: SourceMap; - referencedFiles: string[]; + code?: string; + dynamicImports: string[]; + fileName: string; + implicitlyLoadedBefore: string[]; + importedBindings: { + [imported: string]: string[]; + }; + imports: string[]; + map?: SourceMap; + referencedFiles: string[]; } export declare interface RenderedModule { - code: string | null; - originalLength: number; - removedExports: string[]; - renderedExports: string[]; - renderedLength: number; + code: string | null; + originalLength: number; + removedExports: string[]; + renderedExports: string[]; + renderedLength: number; } export declare interface RenderTextureAssetUserData extends TextureBaseAssetUserData { width: number; height: number; } export declare type ResolveAssetUrlHook = ( - this: PluginContext, - options: { - assetFileName: string; - chunkId: string; - format: InternalModuleFormat; - moduleId: string; - relativeAssetPath: string; - } + this: PluginContext, + options: { + assetFileName: string; + chunkId: string; + format: InternalModuleFormat; + moduleId: string; + relativeAssetPath: string; + } ) => string | null | void; export declare interface ResolvedId extends ModuleOptions { - external: boolean | 'absolute'; - id: string; + external: boolean | 'absolute'; + id: string; } export declare interface ResolvedIdMap { - [key: string]: ResolvedId; + [key: string]: ResolvedId; } export declare type ResolveDynamicImportHook = ( - this: PluginContext, - specifier: string | AcornNode, - importer: string + this: PluginContext, + specifier: string | AcornNode, + importer: string ) => ResolveIdResult; export declare type ResolveFileUrlHook = ( - this: PluginContext, - options: { - assetReferenceId: string | null; - chunkId: string; - chunkReferenceId: string | null; - fileName: string; - format: InternalModuleFormat; - moduleId: string; - referenceId: string; - relativePath: string; - } + this: PluginContext, + options: { + assetReferenceId: string | null; + chunkId: string; + chunkReferenceId: string | null; + fileName: string; + format: InternalModuleFormat; + moduleId: string; + referenceId: string; + relativePath: string; + } ) => string | null | void; export declare type ResolveIdHook = ( - this: PluginContext, - source: string, - importer: string | undefined, - options: { custom?: CustomPluginOptions; isEntry: boolean } + this: PluginContext, + source: string, + importer: string | undefined, + options: { custom?: CustomPluginOptions; isEntry: boolean } ) => ResolveIdResult; export declare type ResolveIdResult = string | false | null | void | PartialResolvedId; export declare type ResolveImportMetaHook = ( - this: PluginContext, - prop: string | null, - options: { chunkId: string; format: InternalModuleFormat; moduleId: string } + this: PluginContext, + prop: string | null, + options: { chunkId: string; format: InternalModuleFormat; moduleId: string } ) => string | null | void; export declare namespace rollup { - export { + export { rollup_2 as rollup, watch, defineConfig, @@ -5035,92 +7006,92 @@ export declare namespace rollup { } export declare function rollup_2(options: RollupOptions): Promise; export declare interface RollupAwaitingEmitter any }> - extends TypedEventEmitter { - close(): Promise; - emitAndAwait(event: K, ...args: Parameters): Promise[]>; - onCurrentAwaited( - event: K, - listener: (...args: Parameters) => Promise> - ): this; - removeAwaited(): this; + extends TypedEventEmitter { + close(): Promise; + emitAndAwait(event: K, ...args: Parameters): Promise[]>; + onCurrentAwaited( + event: K, + listener: (...args: Parameters) => Promise> + ): this; + removeAwaited(): this; } export declare interface RollupBuild { - cache: RollupCache | undefined; - close: () => Promise; - closed: boolean; - generate: (outputOptions: OutputOptions) => Promise; - getTimings?: () => SerializedTimings; - watchFiles: string[]; - write: (options: OutputOptions) => Promise; + cache: RollupCache | undefined; + close: () => Promise; + closed: boolean; + generate: (outputOptions: OutputOptions) => Promise; + getTimings?: () => SerializedTimings; + watchFiles: string[]; + write: (options: OutputOptions) => Promise; } export declare interface RollupCache { - modules: ModuleJSON[]; - plugins?: Record; + modules: ModuleJSON[]; + plugins?: Record; } export declare interface RollupError extends RollupLogProps { - parserError?: Error; - stack?: string; - watchFiles?: string[]; + parserError?: Error; + stack?: string; + watchFiles?: string[]; } export declare interface RollupLogProps { - code?: string; - frame?: string; - hook?: string; - id?: string; - loc?: { - column: number; - file?: string; - line: number; - }; - message: string; - name?: string; - plugin?: string; - pluginCode?: string; - pos?: number; - url?: string; + code?: string; + frame?: string; + hook?: string; + id?: string; + loc?: { + column: number; + file?: string; + line: number; + }; + message: string; + name?: string; + plugin?: string; + pluginCode?: string; + pos?: number; + url?: string; } export declare interface RollupOptions extends InputOptions { - output?: OutputOptions | OutputOptions[]; + output?: OutputOptions | OutputOptions[]; } export declare interface RollupOutput { - output: [OutputChunk, ...(OutputChunk | OutputAsset)[]]; + output: [OutputChunk, ...(OutputChunk | OutputAsset)[]]; } export declare interface RollupWarning extends RollupLogProps { - chunkName?: string; - cycle?: string[]; - exportName?: string; - exporter?: string; - guess?: string; - importer?: string; - missing?: string; - modules?: string[]; - names?: string[]; - reexporter?: string; - source?: string; - sources?: string[]; + chunkName?: string; + cycle?: string[]; + exportName?: string; + exporter?: string; + guess?: string; + importer?: string; + missing?: string; + modules?: string[]; + names?: string[]; + reexporter?: string; + source?: string; + sources?: string[]; } export declare type RollupWatcher = RollupAwaitingEmitter<{ - change: (id: string, change: { event: ChangeEvent }) => void; - close: () => void; - event: (event: RollupWatcherEvent) => void; - restart: () => void; + change: (id: string, change: { event: ChangeEvent }) => void; + close: () => void; + event: (event: RollupWatcherEvent) => void; + restart: () => void; }>; export declare type RollupWatcherEvent = - | { code: 'START' } - | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] } - | { - code: 'BUNDLE_END'; - duration: number; - input?: InputOption; - output: readonly string[]; - result: RollupBuild; - } - | { code: 'END' } - | { code: 'ERROR'; error: RollupError; result: RollupBuild | null }; + | { code: 'START' } + | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] } + | { + code: 'BUNDLE_END'; + duration: number; + input?: InputOption; + output: readonly string[]; + result: RollupBuild; + } + | { code: 'END' } + | { code: 'ERROR'; error: RollupError; result: RollupBuild | null }; export declare type RollupWatchHooks = 'onError' | 'onStart' | 'onBundleStart' | 'onBundleEnd' | 'onEnd'; export declare interface RollupWatchOptions extends InputOptions { - output?: OutputOptions | OutputOptions[]; - watch?: WatcherOptions | false; + output?: OutputOptions | OutputOptions[]; + watch?: WatcherOptions | false; } export declare interface RtSpriteFrameAssetUserData { imageUuidOrDatabaseUri: string; @@ -5128,6 +7099,7 @@ export declare interface RtSpriteFrameAssetUserData { height?: number; } export declare function run(platform: Platform, dest: string): Promise; +declare function run_2(platform: string, dest: string): Promise; export declare interface ScriptAssetUserData { isPlugin?: boolean; isNative?: boolean; @@ -5158,18 +7130,39 @@ export declare class ScriptBuilder_2 { static buildSystemJs(options: IBuildSystemJsOption): Promise; static outputImportMap(importMap: ImportMap, options: IImportMapOptions): Promise; } +declare class ScriptBuilder_4 { + _scriptOptions: IScriptOptions_2; + _importMapOptions: ImportMapOptions_2; + scriptPackages: string[]; + static projectOptions: IScriptProjectOption_2; + initTaskOptions(options: IInternalBuildOptions_2 | IInternalBundleBuildOptions_2): { + scriptOptions: IScriptOptions_2; + importMapOptions: { + format: "esm" | "commonjs" | undefined; + data: { + imports: {}; + }; + output: string; + }; + }; + initProjectOptions(options: IInternalBuildOptions_2 | IInternalBundleBuildOptions_2): Promise; + buildBundleScript(bundles: IBundle_2[]): Promise; + static buildPolyfills(options: IPolyFills_2 | undefined, dest: string): Promise; + static buildSystemJs(options: IBuildSystemJsOption_2): Promise; + static outputImportMap(importMap: ImportMap_2, options: IImportMapOptions_2): Promise; +} export declare interface ScriptModuleUserData { isPlugin: false; } export declare type SequentialPluginHooks = - | 'augmentChunkHash' - | 'generateBundle' - | 'options' - | 'outputOptions' - | 'renderChunk' - | 'transform'; + | 'augmentChunkHash' + | 'generateBundle' + | 'options' + | 'outputOptions' + | 'renderChunk' + | 'transform'; export declare interface SerializablePluginCache { - [key: string]: [number, any]; + [key: string]: [number, any]; } export declare interface SerializedAssetFinder { meshes?: Array; @@ -5180,7 +7173,7 @@ export declare interface SerializedAssetFinder { scenes?: Array; } export declare interface SerializedTimings { - [label: string]: [number, number, number]; + [label: string]: [number, number, number]; } export declare interface SharedSettings { useDefineForClassFields: boolean; @@ -5198,16 +7191,16 @@ export declare interface SharedSettings { }; } export declare type ShouldTransformCachedModuleHook = ( - this: PluginContext, - options: { - ast: AcornNode; - code: string; - id: string; - meta: CustomPluginOptions; - moduleSideEffects: boolean | 'no-treeshake'; - resolvedSources: ResolvedIdMap; - syntheticNamedExports: boolean | string; - } + this: PluginContext, + options: { + ast: AcornNode; + code: string; + id: string; + meta: CustomPluginOptions; + moduleSideEffects: boolean | 'no-treeshake'; + resolvedSources: ResolvedIdMap; + syntheticNamedExports: boolean | string; + } ) => boolean; export declare interface SimpleInfo { time: number; @@ -5220,29 +7213,29 @@ export declare interface SimplifyOptions { maxIterationCount?: number; } export declare interface SourceDescription extends Partial> { - ast?: AcornNode; - code: string; - map?: SourceMapInput; + ast?: AcornNode; + code: string; + map?: SourceMapInput; } export declare interface SourceMap { - file: string; - mappings: string; - names: string[]; - sources: string[]; - sourcesContent: string[]; - version: number; - toString(): string; - toUrl(): string; + file: string; + mappings: string; + names: string[]; + sources: string[]; + sourcesContent: string[]; + version: number; + toString(): string; + toUrl(): string; } export declare type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' }; export declare type SourcemapPathTransformOption = ( - relativeSourcePath: string, - sourcemapPath: string + relativeSourcePath: string, + sourcemapPath: string ) => string; export declare type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; + | [number] + | [number, number, number, number] + | [number, number, number, number, number]; export declare interface SpineAssetUserData { atlasUuid: string; } @@ -5350,10 +7343,10 @@ export declare class StatsQuery { private _editorPublicModules; } export declare namespace StatsQuery { - namespace ConstantManager { - type PlatformType = 'WEB_EDITOR' | 'WEB_MOBILE' | 'WEB_DESKTOP' | 'WECHAT' | 'WECHAT_MINI_PROGRAM' | 'BYTEDANCE' | 'ALIPAY' | 'TAOBAO' | 'TAOBAO_MINIGAME' | 'OPPO' | 'VIVO' | 'HUAWEI' | 'HONOR' | 'COCOS_RUNTIME' | 'SUD' | 'SUDV2' | 'NATIVE_EDITOR' | 'ANDROID' | 'WINDOWS' | 'IOS' | 'MAC' | 'OHOS' | 'OPEN_HARMONY' | 'LINUX' | 'HTML5' | 'NATIVE' | 'NODEJS' | 'INVALID_PLATFORM'; - type IPlatformConfig = { [key in PlatformType]: boolean }; - interface IInternalFlagConfig { + export namespace ConstantManager { + export type PlatformType = 'WEB_EDITOR' | 'WEB_MOBILE' | 'WEB_DESKTOP' | 'WECHAT' | 'WECHAT_MINI_PROGRAM' | 'BYTEDANCE' | 'ALIPAY' | 'TAOBAO' | 'TAOBAO_MINIGAME' | 'OPPO' | 'VIVO' | 'HUAWEI' | 'HONOR' | 'COCOS_RUNTIME' | 'SUD' | 'SUDV2' | 'NATIVE_EDITOR' | 'ANDROID' | 'WINDOWS' | 'IOS' | 'MAC' | 'OHOS' | 'OPEN_HARMONY' | 'LINUX' | 'HTML5' | 'NATIVE' | 'NODEJS' | 'INVALID_PLATFORM'; + export type IPlatformConfig = { [key in PlatformType]: boolean }; + export interface IInternalFlagConfig { SERVER_MODE: boolean; NOT_PACK_PHYSX_LIBS: boolean; WEBGPU: boolean; @@ -5363,33 +7356,33 @@ export declare namespace StatsQuery { USE_3D: boolean; USE_UI_SKEW: boolean; } - interface IPublicFlagConfig { + export interface IPublicFlagConfig { DEBUG: boolean; NET_MODE: number; } - interface IFlagConfig extends IInternalFlagConfig, IPublicFlagConfig {} - interface IModeConfig { + export interface IFlagConfig extends IInternalFlagConfig, IPublicFlagConfig {} + export interface IModeConfig { EDITOR: boolean; PREVIEW: boolean; BUILD: boolean; TEST: boolean; } - interface IConstantOptions { + export interface IConstantOptions { platform: PlatformType; flagConfig: IFlagConfig; } - type ModeType = keyof IModeConfig; - type FlagType = keyof IFlagConfig; - interface BuildTimeConstants extends IPlatformConfig, IFlagConfig, IModeConfig {} - interface CCEnvConstants extends IPlatformConfig, IPublicFlagConfig, IModeConfig {} - type ValueType = boolean | number; - interface ConstantOptions { + export type ModeType = keyof IModeConfig; + export type FlagType = keyof IFlagConfig; + export interface BuildTimeConstants extends IPlatformConfig, IFlagConfig, IModeConfig {} + export interface CCEnvConstants extends IPlatformConfig, IPublicFlagConfig, IModeConfig {} + export type ValueType = boolean | number; + export interface ConstantOptions { mode: ModeType; platform: PlatformType; flags: Partial>; } } - class ConstantManager { + export class ConstantManager { private _engineRoot; private _ccConfigJsonStr; constructor(engineRoot: string); @@ -5414,19 +7407,19 @@ export declare interface StoreInfo { } export declare const SUPPORT_CREATE_TYPES: readonly ["animation-clip", "typescript", "auto-atlas", "effect", "scene", "prefab", "material", "texture-cube", "terrain", "physics-material", "label-atlas", "render-texture", "directory", "effect-header"]; export declare type SyncPluginHooks = - | 'augmentChunkHash' - | 'outputOptions' - | 'renderDynamicImport' - | 'resolveAssetUrl' - | 'resolveFileUrl' - | 'resolveImportMeta'; + | 'augmentChunkHash' + | 'outputOptions' + | 'renderDynamicImport' + | 'resolveAssetUrl' + | 'resolveFileUrl' + | 'resolveImportMeta'; export declare enum TangentImportSetting { exclude = 0, optional = 1, require = 2, recalculate = 3 } -export declare const enum TaskAddResult { +export declare enum TaskAddResult { BUSY = 0, SUCCESS = 1, PARAM_ERROR = 2 @@ -5485,7 +7478,7 @@ export declare class TextureCompress_2 extends EventEmitter_2 { updateUserConfig(): Promise; static queryTextureCompressCache(uuid: string): CompressCacheInfo; addTask(uuid: string, task: IImageTaskInfo): IImageTaskInfo; - addTaskWithAssetInfo(assetInfo: Asset | VirtualAsset): IImageTaskInfo | { + addTaskWithAssetInfo(assetInfo: Asset | VirtualAsset_2): IImageTaskInfo | { src: string; presetId: any; compressOptions: Record>; @@ -5495,7 +7488,7 @@ export declare class TextureCompress_2 extends EventEmitter_2 { dest: never[]; suffix: never[]; } | undefined; - genTaskInfoFromAssetInfo(assetInfo: Asset | VirtualAsset): IImageTaskInfo | { + genTaskInfoFromAssetInfo(assetInfo: Asset | VirtualAsset_2): IImageTaskInfo | { src: string; presetId: any; compressOptions: Record>; @@ -5518,21 +7511,75 @@ export declare class TextureCompress_2 extends EventEmitter_2 { private customCompressImage; compressImageByConfig(optionItem: ICompressConfig): Promise; } -export declare interface TextureCompressFullRenderConfig { - configGroups: IConfigGroups; - textureFormatConfigs: Record; - formatsInfo: Record; - defaultSupport: ISupportFormat; - platformRenderConfigs: Record; -} -export declare interface TextureCompressRenderConfig { - displayName: string; - platformConfigs: Record; -} -export declare interface TextureCubeAssetUserData extends TextureBaseAssetUserData { - imageDatabaseUri?: string; - isRGBE: boolean; - mipBakeMode: number; +declare class TextureCompress_4 extends EventEmitter_2 { + _taskMap: Record; + platform: string; + static overwriteFormats: Record; + static _presetIdToCompressOption: Record>>; + static allTextureCompressConfig: AllTextureCompressConfig_2; + static userCompressConfig: UserCompressConfig_2; + static compressCacheDir: string; + static storedCompressInfo: Record; + static storedCompressInfoPath: string; + static enableMipMaps: boolean; + _waitingCompressQueue: Set; + _compressAssetLen: number; + _compressExecuteInfo: CompressExecuteInfo_2 | null; + textureCompress: boolean; + constructor(platform: string, textureCompress?: boolean); + static initCommonOptions(): Promise; + init(): Promise; + updateUserConfig(): Promise; + static queryTextureCompressCache(uuid: string): CompressCacheInfo_2; + addTask(uuid: string, task: IImageTaskInfo_2): IImageTaskInfo_2; + addTaskWithAssetInfo(assetInfo: Asset_3 | VirtualAsset_4): IImageTaskInfo_2 | { + src: string; + presetId: any; + compressOptions: Record>; + hasAlpha: any; + mtime: any; + hasMipmaps: boolean; + dest: never[]; + suffix: never[]; + } | undefined; + genTaskInfoFromAssetInfo(assetInfo: Asset_3 | VirtualAsset_4): IImageTaskInfo_2 | { + src: string; + presetId: any; + compressOptions: Record>; + hasAlpha: any; + mtime: any; + hasMipmaps: boolean; + dest: never[]; + suffix: never[]; + } | null | undefined; + getCompressOptions(presetId: string): (Record>) | null; + queryTask(uuid: string): IImageTaskInfo_2; + removeTask(uuid: string): void; + run(taskMap?: Record): Promise | undefined>; + private sortImageTask; + executeCompressQueue(): Promise | undefined; + _getNextTask(): ICompressConfig_2 | null; + _checkTaskCanExecute(taskConfig: ICompressConfig_2): boolean; + _compressImage(config: ICompressConfig_2): Promise; + _step(): Promise; + private customCompressImage; + compressImageByConfig(optionItem: ICompressConfig_2): Promise; +} +export declare interface TextureCompressFullRenderConfig { + configGroups: IConfigGroups; + textureFormatConfigs: Record; + formatsInfo: Record; + defaultSupport: ISupportFormat; + platformRenderConfigs: Record; +} +export declare interface TextureCompressRenderConfig { + displayName: string; + platformConfigs: Record; +} +export declare interface TextureCubeAssetUserData extends TextureBaseAssetUserData { + imageDatabaseUri?: string; + isRGBE: boolean; + mipBakeMode: number; faceSize?: number; sign?: string; front?: string; @@ -5543,18 +7590,18 @@ export declare interface TextureCubeAssetUserData extends TextureBaseAssetUserDa bottom?: string; } export declare type TransformHook = ( - this: TransformPluginContext, - code: string, - id: string + this: TransformPluginContext, + code: string, + id: string ) => TransformResult; export declare interface TransformModuleJSON { - ast?: AcornNode; - code: string; - customTransformCache: boolean; - originalCode: string; - originalSourcemap: ExistingDecodedSourceMap | null; - sourcemapChain: DecodedSourceMapOrMissing[]; - transformDependencies: string[]; + ast?: AcornNode; + code: string; + customTransformCache: boolean; + originalCode: string; + originalSourcemap: ExistingDecodedSourceMap | null; + sourcemapChain: DecodedSourceMapOrMissing[]; + transformDependencies: string[]; } export declare interface TransformOptions { excludes?: Array; @@ -5562,32 +7609,32 @@ export declare interface TransformOptions { targets?: ITransformTarget; } export declare interface TransformPluginContext extends PluginContext { - getCombinedSourcemap: () => SourceMap; + getCombinedSourcemap: () => SourceMap; } export declare type TransformResult = string | null | void | Partial; export declare interface TreeshakingOptions - extends Partial> { - moduleSideEffects?: ModuleSideEffectsOption; - preset?: TreeshakingPreset; - pureExternalModules?: PureModulesOption; + extends Partial> { + moduleSideEffects?: ModuleSideEffectsOption; + preset?: TreeshakingPreset; + pureExternalModules?: PureModulesOption; } export declare type TreeshakingPreset = 'smallest' | 'safest' | 'recommended'; export declare interface TypedEventEmitter any }> { - addListener(event: K, listener: T[K]): this; - emit(event: K, ...args: Parameters): boolean; - eventNames(): Array; - getMaxListeners(): number; - listenerCount(type: keyof T): number; - listeners(event: K): Array; - off(event: K, listener: T[K]): this; - on(event: K, listener: T[K]): this; - once(event: K, listener: T[K]): this; - prependListener(event: K, listener: T[K]): this; - prependOnceListener(event: K, listener: T[K]): this; - rawListeners(event: K): Array; - removeAllListeners(event?: K): this; - removeListener(event: K, listener: T[K]): this; - setMaxListeners(n: number): this; + addListener(event: K, listener: T[K]): this; + emit(event: K, ...args: Parameters): boolean; + eventNames(): Array; + getMaxListeners(): number; + listenerCount(type: keyof T): number; + listeners(event: K): Array; + off(event: K, listener: T[K]): this; + on(event: K, listener: T[K]): this; + once(event: K, listener: T[K]): this; + prependListener(event: K, listener: T[K]): this; + prependOnceListener(event: K, listener: T[K]): this; + rawListeners(event: K): Array; + removeAllListeners(event?: K): this; + removeListener(event: K, listener: T[K]): this; + setMaxListeners(n: number): this; } export declare function upload(platform: Platform, dest: string, accessToken?: string): Promise; export declare type Url = string; @@ -5612,7 +7659,13 @@ export declare interface UserCompressConfig { } export declare type UUID = string; export declare const VERSION: string; -export declare class VirtualAsset { +export declare class VirtualAsset extends VirtualAsset_2 { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} +export declare class VirtualAsset_2 { versionCode: number; _init: boolean; importError: Error | any; @@ -5637,7 +7690,7 @@ export declare class VirtualAsset { generate(): void; meta: Meta; subAssets: { - [name: string]: VirtualAsset; + [name: string]: VirtualAsset_2; }; set imported(imported: boolean); get imported(): boolean; @@ -5646,12 +7699,12 @@ export declare class VirtualAsset { lock(): Promise; unlock(): void; _assetDB: AssetDB; - _parent: VirtualAsset | Asset | null; + _parent: VirtualAsset_2 | Asset | null; _name: string; _id: string; _swapSpace: any; _isDirectory?: boolean; - get parent(): Asset | VirtualAsset | null; + get parent(): Asset | VirtualAsset_2 | null; get userData(): { [index: string]: any; }; @@ -5668,28 +7721,94 @@ export declare class VirtualAsset { createSubAsset(name: string, importer: string, options?: { displayName?: string; id?: string; - }): Promise; + }): Promise; + depend(fileOrUuidOrUrl: string): void; + getSwapSpace(): T; +} +declare class VirtualAsset_3 extends VirtualAsset_4 { + getData(name: 'output'): IExportData_2; + getData(name: string): any; + setData(name: 'output', data: IExportData_2): void; + setData(name: string, data: any): void; +} +declare class VirtualAsset_4 { + versionCode: number; + _init: boolean; + importError: Error | any; + get init(): boolean; + set init(bool: boolean); + _waitInitHandle: Function[]; + waitInit(): Promise; + action: AssetActionEnum_2; + task: number; + invalid: boolean; + uuid2recycle: { + [index: string]: Meta_2; + }; + get source(): string; + get url(): string; + get library(): string; + get temp(): string; + get uuid(): string; + get displayName(): string; + getData(key: string): any; + setData(key: string, value: any): void; + generate(): void; + meta: Meta_2; + subAssets: { + [name: string]: VirtualAsset_4; + }; + set imported(imported: boolean); + get imported(): boolean; + _lock: boolean; + _waitLockHandler: Function[]; + lock(): Promise; + unlock(): void; + _assetDB: AssetDB_2; + _parent: VirtualAsset_4 | Asset_3 | null; + _name: string; + _id: string; + _swapSpace: any; + _isDirectory?: boolean; + get parent(): Asset_3 | VirtualAsset_4 | null; + get userData(): { + [index: string]: any; + }; + constructor(meta: Meta_2, name: string, id: string, assetDB: AssetDB_2); + assignUserData(json: Object, overwrite?: boolean): void; + save(): any; + reset(): Promise; + getFilePath(extOrFile: string): string; + saveToLibrary(extOrFile: string, buffer: Buffer | string): Promise; + copyToLibrary(extOrFile: string, target: string): Promise; + deleteFromLibrary(extOrFile: string): Promise; + existsInLibrary(extOrFile: string): Promise; + isDirectory(): boolean; + createSubAsset(name: string, importer: string, options?: { + displayName?: string; + id?: string; + }): Promise; depend(fileOrUuidOrUrl: string): void; getSwapSpace(): T; } export declare type WarningHandler = (warning: RollupWarning) => void; export declare type WarningHandlerWithDefault = ( - warning: RollupWarning, - defaultHandler: WarningHandler + warning: RollupWarning, + defaultHandler: WarningHandler ) => void; export declare function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher; export declare type WatchChangeHook = ( - this: PluginContext, - id: string, - change: { event: ChangeEvent } + this: PluginContext, + id: string, + change: { event: ChangeEvent } ) => void; export declare interface WatcherOptions { - buildDelay?: number; - chokidar?: ChokidarOptions; - clearScreen?: boolean; - exclude?: string | RegExp | (string | RegExp)[]; - include?: string | RegExp | (string | RegExp)[]; - skipWrite?: boolean; + buildDelay?: number; + chokidar?: ChokidarOptions; + clearScreen?: boolean; + exclude?: string | RegExp | (string | RegExp)[]; + include?: string | RegExp | (string | RegExp)[]; + skipWrite?: boolean; } export declare type WebDesktopBuildOptions = IBuildTaskOption<'web-desktop'>; export declare interface webDesktopOptions { @@ -5730,8 +7849,18 @@ export { } exports[`DTS API compatibility cli.d.ts should match snapshot 1`] = ` "import type { Camera } from 'cc'; import type { Component } from 'cc'; +import { IBuildCommandOption } from './builder'; +import { IBuildResultData } from './builder'; +import { NextFunction } from 'express'; import type { Node as Node_2 } from 'cc'; +import { Platform } from './builder'; +import { Request as Request_2 } from 'express'; +import { Response as Response_2 } from 'express'; +import { Router } from 'express-serve-static-core'; import type { Scene } from 'cc'; +import { Server } from 'socket.io'; +import type { Server as Server_2 } from 'http'; +import type { Server as Server_3 } from 'https'; import type { Terrain } from 'cc'; import type { Vec3 as Vec3_2 } from 'cc'; export declare interface AnimationClipAssetUserData { @@ -5836,9 +7965,23 @@ export declare interface BitmapFontAssetUserData { export declare type CancelCreateDragResult = CreateDragResult>; +declare type CLITaskMode = 'hold' | 'simple'; export declare type CommitCreateDragResult = CreateDragResult>; +export declare namespace CoreExtensionRoots { + export { + isLegacyProjectLocalization, + resolveBuiltinExtensionsRoot, + resolveExtensionRoots, + ExtensionRoot + } +} +export declare namespace CoreLauncher { + export { + Launcher as default + } +} export declare const CREATE_TYPES: readonly ["scene", "prefab"]; export declare type CreateDragCancelReason = 'leave' @@ -5903,10 +8046,19 @@ export declare interface DirectoryAssetUserData { bundleName?: string; priority?: number; } +export declare namespace Editor { + export { + Host + } +} export declare interface EffectAssetUserData { combinations?: any; editor?: any; } +declare interface ExtensionRoot { + kind: 'project' | 'builtin'; + path: string; +} export declare type Filter = 'none' | 'nearest' | 'linear'; export declare interface FntData { commonHeight?: number; @@ -5929,6 +8081,14 @@ export declare interface FontDef { export declare interface FontDefDictionary { [charId: number]: FontDef; } +declare function getServerUrl(): string; +export declare namespace Global_2 { + export { + GlobalPaths, + GlobalConfig + } +} +declare const GlobalConfig: IGlobalConfig; export declare class GlobalEventManager { on>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void; on(event: string, listener: (...args: any[]) => void): void; @@ -5942,6 +8102,11 @@ export declare class GlobalEventManager { broadcast(event: string, ...args: any[]): void; clear(event?: string): void; } +declare const GlobalPaths: { + staticDir: string; + workspace: string; + enginePath: string; +}; export declare interface GltfAnimationAssetUserData { gltfIndex: number; events: Array<{ @@ -6015,6 +8180,17 @@ export declare interface GlTFUserData { options: LODsOption[]; }; } +export declare namespace Host { + export { + CoreExtensionRoots, + CoreLauncher, + Global_2 as Global, + ServerIndex, + ServerInterfaces, + ServerMiddlewareIndex, + ServerSocket + } +} export declare interface IAddComponentOptions { nodePath: string; component: string; @@ -6784,6 +8960,10 @@ export declare interface IFbxSetting { smartMaterialEnabled?: boolean; matchMeshNames?: boolean; } +declare interface IGetPostConfig { + url: string | RegExp; + handler: (req: Request_2, res: Response_2, next?: NextFunction) => Promise; +} export declare interface IGetPrefabInfoParams { nodePath: string; } @@ -6844,6 +9024,9 @@ export declare interface IGizmoService { generateLightProbes(): number; regionSelectLightProbes(left: number, right: number, top: number, bottom: number, additive: boolean): number; } +declare interface IGlobalConfig { + mode: CLITaskMode; +} export declare interface IInsertLODOptions { path: string; index: number; @@ -7020,6 +9203,12 @@ export declare interface ImageMeta { uri?: string; remap?: string; } +declare interface IMiddlewareContribution { + get?: IGetPostConfig[]; + post?: IGetPostConfig[]; + staticFiles?: IStaticFileConfig[]; + socket?: ISocketConfig; +} export declare interface IMotionPreviewService { showMotion(desc: MotionPreviewDesc): Promise; hideMotion(): Promise; @@ -7666,6 +9855,17 @@ export declare interface ISetPropertyOptions { dump: IProperty; record?: boolean; } +declare function isLegacyProjectLocalization(projectRoot: string, extensionDir: string, manifest: { + name?: unknown; +} | null | undefined): boolean; +declare interface ISocketConfig { + connection: (socket: any) => void; + disconnect: (socket: any) => void; +} +declare interface IStaticFileConfig { + url: string; + path: string; +} export declare type ISupportCreateCCType = | 'cc.AnimationClip' | 'cc.Script' @@ -7933,6 +10133,37 @@ export declare interface LabelAtlasAssetUserData { spriteFrameUuid: string; _fntConfig: FntData; } +declare class Launcher { + protected projectPath: string; + private _init; + private _import; + private static active; + private ownership?; + private importPromise?; + private startupPromise?; + private closePromise?; + private projectOpened; + private scriptsStarted; + private assetsStarted; + private serverStarted; + private sceneStarted; + constructor(projectPath: string); + private init; + import(): Promise; + private importOwned; + startup(port?: number, options?: { + allowedOrigins?: string[]; + publishReady?: boolean; + }): Promise; + private startupOwned; + build(platform: Platform, options: Partial): Promise; + static make(platform: Platform, dest: string): Promise; + static run(platform: Platform, dest: string): Promise; + static upload(platform: Platform, dest: string, accessToken?: string): Promise; + static publish(platform: Platform, dest: string): Promise; + close(): Promise; + private cleanup; +} export declare interface LODsOption { screenRatio: number; faceCount: number; @@ -7984,6 +10215,14 @@ export declare interface MeshSimplifyOptions { errorRate?: number; lockBoundary?: boolean; } +declare class MiddlewareManager { + router: Router; + staticRouter: Router; + middlewareStaticFile: IStaticFileConfig[]; + middlewareSocket: Map; + register(name: string, module: IMiddlewareContribution): void; +} +declare const middlewareService: MiddlewareManager; export declare interface MotionPreviewDesc { motion: MotionPreviewDescNode | null; variables: MotionPreviewVariable[]; @@ -8157,6 +10396,7 @@ export declare enum PrefabState { } export declare type PreviewPlayState = 'stop' | 'play' | 'pause'; export declare type ReferenceImageVisibilityReason = 'visible' | 'disabled' | 'no-editor' | 'not-2d' | 'unbound' | 'missing' | 'load-error'; +declare function register(name: string, module: IMiddlewareContribution): void; export declare enum ReloadResult { SUCCESS = 0, FAILED = 1, @@ -8169,11 +10409,17 @@ export declare interface RenderTextureAssetUserData extends TextureBaseAssetUser width: number; height: number; } +declare interface RequestGuardConfig { + configuredHost?: string; +} +declare function resolveBuiltinExtensionsRoot(resourcesPath?: string | undefined, env?: NodeJS.ProcessEnv): string | undefined; +declare function resolveExtensionRoots(projectPath: string, env?: NodeJS.ProcessEnv): ExtensionRoot[]; export declare interface RtSpriteFrameAssetUserData { imageUuidOrDatabaseUri: string; width?: number; height?: number; } +declare const SCENE_RENDERER_ROOM = "scene-renderer"; export declare const SCENE_TEMPLATE_TYPE: readonly ["2d", "3d", "quality"]; export declare type SceneDragEvent = 'onDragLeave' | 'onDragOver' | 'onDrop'; export declare type SceneKeyboardEvent = 'keydown' | 'keyup'; @@ -8203,12 +10449,46 @@ export declare interface SerializedNodeData { uuid: string; }[]; } +export declare namespace ServerIndex { + export { + startServer, + stopServer, + getServerUrl, + register + } +} +export declare namespace ServerInterfaces { + export { + IGetPostConfig, + IStaticFileConfig, + ISocketConfig, + IMiddlewareContribution + } +} +export declare namespace ServerMiddlewareIndex { + export { + middlewareService + } +} +export declare namespace ServerSocket { + export { + SCENE_RENDERER_ROOM, + SocketService, + socketService + } +} export declare interface SimplifyOptions { targetRatio?: number; enableSmartLink?: boolean; agressiveness?: number; maxIterationCount?: number; } +declare class SocketService { + io: Server | undefined; + startup(server: Server_2 | Server_3, getGuardConfig?: () => RequestGuardConfig): void; + disconnect(): void; +} +declare const socketService: SocketService; export declare interface SpineAssetUserData { atlasUuid: string; } @@ -8255,6 +10535,8 @@ export declare interface SpriteFrameVertices { minPos: number[]; maxPos: number[]; } +declare function startServer(port?: number, host?: string): Promise; +declare function stopServer(): Promise; export declare const SUPPORT_CREATE_TYPES: readonly ["animation-clip", "typescript", "auto-atlas", "effect", "scene", "prefab", "material", "texture-cube", "terrain", "physics-material", "label-atlas", "render-texture", "directory", "effect-header"]; export declare enum TangentImportSetting { exclude = 0, @@ -8321,12 +10603,146 @@ export { } `; exports[`DTS API compatibility configuration.d.ts should match snapshot 1`] = ` -"import { EventEmitter } from 'events'; +"import { ConfigurationScope as ConfigurationScope_2 } from './configuration'; +import { EventEmitter } from 'events'; +import { IBaseConfiguration as IBaseConfiguration_2 } from './configuration'; +import { ICocosConfigurationNode as ICocosConfigurationNode_2 } from './configuration'; +import { ICocosConfigurationPropertySchema as ICocosConfigurationPropertySchema_2 } from './configuration'; +import { IConfiguration as IConfiguration_2 } from './configuration'; +declare const COCOS_CREATOR_VERSION: string; +declare type CocosCLIConfigScope = 'project' | 'local'; +declare class CocosConfigLoader { + private initialized; + private projectPath; + private configMap; + initialize(projectPath: string): void; + private getPathByScope; + loadConfig(scope: CocosCreatorConfigScope, pkgName: string): Promise; +} +declare type CocosCreatorConfigScope = 'local' | 'project' | 'global'; +declare class CocosMigration { + private static loader; + static migrate(projectPath: string, target: IMigrationTarget): Promise; + private static applyTargetPath; +} +declare class CocosMigrationManager { + private static _targets; + private static _initialized; + static get migrationTargets(): Map; + private static registerMigration; + static register(migrationTarget: IMigrationTarget | IMigrationTarget[]): void; + static migrate(projectPath: string): Promise>>; + static clear(): void; + private static createConfigList; +} +declare class ConfigurationManager extends EventEmitter implements IConfigurationManager { + static VERSION: string; + static name: string; + static SchemaPathSource: string; + static relativeSchemaPath: string; + static schemaRef: string; + private static readonly legacyLocalConfigPaths; + private initialized; + private projectPath; + private configPath; + private localConfigPath; + private projectConfig; + private localConfig; + private saveQueue; + private localSaveQueue; + private _version; + get version(): string; + set version(value: string); + private configurationMap; + private onRegistryConfigurationBind; + private onUnRegistryConfigurationBind; + initialize(projectPath: string): Promise; + reload(): Promise; + private onRegistryConfiguration; + private onUnRegistryConfiguration; + private initializeConfigFromProject; + private initializeConfigFromLocal; + migrate(): Promise; + migrateFromProject(projectPath: string): Promise; + private splitLegacyConfigScopes; + private removeByDotPathAndPrune; + private parseKey; + private getInstance; + get(key: string, scope?: ConfigurationScope_2): Promise; + set(key: string, value: T, scope?: ConfigurationScope_2): Promise; + remove(key: string, scope?: ConfigurationScope_2): Promise; + private ensureInitialized; + private load; + private readLocalConfig; + private relocateLegacyRootConfig; + save(forceOrScope?: boolean | ConfigurationScope_2, scope?: ConfigurationScope_2): Promise; + private normalizeSaveOptions; + private saveProjectConfig; + private saveLocalConfig; + private writeConfigWithRetry; + getConfigPath(scope?: ConfigurationScope_2): Promise; + reset(): void; +} +declare const configurationManager: ConfigurationManager; +declare class ConfigurationRegistry extends EventEmitter implements IConfigurationRegistry { + private instances; + private registrations; + getInstances(): Record; + getInstance(moduleName: string): IBaseConfiguration_2 | undefined; + register(moduleName: string, registration?: IConfigurationRegistration): Promise; + register(moduleName: string, defaultConfig?: Record): Promise; + register(moduleName: string, instance: T): Promise; + register(moduleName: string, instance: T, registration: IConfigurationRegistration): Promise; + unregister(moduleName: string): Promise; + getMetadata(): Promise; + private parseRegisterArguments; + private resolveDefaultConfig; + private mergeRegistration; + private deriveDefaultsFromNodes; +} +declare const configurationRegistry: ConfigurationRegistry; export declare type ConfigurationScope = 'default' | 'project' | 'local'; +export declare namespace CoreConfigurationIndex { + export { + ConfigurationScope_2 as ConfigurationScope, + IBaseConfiguration_2 as IBaseConfiguration, + configurationRegistry, + configurationManager, + ICocosConfigurationNode_2 as ICocosConfigurationNode, + ICocosConfigurationPropertySchema_2 as ICocosConfigurationPropertySchema, + CocosMigrationManager, + CocosMigration, + CocosConfigLoader, + getMigrationList, + CocosCreatorConfigScope, + CocosCLIConfigScope, + IMigrationTarget, + COCOS_CREATOR_VERSION + } +} +export declare namespace CoreConfigurationScriptInterface { + export { + ConfigurationScope_2 as ConfigurationScope, + IConfiguration_2 as IConfiguration, + MessageType + } +} +export declare namespace Editor { + export { + Host + } +} export declare type EventEmitterMethods = Pick; export declare function get(key: string, scope?: ConfigurationScope): Promise; export declare function getConfigPath(scope?: ConfigurationScope): Promise; export declare function getMetadata(): Promise; +declare function getMigrationList(): IMigrationTarget[]; +export declare namespace Host { + export { + CoreConfigurationIndex, + CoreConfigurationScriptInterface + } +} export declare interface IBaseConfiguration extends EventEmitterMethods { moduleName: string; getDefaultConfig(): Record | undefined; @@ -8337,6 +10753,9 @@ export declare interface IBaseConfiguration extends EventEmitterMethods { remove(key: string, scope?: ConfigurationScope): Promise; save(scope?: ConfigurationScope): Promise; } +declare type ICocosConfigurationMetadataProvider = () => ICocosConfigurationMetadataValue; +declare type ICocosConfigurationMetadataRegistration = ICocosConfigurationNode_2[] | ICocosConfigurationMetadataProvider; +declare type ICocosConfigurationMetadataValue = ICocosConfigurationNode_2[] | Promise; export declare interface ICocosConfigurationNode { id: string; title: string; @@ -8369,7 +10788,47 @@ export declare interface ICocosConfigurationPropertySchema { export declare interface IConfiguration { [key: string]: any; } +declare interface IConfigurationManager { + initialize(projectPath: string): Promise; + get(key: string, scope?: ConfigurationScope_2): Promise; + set(key: string, value: T, scope?: ConfigurationScope_2): Promise; + remove(key: string, scope?: ConfigurationScope_2): Promise; + reload(): Promise; + migrate(): Promise; + migrateFromProject(projectPath: string): Promise; + save(forceOrScope?: boolean | ConfigurationScope_2, scope?: ConfigurationScope_2): Promise; + getConfigPath(scope?: ConfigurationScope_2): Promise; +} +declare interface IConfigurationRegistration { + defaults?: Record; + nodes?: ICocosConfigurationMetadataRegistration; +} +declare interface IConfigurationRegistry { + getInstances(): Record; + getInstance(moduleName: string): IBaseConfiguration_2 | undefined; + register(moduleName: string, registration?: IConfigurationRegistration): Promise; + register(moduleName: string, defaultConfig?: Record): Promise; + register(moduleName: string, instance: T): Promise; + register(moduleName: string, instance: T, registration: IConfigurationRegistration): Promise; + unregister(moduleName: string): Promise; + getMetadata(): Promise; +} +declare interface IMigrationTarget { + sourceScope: CocosCreatorConfigScope; + targetScope?: CocosCLIConfigScope; + pluginName: string; + targetPath?: string; + migrate(oldConfig: Record): Promise; +} export declare function init(projectPath: string): Promise; +declare const MessageType: { + readonly Save: "configuration:save"; + readonly Registry: "configuration:registry"; + readonly UnRegistry: "configuration:unregistry"; + readonly Reload: "configuration:reload"; + readonly Update: "configuration:update"; + readonly Remove: "configuration:remove"; +}; export declare function migrate(): Promise; export declare function migrateFromProject(): Promise; export declare function onDidSave(callback: () => void, scope?: ConfigurationScope): () => void; @@ -8382,7 +10841,118 @@ export { } `; exports[`DTS API compatibility engine.d.ts should match snapshot 1`] = ` -"import { __private } from 'cc'; +"import { __private } from 'cc/editor/new-gen-anim'; +import { __private as __private_2 } from 'cc'; +import { AnimationBlend } from 'cc/editor/new-gen-anim'; +import { AnimationBlend1D } from 'cc/editor/new-gen-anim'; +import { AnimationBlend2D } from 'cc/editor/new-gen-anim'; +import { AnimationBlendDirect } from 'cc/editor/new-gen-anim'; +import { AnimationGraph } from 'cc/editor/new-gen-anim'; +import { AnimationGraphVariant } from 'cc/editor/new-gen-anim'; +import { AnimationMask } from 'cc/editor/new-gen-anim'; +import { AnimationTransition } from 'cc/editor/new-gen-anim'; +import { Asset } from 'cc'; +import { BinaryCondition } from 'cc/editor/new-gen-anim'; +import { BindableBoolean } from 'cc/editor/new-gen-anim'; +import { BindableNumber } from 'cc/editor/new-gen-anim'; +import { blend1D } from 'cc/editor/new-gen-anim'; +import { blendSimpleDirectional } from 'cc/editor/new-gen-anim'; +import { ClipMotion } from 'cc/editor/new-gen-anim'; +import { cloneState } from 'cc/editor/new-gen-anim'; +import { Component as Component_2 } from 'cc'; +import { Condition } from 'cc/editor/new-gen-anim'; +import { Constructor } from 'cc'; +import { copyPoseGraphNodes } from 'cc/editor/new-gen-anim'; +import { CopyPoseGraphNodesOptions } from 'cc/editor/new-gen-anim'; +import { copyStateMachineAsPoseGraphNode } from 'cc/editor/new-gen-anim'; +import { createPoseGraphNode } from 'cc/editor/new-gen-anim'; +import { createPoseNodeOnAssetDrag } from 'cc/editor/new-gen-anim'; +import { default as default_2 } from 'cc/overwrite'; +import { earcut } from 'cc/editor/2d-misc'; +import { EmptyState } from 'cc/editor/new-gen-anim'; +import { EmptyStateTransition } from 'cc/editor/new-gen-anim'; +import { EnterNodeInfo } from 'cc/editor/new-gen-anim'; +import { EventEmitter } from 'events'; +import { getCreatePoseGraphNodeEntries } from 'cc/editor/new-gen-anim'; +import { getInputConventionalI18nInfo } from 'cc/editor/new-gen-anim'; +import { getInputDefaultDisplayName } from 'cc/editor/new-gen-anim'; +import { getNodeAppearanceOptions } from 'cc/editor/new-gen-anim'; +import { getPoseGraphAssetDragHandlersMap } from 'cc/editor/new-gen-anim'; +import { getPoseGraphNodeInputAttrs } from 'cc/editor/new-gen-anim'; +import { getTCBindingTypeInfo } from 'cc/editor/new-gen-anim'; +import { getVariableValueAttributes } from 'cc/editor/new-gen-anim'; +import { gfx } from 'cc'; +import { IEngineConfig as IEngineConfig_2 } from './engine'; +import { IEngineGraphicsConfig as IEngineGraphicsConfig_2 } from './engine'; +import { IEngineGraphicsPipeline as IEngineGraphicsPipeline_2 } from './engine'; +import { InvalidTransitionError } from 'cc/editor/new-gen-anim'; +import { isAnimationTransition } from 'cc/editor/new-gen-anim'; +import { Layer } from 'cc/editor/new-gen-anim'; +import { LODGroupEditorUtility } from 'cc/editor/lod-group-utils'; +import { Motion } from 'cc/editor/new-gen-anim'; +import { MotionEval } from 'cc/editor/new-gen-anim'; +import { MotionPort } from 'cc/editor/new-gen-anim'; +import { MotionPreviewer } from 'cc/editor/new-gen-anim'; +import { MotionPreviewerTimelineStats } from 'cc/editor/new-gen-anim'; +import { MotionState } from 'cc/editor/new-gen-anim'; +import { Node as Node_3 } from 'cc'; +import { pastePoseGraphNodes } from 'cc/editor/new-gen-anim'; +import { PastePoseGraphNodesOptions } from 'cc/editor/new-gen-anim'; +import { pastePoseGraphNodesResult } from 'cc/editor/new-gen-anim'; +import { PoseGraph } from 'cc/editor/new-gen-anim'; +import { PoseGraphAssetDragHandlersInfo } from 'cc/editor/new-gen-anim'; +import { PoseGraphCreateNodeContext } from 'cc/editor/new-gen-anim'; +import { PoseGraphCreateNodeEntry } from 'cc/editor/new-gen-anim'; +import { PoseGraphNodeAppearanceOptions } from 'cc/editor/new-gen-anim'; +import { poseGraphOp } from 'cc/editor/new-gen-anim'; +import { Prefab } from 'cc'; +import { ProceduralPoseState } from 'cc/editor/new-gen-anim'; +import { ProceduralPoseTransition } from 'cc/editor/new-gen-anim'; +import { SimpleDirectionalIssueSameDirection } from 'cc/editor/new-gen-anim'; +import { SimpleDirectionalSampleIssue } from 'cc/editor/new-gen-anim'; +import { stashPoseGraph } from 'cc/editor/new-gen-anim'; +import { StashPoseGraphResult } from 'cc/editor/new-gen-anim'; +import { StashReference } from 'cc/editor/new-gen-anim'; +import { State } from 'cc/editor/new-gen-anim'; +import { StateMachine } from 'cc/editor/new-gen-anim'; +import { SubStateMachine } from 'cc/editor/new-gen-anim'; +import { TCBinding } from 'cc/editor/new-gen-anim'; +import { TCBindingTransitionSourceFilter } from 'cc/editor/new-gen-anim'; +import { TCBindingTypeInfo } from 'cc/editor/new-gen-anim'; +import { TCBindingValueType } from 'cc/editor/new-gen-anim'; +import { Transition } from 'cc/editor/new-gen-anim'; +import { TransitionPreviewer } from 'cc/editor/new-gen-anim'; +import { TransitionPreviewerTimelineStats } from 'cc/editor/new-gen-anim'; +import { TriggerCondition } from 'cc/editor/new-gen-anim'; +import { TriggerResetMode } from 'cc/editor/new-gen-anim'; +import { turnMotionStateIntoSubStateMachine } from 'cc/editor/new-gen-anim'; +import { UnaryCondition } from 'cc/editor/new-gen-anim'; +import { validateSimpleDirectionalSamples } from 'cc/editor/new-gen-anim'; +import { Value } from 'cc/editor/new-gen-anim'; +import { VariableBindingView } from 'cc/editor/new-gen-anim'; +import { VariableDescription } from 'cc/editor/new-gen-anim'; +import { VariableNotDefinedError } from 'cc/editor/new-gen-anim'; +import { VariableType } from 'cc/editor/new-gen-anim'; +import { viewVariableBindings } from 'cc/editor/new-gen-anim'; +import { visitAnimationClips } from 'cc/editor/new-gen-anim'; +import { visitAnimationClipsInController } from 'cc/editor/new-gen-anim'; +import { visitAnimationGraphEditorExtras } from 'cc/editor/new-gen-anim'; +import { visitStashReferences } from 'cc/editor/new-gen-anim'; +declare namespace __EditorModule0 { + export { + compressUUID, + compressHex, + decompressUUID, + isUUID, + getUuidFromLibPath, + generate, + nameToSubId, + NonUuidMark + } +} +declare function addPrefabInfo(targetNode: Node_3, rootNode: Node_3, asset: Prefab, opts?: IAddPrefabInfoOption): void; +declare function addPrefabInstance(node: Node_3): void; +declare function asAsset(uuid: string, type?: Constructor): Asset | null; export declare interface BaseItem { label?: string; description?: string; @@ -8393,6 +10963,24 @@ export declare interface BaseItem { required?: boolean; dependencies?: string[]; } +export declare namespace Browser { + export { + EngineEditorExtends, + EngineNodePath, + EngineSerialize, + EngineDeserialize, + EngineGeometry, + EnginePrefab, + EngineGraphicsConfig, + EnginePolyfill, + EngineOverwrite, + EngineEditor2dMisc, + EngineEditorNewGenAnim, + EngineEditorLodGroupUtils + } +} +declare const calculateNormals: (positions: ArrayLike, indices: ArrayLike, out?: IWritableArrayLike) => IWritableArrayLike; +declare const calculateTangents: (positions: ArrayLike, indices: ArrayLike, normals: ArrayLike, uvs: ArrayLike, out?: IWritableArrayLike) => IWritableArrayLike; export declare interface CategoryDetail extends CategoryInfo { modules: IModules; } @@ -8412,6 +11000,203 @@ export declare type CCEModuleMap = { } & { mapLocation: string; }; +declare function checkAndStripNode(node: Node_3, quiet?: boolean | undefined): Record; +declare const Component: ComponentManager; +declare class ComponentManager extends EventEmitter { + allow: boolean; + _menus: MenuItem[]; + _pathToUuid: Map; + _caseInsensitivePathMap: Map; + _uuidToPath: Map; + _addOriginPathToCaseInsensitivePathMap(lowercasePath: string, originalPaths: string): void; + addMenu(component: Function, path: string, priority?: number): void; + removeMenu(component: Function): void; + getMenus(): MenuItem[]; + _map: { + [index: string]: any; + }; + add(uuid: string, component: any): void; + _mapComponentToPath(component: any): void; + _removeComponentPath(uuid: any): void; + _generateUniquePath(component: any): string; + remove(uuid: string): void; + clear(): void; + getComponent(uuid: string): any; + _getUuidFromLowercasePath(path: string): { + code: number; + errMsg: string; + uuid: string; + }; + getComponentFromPath(path: string): any; + getPathFromUuid(uuid: string): string; + getComponents(): { + [index: string]: any; + }; + changeUUID(oldUUID: string, newUUID: string): void; +} +declare function compressHex(hexString: string, reservedHeadLength: number): string; +declare function compressUUID(uuid: string, min: boolean): string; +declare const CUSTOM_PIPELINE_MODULE: IEngineGraphicsPipeline_2; +declare const CUSTOM_PIPELINE_NAME_KEY = "CUSTOM_PIPELINE_NAME"; +declare const CUSTOM_PIPELINE_POST_PROCESS_MODULE = "custom-pipeline-post-process"; +declare function decompressUUID(uuid: string): string; +declare const DEFAULT_CUSTOM_PIPELINE_NAME = "Builtin"; +declare function deriveGraphicsConfigFromCustomPipeline(customPipeline: boolean | undefined, includeModules?: string[]): IEngineGraphicsConfig_2; +declare function deriveGraphicsConfigFromModules(includeModules?: string[]): IEngineGraphicsConfig_2; +declare let deserializeFull: any; +declare function deserializeFull_2(serialized: unknown): Promise; +export declare namespace Editor { + export { + Browser + } +} +declare function emit(name: string | symbol, ...args: string[]): void; +export declare namespace EngineDeserialize { + export { + deserializeFull_2 as deserializeFull + } +} +export declare namespace EngineEditor2dMisc { + export { + earcut + } +} +export declare namespace EngineEditorExtends { + export { + init_2 as init, + emit, + on, + removeListener, + serialize, + serializeCompiled, + deserializeFull, + walkProperties, + UuidUtils, + Script, + Node_2 as Node, + Component, + GeometryUtils, + PrefabUtils, + MissingReporter + } +} +export declare namespace EngineEditorLodGroupUtils { + export { + LODGroupEditorUtility + } +} +export declare namespace EngineEditorNewGenAnim { + export { + blend1D, + validateSimpleDirectionalSamples, + viewVariableBindings, + cloneState, + turnMotionStateIntoSubStateMachine, + visitAnimationClips, + visitAnimationClipsInController, + visitAnimationGraphEditorExtras, + getVariableValueAttributes, + isAnimationTransition, + getTCBindingTypeInfo, + getCreatePoseGraphNodeEntries, + createPoseGraphNode, + getNodeAppearanceOptions, + getInputConventionalI18nInfo, + getInputDefaultDisplayName, + getPoseGraphNodeInputAttrs, + copyPoseGraphNodes, + copyStateMachineAsPoseGraphNode, + pastePoseGraphNodes, + stashPoseGraph, + visitStashReferences, + getPoseGraphAssetDragHandlersMap, + createPoseNodeOnAssetDrag, + blendSimpleDirectional, + SimpleDirectionalIssueSameDirection, + SimpleDirectionalSampleIssue, + VariableBindingView, + MotionPreviewer, + TransitionPreviewer, + MotionPreviewerTimelineStats, + TransitionPreviewerTimelineStats, + InvalidTransitionError, + VariableNotDefinedError, + AnimationGraph, + StateMachine, + SubStateMachine, + EmptyStateTransition, + EmptyState, + ProceduralPoseState, + ProceduralPoseTransition, + Transition, + AnimationTransition, + Layer, + State, + BinaryCondition, + UnaryCondition, + TriggerCondition, + Condition, + TCBinding, + TCBindingValueType, + TCBindingTransitionSourceFilter, + TCBindingTypeInfo, + VariableDescription, + TriggerResetMode, + MotionState, + BindableNumber, + BindableBoolean, + AnimationMask, + AnimationGraphVariant, + PoseGraph, + EnterNodeInfo, + Motion, + MotionEval, + MotionPort, + ClipMotion, + AnimationBlend, + AnimationBlend1D, + AnimationBlend2D, + AnimationBlendDirect, + poseGraphOp, + PoseGraphCreateNodeEntry, + PoseGraphCreateNodeContext, + PoseGraphNodeAppearanceOptions, + CopyPoseGraphNodesOptions, + pastePoseGraphNodesResult, + PastePoseGraphNodesOptions, + StashPoseGraphResult, + StashReference, + PoseGraphAssetDragHandlersInfo, + Value, + VariableType, + __private + } +} +export declare namespace EngineGeometry { + export { + forEachFace, + getUintArrayCtor, + calculateNormals, + calculateTangents, + MeshSplitInfo, + splitBasedOnJoints + } +} +export declare namespace EngineGraphicsConfig { + export { + hasOwnConfigKey, + ensureCustomPipelineMacroConfig, + deriveGraphicsConfigFromModules, + deriveGraphicsConfigFromCustomPipeline, + mergeGraphicsConfigWithModules, + normalizeIncludeModulesWithGraphics, + CUSTOM_PIPELINE_MODULE, + LEGACY_PIPELINE_MODULE, + CUSTOM_PIPELINE_POST_PROCESS_MODULE, + CUSTOM_PIPELINE_NAME_KEY, + DEFAULT_CUSTOM_PIPELINE_NAME + } +} export declare interface EngineInfo { typescript: { type: 'builtin' | 'custom'; @@ -8426,12 +11211,100 @@ export declare interface EngineInfo { tmpDir: string; version: string; } +export declare namespace EngineNodePath { + export { + formatUniqueName, + validateNodeName, + sanitizeNodeName, + stripLeadingSlashes, + normalizeNodePath, + isRootNodePath, + ILLEGAL_NAME_CHARS + } +} +export declare namespace EngineOverwrite { + export { + default_2 as default + } +} +export declare namespace EnginePolyfill { + export { + } +} +export declare namespace EnginePrefab { + export { + walkNode, + visitObjTypeReferences, + addPrefabInfo, + checkAndStripNode, + addPrefabInstance + } +} +export declare namespace EngineSerialize { + export { + serialize_2 as serialize, + serializeCompiled_2 as serializeCompiled + } +} +declare function ensureCustomPipelineMacroConfig(macroConfig: IEngineConfig_2['macroConfig']): NonNullable; export declare interface Features { [feature: string]: IModuleItem; } +declare function findRootObject(data: Format.AnyItem, type: string): string | number | boolean | Format.InstanceReference | { + [x: string]: Format.AnyItem; +} | null; +declare function forEachFace(indices: ArrayLike, primitiveMode: gfx.PrimitiveMode, callback: (faceIndices: number[]) => any): void; +declare namespace Format { + interface Class { + __type__: string; + [prop: string]: AnyItem; + } + interface CustomizedClass extends Class { + content: any; + } + interface TypedArray extends Class { + __type__: 'TypedArray'; + ctor: string; + array: any[]; + } + interface InstanceReference { + __id__: number; + } + interface AssetReference { + __uuid__: string; + } + type RawItem = number | string | boolean | null; + type Item = Class | InstanceReference | RawItem; + type Dict = { + [key in string]: AnyItem; + }; + type Array = AnyItem[]; + type Object = Class | Dict | Array; + type AnyItem = Item | Dict | Array; + {}; +} +declare function formatUniqueName(baseName: string, existingCount: number): string; +declare function generate(compress?: boolean): string; +declare let GeometryUtils: any; export declare function getConfig(useDefault?: boolean): Promise; export declare function getInfo(): Promise; export declare function getRenderConfig(): Promise; +declare function getRootData(data: IFileData): IFileData[File.Instances]; +declare function getUintArrayCtor(maxElement: number): Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor; +declare function getUuidFromLibPath(path: string): string; +declare function hasOwnConfigKey(object: object | undefined, key: string): boolean; +declare interface IAddPrefabInfoOption { + nodeFileIdGenerator?: (node: Node_3) => string; + compFileIdGenerator?: (comp: Component_2, index: number) => string; +} +declare interface IBuilderOptions { + builder?: 'dynamic' | 'compiled'; + stringify?: boolean; + minify?: boolean; + noNativeDep?: boolean; + forceInline?: boolean; + useCCON?: boolean; +} export declare interface IChunkContent { skeleton: null | string; clips: string[]; @@ -8520,6 +11393,8 @@ export declare interface IFeatureItem extends BaseItem { isNativeModule?: boolean; cmakeConfig?: string; } +declare type IFileData = D.IFileData_; +declare type IFileData_2 = D.IFileData_; export declare type IFlags = Record; export declare type IFlags_2 = Record; export declare interface IInitEngineInfo { @@ -8550,6 +11425,7 @@ export declare interface IJointTextureLayoutPreviewResult { resolvedLayouts: IResolvedCustomJointTextureLayout[]; missingAssets: string[]; } +declare const ILLEGAL_NAME_CHARS: RegExp; export declare interface IModuleConfig { moduleTreeDump: { default: IModules; @@ -8569,7 +11445,24 @@ export declare interface IModuleConfig { export declare type IModuleItem = IFeatureItem | IFeatureGroup; export declare type IModules = Record; export declare function init(projectPath: string): Promise; +declare function init_2(): Promise; export declare function initEngine(enginePath: string, projectPath: string, serverURL?: string): Promise; +declare interface IOptions extends IParserOptions, IBuilderOptions { +} +declare type IPackedFileData = D.IPackedFileData_; +declare interface IParserOptions { + valueReplacer?: (owner: object, key: string | number, value: unknown) => unknown; + compressUuid?: boolean; + discardInvalid?: boolean; + dontStripDefault?: boolean; + missingClassReporter?: any; + missingObjectReporter?: any; + reserveContentsForSyncablePrefab?: boolean; + _exporting?: boolean; + useCCON?: boolean; + keepNodeUuid?: boolean; + recordAssetDepends?: string[]; +} export declare interface IPhysicsConfig { gravity: IVec3Like; allowSleep: boolean; @@ -8625,21 +11518,75 @@ export declare interface ISplashSetting { base64?: string; } } +declare function isRootNodePath(path: string | undefined): boolean; +declare function isUUID(str: string): boolean; export declare interface IVec3Like { x: number; y: number; z: number; } +declare interface IWritableArrayLike { + length: number; + [index: number]: T; +} export declare type JointTextureLayoutDeviceTipLevel = 'valid' | 'warning' | 'error'; +declare const LEGACY_PIPELINE_MODULE: IEngineGraphicsPipeline_2; export declare type MacroItem = { key: string; value: boolean; } export declare type MakeRequired = T & Required>; +declare interface MenuItem { + component: Function; + menuPath: string; + priority: number; +} +declare function mergeGraphicsConfigWithModules(includeModules?: string[], graphics?: IEngineGraphicsConfig_2): IEngineGraphicsConfig_2; +declare class MeshSplitInfo { + indices: number[]; + jointSet: Set; + primitiveMode: gfx.PrimitiveMode; + constructor(primitiveMode?: any); +} export declare interface Migration { version: string; migrate(moduleCache: Record): Record; } +declare class MissingClassReporter extends MissingReporter_2 { + report(): void; + reportByOwner(): void; +} +declare class MissingObjectReporter extends MissingReporter_2 { + doReport(obj: any, value: any, parsedObjects: any, rootUrl: any, inRootBriefLocation: any): void; + report(): void; + reportByOwner(): void; +} +declare const MissingReporter: { + classInstance: { + reporter: MissingClassReporter; + classFinder(id: any, owner?: any, propName?: any): any; + hasMissingClass: boolean; + reportMissingClass(asset: any): void; + reset(): void; + }; + class: typeof MissingClassReporter; + object: typeof MissingObjectReporter; +}; +declare class MissingReporter_2 { + outputLevel: 'debug' | 'warn' | 'error'; + static INFO_DETAILED: string; + static getObjectType(obj: any): "scene" | "prefab" | "asset" | "component"; + missingObjects: Set; + missingOwners: Map; + root: any; + report(): void; + reportByOwner(): void; + constructor(root?: any); + reset(): void; + stash(obj: any): void; + stashByOwner(owner: any, propName: any, value: any): void; + removeStashedByOwner(owner: any, propName: any): any; +} export declare interface ModuleRenderConfig { $schema?: string; features: Features; @@ -8647,13 +11594,82 @@ export declare interface ModuleRenderConfig { version: string; migrationScript?: string; } -export declare function queryJointTextureLayoutPreview(): Promise; -export declare function queryLayerBuiltin(): Promise<{ - name: string; - value: number; +declare function nameToSubId(name: string, extend?: number): string; +declare const Node_2: NodeManager; +declare class NodeManager extends EventEmitter { + allow: boolean; + _map: { + [index: string]: any; + }; + private _parentChildren; + add(uuid: string, node: Node_3): void; + remove(uuid: string): void; + clear(): void; + updateNodeName(uuid: string, newName: string): void; + updateNodeParent(uuid: string, newParentUuid?: string): string; + getNode(uuid: string): Node_3 | null; + getNodeByPath(path: string): Node_3 | null; + getNodePath(node: Node_3): string; + getNodeUuidByPath(path: string): string | null; + getNodeByPathOrThrow(path: string): Node_3; + getNodeUuidByPathOrThrow(nodePath: string): string; + getNodes(): { + [index: string]: any; + }; + getNodesByAsset(uuid: string): string[]; + getNodesInScene(): { + [index: string]: any; + }; + changeNodeUUID(oldUUID: string, newUUID: string): void; + private _getParentUuid; + private _cleanupParentRelations; +} +declare const NonUuidMark = "."; +declare function normalizeIncludeModulesWithGraphics(includeModules?: string[], graphics?: IEngineGraphicsConfig_2): string[]; +declare function normalizeNodePath(path: string): string; +declare function on(name: string | symbol, handle: (...args: any[]) => void): void; +declare function packJSONs(datas: IFileData_2[]): IPackedFileData; +declare let PrefabUtils: any; +export declare function queryJointTextureLayoutPreview(): Promise; +export declare function queryLayerBuiltin(): Promise<{ + name: string; + value: number; }[]>; -export declare function querySortingLayerBuiltin(): Promise; +export declare function querySortingLayerBuiltin(): Promise; +declare function removeListener(name: string | symbol, handle: (...args: any[]) => void): void; +declare function sanitizeNodeName(name: string): string; +declare const Script: ScriptManager; +declare class ScriptManager extends EventEmitter { + allow: boolean; + _map: { + [index: string]: Function[]; + }; + add(uuid: string, ctor: Function): void; + remove(uuid: string, ctor: Function): void; + getCtors(uuid: string): Function[]; +} +declare let serialize: any; +declare function serialize_2(obj: Exclude, options?: IOptions): string | object; +declare namespace serialize_2 { + var asAsset: asAsset; + var setName: setName; + var findRootObject: findRootObject; +} +declare let serializeCompiled: any; +declare function serializeCompiled_2(obj: Exclude, options: IOptions): string | object; +declare namespace serializeCompiled_2 { + var getRootData: getRootData; + var packJSONs: packJSONs; +} +declare function setName(data: Format.AnyItem, name: string): void; +declare const splitBasedOnJoints: (joints: ArrayLike, indices: ArrayLike, primitiveMode: gfx.PrimitiveMode, capacity: number) => MeshSplitInfo[]; export declare function startEngineCompilation(force?: boolean): Promise; +declare function stripLeadingSlashes(path: string): string; +declare const UuidUtils: typeof __EditorModule0; +declare function validateNodeName(name: string): string | null; +declare function visitObjTypeReferences(node: Node_3, visitor: any): void; +declare function walkNode(node: Node_3, handle: (node: Node_3, isChild: boolean) => boolean | void, isChild?: boolean): void; +declare function walkProperties(root: any, iteratee: any, options: any): void; export { } " `; @@ -11018,12 +14034,29 @@ export { } `; exports[`DTS API compatibility project.d.ts should match snapshot 1`] = ` -"export declare function close_2(): Promise; +"import { Project as Project_2 } from './project'; +declare function close_2(): Promise; export { close_2 as close } +export { close_2 } +export declare namespace CoreProjectIndex { + export { + project as default + } +} export declare function discoverProjectBackend(project: string): Promise; +export declare namespace Editor { + export { + Host + } +} export declare function ensureProjectBackend(project: string, options?: StartProjectBackendOptions): Promise; export declare function get(): Promise; export declare function getInfo(): Promise; +export declare namespace Host { + export { + CoreProjectIndex + } +} export declare function init(projectPath: string): Promise; export declare interface IProject { get path(): string; @@ -11038,8 +14071,9 @@ export declare interface IProject { getInfo(key?: string): ProjectInfo | any; updateInfo(keyOrValue: string | ProjectInfo, value?: T): Promise; } -export declare function open_2(projectPath: string): Promise; +declare function open_2(projectPath: string): Promise; export { open_2 as open } +export { open_2 } export declare class Project implements IProject { static readonly version = "4.0.0"; private _projectPath; @@ -11063,6 +14097,7 @@ export declare class Project implements IProject { private static generateProjectInfo; private isValid; } +declare const project: Project_2; export declare interface ProjectBackendDescriptor { protocol: 1; project: string; @@ -11118,7 +14153,948 @@ export { } `; exports[`DTS API compatibility scene.d.ts should match snapshot 1`] = ` -"import type { ChildProcess } from 'child_process'; +"import { AnimationEditorType } from './cli'; +import { AnimationGraphChangedEvent } from './assets'; +import { AnimationGraphExpectedVersion } from './assets'; +import { AnimationGraphInspectorPropertyOperationRequest } from './assets'; +import { AnimationGraphInspectorSnapshot } from './assets'; +import { AnimationGraphMotionPreviewData } from './assets'; +import { AnimationGraphPoseGraphAssetDragHandlersEntry } from './assets'; +import { AnimationGraphSnapshot } from './assets'; +import { AnimationGraphTarget } from './assets'; +import { AnimationMode } from './cli'; +import { AnimationPlayOperation } from './cli'; +import { AnimGraphVariantDump } from './assets'; +import type { Asset as Asset_3 } from 'cc'; +import { AssetActionEnum } from './builder'; +import { AssetChangeInfo } from './scripting'; +import { AssetDBOptions } from './builder'; +import { AssetDBRefreshOptions } from './builder'; +import { AssetDBStartOptions } from './builder'; +import { AssetOperationOption } from './assets'; +import { AssetPropertySchemaMap } from './assets'; +import { AssetUserDataMap } from './assets'; +import { BeginCreateDragResult } from './cli'; +import { BUILTIN_NODE_CREATE_TARGETS as BUILTIN_NODE_CREATE_TARGETS_2 } from './scene'; +import { BuiltinNodeCreateEntryId as BuiltinNodeCreateEntryId_2 } from './scene'; +import type { Camera } from 'cc'; +import { CancelCreateDragResult } from './cli'; +import { default as cc_2 } from 'cc'; +import { CCEModuleMap } from './engine'; +import { ccOverwrite } from 'cc/overwrite'; +import { ChildProcess } from 'child_process'; +import { CommitCreateDragResult } from './cli'; +import { Component } from 'cc'; +import { ConfigurationScope } from './configuration'; +import { CREATE_TYPES } from './cli'; +import { CreateAssetByTypeOptions } from './assets'; +import { CreateAssetOptions } from './assets'; +import { CreateDragCancelReason } from './cli'; +import { CreateDragError } from './cli'; +import { CreateDragErrorCode } from './cli'; +import { CreateDragResult } from './cli'; +import { CreateDragSession } from './cli'; +import { CustomConsole } from './builder'; +import { DeleteAssetOptions } from './assets'; +import { DependencyManager } from './builder'; +import { Editor as Editor_10 } from './simulator'; +import { Editor as Editor_11 } from './engine'; +import { Editor as Editor_2 } from './base'; +import { Editor as Editor_3 } from './assets'; +import { Editor as Editor_4 } from './builder'; +import { Editor as Editor_5 } from './configuration'; +import { Editor as Editor_6 } from './cli'; +import { Editor as Editor_7 } from './project'; +import { Editor as Editor_8 } from './scene'; +import { Editor as Editor_9 } from './scripting'; +import type { EffectAsset } from 'cc'; +import EventEmitter from 'events'; +import { ExecuteAnimationGraphCommandRequest } from './assets'; +import { FilterPluginOptions } from './assets'; +import { GeometryRenderer as GeometryRenderer_2 } from 'cc'; +import { GlobalEventManager } from './cli'; +import type { i18n } from 'i18next'; +import { IAddComponentOptions } from './cli'; +import { IAnimationAuxiliaryCurveDump } from './cli'; +import { IAnimationAuxiliaryKeyDump } from './cli'; +import { IAnimationClipDump } from './cli'; +import { IAnimationClipMenuItem } from './cli'; +import { IAnimationClipsInfo } from './cli'; +import { IAnimationCurveChannelDump } from './cli'; +import { IAnimationCurveDump } from './cli'; +import { IAnimationCurveKeyData } from './cli'; +import { IAnimationCurveKeyDump } from './cli'; +import { IAnimationEditClipOptions } from './cli'; +import { IAnimationEmbeddedPlayable } from './cli'; +import { IAnimationEmbeddedPlayerDump } from './cli'; +import { IAnimationEmbeddedPlayerGroup } from './cli'; +import { IAnimationEnterOptions } from './cli'; +import { IAnimationEventDump } from './cli'; +import { IAnimationExitOptions } from './cli'; +import { IAnimationKeyValueDump } from './cli'; +import { IAnimationOperation } from './cli'; +import { IAnimationOperationOptions } from './cli'; +import { IAnimationOperationResult } from './cli'; +import { IAnimationPlayStateOptions } from './cli'; +import { IAnimationPropertyInfo } from './cli'; +import { IAnimationPropertyType } from './cli'; +import { IAnimationQueryAuxiliaryCurveValueAtFrameOptions } from './cli'; +import { IAnimationQueryClipOptions } from './cli'; +import { IAnimationQueryPropertyValueAtFrameOptions } from './cli'; +import { IAnimationRootResult } from './cli'; +import { IAnimationSaveOptions } from './cli'; +import { IAnimationService } from './cli'; +import { IAnimationSetTimeOptions } from './cli'; +import { IAnimationTargetOptions } from './cli'; +import { IAnimationTimeOptions } from './cli'; +import { IAnimationValue } from './cli'; +import { IApplyPrefabChangesParams } from './cli'; +import { IAssetConfig } from './assets'; +import { IAssetDBInfo } from './assets'; +import { IAssetInfo } from './assets'; +import { IAssetMeta } from './assets'; +import { IAssetService } from './cli'; +import { IAssetType } from './assets'; +import { IBaseIdentifier } from './cli'; +import { IBeginCreateDragParams } from './cli'; +import { ICameraConfig } from './cli'; +import { ICancelCreateDragParams } from './cli'; +import { IChangeNodeLockParams } from './cli'; +import { IChangeNodeOptions } from './cli'; +import { IClipboardState } from './cli'; +import { ICloseOptions } from './cli'; +import { ICommitCreateDragParams } from './cli'; +import { IComponent } from './cli'; +import { IComponentService } from './cli'; +import { ICopyParams } from './cli'; +import { ICreateByAssetParams } from './cli'; +import { ICreateByNodeTypeParams } from './cli'; +import { ICreateBySerializedDataParams } from './cli'; +import { ICreateDragConfirmation } from './cli'; +import { ICreateDragItem } from './cli'; +import { ICreateDragPointer } from './cli'; +import { ICreateMenuInfo } from './assets'; +import { ICreateNodePreflightResult } from './cli'; +import { ICreateOptions } from './cli'; +import { ICreatePrefabFromNodeParams } from './cli'; +import { ICreateType } from './cli'; +import { ICustomLayerConfig } from './cli'; +import { ICutParams } from './cli'; +import { IData } from './builder'; +import { IDeleteNodeParams } from './cli'; +import { IDeleteNodeResult } from './cli'; +import { IDesignResolution } from './engine'; +import { IDuplicateParams } from './cli'; +import { IEditorService } from './cli'; +import { IEngineService } from './cli'; +import { IEraseLODOptions } from './cli'; +import { IExecuteComponentMethodOptions } from './cli'; +import { IExportData } from './builder'; +import { IGetPrefabInfoParams } from './cli'; +import { IGizmoService } from './cli'; +import { IInsertLODOptions } from './cli'; +import { IIsPrefabInstanceParams } from './cli'; +import { ILightFXCancelResult } from './cli'; +import { ILightFXDiagnostics } from './cli'; +import { ILightmapBakeCapabilities } from './cli'; +import { ILightmapBakeInfo } from './cli'; +import { ILightmapBakeOptions } from './cli'; +import { ILightmapBakeResult } from './cli'; +import { ILightmapBakeService } from './cli'; +import { ILightmapClearResult } from './cli'; +import { ILightmapTextureInfo } from './cli'; +import { ILightProbeBakeCapabilities } from './cli'; +import { ILightProbeBakeOptions } from './cli'; +import { ILightProbeBakeResult } from './cli'; +import { ILightProbeBakeService } from './cli'; +import { ILightProbeSetting } from './cli'; +import { ILightProbeSettings } from './cli'; +import { ILODGroupBoundsResult } from './cli'; +import { ILODGroupLevelsResult } from './cli'; +import { IMotionPreviewService } from './cli'; +import { IMoveArrayElementParams } from './cli'; +import { InfoManager } from './builder'; +import { INode } from './cli'; +import { INodeDumpOptions } from './cli'; +import { INodeService } from './cli'; +import { INodeTreeComponent } from './cli'; +import { INodeTreeItem } from './cli'; +import { IOpenOptions } from './cli'; +import { IOperationService } from './cli'; +import { IOriginAxesConfig } from './cli'; +import { IParticlePlayInfo } from './cli'; +import { IParticleService } from './cli'; +import { IPasteParams } from './cli'; +import { IPluginScriptInfo } from './assets'; +import { IPrefab } from './cli'; +import { IPrefabStateInfo } from './cli'; +import { IPreviewInstance } from './cli'; +import { IPreviewPlayService } from './cli'; +import { IPreviewPlayStartOptions } from './cli'; +import { IPreviewService } from './cli'; +import { IPreviewSettingsResult } from './builder'; +import { IProperty } from './assets'; +import { IPropertyValueType } from './assets'; +import { IQueryClassesOptions } from './cli'; +import { IQueryComponentOptions } from './cli'; +import { IQueryLODGroupRelativeHeightOptions } from './cli'; +import { IQueryNodeParams } from './cli'; +import { IQueryNodeTreeParams } from './cli'; +import { IRecalculateLODGroupBoundsOptions } from './cli'; +import { IRectSnapConfigData } from './cli'; +import { IRedoService } from './cli'; +import { IReferenceImageCancelOptions } from './cli'; +import { IReferenceImageCommitOptions } from './cli'; +import { IReferenceImageConfigItem } from './cli'; +import { IReferenceImageError } from './cli'; +import { IReferenceImageItem } from './cli'; +import { IReferenceImageParameters } from './cli'; +import { IReferenceImagePathOptions } from './cli'; +import { IReferenceImagePreviewOptions } from './cli'; +import { IReferenceImageService } from './cli'; +import { IReferenceImageState } from './cli'; +import { IReferenceImageVisibilityOptions } from './cli'; +import { IReflectionProbeBakeAllOptions } from './cli'; +import { IReflectionProbeBakeAllResult } from './cli'; +import { IReflectionProbeBakeFailure } from './cli'; +import { IReflectionProbeBakeOptions } from './cli'; +import { IReflectionProbeBakeResult } from './cli'; +import { IReflectionProbeCancelOptions } from './cli'; +import { IReflectionProbeClearFailure } from './cli'; +import { IReflectionProbeClearOptions } from './cli'; +import { IReflectionProbeClearResult } from './cli'; +import { IReflectionProbeSceneIdentity } from './cli'; +import { IReflectionProbeService } from './cli'; +import { IReflectionProbeTaskState } from './cli'; +import { IRegeneratePolygon2DPointsOptions } from './cli'; +import { IRegeneratePolygon2DPointsResult } from './cli'; +import { IReloadOptions } from './cli'; +import { IRemoveArrayElementParams } from './cli'; +import { IRemoveComponentOptions } from './cli'; +import { IRemovedComponentInfo } from './cli'; +import { IReorderParams } from './cli'; +import { IRevertToPrefabParams } from './cli'; +import { ISaveOptions } from './cli'; +import { IScene } from './cli'; +import { ISceneCommandProvider as ISceneCommandProvider_2 } from './scene'; +import { ISceneMouseEvent } from './cli'; +import { ISceneViewService } from './cli'; +import { IScriptService } from './cli'; +import { ISelectionService } from './cli'; +import { ISerializeNodesParams } from './cli'; +import { IServiceManager } from './cli'; +import { ISetParentParams } from './cli'; +import { ISetPropertyOptions } from './cli'; +import { ISupportCreateType } from './assets'; +import { ITargetOverrideInfo } from './cli'; +import { ITerrainBlockData } from './cli'; +import { ITerrainBlockLayerSlot } from './cli'; +import { ITerrainBlockSnapshot } from './cli'; +import { ITerrainBrushPatch } from './cli'; +import { ITerrainBrushState } from './cli'; +import { ITerrainEditorState } from './cli'; +import { ITerrainInvalidSnapshot } from './cli'; +import { ITerrainLayerPatch } from './cli'; +import { ITerrainLayerState } from './cli'; +import { ITerrainManageState } from './cli'; +import { ITerrainPaintBrushPatch } from './cli'; +import { ITerrainPaintBrushState } from './cli'; +import { ITerrainPaintSessionPatch } from './cli'; +import { ITerrainPaintState } from './cli'; +import { ITerrainSculptSessionPatch } from './cli'; +import { ITerrainSculptState } from './cli'; +import { ITerrainService } from './cli'; +import { ITerrainSnapshot } from './cli'; +import { ITerrainTarget } from './cli'; +import { IUerDataConfigItem } from './assets'; +import { IUIService } from './cli'; +import { IUndoBeginOptions } from './cli'; +import { IUndoCheckpoint } from './cli'; +import { IUndoCommand } from './cli'; +import { IUndoCommandMeta } from './cli'; +import { IUndoGroupOptions } from './cli'; +import { IUndoOperationOptions } from './cli'; +import { IUndoPushWithPreviousOptions } from './cli'; +import { IUndoRedoResult } from './cli'; +import { IUndoScope } from './cli'; +import { IUndoService } from './cli'; +import { IUnlinkPrefabParams } from './cli'; +import { IUnpackPrefabInstanceParams } from './cli'; +import { IUpdateCreateDragParams } from './cli'; +import { IVec3 } from './cli'; +import { LightProbeGroup } from 'cc'; +import { Meta } from './builder'; +import { MetaManager } from './builder'; +import { MotionPreviewDesc as MotionPreviewDesc_2 } from './scene'; +import { MotionPreviewDescNode as MotionPreviewDescNode_2 } from './scene'; +import { MotionPreviewVariable as MotionPreviewVariable_2 } from './cli'; +import type { NextFunction } from 'express'; +import { Node as Node_2 } from 'cc'; +import { NodeEventType } from './cli'; +import { NodeType } from './cli'; +import { OperationEvent } from './cli'; +import { ParallelQueue } from './builder'; +import { Polygon2DPointsSource } from './cli'; +import { Prefab } from 'cc'; +import { PrefabCanvasHandling } from './cli'; +import { PrefabState } from './cli'; +import { PreviewPlayState } from './cli'; +import { QueryAssetsOption } from './assets'; +import { QueryAssetType } from './assets'; +import { ReferenceImageVisibilityReason } from './cli'; +import { ReloadAnimationGraphOptions } from './assets'; +import { ReloadResult } from './cli'; +import type { Request as Request_2 } from 'express'; +import type { Response as Response_2 } from 'express'; +import { Scene } from 'cc'; +import { SCENE_TEMPLATE_TYPE } from './cli'; +import { SceneAsset } from 'cc'; +import { SceneCommand as SceneCommand_2 } from './scene'; +import { SceneCommandProviderRegistration as SceneCommandProviderRegistration_2 } from './scene'; +import { SceneCommandRequestOptions as SceneCommandRequestOptions_2 } from './scene'; +import { SceneCommandResult as SceneCommandResult_2 } from './scene'; +import { SceneDragEvent } from './cli'; +import { SceneEventBatch as SceneEventBatch_2 } from './scene'; +import { SceneKeyboardEvent } from './cli'; +import { SceneMouseEvent } from './cli'; +import { SceneRecordedChange as SceneRecordedChange_2 } from './scene'; +import { SceneRenderSnapshot as SceneRenderSnapshot_2 } from './scene'; +import { SceneSessionClient as SceneSessionClient_3 } from './scene'; +import { SceneSessionCommand as SceneSessionCommand_2 } from './scene'; +import { SceneSessionDescriptor as SceneSessionDescriptor_2 } from './scene'; +import { SceneSessionError as SceneSessionError_2 } from './scene'; +import { SceneSessionEvent as SceneSessionEvent_2 } from './scene'; +import { SceneSessionSnapshot as SceneSessionSnapshot_2 } from './scene'; +import { SceneVersion as SceneVersion_2 } from './scene'; +import { SerializedLoaderContext } from '@cocos/creator-programming-quick-pack/lib/utils/loader-context'; +import { SerializedNodeData } from './cli'; +import { SetAnimationGraphInspectorPropertyRequest } from './assets'; +import { SharedSettings } from './scripting'; +import { TEditorEntity } from './cli'; +import { Terrain } from 'cc'; +import { TerrainBlockReadResult } from './cli'; +import { TerrainBrushKind } from './cli'; +import { TerrainEditorMode } from './cli'; +import { TerrainReadResult } from './cli'; +import { TerrainSculptTool } from './cli'; +import { Texture2D } from 'cc'; +import { ThumbnailInfo } from './assets'; +import { ThumbnailSize } from './assets'; +import { TSceneTemplateType } from './cli'; +import { UIAlignType } from './cli'; +import { UpdateCreateDragResult } from './cli'; +import { Vec3 } from 'cc'; +import { WorkerSceneCommandProvider as WorkerSceneCommandProvider_2 } from './scene'; +declare type AnimationEventReason = 'enter' | 'exit' | 'set-time' | 'play-state' | 'change-clip' | 'operation' | 'undo-redo' | 'asset-refresh'; +declare const animationGraph: AnimationGraphAssetService; +declare class AnimationGraphAssetService { + private readonly _documents; + private readonly _queues; + private readonly _listeners; + query(uuidOrUrlOrPath: string): Promise; + queryInspector(uuidOrUrlOrPath: string, target: AnimationGraphTarget): Promise; + queryMotionPreviewData(uuidOrUrlOrPath: string, target: Extract): Promise; + queryPoseGraphAssetDragHandlers(): Promise; + private _queryPoseGraphEditingMetadata; + queryStateMachineComponentTypes(): Promise; + setInspectorProperty(uuidOrUrlOrPath: string, request: SetAnimationGraphInspectorPropertyRequest): Promise; + resetInspectorProperty(uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest): Promise; + createInspectorProperty(uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest): Promise; + private _applyInspectorOperation; + execute(uuidOrUrlOrPath: string, request: ExecuteAnimationGraphCommandRequest): Promise; + save(uuidOrUrlOrPath: string, expected: AnimationGraphExpectedVersion, sourceId?: string): Promise; + reload(uuidOrUrlOrPath: string, options?: ReloadAnimationGraphOptions, sourceId?: string): Promise; + onChanged(listener: AnimationGraphChangeListener): () => void; + runExternalWrite(uuidOrUrlOrPath: string, write: () => Promise): Promise; + runExternalWrites(uuids: string[], write: () => Promise): Promise; + assertExternalWriteAllowed(uuidOrUrlOrPath: string): void; + private _getOrLoad; + private _loadDocument; + private _loadProjectScripts; + private _queryAnimationGraphAsset; + private _readFingerprint; + private _refreshExternalState; + private _assertSourceUnchanged; + private _assertExpectedVersion; + private _markChanged; + private _emitChanged; + private _version; + private _snapshot; + private _inspectorSnapshot; + private _queryGraph; + private _queryGraphVariables; + private _queryLayer; + private _queryStateMachine; + private _queryState; + private _queryTransition; + private _queryTransitionCondition; + private _queryMotion; + private _queryPoseGraph; + private _resolveInspectorBinding; + private _createStateBinding; + private _createTransitionBinding; + private _createMotionBinding; + private _createPoseInputBinding; + private _encodePoseInputValue; + private _getLayer; + private _getLayerStateMachine; + private _getStateMachineByContext; + private _getStateMachineForAddress; + private _resolveState; + private _resolveTransition; + private _resolveMotion; + private _resolvePoseGraph; + private _getPoseGraphByContext; + private _resolvePoseNode; + private _nodeId; + private _executeCommand; + private _createMotion; + private _removeMotion; + private _createAssetReference; + private _serialize; + private _deserializeGraph; + private _cloneDocumentForMutation; + private _commitMutation; + private _collectPoseNodes; + private _commandPath; + private _targetNotFound; + private _nameConflict; + private _enqueue; +} +declare type AnimationGraphChangeListener = (event: AnimationGraphChangedEvent) => void; +declare const animationGraphVariant: AnimationGraphVariantAssetService; +declare class AnimationGraphVariantAssetService { + private _pendingEdits; + query(uuid: string): Promise; + change(uuid: string, dump: AnimGraphVariantDump): Promise; + save(uuid: string): Promise; + private _applyChange; + private _encodeVariant; + private _resetDump; + private _entryOverrides; + private _loadAnimationGraphVariant; + private _loadAnimationGraphByUuid; + private _readSerializedAsset; + private _deserializeWithAssetPlaceholders; + private _queryTypedAsset; + private _queryAssetUuid; + private _createAssetReference; + private _querySourceMtime; + private _snapshotGraph; + private _assertSourceUnchanged; + private _assertGraphUnchanged; + private _cloneDump; +} +declare type AnimationPlayState_2 = 'stop' | 'playing' | 'pause'; +declare class AnimationService extends BaseService> implements IAnimationService { + private _session; + private readonly _animationStates; + private _curEditTime; + private _playState; + private readonly _selfSavedClipRefreshes; + private readonly _playback; + private readonly _onAssetRefreshed; + constructor(); + enter(options: IAnimationEnterOptions): Promise; + exit(options: IAnimationExitOptions): Promise; + queryState(): Promise; + queryRoot(options: IAnimationTargetOptions): Promise; + queryRootInfo(options: IAnimationTargetOptions): Promise; + queryClips(options: IAnimationTargetOptions): Promise; + queryClip(options: IAnimationQueryClipOptions): Promise; + queryProperties(options: IAnimationTargetOptions): Promise; + queryTime(options: IAnimationTimeOptions): Promise; + queryPropertyValueAtFrame(options: IAnimationQueryPropertyValueAtFrameOptions): Promise; + queryAuxiliaryCurveValueAtFrame(options: IAnimationQueryAuxiliaryCurveValueAtFrameOptions): Promise; + setTime(options: IAnimationSetTimeOptions): Promise; + changePlayState(options: IAnimationPlayStateOptions): Promise; + changeEditClip(options: IAnimationEditClipOptions): Promise; + applyOperations(options: IAnimationOperationOptions): Promise; + save(options?: IAnimationSaveOptions): Promise; + preserveCurrentClipAssetForChange(uuid: string): boolean; + onAssetDeleted(uuid: string): void; + onEditorClosed(): void; + private _resolveRootNode; + private _resolveNode; + private _resolveClipForQuery; + private _getAnimationState; + private _stopCurrent; + private _resetAnimationStatePreservingClip; + private _restoreFailedOperationSnapshot; + private _restoreCurrentClipSnapshot; + private _restoreCurrentClipAfterSelfSave; + private _restoreClipSnapshotWithStateRecreation; + private _refreshCurrentClipAsset; + private _rebindCurrentAnimationStateClip; + private _disposeSession; + private _restoreSelection; + private _emitNodeChanged; + private _broadcastStateChanged; + private _broadcastTimeChanged; + private _broadcastClipChanged; + private _saveSceneForAnimationSession; + private _getSessionRootNode; + private _refreshSessionRootPath; + private _discardAnimationSessionChanges; + private _isAnimationSessionDirty; + private _isSceneSessionDirty; + private _createAnimationUndoScope; + private _markSelfSavedClipRefresh; + private _shouldSuppressSelfSavedClipRefresh; + private _createPreviousScenePropertyUndoScope; + private _resolveScenePropertyNodePath; +} +declare type AnySceneMethod = (...args: any[]) => any; +declare function applyEncodedPropertyOperation(owner: any, key: string, current: IProperty, attributes: any, operation: EncodedPropertyOperation): void; +declare function applyEncodedPropertyPatch(owner: any, key: string, current: IProperty, patch: IProperty | unknown): Promise; +declare function applyPropertyObjectOperation(instance: any, path: string, operation: EncodedPropertyOperation): void; +declare function applyPropertyObjectPatch(instance: any, path: string, patch: IProperty | unknown): Promise; +declare class Asset extends VirtualAsset_2 { + _source: string; + get source(): string; + _url: string; + get url(): string; + extname: string; + basename: string; + constructor(source: string, meta: Meta, assetDB: AssetDB); + updateUrl(): void; + save(): Promise; + isDirectory(): boolean; +} +declare class Asset_2 extends Asset { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} +declare class AssetDB extends EventEmitter { + static readonly version = "1.0.1"; + options: AssetDBOptions; + flag: { + starting: boolean; + started: boolean; + }; + path2asset: Map; + uuid2asset: Map; + importerManager: any; + metaManager: MetaManager; + console: CustomConsole; + infoManager: InfoManager; + dependencyManager: DependencyManager; + taskManager: ParallelQueue; + dataManager: DataManager; + _lock: boolean; + _waitLockHandler: Function[]; + cachePath: string; + get assetProgressInfo(): { + current: number; + total: number; + wait: any; + }; + private lock; + private unlock; + constructor(options: AssetDBOptions); + preImporterHandler?(file: string): boolean; + private prepareStart; + start(options?: AssetDBStartOptions): Promise; + startWithCache(): Promise; + updateInfoManager(): Promise; + private _generateRecordInfo; + save(): Promise; + private restoreFromCache; + stop(): Promise; + pathToUuid(path: string): string | null; + uuidToPath(uuid: string): string | null; + getAsset(uuid: string): VirtualAsset_2 | null; + reimport(fileOrUUID: string): Promise; + refresh(path: string, options?: AssetDBRefreshOptions): Promise; + private _replaceUUID; + private _updateAssetPathCase; + private _checkAssetsStatSync; + private _checkAssetStat; +} +declare type AssetHandler = AssetHandlerBase | CustomAssetHandler; +declare interface AssetHandlerBase extends CustomHandlerBase { + displayName?: string; + description?: string; + docURL?: string; + validate?(asset: IAsset): Promise; + importer: Importer; + exporter?: Exporter; + destroy?: (asset: IAsset) => Promise; + assetType?: IAssetType; + propertySchemaConfig?: AssetPropertySchemaMap; + userDataConfig?: { + default: Record; + generate?(asset: IAsset): Promise>; + }; + createInfo?: { + generateMenuInfo?(): ICreateMenuInfo[] | Promise; + create?(option: CreateAssetOptions): Promise; + save?(asset: IAsset, content: string | Buffer | JSON): boolean | Promise; + preventDefaultTemplateMenu?: boolean; + }; + instantiation?: string; + generateThumbnail?(asset: IAsset, size?: ThumbnailSize): Promise; +} +declare interface AssetHandlerInfo { + name: string; + extensions: string[]; + load: () => AssetHandler | Promise; +} +declare class AssetHandlerManager { + static createTemplateRoot: string; + name2handler: Record; + type2handler: Record; + name2importer: Record; + importer2OperateRecord: { + [importer: string]: { + [operate: string]: AssetHandler | CustomHandler; + }; + }; + extname2registerInfo: Record; + name2registerInfo: Record; + name2custom: Record; + importer2custom: Record; + _userDataCache: Record; + _defaultUserData: Record; + clear(): void; + compileEffect(_force: boolean): void; + startAutoGenEffectBin(): void; + getEffectBinPath(): Promise; + init(): Promise; + activateRegisterAll(): Promise; + private ensureHandler; + private activateRegister; + register(pkgName: string, assetHandlerInfos: AssetHandlerInfo[], internal: boolean): void; + unregister(pkgName: string, assetHandlerInfos: AssetHandlerInfo[]): void; + findImporter(asset: IAsset, withoutDefaultImporter?: boolean): Promise; + getDefaultImporter(asset: IAsset): Promise; + _findImporterInRegisterInfo(asset: IAsset, registerInfos: HandlerInfo[]): Promise; + add(assetHandler: AssetHandler, extensions: string[]): void; + getCreateMap(): Promise; + getCreateMenuByName(importer: string): Promise; + createAssetTemplate(importer: string, templatePath: string, target: string): Promise; + createAsset(options: CreateAssetOptions): Promise; + destroyAsset(asset: IAsset): Promise; + saveAsset(asset: IAsset, content: string | Buffer): Promise; + generateExportData(asset: IAsset, options?: IExportOptions): Promise; + outputExportData(handler: string, src: IExportData, dest: IExportData): Promise; + queryRawAssetConfigMap(): Promise>; + queryAssetConfigMap(): Promise>; + queryThumbnailHandlers(): string[]; + generateThumbnail(asset: IAsset, size?: ThumbnailSize): Promise; + queryUserDataConfig(asset: IAsset): Promise | undefined>; + queryUserDataConfigDefault(importer: string): Promise | undefined>; + queryPropertySchema(importer: string): Promise; + runImporterHook(asset: IAsset, hookName: 'before' | 'after'): Promise; + _findOperateHandler(importer: string, operate: keyof AssetHandler): CustomHandler | AssetHandler | null; + queryAllImporter(): string[]; + queryAllAssetTypes(): unknown[]; + updateDefaultUserData(handler: string, key: string, value: any): Promise; + private _updateDefaultUserDataToHandler; +} +declare const assetHandlerManager: AssetHandlerManager; +declare class AssetManager extends EventEmitter { + queryAssets: (options?: QueryAssetsOption) => IAsset[]; + queryAssetDependencies: (uuidOrURL: string, type?: QueryAssetType) => Promise; + queryAssetUsers: (uuidOrURL: string, type?: QueryAssetType) => Promise; + queryAsset: (uuidOrURLOrPath: string) => IAsset | null; + queryAssetInfo: (urlOrUUIDOrPath: string, dataKeys?: readonly (keyof IAssetInfo)[]) => IAssetInfo | null; + queryAssetInfoByUUID: (uuid: string, dataKeys?: readonly (keyof IAssetInfo)[]) => IAssetInfo | null; + queryAssetInfos: (options?: QueryAssetsOption, dataKeys?: readonly (keyof IAssetInfo)[]) => IAssetInfo[]; + querySortedPlugins: (filterOptions?: FilterPluginOptions) => IPluginScriptInfo[]; + queryUUID: (urlOrPath: string) => string | null; + queryPath: (urlOrUuid: string) => string; + queryUrl: (uuidOrPath: string) => string; + generateAvailableURL: (url: string) => string; + queryDBAssetInfo: (name: string) => IAssetInfo | null; + encodeAsset: (asset: IAsset, dataKeys?: readonly (keyof IAssetInfo)[], invalid?: boolean) => IAssetInfo; + queryAssetProperty: (asset: IAsset, property: (keyof IAssetInfo | "depends" | "dependScripts" | "dependedScripts")) => any; + queryAssetMeta: (uuidOrURLOrPath: string) => IAssetMeta | null; + querySubAssetName: (mainUuid: string, subId: string) => string | null; + queryAssetMtime: (uuid: string) => number | null; + importAsset: (source: string, target: string, options?: AssetOperationOption) => Promise; + copyAsset: (source: string, target: string, options?: AssetOperationOption) => Promise; + saveAssetMeta: (uuid: string, meta: IAssetMeta, asset?: IAsset) => Promise; + saveAsset: (uuidOrURLOrPath: string, content: string | Buffer) => Promise; + createAsset: (options: CreateAssetOptions) => Promise; + refreshAsset: (pathOrUrlOrUUID: string) => Promise; + refreshAssetOnly: (pathOrUrlOrUUID: string) => Promise; + reimportAsset: (pathOrUrlOrUUID: string) => Promise; + renameAsset: (source: string, newName: string, option?: AssetOperationOption) => Promise; + removeAsset: (uuidOrURLOrPath: string, options?: DeleteAssetOptions) => Promise; + moveAsset: (source: string, target: string, option?: AssetOperationOption) => Promise; + generateExportData: (asset: Asset, options?: IExportOptions) => Promise; + outputExportData: (handler: string, src: IExportData, dest: IExportData) => Promise; + createAssetByType: (type: ISupportCreateType, dirOrUrl: string, baseName: string, options?: CreateAssetByTypeOptions) => Promise; + updateUserData: (uuidOrURLOrPath: string, userData: AssetUserDataMap[T]) => Promise; + updateUserDataByPath: (uuidOrURLOrPath: string, path: string, value: any) => Promise; + querySerializedData: typeof serializedData.querySerializedData; + saveSerializedData: typeof serializedData.saveSerializedData; + queryMaterial: typeof materialService.queryMaterial; + queryMaterialEffect: typeof materialService.queryEffect; + queryMaterialAllEffects: typeof materialService.queryAllEffects; + saveMaterial: typeof materialService.saveMaterial; + queryAnimationGraph: (uuidOrUrlOrPath: string) => Promise; + queryAnimationGraphInspector: (uuidOrUrlOrPath: string, target: AnimationGraphTarget) => Promise; + queryAnimationGraphMotionPreviewData: (uuidOrUrlOrPath: string, target: Extract) => Promise; + queryAnimationGraphPoseGraphAssetDragHandlers: () => Promise; + queryAnimationGraphStateMachineComponentTypes: () => Promise; + setAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: SetAnimationGraphInspectorPropertyRequest) => Promise; + resetAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest) => Promise; + createAnimationGraphInspectorProperty: (uuidOrUrlOrPath: string, request: AnimationGraphInspectorPropertyOperationRequest) => Promise; + executeAnimationGraphCommand: (uuidOrUrlOrPath: string, request: ExecuteAnimationGraphCommandRequest) => Promise; + saveAnimationGraph: (uuidOrUrlOrPath: string, expected: AnimationGraphExpectedVersion, sourceId?: string) => Promise; + reloadAnimationGraph: (uuidOrUrlOrPath: string, options?: ReloadAnimationGraphOptions, sourceId?: string) => Promise; + onAnimationGraphChanged: (listener: (event: AnimationGraphChangedEvent) => void) => () => void; + queryAnimationGraphVariant: (uuid: string) => Promise; + changeAnimationGraphVariant: (uuid: string, dump: AnimGraphVariantDump) => Promise; + saveAnimationGraphVariant: (uuid: string) => Promise; + queryAssetConfigMap: () => Promise>; + queryPropertySchema: (importer: string) => Promise; + updateDefaultUserData: (handler: string, key: string, value: any) => Promise; + getCreateMap: () => Promise; + queryAssetUserDataConfig: (asset: IAsset) => Promise | undefined>; + queryThumbnailHandlers: () => string[]; + generateThumbnail(urlOrUUIDOrPath: string, size?: ThumbnailSize): Promise; + extractImagePixels(urlOrUUIDOrPath: string, options: IImagePixelExtractionOptions): Promise; + getEffectBinPath(): Promise; + url2uuid(url: string): string; + url2path(url: string): string; + path2url(url: string, dbName?: string): string; + onAssetAdded(listener: (info: IAssetInfo) => void): () => void; + onAssetChanged(listener: (info: IAssetInfo) => void): () => void; + onAssetRemoved(listener: (info: IAssetInfo) => void): () => void; + init(): Promise; + destroyed(): void; + private _extractAssetChangeInfo; + private _snapshotAssetChangeInfo; + _onAssetDBCreated(db: AssetDB): void; + _onAssetDBRemoved(db: AssetDB): void; + private _removeProgressListeners; + private _getImportState; + private _emitProgress; + _onAssetAdd: (asset: IAsset) => Promise; + _onAssetChange: (asset: IAsset) => Promise; + _onAssetDelete: (asset: IAsset) => Promise; + _onAssetAdded: (asset: IAsset) => Promise; + _onAssetChanged: (asset: IAsset) => Promise; + _onAssetDeleted: (asset: IAsset) => Promise; + onReady(listener: () => void): () => void; + onDBReady(listener: (dbInfo: IAssetDBInfo) => void): () => void; + onProgress(listener: (current: number, total: number, url: string, state: 'processing' | 'success' | 'failed') => void): () => void; +} +declare const assetManager: AssetManager; +declare interface AssetManagerEvents { + 'asset-add': (asset: IAsset) => void; + 'asset-change': (asset: IAsset) => void; + 'asset-delete': (asset: IAsset) => void; + 'onAssetAdded': (info: IAssetInfo) => void; + 'onAssetChanged': (info: IAssetInfo) => void; + 'onAssetRemoved': (info: IAssetInfo) => void; + 'progress': (current: number, total: number, url: string, state: 'processing' | 'success' | 'failed') => void; + 'db-ready': (dbInfo: IAssetDBInfo) => void; + 'ready': () => void; +} +declare class AssetOperation extends EventEmitter { + private readonly _importTaskByTargetPath; + private readonly _reservedImportTargetPaths; + _checkReadonly(asset: IAsset): void; + _checkExists(path: string): void; + _checkOverwrite(path: string, option?: AssetOperationOption, isOccupied?: (path: string) => boolean): string; + _checkRenameNewName(asset: IAsset, newName: string): void; + saveAssetMeta(uuid: string, meta: IAssetMeta, asset?: IAsset): Promise; + updateUserData(uuidOrURLOrPath: string, userData: AssetUserDataMap[T]): Promise; + updateUserDataByPath(uuidOrURLOrPath: string, path: string, value: any): Promise; + saveAsset(uuidOrURLOrPath: string, content: string | Buffer): Promise; + saveAnimationGraphDocument(uuidOrURLOrPath: string, content: string | Buffer): Promise; + private _saveAssetContent; + private _validateAssetContentBeforeSave; + private _validateScriptContentBeforeSave; + private _validateSceneOrPrefabContentBeforeSave; + checkValidUrl(urlOrPath: string): boolean; + createAsset(options: CreateAssetOptions): Promise; + createAssetByType(type: ISupportCreateType, dirOrUrl: string, baseName: string, options?: CreateAssetByTypeOptions): Promise; + private _resolveCreateAssetDir; + importAsset(source: string, target: string, options?: AssetOperationOption): Promise; + private _importAsset; + private _queueImportByTargetPath; + private _isPathOccupied; + private _reserveImportTargetPath; + private _getImportTargetKey; + copyAsset(source: string, target: string, options?: AssetOperationOption): Promise; + private _copyAsset; + private _copyAssetSource; + generateExportData(asset: Asset, options?: IExportOptions): Promise; + outputExportData(handler: string, src: IExportData, dest: IExportData): Promise; + refreshAsset(pathOrUrlOrUUID: string): Promise; + refreshAssetOnly(pathOrUrlOrUUID: string): Promise; + private _refreshAsset; + private _pathToDbUrlIfInsideAssetDB; + private _isSameFilesystemPath; + private _dirnameForRefresh; + reimportAsset(pathOrUrlOrUUID: string): Promise; + private _reimportAsset; + moveAsset(source: string, target: string, option?: AssetOperationOption): Promise; + private _moveAsset; + renameAsset(source: string, newName: string, option?: AssetOperationOption): Promise; + private _renameAsset; + removeAsset(uuidOrURLOrPath: string, options?: DeleteAssetOptions): Promise; + private _runAnimationGraphExternalWrite; + private _queryAnimationGraphAssetsAt; + private _isAssetDirectory; + private _isAssetInDatabase; + private _isAnimationGraphAsset; + private _runAnimationGraphExternalWrites; + private _removeAsset; +} +declare const assetOperation: AssetOperation; +declare const assetQuery_2: AssetQueryManager; +declare class AssetQueryManager { + queryAssetDependencies(uuidOrURL: string, type?: QueryAssetType): Promise; + queryAssetUsers(uuidOrURL: string, type?: QueryAssetType): Promise; + queryAsset(uuidOrURLOrPath: string): IAsset | null; + queryAssetInfo(urlOrUUIDOrPath: string, dataKeys?: readonly (keyof IAssetInfo)[]): IAssetInfo | null; + queryAssetInfoByUUID(uuid: string, dataKeys?: readonly (keyof IAssetInfo)[]): IAssetInfo | null; + queryAssetInfos(options?: QueryAssetsOption, dataKeys?: readonly (keyof IAssetInfo)[]): IAssetInfo[]; + queryAssets(options?: QueryAssetsOption): IAsset[]; + querySortedPlugins(filterOptions?: FilterPluginOptions): IPluginScriptInfo[]; + encodeAsset(asset: IAsset, dataKeys?: readonly (keyof IAssetInfo)[], invalid?: boolean): IAssetInfo; + queryAssetProperty(asset: IAsset, property: (keyof IAssetInfo | 'depends' | 'dependScripts' | 'dependedScripts')): any; + queryAssetMeta(uuidOrURLOrPath: string): IAssetMeta | null; + querySubAssetName(mainUuid: string, subId: string): string | null; + private _findSubAssetNameFromMeta; + queryAssetMtime(uuid: string): number | null; + queryUUID(urlOrPath: string): string | null; + queryDBAssetInfo(name: string): IAssetInfo | null; + queryUrl(uuidOrPath: string): string; + queryPath(urlOrUuid: string): string; + generateAvailableURL(url: string): string; +} +declare class AssetService extends BaseService implements IAssetService { + private getEditorSession; + private isCurrentEditorSession; + assetChanged(uuid: string): Promise; + private _preserveCurrentAnimationClipAsset; + assetDeleted(uuid: string): Promise; + onEditorOpened(): void; + onEditorClosed(): void; + onEditorDisposed(): void; + onNodeChanged(node: Node_2): void; + onComponentAdded(comp: Component): void; + onComponentRemoved(comp: Component): void; + releaseAsset(assetUUID: string): void; +} +declare class BaseService> { + protected isOpen: boolean; + protected emit(event: K, ...args: TEvents[K]): void; + protected emitInternal(event: InternalServiceEventName, ...args: any[]): void; + broadcast(event: K, ...args: TEvents[K]): void; + protected on(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void; + protected once(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void; + protected off(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void; + protected clear(event?: keyof TEvents): void; +} +declare function beginLightProbeRestore(scene: Scene): () => void; +declare function beginLightProbeTransformEdit(nodes: Node_2[]): (() => void) | undefined; +declare function broadcastAnimationPropertyCommitted(event: IAnimationPropertyCommittedEvent): void; +export declare namespace Browser { + export { + Scene_3 as Scene, + SceneContext, + SceneCommon, + SceneConfig_2 as SceneConfig, + SceneI18n, + SceneRpc, + SceneLightProbeNormalReset, + SceneAnimationPropertyCommitEvent, + SceneEditorSession, + SceneDump, + SceneEngine, + SceneMessage, + SceneNode, + SceneNodeNodeCreate, + SceneNodeNodeTypeConfig, + SceneNodeNodeUtils, + SceneNodePrefabCanvasMutation, + SceneOperationTypes, + ScenePrefabPrefabEditorUtils, + SceneReferenceImage, + SceneSceneLightProbeSnapshot, + SceneSceneLightProbeTransform, + SceneSceneUtils, + SceneServiceManager, + SceneUtilsAssetReload, + SceneUtilsEditorNode, + SceneUtilsStateMachineFiniteStateMachine, + SceneUtilsStateMachineStateInterface, + SceneSessionClient_2 as SceneSessionClient, + SceneSessionMethods, + SceneSessionProtocol + } +} +export declare interface BrowserCapabilities { + readonly apiVersion: 1; + readonly identity: object; + readonly modules: BrowserModules; + readonly environment: BrowserEnvironment; +} +export declare interface BrowserEnvironment { serverURL: string; runtimeResourceBase: string; [key: string]: unknown; } +export declare interface BrowserHost { + readonly apiVersion: 1; + loadEngine(options: Record): Promise; + prepareScene(options: Record): Promise; +} +export declare interface BrowserModules { + 'scene': Editor_8.Browser.Scene; + 'scene/context': Editor_8.Browser.SceneContext; + 'scene/common': Editor_8.Browser.SceneCommon; + 'scene/config': Editor_8.Browser.SceneConfig; + 'scene/i18n': Editor_8.Browser.SceneI18n; + 'scene/rpc': Editor_8.Browser.SceneRpc; + 'scene/light-probe-normal-reset': Editor_8.Browser.SceneLightProbeNormalReset; + 'scene/animation/property-commit-event': Editor_8.Browser.SceneAnimationPropertyCommitEvent; + 'scene/editor-session': Editor_8.Browser.SceneEditorSession; + 'scene/dump': Editor_8.Browser.SceneDump; + 'scene/engine': Editor_8.Browser.SceneEngine; + 'scene/message': Editor_8.Browser.SceneMessage; + 'scene/node': Editor_8.Browser.SceneNode; + 'scene/node/node-create': Editor_8.Browser.SceneNodeNodeCreate; + 'scene/node/node-type-config': Editor_8.Browser.SceneNodeNodeTypeConfig; + 'scene/node/node-utils': Editor_8.Browser.SceneNodeNodeUtils; + 'scene/node/prefab-canvas-mutation': Editor_8.Browser.SceneNodePrefabCanvasMutation; + 'scene/operation/types': Editor_8.Browser.SceneOperationTypes; + 'scene/prefab/prefab-editor-utils': Editor_8.Browser.ScenePrefabPrefabEditorUtils; + 'scene/reference-image': Editor_8.Browser.SceneReferenceImage; + 'scene/scene/light-probe-snapshot': Editor_8.Browser.SceneSceneLightProbeSnapshot; + 'scene/scene/light-probe-transform': Editor_8.Browser.SceneSceneLightProbeTransform; + 'scene/scene/utils': Editor_8.Browser.SceneSceneUtils; + 'scene/service-manager': Editor_8.Browser.SceneServiceManager; + 'scene/utils/asset-reload': Editor_8.Browser.SceneUtilsAssetReload; + 'scene/utils/editor-node': Editor_8.Browser.SceneUtilsEditorNode; + 'scene/utils/state-machine/finite-state-machine': Editor_8.Browser.SceneUtilsStateMachineFiniteStateMachine; + 'scene/utils/state-machine/state-interface': Editor_8.Browser.SceneUtilsStateMachineStateInterface; + 'scene/session/client': Editor_8.Browser.SceneSessionClient; + 'scene/session/methods': Editor_8.Browser.SceneSessionMethods; + 'scene/session/protocol': Editor_8.Browser.SceneSessionProtocol; + 'engine/editor-extends': Editor_11.Browser.EngineEditorExtends; + 'engine/node-path': Editor_11.Browser.EngineNodePath; + 'engine/serialize': Editor_11.Browser.EngineSerialize; + 'engine/deserialize': Editor_11.Browser.EngineDeserialize; + 'engine/geometry': Editor_11.Browser.EngineGeometry; + 'engine/prefab': Editor_11.Browser.EnginePrefab; + 'engine/graphics-config': Editor_11.Browser.EngineGraphicsConfig; + 'engine/polyfill': Editor_11.Browser.EnginePolyfill; + 'engine/overwrite': Editor_11.Browser.EngineOverwrite & { 'export=': ccOverwrite }; + 'engine/editor/2d-misc': Editor_11.Browser.EngineEditor2dMisc; + 'engine/editor/new-gen-anim': Editor_11.Browser.EngineEditorNewGenAnim; + 'engine/editor/lod-group-utils': Editor_11.Browser.EngineEditorLodGroupUtils; +} export declare const BUILTIN_NODE_CREATE_TARGETS: Readonly<{ readonly empty: "db: readonly label: "db: @@ -11143,100 +15119,3455 @@ export declare const BUILTIN_NODE_CREATE_TARGETS: Readonly<{ readonly widget: "db: }>; export declare type BuiltinNodeCreateEntryId = keyof typeof BUILTIN_NODE_CREATE_TARGETS; -export declare function init(): Promise; -export declare interface ISceneCommandProvider { - request(module: string, method: string, args?: any[], options?: SceneCommandRequestOptions): Promise; - notify?(module: string, method: string, args?: any[]): void; - isConnect?(): boolean | undefined; - dispose?(): void; +declare let bundleRefresher: ((serverURL?: string) => Promise) | undefined; +declare function captureLightProbeData(scene: Scene): LightProbeDataSnapshot; +declare function captureLightProbeGroup(component: Component): LightProbeGroupSnapshot | undefined; +declare class ComponentService extends BaseService implements IComponentService { + modeName: SceneModeType; + protected _sceneEventListener: ISceneEvents_2[]; + queryMode(): SceneModeType; + onAddComponent(comp: Component, opts?: IOptionBase): void; + onRemoveComponent(comp: Component, opts?: IOptionBase): void; + onComponentAdded(comp: Component, opts?: IOptionBase): void; + onComponentRemoved(comp: Component, opts?: IOptionBase): void; + dispatchEvents(eventName: keyof ISceneEvents_2, ...args: any[any]): void; + private requireComponentList; + private resolveComponentCtor; + add(params: IAddComponentOptions): Promise; + checkComponentsCollision(node: Node_2): Promise; + checkDynamicBodyShape(ndoe: Node_2): void; + private findComponent; + remove(params: IRemoveComponentOptions): Promise; + queryImpl(params: IQueryComponentOptions): Promise; + query(params: IQueryComponentOptions | string): Promise; + regeneratePolygon2DPoints(options: IRegeneratePolygon2DPointsOptions): Promise; + setProperty(options: ISetPropertyOptions): Promise; + resetProperty(options: ISetPropertyOptions): Promise; + private _shouldRecordComponentCommand; + private _recordComponentSnapshot; + private _recordComponentPropertySnapshot; + private _captureComponentSnapshot; + private _captureComponentPropertySnapshot; + private _createComponentPropertySnapshotAdapter; + private _applyComponentPropertySnapshots; + private _resolveComponentPropertyTarget; + private _createComponentAnimationPropPath; + private _findSnapshotComponent; + private _findSnapshotNode; + private _snapshotMapsEqual; + private _cloneSnapshotDump; + private _restoreComponentSnapshotDump; + private _getComponentType; + private _createUndoSnapshotId; + queryNode(uuid: string | undefined): Node_2 | null; + queryAll(): Promise; + hasScript(name: string): Promise; + queryClasses(options?: IQueryClassesOptions): Promise<{ + name: string; + }[]>; + queryFunctionOfNode(path: string): Promise; + queryComponents(): Promise>; + init(): void; + private readonly CompMgrEventHandlers; + private compMgrEventHandlers; + registerCompMgrEvents(): void; + unregisterCompMgrEvents(): void; + onCompAdd(uuid: string, component: Component): void; + onCompRemove(uuid: string, component: Component): void; + reset(params: IQueryComponentOptions): Promise; + recalculateLODGroupBounds(options: IRecalculateLODGroupBoundsOptions): Promise; + insertLOD(options: IInsertLODOptions): Promise; + eraseLOD(options: IEraseLODOptions): Promise; + queryLODGroupRelativeHeight(options: IQueryLODGroupRelativeHeightOptions): Promise; + executeMethod(options: IExecuteComponentMethodOptions): Promise; + getPathByUuid(uuid: string): string; } -export declare interface MotionPreviewDesc { - motion: MotionPreviewDescNode | null; - variables: MotionPreviewVariable[]; +export declare namespace CoreSceneCommonIndex { + export { + SceneReadyChannel, + SceneProcessEventTag, + INodeProperties, + IUpdateNodeParams, + IUpdateNodeResult, + INodeIdentifier, + INodeInfo, + IComponentIdentifier, + IComponentInfo, + ISetPropertyOptionsInfo, + ISceneInfo, + OptimizationPolicy, + IPrefabInstance, + IMountedChildrenInfo, + IPropertyOverrideInfo, + ITargetInfo, + IMountedComponentsInfo, + ITargetOverrideDetail, + IPrefabDetail, + IPrefabInfo, + INodeTreeComponent, + INodeTreeItem, + IQueryNodeTreeParams, + SerializedNodeData, + ISerializeNodesParams, + ICreateBySerializedDataParams, + NodeType, + PrefabCanvasHandling, + ICreateNodePreflightResult, + INodeDumpOptions, + IQueryNodeParams, + IPrefab, + INode, + IDeleteNodeParams, + IDeleteNodeResult, + IClipboardState, + ISetParentParams, + IReorderParams, + ICopyParams, + IPasteParams, + IDuplicateParams, + ICutParams, + IMoveArrayElementParams, + IRemoveArrayElementParams, + IChangeNodeLockParams, + ICreateByNodeTypeParams, + ICreateByAssetParams, + ICreateDragItem, + ICreateDragPointer, + IBeginCreateDragParams, + IUpdateCreateDragParams, + ICommitCreateDragParams, + CreateDragCancelReason, + ICancelCreateDragParams, + ICreateDragConfirmation, + CreateDragSession, + CreateDragErrorCode, + CreateDragError, + CreateDragResult, + BeginCreateDragResult, + UpdateCreateDragResult, + CommitCreateDragResult, + CancelCreateDragResult, + IChangeNodeOptions, + INodeService, + NodeEventType, + MobilityMode, + INodeEvents, + IPublicNodeService, + EventSourceType, + BUILTIN_NODE_CREATE_TARGETS_2 as BUILTIN_NODE_CREATE_TARGETS, + BuiltinNodeCreateEntryId_2 as BuiltinNodeCreateEntryId, + IPrefabEvents, + IPublicPrefabService, + IPrefabService, + ICreatePrefabFromNodeParams, + IApplyPrefabChangesParams, + IRevertToPrefabParams, + IUnpackPrefabInstanceParams, + IIsPrefabInstanceParams, + IGetPrefabInfoParams, + IUnlinkPrefabParams, + ITargetOverrideInfo, + PrefabState, + IPrefabStateInfo, + ICompPrefabInfo, + TEditorEntity, + IEditorService, + TEditorInstance, + IEditorEvents, + IEditorTarget, + IPublicEditorService, + SCENE_TEMPLATE_TYPE, + TSceneTemplateType, + CREATE_TYPES, + ICreateType, + ReloadResult, + IBaseIdentifier, + ICreateOptions, + ISaveOptions, + IOpenOptions, + IReloadOptions, + ICloseOptions, + IScene, + IScriptService, + IScriptEvents, + IPublicScriptService, + IComponent, + IAddComponentOptions, + IRemoveComponentOptions, + IRemovedComponentInfo, + IQueryComponentOptions, + IRecalculateLODGroupBoundsOptions, + ILODGroupBoundsResult, + IInsertLODOptions, + IEraseLODOptions, + IQueryLODGroupRelativeHeightOptions, + ILODGroupLevelsResult, + ISetPropertyOptions, + IExecuteComponentMethodOptions, + Polygon2DPointsSource, + IRegeneratePolygon2DPointsOptions, + IRegeneratePolygon2DPointsResult, + IQueryClassesOptions, + IComponentService, + IComponentEvents, + IPublicComponentService, + IAssetService, + IAssetEvents, + IPublicAssetService, + ICustomLayerConfig, + IEngineService, + IEngineEvents, + IPublicEngineService, + AnimationMode, + AnimationEditorType, + AnimationPlayOperation, + IAnimationValue, + IAnimationPropertyType, + IAnimationKeyValueDump, + IAnimationCurveKeyData, + IAnimationCurveKeyDump, + IAnimationCurveChannelDump, + IAnimationCurveDump, + IAnimationTargetOptions, + IAnimationEnterOptions, + IAnimationExitOptions, + IAnimationTimeOptions, + IAnimationQueryClipOptions, + IAnimationQueryPropertyValueAtFrameOptions, + IAnimationQueryAuxiliaryCurveValueAtFrameOptions, + IAnimationSetTimeOptions, + IAnimationPlayStateOptions, + IAnimationEditClipOptions, + IAnimationRootResult, + IAnimationClipMenuItem, + IAnimationEventDump, + IAnimationEmbeddedPlayable, + IAnimationEmbeddedPlayerDump, + IAnimationEmbeddedPlayerGroup, + IAnimationAuxiliaryKeyDump, + IAnimationAuxiliaryCurveDump, + IAnimationClipDump, + IAnimationClipsInfo, + IAnimationPropertyInfo, + IAnimationOperation, + IAnimationOperationOptions, + IAnimationOperationResult, + IAnimationSaveOptions, + IAnimationService, + AnimationPlayState_2 as AnimationPlayState, + AnimationEventReason, + IAnimationRootInfo, + IAnimationStateInfo, + IAnimationStateChangedEvent, + IAnimationClipEvent, + IAnimationTimeChangedEvent, + IAnimationPropertyCommittedEvent, + IAnimationEvents, + IPublicAnimationService, + ISelectionService, + IPublicSelectionService, + ISelectionEvents, + IOperationService, + OperationEvent, + ISceneMouseEvent, + ISceneKeyboardEvent, + OperationPriority, + IPublicOperationService, + IUndoScope, + IUndoCommandMeta, + IUndoRedoResult, + IUndoOperationOptions, + IUndoCheckpoint, + IUndoPushWithPreviousOptions, + IUndoCommand, + IUndoGroupOptions, + IUndoBeginOptions, + IUndoService, + IRedoService, + IPublicUndoService, + IPublicRedoService, + IUndoEvents, + ICameraConfig, + IOriginAxesConfig, + ICameraService, + IPublicCameraService, + ICameraEvents, + IRectSnapConfigData, + IGizmoService, + IPublicGizmoService, + IGizmoEvents, + ISceneViewService, + IPublicSceneViewService, + ISceneViewEvents, + IPreviewInstance, + IPreviewService, + MotionPreviewDescNode_2 as MotionPreviewDescNode, + MotionPreviewVariable_2 as MotionPreviewVariable, + MotionPreviewDesc_2 as MotionPreviewDesc, + IMotionPreviewService, + IMaterialPreviewInstance, + ISpinePreviewInstance, + IPublicPreviewService, + IPreviewEvents, + PreviewPlayState, + IPreviewPlayStartOptions, + IPreviewPlayService, + IPreviewPlayEvents, + IPublicPreviewPlayService, + UIAlignType, + IUIService, + IPublicUIService, + IUIEvents, + IReflectionProbeSceneIdentity, + IReflectionProbeBakeOptions, + IReflectionProbeBakeResult, + IReflectionProbeBakeAllOptions, + IReflectionProbeBakeFailure, + IReflectionProbeBakeAllResult, + IReflectionProbeClearOptions, + IReflectionProbeClearFailure, + IReflectionProbeClearResult, + IReflectionProbeCancelOptions, + IReflectionProbeTaskState, + IReflectionProbeService, + IReflectionProbeEvents, + IPublicReflectionProbeService, + ITerrainTarget, + TerrainEditorMode, + TerrainSculptTool, + TerrainBrushKind, + ITerrainManageState, + ITerrainLayerState, + ITerrainLayerPatch, + ITerrainBrushState, + ITerrainPaintBrushState, + ITerrainSculptState, + ITerrainPaintState, + ITerrainEditorState, + ITerrainSnapshot, + ITerrainInvalidSnapshot, + TerrainReadResult, + ITerrainBrushPatch, + ITerrainPaintBrushPatch, + ITerrainSculptSessionPatch, + ITerrainPaintSessionPatch, + ITerrainBlockLayerSlot, + ITerrainBlockData, + ITerrainBlockSnapshot, + TerrainBlockReadResult, + ITerrainService, + TerrainLayerErrorCode, + TerrainLayerError, + IPublicTerrainService, + ITerrainEvents, + ISceneEvents, + IMessageManagerEvents, + normalizeReferenceImageConfig, + validateReferenceImageParameters, + IReferenceImageConfigItem, + IReferenceImageItem, + ReferenceImageVisibilityReason, + IReferenceImageError, + IReferenceImageState, + IReferenceImageParameters, + IReferenceImagePreviewOptions, + IReferenceImageCommitOptions, + IReferenceImageCancelOptions, + IReferenceImagePathOptions, + IReferenceImageVisibilityOptions, + IReferenceImageService, + IReferenceImageConfig, + IReferenceImageAuthoritySnapshot, + IReferenceImageAuthorityMutation, + IReferenceImageAuthorityStore, + IReferenceImageEvents, + IPublicReferenceImageService, + IReferenceImageFileService, + ILightProbeBakeOptions, + ILightProbeSetting, + ILightProbeSettings, + ILightProbeBakeCapabilities, + ILightProbeBakeResult, + ILightmapBakeOptions, + ILightmapBakeCapabilities, + ILightmapBakeResult, + ILightmapBakeInfo, + ILightmapClearResult, + ILightFXCancelResult, + ILightProbeBakeService, + ILightmapBakeService, + ILightFXBakeEvents, + IPublicLightProbeBakeService, + IPublicLightmapBakeService, + IParticlePlayInfo, + IParticleService, + IPublicParticleService + } } -export declare type MotionPreviewDescNode = { - kind: 'clip'; - clipUuid: string | null; -} | { - kind: 'blend-1d'; - variable: string | null; - value: number; - children: { - motion: MotionPreviewDescNode | null; - threshold: number; - }[]; -} | { - kind: 'blend-2d'; - variableX: string | null; - valueX: number; - variableY: string | null; - valueY: number; - algorithm?: number; - children: { - motion: MotionPreviewDescNode | null; - threshold: { - x: number; - y: number; - }; - }[]; -} | { - kind: 'blend-direct'; - children: { - motion: MotionPreviewDescNode | null; - weight: number; - }[]; -}; -export declare interface MotionPreviewVariable { - name: string; - value: number | null; +export declare namespace CoreSceneCommonPreview { + export { + IPreviewInstance, + IPreviewService, + MotionPreviewDescNode_2 as MotionPreviewDescNode, + MotionPreviewVariable_2 as MotionPreviewVariable, + MotionPreviewDesc_2 as MotionPreviewDesc, + IMotionPreviewService, + IMaterialPreviewInstance, + ISpinePreviewInstance, + IPublicPreviewService, + IPreviewEvents + } } -export declare function resetCommandProvider(): void; -export declare interface SceneCommand { - module: string; - method: string; - args?: unknown[]; +export declare namespace CoreSceneCommonReflectionProbe { + export { + IReflectionProbeSceneIdentity, + IReflectionProbeBakeOptions, + IReflectionProbeBakeResult, + IReflectionProbeBakeAllOptions, + IReflectionProbeBakeFailure, + IReflectionProbeBakeAllResult, + IReflectionProbeClearOptions, + IReflectionProbeClearFailure, + IReflectionProbeClearResult, + IReflectionProbeCancelOptions, + IReflectionProbeTaskState, + IReflectionProbeService, + IReflectionProbeEvents, + IPublicReflectionProbeService + } } -export declare interface SceneCommandProviderRegistration { - dispose(): void; +export declare namespace CoreSceneIndex { + export { + loadSceneI18n, + init_2 as init, + startupScene, + sceneConfigInstance, + SceneReadyChannel, + SceneProcessEventTag, + INodeProperties, + IUpdateNodeParams, + IUpdateNodeResult, + INodeIdentifier, + INodeInfo, + IComponentIdentifier, + IComponentInfo, + ISetPropertyOptionsInfo, + ISceneInfo, + OptimizationPolicy, + IPrefabInstance, + IMountedChildrenInfo, + IPropertyOverrideInfo, + ITargetInfo, + IMountedComponentsInfo, + ITargetOverrideDetail, + IPrefabDetail, + IPrefabInfo, + INodeTreeComponent, + INodeTreeItem, + IQueryNodeTreeParams, + SerializedNodeData, + ISerializeNodesParams, + ICreateBySerializedDataParams, + NodeType, + PrefabCanvasHandling, + ICreateNodePreflightResult, + INodeDumpOptions, + IQueryNodeParams, + IPrefab, + INode, + IDeleteNodeParams, + IDeleteNodeResult, + IClipboardState, + ISetParentParams, + IReorderParams, + ICopyParams, + IPasteParams, + IDuplicateParams, + ICutParams, + IMoveArrayElementParams, + IRemoveArrayElementParams, + IChangeNodeLockParams, + ICreateByNodeTypeParams, + ICreateByAssetParams, + ICreateDragItem, + ICreateDragPointer, + IBeginCreateDragParams, + IUpdateCreateDragParams, + ICommitCreateDragParams, + CreateDragCancelReason, + ICancelCreateDragParams, + ICreateDragConfirmation, + CreateDragSession, + CreateDragErrorCode, + CreateDragError, + CreateDragResult, + BeginCreateDragResult, + UpdateCreateDragResult, + CommitCreateDragResult, + CancelCreateDragResult, + IChangeNodeOptions, + INodeService, + NodeEventType, + MobilityMode, + INodeEvents, + IPublicNodeService, + EventSourceType, + BUILTIN_NODE_CREATE_TARGETS_2 as BUILTIN_NODE_CREATE_TARGETS, + BuiltinNodeCreateEntryId_2 as BuiltinNodeCreateEntryId, + IPrefabEvents, + IPublicPrefabService, + IPrefabService, + ICreatePrefabFromNodeParams, + IApplyPrefabChangesParams, + IRevertToPrefabParams, + IUnpackPrefabInstanceParams, + IIsPrefabInstanceParams, + IGetPrefabInfoParams, + IUnlinkPrefabParams, + ITargetOverrideInfo, + PrefabState, + IPrefabStateInfo, + ICompPrefabInfo, + TEditorEntity, + IEditorService, + TEditorInstance, + IEditorEvents, + IEditorTarget, + IPublicEditorService, + SCENE_TEMPLATE_TYPE, + TSceneTemplateType, + CREATE_TYPES, + ICreateType, + ReloadResult, + IBaseIdentifier, + ICreateOptions, + ISaveOptions, + IOpenOptions, + IReloadOptions, + ICloseOptions, + IScene, + IScriptService, + IScriptEvents, + IPublicScriptService, + IComponent, + IAddComponentOptions, + IRemoveComponentOptions, + IRemovedComponentInfo, + IQueryComponentOptions, + IRecalculateLODGroupBoundsOptions, + ILODGroupBoundsResult, + IInsertLODOptions, + IEraseLODOptions, + IQueryLODGroupRelativeHeightOptions, + ILODGroupLevelsResult, + ISetPropertyOptions, + IExecuteComponentMethodOptions, + Polygon2DPointsSource, + IRegeneratePolygon2DPointsOptions, + IRegeneratePolygon2DPointsResult, + IQueryClassesOptions, + IComponentService, + IComponentEvents, + IPublicComponentService, + IAssetService, + IAssetEvents, + IPublicAssetService, + ICustomLayerConfig, + IEngineService, + IEngineEvents, + IPublicEngineService, + AnimationMode, + AnimationEditorType, + AnimationPlayOperation, + IAnimationValue, + IAnimationPropertyType, + IAnimationKeyValueDump, + IAnimationCurveKeyData, + IAnimationCurveKeyDump, + IAnimationCurveChannelDump, + IAnimationCurveDump, + IAnimationTargetOptions, + IAnimationEnterOptions, + IAnimationExitOptions, + IAnimationTimeOptions, + IAnimationQueryClipOptions, + IAnimationQueryPropertyValueAtFrameOptions, + IAnimationQueryAuxiliaryCurveValueAtFrameOptions, + IAnimationSetTimeOptions, + IAnimationPlayStateOptions, + IAnimationEditClipOptions, + IAnimationRootResult, + IAnimationClipMenuItem, + IAnimationEventDump, + IAnimationEmbeddedPlayable, + IAnimationEmbeddedPlayerDump, + IAnimationEmbeddedPlayerGroup, + IAnimationAuxiliaryKeyDump, + IAnimationAuxiliaryCurveDump, + IAnimationClipDump, + IAnimationClipsInfo, + IAnimationPropertyInfo, + IAnimationOperation, + IAnimationOperationOptions, + IAnimationOperationResult, + IAnimationSaveOptions, + IAnimationService, + AnimationPlayState_2 as AnimationPlayState, + AnimationEventReason, + IAnimationRootInfo, + IAnimationStateInfo, + IAnimationStateChangedEvent, + IAnimationClipEvent, + IAnimationTimeChangedEvent, + IAnimationPropertyCommittedEvent, + IAnimationEvents, + IPublicAnimationService, + ISelectionService, + IPublicSelectionService, + ISelectionEvents, + IOperationService, + OperationEvent, + ISceneMouseEvent, + ISceneKeyboardEvent, + OperationPriority, + IPublicOperationService, + IUndoScope, + IUndoCommandMeta, + IUndoRedoResult, + IUndoOperationOptions, + IUndoCheckpoint, + IUndoPushWithPreviousOptions, + IUndoCommand, + IUndoGroupOptions, + IUndoBeginOptions, + IUndoService, + IRedoService, + IPublicUndoService, + IPublicRedoService, + IUndoEvents, + ICameraConfig, + IOriginAxesConfig, + ICameraService, + IPublicCameraService, + ICameraEvents, + IRectSnapConfigData, + IGizmoService, + IPublicGizmoService, + IGizmoEvents, + ISceneViewService, + IPublicSceneViewService, + ISceneViewEvents, + IPreviewInstance, + IPreviewService, + MotionPreviewDescNode_2 as MotionPreviewDescNode, + MotionPreviewVariable_2 as MotionPreviewVariable, + MotionPreviewDesc_2 as MotionPreviewDesc, + IMotionPreviewService, + IMaterialPreviewInstance, + ISpinePreviewInstance, + IPublicPreviewService, + IPreviewEvents, + PreviewPlayState, + IPreviewPlayStartOptions, + IPreviewPlayService, + IPreviewPlayEvents, + IPublicPreviewPlayService, + UIAlignType, + IUIService, + IPublicUIService, + IUIEvents, + IReflectionProbeSceneIdentity, + IReflectionProbeBakeOptions, + IReflectionProbeBakeResult, + IReflectionProbeBakeAllOptions, + IReflectionProbeBakeFailure, + IReflectionProbeBakeAllResult, + IReflectionProbeClearOptions, + IReflectionProbeClearFailure, + IReflectionProbeClearResult, + IReflectionProbeCancelOptions, + IReflectionProbeTaskState, + IReflectionProbeService, + IReflectionProbeEvents, + IPublicReflectionProbeService, + ITerrainTarget, + TerrainEditorMode, + TerrainSculptTool, + TerrainBrushKind, + ITerrainManageState, + ITerrainLayerState, + ITerrainLayerPatch, + ITerrainBrushState, + ITerrainPaintBrushState, + ITerrainSculptState, + ITerrainPaintState, + ITerrainEditorState, + ITerrainSnapshot, + ITerrainInvalidSnapshot, + TerrainReadResult, + ITerrainBrushPatch, + ITerrainPaintBrushPatch, + ITerrainSculptSessionPatch, + ITerrainPaintSessionPatch, + ITerrainBlockLayerSlot, + ITerrainBlockData, + ITerrainBlockSnapshot, + TerrainBlockReadResult, + ITerrainService, + TerrainLayerErrorCode, + TerrainLayerError, + IPublicTerrainService, + ITerrainEvents, + ISceneEvents, + IMessageManagerEvents, + normalizeReferenceImageConfig, + validateReferenceImageParameters, + IReferenceImageConfigItem, + IReferenceImageItem, + ReferenceImageVisibilityReason, + IReferenceImageError, + IReferenceImageState, + IReferenceImageParameters, + IReferenceImagePreviewOptions, + IReferenceImageCommitOptions, + IReferenceImageCancelOptions, + IReferenceImagePathOptions, + IReferenceImageVisibilityOptions, + IReferenceImageService, + IReferenceImageConfig, + IReferenceImageAuthoritySnapshot, + IReferenceImageAuthorityMutation, + IReferenceImageAuthorityStore, + IReferenceImageEvents, + IPublicReferenceImageService, + IReferenceImageFileService, + ILightProbeBakeOptions, + ILightProbeSetting, + ILightProbeSettings, + ILightProbeBakeCapabilities, + ILightProbeBakeResult, + ILightmapBakeOptions, + ILightmapBakeCapabilities, + ILightmapBakeResult, + ILightmapBakeInfo, + ILightmapClearResult, + ILightFXCancelResult, + ILightProbeBakeService, + ILightmapBakeService, + ILightFXBakeEvents, + IPublicLightProbeBakeService, + IPublicLightmapBakeService, + IParticlePlayInfo, + IParticleService, + IPublicParticleService, + IMainModule, + Scene_2 as Scene + } } -export declare interface SceneCommandRequestOptions { - timeout?: number; +export declare namespace CoreSceneMainProcessIndex { + export { + IMainModule, + Scene_2 as Scene + } } -export declare interface SceneCommandResult { - value: unknown; - version: SceneVersion; +export declare namespace CoreSceneMainProcessRpc { + export { + ProcessRPC, + ISceneCommandProvider_2 as ISceneCommandProvider, + SceneCommandProviderRegistration_2 as SceneCommandProviderRegistration, + SceneCommandRequestOptions_2 as SceneCommandRequestOptions, + WorkerSceneCommandProvider_2 as WorkerSceneCommandProvider, + SceneHostLocalExecutor, + SceneHostModules, + SceneRpcClient, + RpcProxy, + Rpc + } } -export declare interface SceneEventBatch { - version: SceneVersion; - sequence: number; - resync: boolean; - events: SceneSessionEvent[]; +export declare namespace CoreSceneRuntimeResourcesSceneRoutes { + export { + sceneResourceRoutes + } } -export declare interface SceneRecordedChange { - uuid: string; - kind: 'node' | 'component'; - dump: any; +export declare namespace CoreSceneRuntimeResourcesScriptingRoutes { + export { + scriptingRoutes + } } -export declare interface SceneRenderSnapshot { - serializedScene: string; - rootUuid: string; - assetUuid: string; - kind: 'scene' | 'prefab'; - prefabUUIDs: unknown; +export declare namespace CoreSceneRuntimeResourcesSettings { + export { + getCachedPreviewSettings, + getCachedSceneEditorSettings, + isPreviewSettingsReady, + invalidatePreviewSettings, + PreviewNotReadyError + } } -export declare class SceneSessionClient { - readonly descriptor: SceneSessionDescriptor; - constructor(descriptor: SceneSessionDescriptor); - snapshot(signal?: AbortSignal): Promise; - command(command: SceneSessionCommand, signal?: AbortSignal): Promise; - events(version: SceneVersion, after: number, signal?: AbortSignal): Promise; - private fetch; +declare function createNodeByAsset(info: { + uuid: string; + canvasRequired?: boolean; + type?: string; + workMode?: string; +}): Promise<{ + node: Node_2; + canvasRequired: boolean; +}>; +declare function createPendingPrefabCanvasMutation(record: IPrefabCanvasUndoRecord, effects: IPrefabCanvasMutationEffects): IPendingPrefabCanvasMutation; +declare function createShouldHideInHierarchyCanvasNode(scene: Scene, workMode?: string): Promise; +declare interface CustomAssetHandler extends Partial { + name: string; + extends: string; + importer?: ImporterHook | Importer; +} +declare class CustomEvent_2 extends EventEmitter { + on(type: EventType, listener: (...arg: any[]) => void): this; + off(type: EventType, listener: (...arg: any[]) => void): this; + once(type: EventType, listener: (...arg: any[]) => void): this; + emit(type: EventType, ...arg: any[]): boolean; +} +declare interface CustomHandler extends CustomHandlerBase { + handlerList: string[]; + importer?: { + before: (asset: IAsset) => Promise; + after: (asset: IAsset) => Promise; + }; + importer?: ImporterHook; + customOperationMap?: Record; +} +declare interface CustomHandlerBase { + name: string; + open?(asset: IAsset): boolean | Promise; + customOperationMap?: Record; +} +declare class CustomImporter extends Importer_2 { + constructor(extensions: string[], assetHandler: AssetHandler); +} +declare interface CustomOperator { + label?: string; + operator: (...args: any[]) => any | Promise; + public?: boolean; +} +declare class DataManager { + file: string | undefined; + dataMap: { + [uuid: string]: IData; + }; + _saveTimer: any; + private console; + constructor(customConsole: CustomConsole); + setRecordJSON(json: string): Promise; + save(): void; + saveImmediate(): void; + has(asset: VirtualAsset_2): boolean; + empty(asset: VirtualAsset_2): void; + update(asset: VirtualAsset_2): void; + setValue(asset: VirtualAsset_2, key: string, value: any): void; + getValue(asset: VirtualAsset_2, key: string): any; + get(asset: VirtualAsset_2, key?: keyof IData): null | any; +} +declare enum DBChangeType { + add = 0, + remove = 1 +} +declare interface DBInfo { + dbID: string; + target: string; +} +declare const _default: ScriptManager; +declare const _default_2: I18n; +declare const _default_3: DumpUtil; +declare class DumpUtil { + dumpProperty(node: Node_2, path: string): IProperty | INode | IScene | null; + dumpNode(node: Node_2, options?: INodeDumpOptions): INode | IScene | null; + dumpComponent(comp: Component): IComponent; + dumpComponent(comp: null | undefined): null; + restoreProperty(node: Node_2 | Component, path: string, dump: any): Promise; + resetProperty(node: Node_2 | Component, path: string): void; + updatePropertyFromNull(node: Node_2 | Component, path: string): void; + restoreNode(node: Node_2, dump: any): Promise; + parsingPath(path: string, data: any): { + search: string; + key: string; + }; + encodeObject(object: any, attributes: any, owner?: any, objectKey?: string, isTemplate?: boolean): IProperty; + getDefaultValue(type: string | undefined): any; + restoreNodeSnapshotProperties(node: Node_2, dump: any): Promise; + private restoreSceneSnapshotProperties; + restoreComponentSnapshotProperties(component: Component, dump: any): Promise; +} +export declare namespace Editor { + export { + Host, + Browser + } +} +declare class EditorPrefabUtils { + preparePrefabRootForEditing(node: Node_2): void; + rebindPrefabAsset(root: Node_2, prefabAsset: Prefab): void; + serialize(node: Node_2): any; + removePrefabInstanceRoots(rootNode: Node_2 | Scene): void; + generateSceneAsset(scene: Scene, rootNode: Node_2 | null): SceneAsset; + storePrefabUUID(scene: Scene): Map; + generatePrefabUUIDMap(node: Node_2, uuidMap: UUIDMap): void; + restorePrefabUUID(scene: Scene, prefabUUIDMap: UUIDMap): void; + applyPrefabUUID(node: Node_2, uuidMap: UUIDMap | undefined): void; +} +declare const editorPrefabUtils: EditorPrefabUtils; +declare class EditorService extends BaseService implements IEditorService, IEditorSessionService { + private needReloadAgain; + private lastSceneOrNode; + private reloadPromise; + private currentEditorUuid; + private editorMap; + private lockCount; + private lockPromise; + private lockResolve; + private _isReloading; + private lifecyclePromise; + private editorSessionGeneration; + lock(): Promise; + unlock(): void; + waitLocks(): Promise; + getCurrentEditorType(): 'scene' | 'prefab' | 'unknown'; + getCurrentEditorUuid(): string | null; + getEditorSession(): IEditorSessionSnapshot; + isCurrentEditorSession(session: IEditorSessionSnapshot): boolean; + runForSession(session: IEditorSessionSnapshot, operation: (save: () => Promise) => Promise): Promise; + private invalidateEditorSession; + hasOpen(): Promise; + private createEditor; + queryCurrent(): Promise; + querySceneSerializedData(): Promise; + queryRenderSnapshot(): SceneRenderSnapshot_2 | null; + applyRecordedChanges(changes: SceneRecordedChange_2[], label?: string): Promise; + getRootNode(): cc_2.Scene | cc_2.Node | null; + adoptRuntimeScene(scene: cc_2.Scene, identity?: { + url?: string; + }): void; + releaseRuntimeScene(): void; + open(params: IOpenOptions): Promise; + private openUnlocked; + close(params: ICloseOptions): Promise; + private closeUnlocked; + save(params: ISaveOptions): Promise; + saveAs(params: ISaveOptions): Promise; + private saveUnlocked; + private saveTerrainAssets; + private recoverDeletedSourceTo; + private saveAsUnlocked; + private resolveSaveTarget; + private assertSavedTarget; + private isSaveTargetCompatible; + reload(params: IReloadOptions): Promise; + reloadForSession(params: IReloadOptions, session: IEditorSessionSnapshot): Promise; + private reloadUnlocked; + private runLifecycle; + create(params: ICreateOptions): Promise; + onScriptExecutionFinished(): void; + private _clearUndoHistory; + private _markUndoSaved; +} +declare type EncodedPropertyOperation = 'reset' | 'create'; +declare interface EncodedPropertyOperationCapabilities { + set: boolean; + reset: boolean; + create: boolean; +} +declare function encodeEffect(effect: EffectAsset, effectUuid?: string): MaterialTechniqueDump[]; +declare function encodePropertyObject(instance: any, name?: string): IProperty; +declare function encodeSerializedObject(object: any, attributes: any, owner?: any, objectKey?: string, isTemplate?: boolean): IProperty; +declare class EngineService extends BaseService implements IEngineService { + private _setTimeoutId; + private _rafId; + private _maxDeltaTimeInEM; + private _stateRecord; + private _shouldRepaintInEM; + private _tickInEM; + private _insideTick; + private _paused; + private _capture; + private _bindTick; + private geometryRenderer; + private _sceneTick; + private _nodeChangeTimer; + private _particleSelectedUUIDs; + private _stoppedParticleSet; + init(): Promise; + setTimeout(callback: any, time: number): void; + clearTimeout(): void; + repaintInEditMode(): Promise; + forceRepaintInEditMode(): void; + changeDebugOption(key: string, value: any): Promise; + syncDesignResolution(): Promise; + initCustomLayer(layers?: ICustomLayerConfig[]): Promise; + updatePhysicsGroup(groups?: { + index: number; + name: string; + }[]): void; + setFrameRate(fps: number): void; + startTick(): void; + stopTick(): void; + tickInEditMode(deltaTime: number): void; + getGeometryRenderer(): GeometryRenderer & Pick; + enterState(state: NeedAnimState): void; + exitState(state: NeedAnimState): void; + enterAnimationMode(): void; + exitAnimationMode(): void; + resume(): void; + pause(): void; + checkToSetAnimState(nodes: Node_2[]): void; + private _tick; + private _updateTickState; + private _isTickAllowed; + get capture(): boolean; + set capture(b: boolean); + private _getNodeByPath; + private _getNodeByUuid; + onEditorOpened(): void; + onEditorClosed(): void; + onEditorReload(): void; + onNodeChanged(node: Node_2, opts?: any): void; + private _doNodeChanged; + onComponentAdded(comp: Component): void; + onComponentRemoved(comp: Component): void; + onSetPropertyComponent(): void; + private _getSelectedNodes; + onSelectionSelect(path: string, paths: string[]): void; + onSelectionUnselect(path: string, paths: string[]): void; + onSelectionClear(): void; + private _playParticlesOnSelect; + private _pauseParticlesOnUnselect; + private _stopAllParticles; + private _getSelectedParticleSystems; + private _isParticleSystem3D; +} +declare enum EventSourceType { + EDITOR = "editor", + UNDO = "undo", + ENGINE = "engine" +} +declare type EventType = 'pack-build-end' | 'pack-build-start' | 'compiled' | 'compile-start'; +declare interface Exporter { + generateExportData?: (asset: IAsset, options?: Partial) => IExportData | Promise; + outputExportData?: (src: IExportData, dest: IExportData) => boolean | Promise; +} +declare type Factory = (host: ICreateDragHost) => INodeCreateDragController; +declare class FiniteStateMachine { + currentState: TState; + private _states; + private _transitions; + constructor(states: TState[]); + addTransition(from: TState, to: TState, command: string, transition?: Transition): FiniteStateMachine; + addTransition(from: TState, to: TState, command: string, condition: Function): FiniteStateMachine; + Begin(firstState: TState): this; + issueCommand(command: string, opts?: any): Promise; +} +declare function flushLightProbeTransformEdit(scene: Scene): void; +declare class GeometryRenderer { + private _renderer; + private _dataMap; + constructor(); + get renderer(): any; + set renderer(renderer: any); + flush(): void; + removeData(method: string): void; + removeDataAll(): void; +} +declare function getCachedPreviewSettings(startScene?: string): Promise; +declare function getCachedSceneEditorSettings(): Promise; +declare function getDefaultValueByType(type: string, data?: any): any; +declare function getEditorNodeByPath(path: string): Node_2 | null; +declare function getEditorNodeByUuid(uuid: string): Node_2 | null; +declare function getEditorNodePath(node: Node_2): string; +declare function getEditorNodeUuidByPath(path: string): string; +declare function getEncodedPropertyOperationCapabilities(current: IProperty, attributes: any): EncodedPropertyOperationCapabilities; +declare function getLightProbeSnapshotScenes(nodes: Node_2[]): Scene[]; +declare function getLightProbeTransformScene(node: Node_2): Scene | undefined; +declare function getNodeName(name: string, parent: Node_2): string; +declare function getServiceAll(): any[]; +declare function getUICanvasNode(node: Node_2 | null, prefabLimitRoot?: boolean): Node_2 | null; +declare function getUITransformParentNode(node: Node_2 | null): Node_2 | null; +declare const globalEventEmitter: EventEmitter<[never]>; +declare interface HandlerInfo extends AssetHandlerInfo { + pkgName: string; + internal: boolean; +} +declare function hasOneKindOfComponent(node: Node_2 | Scene, kind: any): boolean; +export declare namespace Host { + export { + CoreSceneCommonIndex, + CoreSceneCommonPreview, + CoreSceneCommonReflectionProbe, + CoreSceneIndex, + CoreSceneMainProcessIndex, + CoreSceneMainProcessRpc, + CoreSceneRuntimeResourcesSceneRoutes, + CoreSceneRuntimeResourcesScriptingRoutes, + CoreSceneRuntimeResourcesSettings + } +} +export declare interface HostCapabilities { + readonly apiVersion: 1; + readonly cliVersion: string; + readonly identity: object; + readonly modules: HostModules; + readonly portable: Pick; + readonly browserHostPath: string; +} +export declare interface HostModules { + 'commands/base': Editor_2.Host.CommandsBase; + 'core/assets/index': Editor_3.Host.CoreAssetsIndex; + 'core/base/editor-shim': Editor_2.Host.CoreBaseEditorShim; + 'core/base/i18n': Editor_2.Host.CoreBaseI18n; + 'core/base/utils/uuid': Editor_2.Host.CoreBaseUtilsUuid; + 'core/builder/@types/protected': Editor_4.Host.CoreBuilderTypesProtected; + 'core/builder/index': Editor_4.Host.CoreBuilderIndex; + 'core/builder/platforms/web-common/utils': Editor_4.Host.CoreBuilderPlatformsWebCommonUtils; + 'core/builder/share/common-options-validator': Editor_4.Host.CoreBuilderShareCommonOptionsValidator; + 'core/configuration/index': Editor_5.Host.CoreConfigurationIndex; + 'core/configuration/script/interface': Editor_5.Host.CoreConfigurationScriptInterface; + 'core/extension-roots': Editor_6.Host.CoreExtensionRoots; + 'core/launcher': Editor_6.Host.CoreLauncher; + 'core/project/index': Editor_7.Host.CoreProjectIndex; + 'core/scene/common/index': Editor_8.Host.CoreSceneCommonIndex; + 'core/scene/common/preview': Editor_8.Host.CoreSceneCommonPreview; + 'core/scene/common/reflection-probe': Editor_8.Host.CoreSceneCommonReflectionProbe; + 'core/scene/index': Editor_8.Host.CoreSceneIndex; + 'core/scene/main-process/index': Editor_8.Host.CoreSceneMainProcessIndex; + 'core/scene/main-process/rpc': Editor_8.Host.CoreSceneMainProcessRpc; + 'core/scene/runtime/resources/scene-routes': Editor_8.Host.CoreSceneRuntimeResourcesSceneRoutes; + 'core/scene/runtime/resources/scripting-routes': Editor_8.Host.CoreSceneRuntimeResourcesScriptingRoutes; + 'core/scene/runtime/resources/settings': Editor_8.Host.CoreSceneRuntimeResourcesSettings; + 'core/scripting/index': Editor_9.Host.CoreScriptingIndex; + 'global': Editor_6.Host.Global; + 'lib/simulator/simulator': Editor_10.Host.LibSimulatorSimulator; + 'server/index': Editor_6.Host.ServerIndex; + 'server/interfaces': Editor_6.Host.ServerInterfaces; + 'server/middleware/index': Editor_6.Host.ServerMiddlewareIndex; + 'server/socket': Editor_6.Host.ServerSocket; +} +declare class I18n { + _lang: string; + private _instance; + constructor(instance: i18n); + get instance(): i18n; + setLanguage(language: string): Promise; + t(key: I18nKeys, obj?: { + [key: string]: string; + }): string; + transI18nName(name: string): string; + getBundle(): { + lang: string; + data: Record>; + }; + registerLanguagePatch(language: string, patchPath: string, languageData: Record): void; +} +declare const i18n_2: I18n; +declare type I18nKeys = 'assets.title' | 'assets.description' | 'assets.deprecated_tip' | 'assets.global_readonly_tip' | 'assets.debug_mode' | 'assets.asset_d_b_pause_tips' | 'assets.asset_d_b_init_error' | 'assets.save_asset.fail.unknown' | 'assets.save_asset.fail.uuid' | 'assets.save_asset.fail.asset' | 'assets.save_asset.fail.content' | 'assets.save_asset.fail.readonly' | 'assets.save_asset_meta.fail.unknown' | 'assets.save_asset_meta.fail.uuid' | 'assets.save_asset_meta.fail.content' | 'assets.save_asset_meta.fail.readonly' | 'assets.rename_asset.fail.source' | 'assets.rename_asset.fail.include' | 'assets.rename_asset.fail.parent' | 'assets.rename_asset.warn.overwrite' | 'assets.init.no_asset_db_list' | 'assets.operation.invalid_url' | 'assets.operation.exists_url' | 'assets.operation.readonly' | 'assets.operation.overwrite' | 'assets.delete_asset.fail.unknown' | 'assets.delete_asset.fail.url' | 'assets.delete_asset.fail.unexist' | 'assets.delete_asset.fail.readonly' | 'assets.create_asset.title' | 'assets.create_asset.fail.unknown' | 'assets.create_asset.fail.type' | 'assets.create_asset.fail.url' | 'assets.create_asset.fail.exist' | 'assets.create_asset.fail.drop' | 'assets.create_asset.fail.to_url' | 'assets.create_asset.fail.uuid' | 'assets.import_asset.meta_exists' | 'assets.open_asset.preference_program_warning' | 'assets.open_asset.fail.no_asset' | 'assets.copy_asset.fail.unknown' | 'assets.copy_asset.fail.url' | 'assets.restore_asset_d_b_from_cache_in_valid.upgrade' | 'assets.restore_asset_d_b_from_cache_in_valid.no_library_path' | 'assets.preferences.log_level' | 'assets.preferences.log_level_debug' | 'assets.preferences.log_level_log' | 'assets.preferences.log_level_warn' | 'assets.preferences.log_level_error' | 'assets.preferences.ignore_glob' | 'assets.preferences.ignore_changed' | 'builder.title' | 'builder.description' | 'builder.create_user_template' | 'builder.build_config' | 'builder.build' | 'builder.compile' | 'builder.open_log_file' | 'builder.generate_engine' | 'builder.require' | 'builder.new_build_task' | 'builder.empty_task_holder' | 'builder.empty_scene' | 'builder.empty_platforms' | 'builder.reveal_in_explorer' | 'builder.view_build_config' | 'builder.recompile' | 'builder.confirm' | 'builder.use_splash_screen' | 'builder.bundle_common_chunk' | 'builder.bundle_common_chunk_tips' | 'builder.bundleCommonChunk' | 'builder.bundleCommonChunkTips' | 'builder.off' | 'builder.options.platform' | 'builder.options.name' | 'builder.options.polyfills' | 'builder.options.polyfills_tips' | 'builder.options.async_functions' | 'builder.options.async_functions_tips' | 'builder.options.core_js' | 'builder.options.core_js_tips' | 'builder.options.buildScriptTargets' | 'builder.options.buildScriptTargetsTips' | 'builder.options.remote_server_address' | 'builder.options.remote_server_address_tips' | 'builder.options.sourceMap' | 'builder.options.sourceMapTips' | 'builder.options.sourceMapsInline' | 'builder.options.standaloneSourceMaps' | 'builder.options.experimental_erase_modules' | 'builder.options.experimental_erase_modules_tips' | 'builder.options.includeBundles' | 'builder.options.build_path' | 'builder.options.debug' | 'builder.options.debugTips' | 'builder.options.mangleProperties' | 'builder.options.manglePropertiesTip' | 'builder.options.inlineEnum' | 'builder.options.inlineEnumTip' | 'builder.options.md5_cache' | 'builder.options.md5CacheTips' | 'builder.options.main_bundle_is_remote' | 'builder.options.main_bundle_compression_type' | 'builder.options.pack_autoAtlas' | 'builder.options.start_scene' | 'builder.options.startSceneTips' | 'builder.options.start_scene_asset_bundle' | 'builder.options.start_scene_asset_bundle_tips' | 'builder.options.scenes' | 'builder.options.skip_compress_texture' | 'builder.options.bin_group_config' | 'builder.options.enable_cconb_group' | 'builder.options.enable_cconb_group_tips' | 'builder.tips.enter_name' | 'builder.tips.task_name' | 'builder.tips.build_path' | 'builder.tips.build_scenes' | 'builder.tips.set_start_scene' | 'builder.tips.atlas_in_resources' | 'builder.tips.use_texture_in_atlas' | 'builder.tips.use_image_in_atlas' | 'builder.tips.task_exist' | 'builder.tips.task_busy' | 'builder.tips.platform_missing' | 'builder.tips.conflict_platform' | 'builder.tips.waiting_for_remove_task' | 'builder.tips.waiting_for_db_ready' | 'builder.tips.waiting_for_plugin_ready' | 'builder.tips.waiting_for_worker_ready' | 'builder.tips.waiting_for_data_ready' | 'builder.tips.scene_in_bundle' | 'builder.tips.create_application_template_success' | 'builder.tips.create_application_template_overwrite' | 'builder.tips.application_ejs_version' | 'builder.tips.set_splash_setting' | 'builder.tips.build_task_canceled' | 'builder.tips.pause_asset_import' | 'builder.tips.disable_platform' | 'builder.tips.disable_platform_for_build_command' | 'builder.tips.disable_register_platform_info' | 'builder.tips.platform_information_invalid' | 'builder.tips.create_template_success' | 'builder.tips.template_version_warning' | 'builder.tips.build_package_missing' | 'builder.error.build_error' | 'builder.error.build_dir_not_exists' | 'builder.error.build_path_contains_space' | 'builder.error.build_path_contains_chinese_and_symbol' | 'builder.error.can_not_empty' | 'builder.error.project_name_not_legal' | 'builder.error.package_name_not_legal' | 'builder.error.package_name_start_with_number' | 'builder.error.select_scenes_to_build' | 'builder.error.path_too_long_title' | 'builder.error.path_too_long_desc' | 'builder.error.keep_raw_texture_of_atlas' | 'builder.error.run_hooks_failed' | 'builder.error.cache_compress_texture_missing' | 'builder.error.deserialize_failed' | 'builder.error.missing_import_files' | 'builder.error.required_asset_missing' | 'builder.error.missing_asset' | 'builder.error.check_options_failed' | 'builder.error.unknown_platform' | 'builder.error.asset_import_failed' | 'builder.error.get_asset_json_failed' | 'builder.error.builder_crash' | 'builder.error.texture_compress_failed' | 'builder.error.missing_splash_tips' | 'builder.error.invalid_start_scene' | 'builder.error.missing_scenes' | 'builder.error.bundle_configs' | 'builder.error.platform_register_error' | 'builder.error.check_failed' | 'builder.error.engine_modules_config_key_missing' | 'builder.warn.no_defined_in_i18n' | 'builder.warn.no_serialized_json' | 'builder.warn.same_load_url' | 'builder.warn.atlas_in_resources' | 'builder.warn.path_not_exist' | 'builder.warn.http' | 'builder.warn.required' | 'builder.warn.no_chinese' | 'builder.warn.check_failed_with_new_value' | 'builder.warn.compress_rgb_a' | 'builder.warn.asset_bundle_is_remote_invalid' | 'builder.warn.require_mipmaps' | 'builder.warn.invalid_custom_splash' | 'builder.warn.invalid_remove_splash' | 'builder.warn.exception_remove_splash' | 'builder.warn.deprecated_tip' | 'builder.warn.resources_remote_lock_waring' | 'builder.warn.repeat_atlas_in_bundle' | 'builder.warn.engine_modules_fall_back_tip' | 'builder.warn.invalid_option_in_separate_engine' | 'builder.warn.separate_engine_with_custom_engine' | 'builder.warn.invalid_version_in_separate_engine' | 'builder.tasks.build_asset' | 'builder.tasks.build_engine' | 'builder.tasks.build_img' | 'builder.tasks.build_json' | 'builder.tasks.build_atlas' | 'builder.tasks.build_script' | 'builder.tasks.build_project_script' | 'builder.tasks.build_suffix' | 'builder.tasks.build_template' | 'builder.tasks.build_zip_bundle' | 'builder.tasks.load_script' | 'builder.tasks.sort_asset' | 'builder.tasks.build_import_map' | 'builder.tasks.sort_import_map' | 'builder.tasks.sort_asset_bundle' | 'builder.tasks.sort_image' | 'builder.tasks.sort_script' | 'builder.tasks.sort_sprite_frame' | 'builder.tasks.sort_texture' | 'builder.tasks.sort_json' | 'builder.tasks.settings.cache' | 'builder.tasks.settings.options' | 'builder.tasks.settings.design_resolution' | 'builder.tasks.settings.group' | 'builder.tasks.settings.md5' | 'builder.tasks.settings.scene' | 'builder.tasks.settings.script' | 'builder.tasks.settings.init' | 'builder.tasks.settings.macro' | 'builder.tasks.postprocess.compress' | 'builder.tasks.postprocess.save_config' | 'builder.tasks.postprocess.save_settings' | 'builder.asset_bundle.is_bundle' | 'builder.asset_bundle.bundle_name' | 'builder.asset_bundle.priority' | 'builder.asset_bundle.priority_tooltip' | 'builder.asset_bundle.compression_type' | 'builder.asset_bundle.compression_type_tooltip' | 'builder.asset_bundle.target_platform' | 'builder.asset_bundle.target_platform_tooltip' | 'builder.asset_bundle.is_remote_bundle' | 'builder.asset_bundle.remote_bundle_invalid_tooltip' | 'builder.asset_bundle.none' | 'builder.asset_bundle.none_tooltip' | 'builder.asset_bundle.subpackage' | 'builder.asset_bundle.subpackage_tooltip' | 'builder.asset_bundle.merge_dep' | 'builder.asset_bundle.merge_dep_tooltip' | 'builder.asset_bundle.merge_all_json' | 'builder.asset_bundle.merge_all_json_tooltip' | 'builder.asset_bundle.zip' | 'builder.asset_bundle.zip_tooltip' | 'builder.asset_bundle.duplicate_name_message' | 'builder.asset_bundle.duplicate_name_messaged_auto_rename' | 'builder.asset_bundle.duplicate_reserved_keyword_message' | 'builder.asset_bundle.nest_bundle' | 'builder.asset_bundle.filter_config.title' | 'builder.asset_bundle.filter_config.add' | 'builder.asset_bundle.filter_config.preview' | 'builder.asset_bundle.filter_config.add_asset' | 'builder.asset_bundle.filter_config.include' | 'builder.asset_bundle.filter_config.exclude' | 'builder.asset_bundle.filter_config.asset' | 'builder.asset_bundle.filter_config.url' | 'builder.asset_bundle.filter_config.glob' | 'builder.asset_bundle.filter_config.glob_tips' | 'builder.asset_bundle.filter_config.begin_with' | 'builder.asset_bundle.filter_config.end_with' | 'builder.asset_bundle.filter_config.contain' | 'builder.asset_bundle.filter_config.empty_config' | 'builder.asset_bundle.filter_config.preview_list' | 'builder.asset_bundle.filter_config.preview_tips' | 'builder.asset_bundle.filter_config.empty_preview_list' | 'builder.asset_bundle.empty_bundle' | 'builder.asset_bundle.bundle_build_tips' | 'builder.asset_bundle.bundle_build_platform_tips' | 'builder.asset_bundle.build_bundle' | 'builder.asset_bundle.publish_config' | 'builder.asset_bundle.build_bundle_i_n_process' | 'builder.asset_bundle.bundle_build_close_tip' | 'builder.asset_bundle.build_bundle_busy' | 'builder.asset_bundle.build_bundle_params' | 'builder.asset_bundle.bundle_config' | 'builder.asset_bundle.export_bundle_build_config' | 'builder.asset_bundle.preferred_options' | 'builder.asset_bundle.preferred_options_tips' | 'builder.asset_bundle.fallback_options' | 'builder.asset_bundle.fallback_options_tips' | 'builder.asset_bundle.platform_override' | 'builder.asset_bundle.platform_override_empty_tip' | 'builder.asset_bundle.default_config' | 'builder.asset_bundle.native' | 'builder.asset_bundle.web' | 'builder.asset_bundle.minigame' | 'builder.asset_bundle.import_config' | 'builder.asset_bundle.export_config' | 'builder.asset_bundle.preview_setting' | 'builder.asset_bundle.platform' | 'builder.asset_bundle.platform_config' | 'builder.asset_bundle.edit_config' | 'builder.asset_bundle.add_config' | 'builder.asset_bundle.delete_config' | 'builder.asset_bundle.is_remote_fallback_tips' | 'builder.asset_bundle.reset' | 'builder.asset_bundle.reset_uni' | 'builder.asset_bundle.separate_config' | 'builder.asset_bundle.all_mini_games' | 'builder.asset_bundle.uni_config' | 'builder.asset_bundle.true' | 'builder.asset_bundle.false' | 'builder.asset_bundle.overwrite' | 'builder.asset_bundle.merge' | 'builder.project.texture_compress.title' | 'builder.project.texture_compress.compress_preset' | 'builder.project.texture_compress.custom_format' | 'builder.project.texture_compress.same_config_name' | 'builder.project.texture_compress.add_config' | 'builder.project.texture_compress.edit_config_name' | 'builder.project.texture_compress.export_config' | 'builder.project.texture_compress.import_config' | 'builder.project.texture_compress.import_config_options' | 'builder.project.texture_compress.merge' | 'builder.project.texture_compress.preset_name' | 'builder.project.texture_compress.add_format' | 'builder.project.texture_compress.compress_format' | 'builder.project.texture_compress.mipmap.no_power_of_two' | 'builder.project.texture_compress.tips.require_object' | 'builder.project.texture_compress.tips.require_name' | 'builder.project.texture_compress.tips.xx_require_object' | 'builder.project.texture_compress.tips.platform_err' | 'builder.project.texture_compress.tips.texture_type_err' | 'builder.project.texture_compress.tips.options_quality_type_err' | 'builder.project.texture_compress.tips.number_quality_type_err' | 'builder.project.texture_compress.tips.import_failed' | 'builder.project.texture_compress.tips.user_preset_err' | 'builder.project.texture_compress.tips.enter_config_name_to_add' | 'builder.project.texture_compress.tips.input_config_name_to_search' | 'builder.project.splash_setting.title' | 'builder.project.splash_setting.confirm' | 'builder.project.splash_setting.settings.total_time' | 'builder.project.splash_setting.settings.display_ratio' | 'builder.project.splash_setting.settings.auto_fit' | 'builder.project.splash_setting.settings.watermark_location' | 'builder.project.splash_setting.settings.logo.title' | 'builder.project.splash_setting.settings.logo.default' | 'builder.project.splash_setting.settings.logo.none' | 'builder.project.splash_setting.settings.logo.custom' | 'builder.project.splash_setting.settings.background.title' | 'builder.project.splash_setting.settings.background.default' | 'builder.project.splash_setting.settings.background.color' | 'builder.project.splash_setting.settings.background.custom' | 'builder.project.splash_setting.settings.background.custom_tips' | 'builder.project.splash_setting.custom' | 'builder.project.splash_setting.default' | 'builder.project.splash_setting.disabled' | 'builder.project.splash_setting.watermark_location_config.top' | 'builder.project.splash_setting.watermark_location_config.bottom' | 'builder.project.splash_setting.watermark_location_config.left' | 'builder.project.splash_setting.watermark_location_config.right' | 'builder.project.splash_setting.watermark_location_config.center' | 'builder.project.splash_setting.preview' | 'builder.project.splash_setting.total_time_tips' | 'builder.project.splash_setting.display_ratio_tips' | 'builder.project.splash_setting.tips' | 'builder.project.splash_setting.select_image' | 'builder.project.splash_setting.use_default_tip' | 'builder.project.splash_setting.enable_custom_splash' | 'builder.project.splash_setting.reset' | 'builder.project.splash_setting.preview_in_browser' | 'builder.project.splash_setting.information_dialog_unusual' | 'builder.example' | 'builder.platforms.native.title' | 'builder.platforms.native.options.make' | 'builder.platforms.native.options.run' | 'builder.platforms.native.options.encrypted' | 'builder.platforms.native.options.xxtea_key' | 'builder.platforms.native.options.compress_zip' | 'builder.platforms.native.encrypt.disable_tips' | 'builder.platforms.mac.title' | 'builder.platforms.mac.error.m1_with_physic_x' | 'common.loading' | 'common.success' | 'common.error' | 'common.warning' | 'common.info' | 'common.confirm' | 'common.cancel' | 'common.ok' | 'common.yes' | 'common.no' | 'common.save' | 'common.delete' | 'common.edit' | 'common.create' | 'common.update' | 'common.refresh' | 'common.close' | 'common.open' | 'common.back' | 'common.next' | 'common.previous' | 'common.finish' | 'common.start' | 'common.stop' | 'common.pause' | 'common.resume' | 'common.deprecated_tip' | 'common.preview.device.design_resolution' | 'common.preview.device.full_screen' | 'common.preview.device.webpage_full_screen' | 'configuration.builder.common.title' | 'configuration.builder.useCache.title' | 'configuration.builder.useCache.serializeData.title' | 'configuration.builder.useCache.engine.title' | 'configuration.builder.useCache.textureCompress.title' | 'configuration.builder.useCache.autoAtlas.title' | 'configuration.builder.textureCompressConfig.title' | 'configuration.builder.textureCompressConfig.description' | 'configuration.builder.bundleConfig.title' | 'configuration.builder.bundleConfig.description' | 'configuration.builder.platform.configSuffix' | 'configuration.builder.platform.outputName.title' | 'configuration.builder.platform.outputName.description' | 'configuration.builder.platform.packageOptions.title' | 'configuration.import.title' | 'configuration.import.globList.title' | 'configuration.import.globList.description' | 'configuration.import.globList.itemTitle' | 'configuration.import.restoreAssetDBFromCache.title' | 'configuration.import.createTemplateRoot.title' | 'configuration.import.userDataTemplate.title' | 'configuration.import.userDataTemplate.description' | 'configuration.import.fbx.title' | 'configuration.import.fbx.legacyFbxImporter.title' | 'configuration.import.fbx.legacyFbxImporter.visible.title' | 'configuration.import.fbx.material.title' | 'configuration.import.fbx.material.smart.title' | 'configuration.scene.tick.title' | 'configuration.scene.tick.description' | 'configuration.script.title' | 'configuration.script.useDefineForClassFields.title' | 'configuration.script.allowDeclareFields.title' | 'configuration.script.loose.title' | 'configuration.script.guessCommonJsExports.title' | 'configuration.script.guessCommonJsExports.description' | 'configuration.script.exportsConditions.title' | 'configuration.script.sortingPlugin.title' | 'configuration.script.sortingPlugin.description' | 'configuration.script.sortingPlugin.itemTitle' | 'configuration.script.preserveSymlinks.title' | 'configuration.script.importMap.title' | 'configuration.script.previewBrowserslistConfigFile.title' | 'configuration.script.updateAutoUpdateImportConfig.title' | 'configuration.engine.dynamic.includeModules.title' | 'configuration.engine.dynamic.includeModules.description' | 'configuration.engine.dynamic.includeModules.itemTitle' | 'configuration.engine.dynamic.flags.title' | 'configuration.engine.dynamic.flags.description' | 'configuration.engine.physicsConfig.title' | 'configuration.engine.physicsConfig.gravity.title' | 'configuration.engine.physicsConfig.gravity.description' | 'configuration.engine.physicsConfig.allowSleep.title' | 'configuration.engine.physicsConfig.allowSleep.description' | 'configuration.engine.physicsConfig.sleepThreshold.title' | 'configuration.engine.physicsConfig.sleepThreshold.description' | 'configuration.engine.physicsConfig.autoSimulation.title' | 'configuration.engine.physicsConfig.autoSimulation.description' | 'configuration.engine.physicsConfig.fixedTimeStep.title' | 'configuration.engine.physicsConfig.fixedTimeStep.description' | 'configuration.engine.physicsConfig.maxSubSteps.title' | 'configuration.engine.physicsConfig.maxSubSteps.description' | 'configuration.engine.physicsConfig.useNodeChains.title' | 'configuration.engine.physicsConfig.physicsEngine.title' | 'configuration.engine.physicsConfig.physicsEngine.description' | 'configuration.engine.physicsConfig.collisionMatrix.title' | 'configuration.engine.physicsConfig.collisionMatrix.description' | 'configuration.engine.physicsConfig.defaultMaterial.title' | 'configuration.engine.physicsConfig.defaultMaterial.description' | 'configuration.engine.physicsConfig.physX.title' | 'configuration.engine.physicsConfig.physX.description' | 'configuration.engine.designResolution.title' | 'configuration.engine.designResolution.width.title' | 'configuration.engine.designResolution.height.title' | 'configuration.engine.designResolution.fitWidth.title' | 'configuration.engine.designResolution.fitHeight.title' | 'configuration.engine.designResolution.highQuality.title' | 'configuration.engine.designResolution.downloadMaxConcurrency.title' | 'configuration.engine.splashScreen.title' | 'configuration.engine.splashScreen.displayRatio.title' | 'configuration.engine.splashScreen.totalTime.title' | 'configuration.engine.splashScreen.watermarkLocation.title' | 'configuration.engine.splashScreen.watermarkLocation.options.default' | 'configuration.engine.splashScreen.watermarkLocation.options.topLeft' | 'configuration.engine.splashScreen.watermarkLocation.options.topRight' | 'configuration.engine.splashScreen.watermarkLocation.options.topCenter' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomLeft' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomCenter' | 'configuration.engine.splashScreen.watermarkLocation.options.bottomRight' | 'configuration.engine.splashScreen.autoFit.title' | 'configuration.engine.splashScreen.logo.title' | 'configuration.engine.splashScreen.background.title' | 'configuration.engine.moduleConfig.title' | 'configuration.engine.moduleConfig.noDeprecatedFeatures.title' | 'configuration.engine.moduleConfig.noDeprecatedFeatures.description' | 'configuration.engine.graphics.title' | 'configuration.engine.graphics.pipeline.title' | 'configuration.engine.graphics.pipeline.options.custom' | 'configuration.engine.graphics.pipeline.options.legacy' | 'configuration.engine.graphics.pipelineName.title' | 'configuration.engine.graphics.customPipelinePostProcess.title' | 'configuration.engine.graphics.renderPipeline.title' | 'configuration.engine.jointTextureLayout.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.itemTitle' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.textureLength.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.textureLength.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.itemTitle' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.skeleton.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.skeleton.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.title' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.description' | 'configuration.engine.jointTextureLayout.customJointTextureLayouts.contents.clips.itemTitle' | 'configuration.engine.macroConfig.title' | 'configuration.engine.macroConfig.macroCustom.title' | 'configuration.engine.macroConfig.macroCustom.description' | 'configuration.engine.macroConfig.macroCustom.itemTitle' | 'configuration.engine.macroConfig.macroCustom.key.title' | 'configuration.engine.macroConfig.macroCustom.value.title' | 'configuration.engine.layers.title' | 'configuration.engine.layers.customLayers.title' | 'configuration.engine.layers.customLayers.description' | 'configuration.engine.layers.sortingLayers.title' | 'configuration.engine.layers.sortingLayers.description' | 'configuration.engine.projectConfig.title' | 'configuration.engine.projectConfig.globalConfigKey.title' | 'configuration.engine.projectConfig.configs.title' | 'configuration.engine.projectConfig.configItem.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.value.title' | 'configuration.engine.projectConfig.noDeprecatedFeatureConfig.version.title' | 'importer.invalid_node_data' | 'importer.node' | 'importer.component' | 'importer.sharp_error' | 'importer.gltf.gltf_asset_group_mesh' | 'importer.gltf.gltf_asset_group_animation' | 'importer.gltf.gltf_asset_group_node' | 'importer.gltf.gltf_asset_group_skin' | 'importer.gltf.gltf_asset_group_sampler' | 'importer.gltf.gltf_asset' | 'importer.gltf.gltf_asset_no_name' | 'importer.gltf.unsupported_alpha_mode' | 'importer.gltf.unsupported_texture_parameter' | 'importer.gltf.texture_parameter_min_filter' | 'importer.gltf.texture_parameter_mag_filter' | 'importer.gltf.unsupported_channel_path' | 'importer.gltf.reference_skin_in_different_scene' | 'importer.gltf.disallow_cubic_spline_channel_split' | 'importer.gltf.failed_to_calculate_tangents_due_to_lack_of_normals' | 'importer.gltf.failed_to_calculate_tangents_due_to_lack_of_uvs' | 'importer.gltf.empty_morph' | 'importer.gltf.unsupported_extension' | 'importer.gltf.failed_to_load_image' | 'importer.gltf.image_uri_should_be_file_url' | 'importer.gltf.failed_to_convert_tga' | 'importer.fbx.failed_to_convert_fbx_file' | 'importer.fbx.no_available_fbx_temp_dir' | 'importer.fbx.fbx2gltf_exists_with_non_zero_code' | 'importer.fbx.fbx_gltf_conv.bad_cpu' | 'importer.fbx.fbx_gltf_conv.missing_dll' | 'importer.fbx.fbx_gltf_conv.unsupported_inherit_type' | 'importer.fbx.fbx_gltf_conv.multi_material_layers' | 'importer.fbx.fbx_gltf_conv.skin_merge_error' | 'importer.dragonbones_atlas.texture_not_imported' | 'importer.dragonbones_atlas.texture_not_found' | 'importer.script.invalid_class_name' | 'importer.script.find_class_name_from_file_name_failed' | 'importer.script.transform_failure' | 'importer.property_schema.auto_atlas.max_width' | 'importer.property_schema.auto_atlas.max_width_description' | 'importer.property_schema.auto_atlas.max_height' | 'importer.property_schema.auto_atlas.max_height_description' | 'importer.property_schema.auto_atlas.padding' | 'importer.property_schema.auto_atlas.padding_description' | 'importer.property_schema.auto_atlas.allow_rotation' | 'importer.property_schema.auto_atlas.allow_rotation_description' | 'importer.property_schema.auto_atlas.force_squared' | 'importer.property_schema.auto_atlas.force_squared_description' | 'importer.property_schema.auto_atlas.power_of_two' | 'importer.property_schema.auto_atlas.power_of_two_description' | 'importer.property_schema.auto_atlas.algorithm' | 'importer.property_schema.auto_atlas.algorithm_description' | 'importer.property_schema.auto_atlas.max_rects' | 'importer.property_schema.auto_atlas.format' | 'importer.property_schema.auto_atlas.format_description' | 'importer.property_schema.auto_atlas.png' | 'importer.property_schema.auto_atlas.jpg' | 'importer.property_schema.auto_atlas.quality' | 'importer.property_schema.auto_atlas.quality_description' | 'importer.property_schema.auto_atlas.contour_bleed' | 'importer.property_schema.auto_atlas.contour_bleed_description' | 'importer.property_schema.auto_atlas.padding_bleed' | 'importer.property_schema.auto_atlas.padding_bleed_description' | 'importer.property_schema.auto_atlas.filter_unused' | 'importer.property_schema.auto_atlas.filter_unused_description' | 'importer.property_schema.auto_atlas.remove_texture_in_bundle' | 'importer.property_schema.auto_atlas.remove_texture_in_bundle_description' | 'importer.property_schema.auto_atlas.remove_image_in_bundle' | 'importer.property_schema.auto_atlas.remove_image_in_bundle_description' | 'importer.property_schema.auto_atlas.remove_sprite_atlas_in_bundle' | 'importer.property_schema.auto_atlas.remove_sprite_atlas_in_bundle_description' | 'importer.property_schema.auto_atlas.texture_setting' | 'importer.property_schema.auto_atlas.texture_setting_description' | 'importer.property_schema.texture.use_uuid' | 'importer.property_schema.texture.use_uuid_description' | 'importer.property_schema.texture.image_uuid_or_database_uri_description' | 'importer.property_schema.texture.wrap_repeat' | 'importer.property_schema.texture.wrap_clamp_to_edge' | 'importer.property_schema.texture.wrap_mirrored_repeat' | 'importer.property_schema.texture.filter_none' | 'importer.property_schema.texture.filter_nearest' | 'importer.property_schema.texture.filter_linear' | 'importer.property_schema.image.type_raw' | 'importer.property_schema.image.type_texture' | 'importer.property_schema.image.type_normal_map' | 'importer.property_schema.image.type_sprite_frame' | 'importer.property_schema.image.type_texture_cube' | 'importer.property_schema.sprite_frame.trim_type_auto' | 'importer.property_schema.sprite_frame.trim_type_custom' | 'importer.property_schema.sprite_frame.trim_type_none' | 'importer.property_schema.sprite_frame.mesh_type_rect' | 'importer.property_schema.sprite_frame.mesh_type_polygon' | 'importer.property_schema.gltf.mesh_optimizer' | 'importer.property_schema.gltf.mesh_optimizer_description' | 'importer.property_schema.gltf.mesh_optimizer_enable' | 'importer.property_schema.gltf.mesh_optimizer_enable_description' | 'importer.property_schema.gltf.mesh_optimizer_algorithm' | 'importer.property_schema.gltf.mesh_optimizer_algorithm_description' | 'importer.property_schema.gltf.mesh_optimizer_simplify' | 'importer.property_schema.gltf.mesh_optimizer_gltfpack' | 'importer.property_schema.gltf.simplify_options' | 'importer.property_schema.gltf.simplify_options_description' | 'importer.property_schema.gltf.enable_smart_link' | 'importer.property_schema.gltf.enable_smart_link_description' | 'importer.property_schema.gltf.agressiveness' | 'importer.property_schema.gltf.agressiveness_description' | 'importer.property_schema.gltf.max_iteration_count' | 'importer.property_schema.gltf.max_iteration_count_description' | 'importer.property_schema.gltf.mount_all_animations_on_prefab_description' | 'importer.property_schema.gltf.target_ratio_description' | 'importer.property_schema.fbx.unit_conversion' | 'importer.property_schema.fbx.unit_conversion_description' | 'importer.property_schema.fbx.unit_conversion_geometry_level' | 'importer.property_schema.fbx.unit_conversion_hierarchy_level' | 'importer.property_schema.fbx.unit_conversion_disabled' | 'importer.property_schema.fbx.match_mesh_names' | 'importer.property_schema.fbx.match_mesh_names_description' | 'importer.property_schema.fbx.fbx_description' | 'importer.texture.anisotropy' | 'importer.texture.anisotropy_tip' | 'importer.texture.filter_mode' | 'importer.texture.filter_mode_tip' | 'importer.texture.minfilter' | 'importer.texture.minfilter_tip' | 'importer.texture.magfilter' | 'importer.texture.magfilter_tip' | 'importer.texture.generate_mipmaps' | 'importer.texture.generate_mipmaps_tip' | 'importer.texture.mipfilter' | 'importer.texture.mipfilter_tip' | 'importer.texture.wrap_mode' | 'importer.texture.wrap_mode_tip' | 'importer.texture.wrap_mode_s' | 'importer.texture.wrap_mode_s_tip' | 'importer.texture.wrap_mode_t' | 'importer.texture.wrap_mode_t_tip' | 'importer.texture.mode_warn' | 'importer.texture.filter_diffenent'; +declare interface IAnimationClipEvent { + reason: AnimationEventReason; + rootUuid: string; + rootPath: string; + clipUuid: string; +} +declare interface IAnimationEvents { + 'animation:state-changed': [event: IAnimationStateChangedEvent]; + 'animation:time-changed': [event: IAnimationTimeChangedEvent]; + 'animation:clip-changed': [event: IAnimationClipEvent]; + 'animation:property-committed': [event: IAnimationPropertyCommittedEvent]; +} +declare interface IAnimationPropertyCommittedEvent { + nodePath: string; + propPath: string; + source?: string; +} +declare interface IAnimationRootInfo extends IAnimationClipsInfo { + nodeTreeDump: INodeTreeItem | null; + clipDump: IAnimationClipDump | null; + time: number; + state: AnimationPlayState_2; + useBakedAnimation: boolean; +} +declare interface IAnimationStateChangedEvent { + reason: AnimationEventReason; + state: IAnimationStateInfo; +} +declare interface IAnimationStateInfo { + active: boolean; + editorType: AnimationEditorType; + mode: AnimationMode; + rootUuid: string; + rootPath: string; + clipUuid: string; + time: number; + playState: AnimationPlayState_2; + dirty: boolean; + sceneDirty: boolean; + selection: string[]; + restoreSelectionOnExit: boolean; +} +declare interface IAnimationTimeChangedEvent extends IAnimationClipEvent { + time: number; + playState: AnimationPlayState_2; +} +declare interface IAppendLightFXInputOptions { + operationId: string; + chunkBase64: string; +} +declare interface IApplyBakedCubemapOptions { + source?: IReflectionProbeSceneIdentity; + sceneUrl: string; + nodePath: string; + componentUuid: string; + cubemapUuid: string; + captureToken: string; + saveScene: boolean; + timeoutMs: number; + serverURL?: string; +} +declare type IAsset = VirtualAsset | Asset_2; +declare interface IAssetEvents { + 'asset:change': [uuid: string]; + 'asset:deleted': [uuid: string]; + 'asset-refresh': [uuid: string]; +} +declare interface IBeginLightFXBakeOptions { + sceneStats?: ILightFXSceneStats; + sceneUuid?: string; + outputUrl?: string; + transactionId?: string; + target: LightFXBakeTarget; + sceneName: string; + textureSources: ILightFXTextureSource[]; + timeoutMs: number; +} +declare interface IBeginLightFXBakeResult { + operationId: string; +} +declare interface ICameraEvents { + 'camera:mode-change': [mode: number]; + 'camera:fov-changed': [fov: number]; + 'camera:projection-changed': [projection: number]; +} +declare interface ICameraService { + init(): void; + initFromConfig(): Promise; + is2D: boolean; + focus(nodes?: string[] | null, editorCameraInfo?: any, immediate?: boolean): void; + defaultFocus(uuid: string): void; + rotateCameraToDir(dir: Vec3, rotateByViewDist: boolean): void; + changeProjection(): void; + setGridVisible(value: boolean): void; + isGridVisible(): boolean; + setCameraProperty(options: any): void; + resetCameraProperty(): void; + queryConfig(): ICameraConfig; + updateConfig(config: Partial): void; + getCameraFov(): number; + zoomUp(): void; + zoomDown(): void; + zoomReset(): void; + alignNodeToSceneView(nodes: string[]): void; + alignSceneViewToNode(nodes: string[]): void; + setGridColor(color: number[], persist?: boolean): void; + setOriginAxes2D(config: IOriginAxesConfig): void; + setOriginAxes3D(config: IOriginAxesConfig): void; + setRulerVisible(visible: boolean): void; + getCamera(): Camera | undefined; + onUpdate(deltaTime: number): void; +} +declare interface ICancelLightFXOperationOptions extends ILightFXOperationOptions { + target: LightFXBakeTarget; + transactionId?: string; +} +declare type ICapturedFaces = IReflectionProbeCapturedFaces; +declare interface IClearBakedCubemapsOptions { + source?: IReflectionProbeSceneIdentity; + sceneUrl: string; + saveScene: boolean; + timeoutMs?: number; +} +declare interface IClearBakedCubemapsResult { + sceneUrl: string; + sceneName: string; + probes: IReflectionProbeBakedDescriptor[]; + clearedCount: number; + saved: boolean; +} +declare interface IComponentEvents extends INodeEvents { + 'component:add': [Component]; + 'component:remove': [Component]; + 'component:set-property': [Component, IChangeNodeOptions]; + 'component:added': [Component]; + 'component:removed': [Component]; + 'component:before-add-component': [string, Node_2]; + 'component:before-remove-component': [Component]; +} +declare interface IComponentIdentifier { + cid: string; + path: string; + uuid: string; + name: string; + type: string; + enabled: boolean; +} +declare interface IComponentInfo extends IComponentIdentifier { + properties: { + [key: string]: IPropertyValueType; + }; + prefab: ICompPrefabInfo | null; +} +declare interface IComponentProxy extends Omit { + add(params: IAddComponentOptions): Promise; + query(params: IQueryComponentOptions): Promise; + setProperty(params: ISetPropertyOptionsInfo): Promise; +} +declare interface ICompPrefabInfo { + fileId: string; +} +declare interface ICreateDragHost { + resolveCanvasTransaction(workMode: string, canvasRequired: boolean, parent: Node_2 | null, position: Vec3 | undefined, prefabCanvasHandling?: PrefabCanvasHandling): Promise<{ + parent: Node_2 | null; + mutation: IPendingPrefabCanvasMutation | null; + }>; + collectSceneNodeUuidsForUndo(): Set | null; + beginPrefabCanvasUndoCapture(beforeUuids: Set | null): IPrefabCanvasUndoRecord[] | null; + endPrefabCanvasUndoCapture(): void; + recordCreateNodeCommand(beforeUuids: Set | null, paths: string[], records: IPrefabCanvasUndoRecord[] | null): void; +} +declare interface IEditorEvents { + 'editor:open': [scene?: any]; + 'editor:close': []; + 'editor:save': []; + 'editor:reload': [scene?: any]; +} +declare interface IEditorSessionService { + getEditorSession(): IEditorSessionSnapshot; + isCurrentEditorSession(session: IEditorSessionSnapshot): boolean; + reloadForSession(params: IReloadOptions, session: IEditorSessionSnapshot): Promise; + runForSession(session: IEditorSessionSnapshot, operation: (save: () => Promise) => Promise): Promise; +} +declare interface IEditorSessionSnapshot { + readonly uuid: string | null; + readonly generation: number; +} +declare interface IEditorTarget { + identifier: IBaseIdentifier; + instance: TEditorInstance; +} +declare interface IEngineEvents { + 'engine:update': []; + 'engine:ticked': []; +} +declare interface IExportOptions { + debug: boolean; + compressUUID: boolean; + stripDefault: boolean; + canUseCache: boolean; +} +declare interface IExtractedImagePixels { + dataBase64: string; + width: number; + height: number; + channels: number; +} +declare interface IGizmoConfig { + is2D: boolean; + is3DIcon: boolean; + iconSize: number; + transformToolName: string; + viewMode: 'view' | 'select'; + pivot: string; + coordinate: string; + toolsVisibility3d: boolean; + gridVisible: boolean; + gridColor: number[]; + originAxis2D: IOriginAxesConfig; + originAxis3D: IOriginAxesConfig; + snapConfigs?: { + position: { + x: number; + y: number; + z: number; + }; + rotation: number; + scale: number; + isPositionSnapEnabled: boolean; + isRotationSnapEnabled: boolean; + isScaleSnapEnabled: boolean; + }; + rectSnapConfig?: IRectSnapConfig; +} +declare interface IGizmoEvents { + 'gizmo:particle-bounds-visibility-changed': [event: { + componentUuid: string; + visible: boolean; + }]; + 'gizmo:tool-changed': [name: string]; + 'gizmo:coordinate-changed': []; + 'gizmo:pivot-changed': []; + 'gizmo:view-mode-changed': []; + 'gizmo:control-begin': []; + 'gizmo:control-end': []; +} +declare interface IImagePixelExtractionOptions { + rect: { + left: number; + top: number; + width: number; + height: number; + }; + rotation?: 0 | 90; +} +declare interface ILightFXBakeEvents { + 'lightfx:bake-start': [target: 'light-probe' | 'lightmap']; + 'lightfx:bake-end': [target: 'light-probe' | 'lightmap', error?: string]; +} +declare interface ILightFXBakeHostService { + queryDiagnostics?(options: ICancelLightFXOperationOptions): Promise; + queryCapabilities(): Promise; + reserveSceneOperation(options: IReserveLightFXSceneOperationOptions): Promise; + releaseSceneOperation(options: ILightFXSceneOperationToken): Promise; + resolveTextureSource(options: IResolveLightFXTextureSourceOptions): Promise; + begin(options: IBeginLightFXBakeOptions): Promise; + appendInput(options: IAppendLightFXInputOptions): Promise; + run(options: IRunLightFXBakeOptions): Promise; + commit(options: ILightFXOperationOptions): Promise; + publishLightmapAssets(options: IPublishLightmapAssetsOptions): Promise<{ + textureUrls: string[]; + }>; + rollback(options: ILightFXOperationOptions): Promise; + cancel(options?: ICancelLightFXOperationOptions): Promise<{ + cancelled: boolean; + target: LightFXBakeTarget | null; + }>; + removeLightmapAssets(options: IRemoveLightmapAssetsOptions): Promise; + queryLightmapTextureInfo(options: IQueryLightmapTextureInfoOptions): Promise; +} +declare interface ILightFXHostCapabilities { + sceneTransactionVersion: 1; + lightmapAssetVersion?: 1; + lightmapOutputDirectory?: true; + lightmapAssetCleanupVersion?: 1; + lightmapRebakeCleanupVersion?: 1; + lightmapPublicationVersion?: 1; + lightmapAuxiliaryAssetsVersion?: 1; + cancelOwnershipVersion?: 1; + diagnosticsVersion?: 1; + busy: boolean; +} +declare interface ILightFXMeshResult { + id: number; + index: number; + offset: number[]; + scale: number[]; +} +declare interface ILightFXOperationOptions { + operationId: string; +} +declare interface ILightFXProbeResult { + position: number[]; + normal: number[]; + coefficients: number[]; +} +declare interface ILightFXResult { + version: number; + meshes: ILightFXMeshResult[]; + terrains: ILightFXTerrainResult[]; + probes: ILightFXProbeResult[]; +} +declare interface ILightFXSceneOperationToken { + transactionId: string; +} +declare interface ILightFXSceneStats { + objects: number; + lights: number; + triangles: number; +} +declare interface ILightFXTerrainResult extends ILightFXMeshResult { + blockId: number; +} +declare interface ILightFXTextureSource { + uuid: string; + nativeExtension: string; + fileName: string; +} +declare interface IMainModule { + 'assetManager': typeof typedAssetManager; + 'programming': typeof _default; + 'sceneConfigInstance': typeof sceneConfigInstance; + 'i18n': typeof _default_2; + 'referenceImageFiles': typeof referenceImageFiles; + 'referenceImageStore': typeof referenceImageStore; + 'lightFXBakeHost': typeof lightFXBakeHost; + 'reflectionProbeBakeHost': typeof reflectionProbeBakeHost; +} +declare interface IMaterialPreviewInstance extends IPreviewInstance { + switchPrimitive(type: string): void; + setLightEnable(enabled: boolean): void; +} +declare interface IMessageManagerEvents extends IEditorEvents, INodeEvents, IComponentEvents, IScriptEvents, Omit, ISelectionEvents, IGizmoEvents, ICameraEvents, ISceneViewEvents, IUndoEvents, IAnimationEvents, IReferenceImageEvents, ISceneEvents { +} +declare interface IMountedChildrenInfo { + targetInfo: ITargetInfo | null; + nodes: INodeIdentifier[]; +} +declare interface IMountedComponentsInfo { + targetInfo: ITargetInfo | null; + components: IComponentIdentifier[]; +} +declare interface Importer { + version: string; + versionCode?: number; + import(asset: VirtualAsset | Asset_2): Promise; + migrations?: Migrate[]; + afterSubAssetsImport?(asset: Asset_2): Promise; + force?(asset: VirtualAsset | Asset_2): Promise; +} +declare class Importer_2 { + _name: string; + _version: string; + _versionCode: number; + _migrationHook: MigrateHook; + _migrations: Migrate[]; + get version(): string; + get versionCode(): number; + extnames: string[]; + flag: { + [name: string]: boolean; + }; + get migrations(): Migrate[]; + get migrationHook(): MigrateHook; + get name(): string; + validate(asset: VirtualAsset_2 | Asset): Promise; + force(asset: VirtualAsset_2 | Asset): Promise; + import(asset: VirtualAsset_2 | Asset): Promise; + afterSubAssetsImport?(asset: VirtualAsset_2 | Asset): Promise; + checkAwake?(asset: VirtualAsset_2 | Asset): Promise; +} +declare interface ImporterHook { + before?: (asset: IAsset) => Promise; + after?: (asset: IAsset) => Promise; +} +export declare function init(): Promise; +declare function init_2(): Promise; +declare function initLocalI18n(): Promise; +declare interface INodeCreateDragController { + begin(params: IBeginCreateDragParams): Promise; + update(params: IUpdateCreateDragParams): Promise; + commit(params: ICommitCreateDragParams): Promise; + cancel(params: ICancelCreateDragParams): Promise; + cancelActive(reason: CreateDragCancelReason): Promise; + dispose(): void; +} +declare interface INodeEvents { + 'node:before-remove': [Node_2]; + 'node:before-change': [Node_2]; + 'node:change': [Node_2, IChangeNodeOptions]; + 'node:before-add': [Node_2]; + 'node:add': [Node_2]; + 'node:added': [Node_2]; + 'node:remove': [Node_2]; + 'node:removed': [Node_2, IChangeNodeOptions]; +} +declare interface INodeIdentifier { + nodeId: string; + path: string; + name: string; +} +declare interface INodeInfo extends INodeIdentifier { + properties: INodeProperties; + components?: IComponentIdentifier[]; + children?: INodeIdentifier[]; + prefab: IPrefabInfo | null; +} +declare interface INodeProperties { + position: IVec3; + rotation: IVec3; + scale: IVec3; + mobility: MobilityMode; + layer: number; + active: boolean; +} +declare interface INodeProxy extends Omit { + createByType(params: ICreateByNodeTypeParams): Promise; + createByAsset(params: ICreateByAssetParams): Promise; + query(params?: IQueryNodeParams): Promise; + update(params: IUpdateNodeParams): Promise; +} +declare function installLightProbeNormalReset(engine: unknown): boolean; +declare type InternalServiceEventName = typeof InternalServiceEvents[keyof typeof InternalServiceEvents]; +declare const InternalServiceEvents: { + readonly EditorReloadClose: "editor:reload-close"; + readonly EditorReloadOpen: "editor:reload-open"; + readonly EditorDisposed: "editor:disposed"; +}; +declare function invalidatePreviewSettings(): void; +declare interface IOptionBase { + modeName?: string; +} +declare interface IPendingPrefabCanvasMutation { + commit(): void; + rollback(): void; +} +declare interface IPrefabCanvasMutationEffects { + commitRecord(record: IPrefabCanvasUndoRecord): void; + removeAddedUITransform(component: Component): boolean; +} +declare interface IPrefabCanvasUndoRecord { + rootNode: Node_2; + rootParent: Node_2 | null; + rootParentUuid: string | null; + rootParentPath: string; + rootSiblingIndex: number; + addedUITransform: Component | null; + previewCanvasNode: Node_2 | null; + previewCanvasCreated: boolean; + workMode: string; +} +declare interface IPrefabDetail { + name: string; + uuid: string; + data: INodeIdentifier; + optimizationPolicy: OptimizationPolicy; + persistent: boolean; +} +declare interface IPrefabEvents { +} +declare interface IPrefabInfo { + asset?: IPrefabDetail; + root?: INodeIdentifier; + instance?: IPrefabInstance; + fileId: string; + targetOverrides: ITargetOverrideDetail[]; + nestedPrefabInstanceRoots: INodeIdentifier[]; +} +declare interface IPrefabInstance { + fileId: string; + prefabRootNode?: INodeIdentifier; + mountedChildren: IMountedChildrenInfo[]; + mountedComponents: IMountedComponentsInfo[]; + propertyOverrides: IPropertyOverrideInfo[]; + removedComponents: ITargetInfo[]; +} +declare interface IPrefabService extends IServiceEvents { + createPrefabFromNode(params: ICreatePrefabFromNodeParams): Promise; + applyPrefabChanges(params: IApplyPrefabChangesParams): Promise; + revertToPrefab(params: IRevertToPrefabParams): Promise; + unpackPrefabInstance(params: IUnpackPrefabInstanceParams): Promise; + isPrefabInstance(params: IIsPrefabInstanceParams): Promise; + getPrefabInfo(params: IGetPrefabInfoParams): Promise; + unlinkPrefab(params: IUnlinkPrefabParams): Promise; + removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void; + filterChildOfPrefabAssetWhenRemoveNode(uuids: string | string[]): string[]; +} +declare interface IPreparedReflectionProbeBake { + operationId: string; + cubemapUuid: string; + cubemapUrl: string; +} +declare interface IPrepareReflectionProbeBakeOptions { + taskId?: string; + captured: IReflectionProbeCapturedFaces; + timeoutMs: number; +} +declare interface IPreviewEvents { +} +declare interface IPreviewPlayEvents { + 'preview-play:state-changed': [state: PreviewPlayState]; +} +declare interface IPropertyOverrideInfo { + targetInfo: ITargetInfo | null; + propertyPath: string[]; + value?: any; +} +declare type IPublicAnimationService = Omit; +declare interface IPublicAssetService extends Omit { +} +declare type IPublicCameraService = Pick & { + is2D: boolean; +}; +declare type IPublicComponentService = Omit; +declare interface IPublicEditorService extends Omit { +} +declare interface IPublicEngineService extends Omit { +} +declare type IPublicGizmoService = Pick; +declare type IPublicLightmapBakeService = Pick; +declare type IPublicLightProbeBakeService = Pick; +declare type IPublicNodeService = Omit; +declare type IPublicOperationService = Pick; +declare type IPublicParticleService = { + queryPlayInfo(uuid: string): Promise; + setPlaySpeed(uuid: string, speed: number): Promise; + play(): Promise; + stop(): Promise; + pause(): Promise; + restart(): Promise; +}; +declare interface IPublicPrefabService extends Omit { +} +declare type IPublicPreviewPlayService = Pick; +declare type IPublicPreviewService = Pick; +declare type IPublicRedoService = IRedoService; +declare type IPublicReferenceImageService = Pick; +declare type IPublicReflectionProbeService = Omit; +declare type IPublicSceneViewService = Pick; +declare interface IPublicScriptService extends Omit { +} +declare type IPublicSelectionService = Pick; +declare interface IPublicServiceManager { + Editor: IPublicEditorService; + Node: IPublicNodeService; + Component: IPublicComponentService; + Script: IPublicScriptService; + Asset: IPublicAssetService; + Engine: IPublicEngineService; + Prefab: IPublicPrefabService; + Selection: IPublicSelectionService; + Operation: IPublicOperationService; + Undo: IPublicUndoService; + Redo: IPublicRedoService; + Camera: IPublicCameraService; + Gizmo: IPublicGizmoService; + SceneView: IPublicSceneViewService; + Preview: IPublicPreviewService; + PreviewPlay: IPublicPreviewPlayService; + UI: IPublicUIService; + ReflectionProbe: IPublicReflectionProbeService; + ReferenceImage: IPublicReferenceImageService; + LightProbeBake: IPublicLightProbeBakeService; + LightmapBake: IPublicLightmapBakeService; + Particle: IPublicParticleService; + Terrain: IPublicTerrainService; +} +declare type IPublicTerrainService = Pick; +declare type IPublicUIService = IUIService; +declare type IPublicUndoService = Omit; +declare interface IPublishLightmapAssetsOptions extends ILightFXOperationOptions { + transactionId: string; +} +declare interface IQueryLightmapTextureInfoOptions { + uuids: string[]; + sceneUuid?: string; +} +declare interface IQueryLightmapTextureInfoResult { + textures: ILightmapTextureInfo[]; + missingTextureUuids: string[]; + ownedTextureUuids?: string[]; +} +declare interface IRectSnapConfig { + enableSnapping: boolean; + snapThreshold: number; +} +declare type IReferenceImageAuthorityMutation = { + type: 'add-and-select'; + path: string; + sceneUuid: string; +} | { + type: 'remove'; + path: string; +} | { + type: 'select'; + path: string; + sceneUuid: string; +} | { + type: 'clear-binding'; + sceneUuid: string; +} | { + type: 'set-visible'; + desiredVisible: boolean; +} | { + type: 'commit-parameters'; + sceneUuid: string; + patch: IReferenceImageParameters; +}; +declare interface IReferenceImageAuthoritySnapshot { + instanceId: string; + revision: number; + config: IReferenceImageConfig; + changed: boolean; +} +declare interface IReferenceImageAuthorityStore { + getSnapshot(): Promise; + mutate(options: IReferenceImageAuthorityMutation): Promise; +} +declare interface IReferenceImageConfig { + images: IReferenceImageConfigItem[]; + sceneBindings: Record; + desiredVisible: boolean; +} +declare interface IReferenceImageEvents { + 'reference-image:state-changed': [state: IReferenceImageState]; +} +declare interface IReferenceImageFileService { + readDataUrl(path: string): Promise; +} +declare interface IReflectionProbeBakedDescriptor extends IReflectionProbeDescriptor { + probeId: number; + cubemapUuid: string; +} +declare interface IReflectionProbeBakeHostService { + cancel(options: { + taskId: string; + }): Promise; + prepare(options: IPrepareReflectionProbeBakeOptions): Promise; + commit(options: IReflectionProbeBakeOperationOptions): Promise; + rollback(options: IReflectionProbeBakeOperationOptions): Promise; + dispose(): Promise; +} +declare interface IReflectionProbeBakeOperationOptions { + operationId: string; +} +declare interface IReflectionProbeCapturedFaces { + sceneUrl: string; + sceneName: string; + componentUuid: string; + probeId: number; + resolution: number; + fastBake: boolean; + captureToken: string; + faces: string[]; + rendererId?: string; +} +declare interface IReflectionProbeDescriptor { + nodePath: string; + componentUuid: string; +} +declare interface IReflectionProbeEvents { + 'reflection-probe:task-changed': [state: IReflectionProbeTaskState]; + 'reflection-probe:bake-start': [nodePath: string]; + 'reflection-probe:bake-end': [nodePath: string, error?: string]; + 'reflection-probe:bake-all-start': [totalCount: number]; + 'reflection-probe:bake-all-progress': [completedCount: number, totalCount: number, nodePath: string, error?: string]; + 'reflection-probe:bake-all-end': [bakedCount: number, failedCount: number, error?: string]; +} +declare interface IRemoveLightmapAssetsOptions { + transactionId?: string; + action?: 'bake' | 'clear'; + sceneUuid: string; + textureUuids: string[]; +} +declare interface IRemoveLightmapAssetsResult { + deletedTextureUuids: string[]; + retainedTextureUuids: string[]; + deletedAuxiliaryAssetUuids?: string[]; + retainedAuxiliaryAssetUuids?: string[]; + failures: Array<{ + uuid: string; + reason: string; + }>; +} +declare interface IReserveLightFXSceneOperationOptions { + target: LightFXBakeTarget; + action: 'bake' | 'clear'; +} +declare interface IResolvedLightFXTextureSource { + fileName: string; +} +declare interface IResolveLightFXTextureSourceOptions { + uuid: string; + nativeExtension: string; +} +declare interface IRunLightFXBakeOptions { + operationId: string; +} +declare interface IRunLightFXBakeResult { + result: ILightFXResult; + textureUrls: string[]; +} +export declare interface ISceneCommandProvider { + request(module: string, method: string, args?: any[], options?: SceneCommandRequestOptions): Promise; + notify?(module: string, method: string, args?: any[]): void; + isConnect?(): boolean | undefined; + dispose?(): void; +} +declare interface ISceneConfig { + tick: boolean; + camera: ICameraConfig; + gizmo: IGizmoConfig; + sceneView: ISceneViewConfig; + 'camera-infos'?: Record; + 'camera-uuids'?: string[]; + referenceImage?: IReferenceImageConfig; +} +declare interface ISceneEvents { + 'scene:light-probe-edit-mode-changed': [enabled: boolean]; + 'scene:light-probe-bounding-box-edit-mode-changed': [enabled: boolean]; + 'scene:dimension-changed': [is2D: boolean]; +} +declare interface ISceneEvents_2 { + onAddComponent?(comp: Component): void; + onRemoveComponent?(comp: Component): void; + onComponentAdded?(comp: Component, opts?: IOptionBase): void; + onComponentRemoved?(comp: Component, opts?: IOptionBase): void; +} +declare interface ISceneInfo extends IBaseIdentifier { + name: string; + prefab: IPrefabInfo | null; + children?: INodeIdentifier[]; + components?: IComponentIdentifier[]; +} +declare interface ISceneKeyboardEvent { + key: string; + keyCode: number; + code: string; + repeat: boolean; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; +} +declare interface ISceneViewConfig { + sceneLightOn: boolean; + initialModes?: Record; +} +declare interface ISceneViewEvents { + 'scene-view:light-changed': [isOn: boolean]; + 'scene-view:visibility-changed': [visible: boolean]; +} +declare interface IScriptEvents { + 'script:execution-finished': []; +} +declare function isEditorNode(node: Node_2): boolean; +declare interface ISelectionEvents { + 'selection:select': [path: string, paths: string[]]; + 'selection:unselect': [path: string, paths: string[]]; + 'selection:clear': []; +} +declare interface IServiceEvents { + onEditorOpened?(): void; + onEditorReload?(): void; + onEditorClosed?(): void; + onEditorSaved?(): void; + onNodeBeforeChanged?(node: Node_2): void; + onBeforeRemoveNode?(node: Node_2): void; + onBeforeAddNode?(node: Node_2): void; + onNodeChanged?(node: Node_2, opts: IChangeNodeOptions): void; + onBeforeNodeAdded?(node: Node_2): void; + onAddNode?(node: Node_2): void; + onRemoveNode?(node: Node_2): void; + onNodeAdded?(node: Node_2): void; + onNodeRemoved?(node: Node_2): void; + onAddComponent?(comp: Component): void; + onRemoveComponent?(comp: Component): void; + onSetPropertyComponent?(comp: Component): void; + onComponentAdded?(comp: Component): void; + onComponentRemoved?(comp: Component): void; + onBeforeChangeComponent?(node: Node_2): void; + onBeforeAddComponent?(name: string, node: Node_2): void; + onBeforeRemoveComponent?(comp: Component): void; + onAssetDeleted?(uuid: string): void; + onAssetChanged?(uuid: string): void; + onAssetRefreshed?(uuid: string): void; + onScriptExecutionFinished?(): void; + onSelectionSelect?(path: string, paths: string[]): void; + onSelectionUnselect?(path: string, paths: string[]): void; + onSelectionClear?(): void; +} +declare interface ISetPropertyOptionsInfo { + componentPath: string; + properties: { + [key: string]: null | undefined | number | boolean | string | object | Array; + }; + record?: boolean; +} +declare function isLightProbeRestoreInProgress(scene: Scene): boolean; +declare function isLightProbeTransformInProgress(scene: Scene): boolean; +declare function isPartOfNode(testNode: Node_2, rootNode: Node_2): boolean; +declare interface ISpinePreviewInstance extends IPreviewInstance { + play(): void; + pause(): void; + stop(): void; + setSkinIndex(index: number): void; + setAnimationIndex(index: number): void; + close(): void; +} +declare function isPreviewSettingsReady(startScene?: string): Promise; +declare interface IState { + fromState?: IState; + enter(opts: any): Promise; + exit(): Promise; +} +declare interface ITargetInfo { + localID: string[]; +} +declare interface ITargetOverrideDetail { + source: IComponentIdentifier | INodeIdentifier | null; + sourceInfo: ITargetInfo | null; + propertyPath: string[]; + target: INodeIdentifier | null; + targetInfo: ITargetInfo | null; +} +declare interface ITerrainEvents { + 'terrain:changed': [component: Terrain]; + 'terrain:sculpt': [node: any]; + 'terrain:block-update': []; + 'terrain:session-changed': [target: ITerrainTarget]; +} +declare interface IUIEvents { + 'ui:align-selection': [type: UIAlignType]; + 'ui:distribute-selection': [type: UIAlignType]; +} +declare interface IUndoEvents { + 'undo:changed': []; + 'dirty:changed': [dirty: boolean]; +} +declare interface IUpdateNodeParams { + path: string; + name?: string; + properties?: Partial; +} +declare interface IUpdateNodeResult { + path: string; +} +declare class LightFXBakeHost implements ILightFXBakeHostService { + private operation; + private readonly completedOperations; + private readonly diagnostics; + private sceneOperation; + private readonly releasedSceneOperations; + queryCapabilities(): Promise; + queryDiagnostics(options: ICancelLightFXOperationOptions): Promise; + private diagnosticText; + private appendLightmapLog; + private lightmapImagesStage; + reserveSceneOperation(options: IReserveLightFXSceneOperationOptions): Promise; + releaseSceneOperation(options: ILightFXSceneOperationToken): Promise; + private validateSceneOperation; + resolveTextureSource(options: IResolveLightFXTextureSourceOptions): Promise; + queryLightmapTextureInfo(options: IQueryLightmapTextureInfoOptions): Promise; + begin(options: IBeginLightFXBakeOptions): Promise; + appendInput(options: IAppendLightFXInputOptions): Promise; + run(options: IRunLightFXBakeOptions): Promise; + commit(options: ILightFXOperationOptions): Promise; + rollback(options: ILightFXOperationOptions): Promise; + publishLightmapAssets(options: IPublishLightmapAssetsOptions): Promise<{ + textureUrls: string[]; + }>; + cancel(options?: ICancelLightFXOperationOptions): Promise<{ + cancelled: boolean; + target: LightFXBakeTarget | null; + }>; + removeLightmapAssets(options: IRemoveLightmapAssetsOptions): Promise; + dispose(): Promise; + private validateBeginOptions; + private validateSceneName; + private copyTextureSources; + private resolveHostTextureSource; + private decodeBase64Chunk; + private stageLightmapAssets; + private waitForAsset; + private disableAlphaFix; + private queryAssetRoot; + private requireOperation; + private requireActiveOperation; + private validateOperationId; + private cannotCommitError; + private terminalOperationError; + private decideTerminalState; + private throwIfTerminated; + private armExpiry; + private cleanup; + private rememberCompletedOperation; +} +declare const lightFXBakeHost: LightFXBakeHost; +declare type LightFXBakeTarget = 'light-probe' | 'lightmap'; +declare class LightmapBakeService extends BaseService implements ILightmapBakeService { + queryCapabilities(): Promise; + bake(options?: ILightmapBakeOptions): Promise; + private bakeExclusive; + private cleanupPreviousBake; + queryBakeInfo(): Promise; + clearBake(options?: { + saveScene?: boolean; + deleteAssets?: boolean; + }): Promise; + private clearBakeExclusive; + private queryRemainingSceneTextureUuids; + private rootAssetUuid; + cancel(): Promise; + private querySceneUrl; + private loadOutputTextures; + private loadIndexedTexture; + private applyBakeResult; + private snapshotBindings; + private snapshotSceneBindings; + private snapshotTerrainBindings; + private clearBindings; + private restoreBindings; + private updateTerrainBinding; + private waitForAsset; + private loadTexture; + private errorMessage; +} +declare class LightProbeBakeService extends BaseService implements ILightProbeBakeService { + querySettings(): Promise; + queryCapabilities(): Promise; + bake(options?: ILightProbeBakeOptions): Promise; + private bakeExclusive; + clearBake(options?: { + saveScene?: boolean; + }): Promise<{ + probeCount: number; + }>; + private clearBakeExclusive; + cancel(): Promise; + private querySceneUrl; + private validateResult; + private applyResult; + private snapshot; + private restore; + private getSettings; + private applySettings; + private errorMessage; +} +declare interface LightProbeDataSnapshot { + data: Scene['globals']['lightProbeInfo']['data']; + nodeOrder: string[]; +} +declare interface LightProbeGroupSnapshot { + name: string; + enabled: boolean; + prefab: LightProbeGroup['__prefab']; + probes: Vec3[]; + method: number; + minPos: Vec3; + maxPos: Vec3; + nProbesX: number; + nProbesY: number; + nProbesZ: number; +} +declare function loadAny(uuid: string): Promise; +declare function loadPreviewAsset(uuid: string, label: string, options?: LoadPreviewAssetOptions): Promise; +declare interface LoadPreviewAssetOptions { + reloadAsset?: boolean; + timeoutMs?: number; +} +declare function loadSceneI18n(): Promise; +declare interface MaterialDump { + effect: string; + technique: number; + data: MaterialTechniqueDump[]; +} +declare interface MaterialEffectInfo { + uuid: string; + name: string; + hideInEditor?: boolean; + assetPath: string; +} +declare interface MaterialPassDump { + index: number; + name?: string; + phase?: string; + switch?: IProperty; + propertyIndex: IProperty; + props: IProperty[]; + defines: IProperty[]; + states: IProperty; +} +declare namespace materialService { + export { + queryAllEffects, + queryEffect, + queryMaterial, + saveMaterial, + encodeEffect, + MaterialEffectInfo, + MaterialPassDump, + MaterialTechniqueDump, + MaterialDump + } +} +declare interface MaterialTechniqueDump { + name?: string; + passes: MaterialPassDump[]; +} +declare type MessageEvent_2 = keyof IMessageManagerEvents; +declare class MessageManager { + private _timerUtil; + private _emitter; + on(event: K, listener: (...args: IMessageManagerEvents[K]) => void): void; + on(event: string, listener: (...args: any[]) => void): void; + once(event: K, listener: (...args: IMessageManagerEvents[K]) => void): void; + once(event: string, listener: (...args: any[]) => void): void; + off(event: K, listener: (...args: IMessageManagerEvents[K]) => void): void; + off(event: string, listener: (...args: any[]) => void): void; + broadcast(event: K, ...args: IMessageManagerEvents[K]): void; + broadcast(event: string, ...args: any[]): void; + clear(event?: string): void; + broadcastNodeChangeMsg(...args: any[]): void; +} +declare const messageManager: MessageManager; +declare interface Migrate { + version: string; + migrate?: Function; +} +declare interface MigrateHook { + pre(asset: Asset | VirtualAsset_2): any; + post(asset: Asset | VirtualAsset_2, num: number): any; +} +declare enum MobilityMode { + Static = 0, + Stationary = 1, + Movable = 2 +} +export declare interface MotionPreviewDesc { + motion: MotionPreviewDescNode | null; + variables: MotionPreviewVariable[]; +} +export declare type MotionPreviewDescNode = { + kind: 'clip'; + clipUuid: string | null; +} | { + kind: 'blend-1d'; + variable: string | null; + value: number; + children: { + motion: MotionPreviewDescNode | null; + threshold: number; + }[]; +} | { + kind: 'blend-2d'; + variableX: string | null; + valueX: number; + variableY: string | null; + valueY: number; + algorithm?: number; + children: { + motion: MotionPreviewDescNode | null; + threshold: { + x: number; + y: number; + }; + }[]; +} | { + kind: 'blend-direct'; + children: { + motion: MotionPreviewDescNode | null; + weight: number; + }[]; +}; +export declare interface MotionPreviewVariable { + name: string; + value: number | null; +} +declare enum NeedAnimState { + CAMERA_ORBIT = 0, + CAMERA_PAN = 1, + CAMERA_WANDER = 2, + ANIMATION_MODE = 3, + PARTICLE_SYSTEM_MODE = 4, + TERRAIN_SYSTEM_MODE = 5, + GAME_VIEW_MODE = 6 +} +declare const NODE_CONFIGS: NodeMap; +declare interface NodeConfig { + name: string; + assetUuid?: string; + canvasRequired?: boolean; + snapshot?: boolean; + nameIncrease?: boolean; + 'project-type'?: string; +} +declare class NodeManager { + emit(event: K, ...args: INodeEvents[K]): void; + emit(event: string, ...args: any[]): void; + private _previewPropertysCache; + get creatableAssetTypes(): string[]; + init(): void; + initWithScene(scene: any): void; + private registerEventListenersForCurrentSceneNodes; + onEditorOpened(): void; + onEditorClosed(): void; + private readonly NodeMgrEventHandlers; + private nodeMgrEventHandlers; + registerNodeMgrEvents(): void; + unregisterNodeMgrEvents(): void; + private readonly NodeHandlers; + private nodeHandlers; + registerEventListeners(node: Node_2): void; + unregisterEventListeners(node: Node_2): void; + onNodeTransformChanged(node: Node_2, transformBit: any): void; + onNodeSizeChanged(node: Node_2): void; + onNodeAnchorChanged(node: Node_2): void; + onNodeParentChanged(parent: Node_2, child: Node_2): void; + onLightProbeChanged(node: Node_2): void; + onLightProbeBakingChanged(node: Node_2): void; + clear(): void; + add(uuid: string, node: Node_2): void; + change(uuid: string, node: Node_2): void; + remove(uuid: string, node: Node_2): void; + query(uuid: string | undefined): Node_2 | null; + getPathByUuid(uuid: string): string; + queryUuids(): string[]; + queryDump(uuid: string): Promise; + queryDumpAtAll(uuid: string): Promise; + queryNodesByAssetUuid(uuid: string): string[]; + queryNodesMissAsset(): Promise; + previewSetNodeProperty(uuid: string, path: string, dump: IProperty): Promise; + cancelPreviewSetNodeProperty(uuid: string, path: string): Promise; + setProperty(uuid: string, path: string, dump: IProperty, record?: boolean): Promise; + resetProperty(uuid: string, path: string): Promise; + updatePropertyFromNull(uuid: string, path: string): Promise; + resetNode(uuid: string): Promise; + setNodeAndChildrenLayer(uuid: string, dump: any): Promise; + moveArrayElement(uuid: string, path: string, target: number, offset: number): boolean; + removeArrayElement(uuid: string, path: string, index: number): boolean; + copy(uuids: string | string[]): string[]; + getCopiedUuids(): string[]; + duplicate(uuids: string | string[]): string[]; + paste(target: string | null | undefined, uuids: string | string[], keepWorldTransform?: boolean): string[]; + setParent(parent: string, uuids: string | string[], keepWorldTransform?: boolean): string[]; + generateAvailableName(name: string, parentUuid?: string): string; + createNodeFromStash(parentUuid: string | null | undefined, name: any, stashUuid: string | null, keepWorldTransform?: boolean, keepLayer?: boolean): undefined | string; + ensureUITransformComponent(node: Node_2): void; + restorePrefab(uuid: string, assetUuid: string): Promise; + private _walkNode; + baseRemoveNode(node: Node_2, keepWorldTransform?: boolean): void; + removeNode(uuids: string | string[], keepWorldTransform?: boolean): void; + changeNodeLock(uuids: string | string[], locked: boolean, loop: boolean): void; + canRemoveOrCopy(uuids: string[]): string[]; + addComponentAt(node: Node_2, comp: Component, index: number): boolean; +} +declare const nodeManager: NodeManager; +declare interface NodeMap { + [key: string]: NodeConfig[]; +} +declare class NodeService extends BaseService implements INodeService { + private readonly _undo; + private _prefabCanvasUndoRecords; + private _prefabCanvasUndoBeforeNodeUuids; + private readonly _prefabCanvasMutationEffects; + private readonly _preflightTokens; + private _preflightTokenSequence; + private _createDrag; + private getCreateDrag; + beginCreateDrag(params: IBeginCreateDragParams): Promise; + updateCreateDrag(params: IUpdateCreateDragParams): Promise; + commitCreateDrag(params: ICommitCreateDragParams): Promise; + cancelCreateDrag(params: ICancelCreateDragParams): Promise; + serialize(params: ISerializeNodesParams): Promise; + createBySerializedData(params: ICreateBySerializedDataParams): Promise; + createByType(params: ICreateByNodeTypeParams): Promise; + createByAsset(params: ICreateByAssetParams): Promise; + preflightCreate(params: ICreateByNodeTypeParams | ICreateByAssetParams): Promise; + private _resolveTypeCreateOptions; + private _resolveAssetIdentity; + private _resolveAssetPreflightTarget; + private _getCreatePathPreflight; + private _getCanvasContext; + private _resolveCreatePreflight; + private _createPreflightToken; + private _validatePreflightToken; + private _sameResolvedCreateIdentity; + private _samePreflightResult; + private _getPreflightRequestKey; + private _getAnchoredCreateParent; + private _getAnchoredCreateTarget; + private _getAnchoredPreflightIdentity; + private _insertAtAnchoredTarget; + _createNode(assetUuid: string | null, canvasNeeded: boolean, checkUITransform: boolean, params: ICreateByNodeTypeParams | ICreateByAssetParams, assetType?: string, expectedAssetCanvasRequired?: boolean, assetName?: string): Promise; + private _getOrCreateNodeByPath; + private _validateCreateParams; + private _validateRequestedNodeName; + private _validateRequestedNodePath; + private _ensurePathExists; + delete(params: IDeleteNodeParams): Promise; + query(params?: IQueryNodeParams): Promise; + queryNodeTree(params: IQueryNodeTreeParams): Promise; + queryNodesByAssetUuid(uuid: string): string[]; + queryNodesMissAsset(): Promise; + checkCanvasRequired(workMode: string, canvasRequiredParam: boolean | undefined, parent: Node_2 | null, position: Vec3 | undefined, prefabCanvasHandling?: PrefabCanvasHandling): Promise; + private _resolveCanvasRequired; + private _resolveCanvasRequiredTransaction; + private ensurePrefabRootUITransform; + private _createPrefabCanvasUndoRecord; + private _pushPrefabCanvasUndoRecord; + onEditorOpened(): void; + onEditorClosed(): void; + onEditorDisposed(): void; + previewSetProperty(options: ISetPropertyOptions): Promise; + cancelPreviewSetProperty(options: ISetPropertyOptions): Promise; + setProperty(options: ISetPropertyOptions): Promise; + reset(path: string): Promise; + resetProperty(options: ISetPropertyOptions): Promise; + private _collectSceneNodeUuidsForUndo; + private _getCreateRootPathForUndo; + private _beginPrefabCanvasUndoCapture; + private _endPrefabCanvasUndoCapture; + private _recordCreateNodeCommand; + private _recordPrefabCanvasUndoCommands; + private _captureAddComponentCommand; + private _captureReparentSnapshotsForUndo; + private _captureNodeSnapshotsForUndo; + private _getNodePathByUuid; + updatePropertyFromNull(options: ISetPropertyOptions): Promise; + setNodeAndChildrenLayer(options: ISetPropertyOptions): Promise; + getPathByUuid(uuid: string): string; + setParent(params: ISetParentParams): Promise; + reorder(params: IReorderParams): Promise; + private _cutUuids; + copy(params: ICopyParams): Promise; + paste(params: IPasteParams): Promise; + duplicate(params: IDuplicateParams): Promise; + cut(params: ICutParams): Promise; + queryClipboardState(): Promise; + moveArrayElement(params: IMoveArrayElementParams): Promise; + removeArrayElement(params: IRemoveArrayElementParams): Promise; + changeNodeLock(params: IChangeNodeLockParams): Promise; +} +declare function normalizeAnimationPropertyCommitPath(propPath: string): string; +declare function normalizeReferenceImageConfig(value: unknown): IReferenceImageConfig; +declare enum OperationPriority { + Preview = 999, + Gizmo = 99, + Camera = 98 +} +declare enum OptimizationPolicy { + AUTO = 0, + SINGLE_INSTANCE = 1, + MULTI_INSTANCE = 2 +} +declare class ParticleService extends BaseService> implements IParticleService { + private _selectedUUIDs; + private _stoppedSet; + private _getSelectedParticleSystemComponents; + onSelectionSelect(path: string, paths: string[]): void; + onSelectionUnselect(path: string, paths: string[]): void; + onSelectionClear(): void; + onComponentAdded(comp: Component): void; + onEditorDisposed(): void; + queryPlayInfo(uuid: string): { + speed: any; + time: number; + particle: any; + isPlaying: boolean; + } | null; + setPlaySpeed(uuid: string, speed: number): void; + play(): void; + stop(): void; + pause(): void; + restart(): void; + private _findComponentByUuid; +} +declare class PrefabService extends BaseService implements IPrefabService { + private _softReload; + private _undo; + private _utils; + init(): void; + createPrefabFromNode(params: ICreatePrefabFromNodeParams): Promise; + applyPrefabChanges(params: IApplyPrefabChangesParams): Promise; + revertToPrefab(params: IRevertToPrefabParams): Promise; + unpackPrefabInstance(params: IUnpackPrefabInstanceParams): Promise; + isPrefabInstance(params: IIsPrefabInstanceParams): Promise; + unlinkPrefab(params: IUnlinkPrefabParams): Promise; + getPrefabInfo(params: IGetPrefabInfoParams): Promise; + onEditorOpened(): void; + onEditorDisposed(): void; + onNodeRemoved(node: Node_2): void; + onNodeChangedInGeneralMode(node: Node_2, opts: IChangeNodeOptions, root: Node_2 | Scene | null): void; + onAddNode(node: Node_2): void; + onNodeAdded(node: Node_2): void; + onNodeChanged(node: Node_2, opts?: IChangeNodeOptions): void; + onSetPropertyComponent(comp: Component, opts?: IChangeNodeOptions): void; + removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void; + checkToRemoveTargetOverride(source: Node_2 | Component, root: Node_2 | Scene | null): void; + createPrefabAssetFromNode(nodeUUID: string, url: string, options?: { + overwrite: boolean; + }): Promise; + linkNodeWithPrefabAsset(nodeUUID: string | Node_2, assetUuid: string | any): Promise; + generatePrefabDataFromNode(nodeUUID: string | Node_2): { + prefabData: string; + clearedReference: any; + } | null; + revertPrefab(nodeUUID: Node_2 | string): Promise; + getUnlinkNodeUuids(uuid: string, removeNested?: boolean): string[]; + unWrapPrefabInstance(nodeUUID: string, removeNested?: boolean): boolean; + unWrapPrefabInstanceInPrefabMode(nodeUUID: string | Node_2, removeNested?: boolean): boolean; + applyPrefab(nodeUUID: string): Promise; + preserveUndoHistoryForPrefabReload(assetUuid: string, editorUuid?: string | null): void; + cancelPreserveUndoHistoryForPrefabReload(assetUuid: string): void; + onAddComponent(comp: Component): void; + onComponentAdded(comp: Component): void; + onRemoveComponentInGeneralMode(comp: Component, rootNode: Node_2 | Scene | null): void; + onComponentRemovedInGeneralMode(comp: Component, rootNode: Node_2 | Scene | null): void; + revertRemovedComponent(nodeUUID: string, fileID: string): Promise; + applyRemovedComponent(nodeUUID: string, fileID: string): Promise; + onAssetChanged(uuid: string): Promise; + onAssetDeleted(uuid: string): Promise; + revert(nodeUuid: string): void; + sync(nodeUuid: string): void; + createNodeFromPrefabAsset(asset: any): Node_2 | null; + filterChildOfAssetOfPrefabInstance(uuids: string | string[], operationTips: string): string[]; + filterPartOfPrefabAsset(uuids: string | string[], operationTips: string): string[]; + filterChildOfPrefabAssetWhenRemoveNode(uuids: string | string[]): string[]; + filterChildOfPrefabAssetWhenSetParent(uuids: string | string[]): string[]; + canModifySibling(uuid: string, target: number, offset: number): boolean; + filterPartOfPrefabAssetWhenCreateComponent(uuids: string | string[]): string[]; + filterPartOfPrefabAssetWhenRemoveComponent(uuids: string | string[]): string[]; + findPathWithRule(root: Node_2, rule: Function): string[]; +} +declare class PreviewNotReadyError extends Error { + constructor(message?: string); +} +declare class ProcessRPC> { + private handlers; + private callbacks; + private msgId; + private process; + private onMessageBind; + private onDisconnectBind; + private serverUrl; + private isWebMode; + attach(proc: NodeJS.Process | ChildProcess): void; + setWebTransport(baseUrl: string): void; + register(handler: Record): void; + dispose(): void; + isConnect(): boolean | undefined; + private listen; + private onMessage; + private reply; + request(module: K, method: M, ...rest: Parameters extends [] ? [args?: [], options?: RequestOptions] : [args: Parameters, options?: RequestOptions]): Promise>>; + executeLocal(module: K, method: M, args: any[]): Promise>>; + notify(module: K, method: M, args?: Parameters): void; +} +declare function queryAllEffects(): Promise>; +declare function queryCanvasRequiredByAsset(info: { + uuid: string; + type?: string; + workMode?: string; +}): Promise; +declare function queryEffect(effectNameOrUuid: string): Promise; +declare function queryMaterial(uuidOrUrlOrPath: string): Promise; +declare function queryPropertyObjectOperationCapabilities(instance: any, rootDump?: IProperty): Record; +declare function queryRegisteredService(name: string): T | null; +declare function querySerializedData(uuidOrUrlOrPath: string): Promise; +declare class RedoService extends BaseService> implements IRedoService { + redo(options?: IUndoOperationOptions): Promise; + canRedo(options?: IUndoOperationOptions): boolean; +} +declare const referenceImageFiles: ReferenceImageFileService; +declare class ReferenceImageFileService implements IReferenceImageFileService { + readDataUrl(filePath: string): Promise; +} +declare class ReferenceImageService extends BaseService implements IReferenceImageService { + private config; + private currentSceneUuid; + private canvasNode; + private imageNode; + private sprite; + private spriteFrame; + private loadedPath; + private missingPaths; + private error; + private authorityRevision; + private authorityInstanceId; + private authorityApplyQueue; + private loadGeneration; + private activeInteractionId; + private interactionWatermark; + private previewPatch; + init(): Promise; + getState(): Promise; + addAndSelect(options: IReferenceImagePathOptions): Promise; + remove(options: IReferenceImagePathOptions): Promise; + select(options: IReferenceImagePathOptions): Promise; + clearBinding(): Promise; + setVisible(options: IReferenceImageVisibilityOptions): Promise; + refresh(): Promise; + previewParameters(options: IReferenceImagePreviewOptions): Promise; + commitParameters(options: IReferenceImageCommitOptions): Promise; + cancelPreview(options: IReferenceImageCancelOptions): Promise; + onEditorOpened(): void; + onEditorClosed(): void; + private onDimensionChanged; + private handleDimensionChanged; + syncFromAuthority(publish?: boolean): Promise; + private pullAuthoritySnapshot; + private reconcileCurrentEditor; + private reconcileRuntime; + private createRuntimeStateKey; + private loadBoundImage; + private createSpriteFrameForPath; + private readDataUrl; + private createSpriteFrame; + private ensureNodes; + private replaceSpriteFrame; + private clearRuntime; + private applyCurrentParameters; + private applyVisibility; + private computeVisibility; + private createState; + private getCurrentPath; + private requireCurrentScene; + private requireCurrentImage; + private getCurrentParameters; + private mutateAuthority; + private enqueueAuthoritySnapshot; + private applyAuthoritySnapshot; + private publishState; + private invalidatePreview; + private closeInteraction; + private validatePath; + private validateInteractionId; + private validateParameters; + private is2D; + private getEditorSession; + private isSessionCurrent; +} +declare class ReferenceImageStore implements IReferenceImageAuthorityStore { + private readonly instanceId; + private revision; + private mutationQueue; + getSnapshot(): Promise; + mutate(options: IReferenceImageAuthorityMutation): Promise; + private mutateLatest; + private applyMutation; + private createSnapshot; +} +declare const referenceImageStore: ReferenceImageStore; +declare class ReflectionProbeBakeHost implements IReflectionProbeBakeHostService { + private operation; + private cmftProcess; + private preparing; + private preparingTaskId?; + private cancelled; + prepare(options: IPrepareReflectionProbeBakeOptions): Promise; + cancel(options: { + taskId: string; + }): Promise; + commit(options: IReflectionProbeBakeOperationOptions): Promise; + rollback(options: IReflectionProbeBakeOperationOptions): Promise; + dispose(): Promise; + private requireOperation; + private finish; + private validateCapturedFaces; + private writeFaces; + private runCmft; + private resolveCmftExecutable; + private prepareMeta; + private replaceOutput; + private cleanupLegacyBackupMetas; + private cleanupLegacyWorkingFiles; + private ensureConvolution; + private hasCompleteConvolution; + private waitForTextureCubeImport; + private waitForTextureCube; + private assertBeforeDeadline; + private delay; + private removeWithRetry; +} +declare const reflectionProbeBakeHost: ReflectionProbeBakeHost; +declare class ReflectionProbeService extends BaseService implements IReflectionProbeService { + private _revision; + private _task; + private _baking; + private _cancelRequested; + private _taskReady?; + private _batchProbes?; + private _batchSelection?; + private _idleTask; + private _publish; + startBake(options: IReflectionProbeBakeAllOptions): Promise; + private _validateSelection; + cancelBake(options: IReflectionProbeCancelOptions): Promise; + private _assertNotCancelled; + getTaskState(source?: IReflectionProbeSceneIdentity): Promise; + private readonly _runtimeId; + getSceneIdentity(): Promise; + private _validateTaskSource; + private _getSceneIdentity; + assertSceneIdentity(source: IReflectionProbeSceneIdentity): void; + bake(options: IReflectionProbeBakeOptions): Promise; + bakeAll(options?: IReflectionProbeBakeAllOptions): Promise; + clearAll(options?: IReflectionProbeClearOptions): Promise; + private _bakeOne; + private _bakeAll; + private _clearAll; + listBakeableProbes(): IReflectionProbeDescriptor[]; + listBakedProbes(): { + sceneName: string; + probes: IReflectionProbeBakedDescriptor[]; + }; + clearBakedCubemaps(options: IClearBakedCubemapsOptions): Promise; + capturePixels(nodePath: string, timeoutMs?: number, componentUuid?: string, source?: IReflectionProbeSceneIdentity): Promise; + applyBakedCubemap(options: IApplyBakedCubemapOptions): Promise<{ + applied: true; + saved: boolean; + }>; + private _validateCapturedFaces; + private _createCaptureToken; + private _queryCurrentSceneUrl; + private _assertCurrentScene; + private _isUnknownRemoteApplyState; + private _isBatchFatalError; + private _runExclusive; + private _errorMessage; + private _resolveGeneratedProbeAssets; + private _waitForCapture; + private _getNodeByExactPath; + private _findProbeByUuid; + private _waitForEndFrame; + private _readPixels; + private _flipImage; + private _encodeBase64; + private _notifyCubemapChanged; + private _loadTextureCube; + private _assertBeforeDeadline; + private _assertClearBeforeDeadline; + private _delay; +} +declare function refreshAssetBundles(serverURL?: string): Promise; +declare function register(name?: string): ClassDecorator; +declare function registerNodeCreateDragFactory(value: Factory): () => void; +declare function registerTerrainSessionResolver(resolve: (terrain: Terrain) => TerrainSession | null): () => void; +declare function registerViewUpdate(update: (dt: number) => void): () => void; +declare function reloadLocalI18n(): Promise; +declare function removePrefabPreviewCanvasNode(previewCanvasNode: Node_2): void; +declare function removePreviewAssetCache(uuid: string): void; +declare interface RequestOptions { + timeout?: number; +} +export declare function resetCommandProvider(): void; +declare function restoreLightProbeData(scene: Scene, snapshot: LightProbeDataSnapshot): void; +declare function restoreLightProbeGroup(component: Component, snapshot: LightProbeGroupSnapshot): void; +declare function restorePrefabRoot(rootNode: Node_2, parent: Node_2 | null, siblingIndex: number): void; +declare const Rpc: RpcProxy; +declare const Rpc_2: RpcProxy_2; +declare class RpcProxy implements SceneRpcClient { + private commandProvider; + private commandProviderRegistration; + private hostLocalExecutor; + private sharedSession; + getSharedSession(): SceneSessionCoordinator; + publishSceneEvent(event: string): void; + getInstance(): SceneRpcClient; + isConnect(): boolean | undefined; + startup(prc: ChildProcess | NodeJS.Process): SceneCommandProviderRegistration_2; + startup(prc?: undefined): undefined; + setCommandProvider(provider: ISceneCommandProvider_2): SceneCommandProviderRegistration_2; + resetCommandProvider(): void; + request(module: K, method: M, ...rest: Parameters> extends [] ? [args?: [], options?: SceneCommandRequestOptions_2] : [args: Parameters>, options?: SceneCommandRequestOptions_2]): Promise>>>; + notify(module: K, method: M, args?: Parameters>): void; + executeLocal(module: string, method: string, args?: any[]): Promise; + dispose(): void; + private ensureHostLocalExecutor; + private disposeCommandProvider; +} +declare class RpcProxy_2 { + private rpcInstance; + private webServerUrl; + getInstance(): ProcessRPC; + getWebServerUrl(): string | undefined; + startup(options?: { + serverURL: string; + }): Promise; + dispose(): void; +} +declare function saveMaterial(uuidOrUrlOrPath: string, dump: MaterialDump): Promise; +declare function saveSerializedData(uuidOrUrlOrPath: string, patch: SerializedAssetPatch): Promise; +declare const Scene_2: { + ReferenceImage: IPublicReferenceImageService; + LightProbeBake: IPublicLightProbeBakeService; + LightmapBake: IPublicLightmapBakeService; + Particle: IPublicParticleService; + Node: INodeProxy; + Component: IComponentProxy; + ReflectionProbe: IPublicReflectionProbeService; + worker: SceneWorker; + createPrefabFromNode(params: ICreatePrefabFromNodeParams): Promise; + unpackPrefabInstance(params: IUnpackPrefabInstanceParams): Promise; + getPrefabInfo(params: IGetPrefabInfoParams): Promise; + applyPrefabChanges: (params: IApplyPrefabChangesParams) => Promise; + revertToPrefab: (params: IRevertToPrefabParams) => Promise; + isPrefabInstance: (params: IIsPrefabInstanceParams) => Promise; + init: () => Promise; + repaintInEditMode: () => Promise; + assetChanged: (uuid: string) => Promise; + assetDeleted: (uuid: string) => Promise; + investigatePackerDriver: () => Promise; + loadScript: () => Promise; + removeScript: () => Promise; + scriptChange: () => Promise; + queryScriptCid: (uuid: string) => Promise; + queryScriptName: (uuid: string) => Promise; + open(params: IOpenOptions): Promise; + queryCurrent(): Promise; + close: (params: ICloseOptions) => Promise; + save: (params: ISaveOptions) => Promise; + create: (params: ICreateOptions) => Promise; + reload: (params: IReloadOptions) => Promise; + hasOpen: () => Promise; + querySceneSerializedData: () => Promise; +}; +export declare namespace Scene_3 { + export { + ReferenceImageService, + LightProbeBakeService, + LightmapBakeService, + register, + getServiceAll, + queryRegisteredService, + ServiceName, + Service, + EditorService, + NodeService, + ScriptService, + AssetService, + TerrainService, + IOptionBase, + ISceneEvents_2 as ISceneEvents, + ComponentService, + EngineService, + NeedAnimState, + AnimationService, + PrefabService, + SelectionService, + UndoService, + RedoService, + ParticleService, + ReflectionProbeService, + globalEventEmitter, + GlobalEventManager, + ServiceEvents + } +} +export declare namespace SceneAnimationPropertyCommitEvent { + export { + normalizeAnimationPropertyCommitPath, + broadcastAnimationPropertyCommitted + } +} +export declare interface SceneCommand { + module: string; + method: string; + args?: unknown[]; +} +export declare interface SceneCommandProviderRegistration { + dispose(): void; +} +export declare interface SceneCommandRequestOptions { + timeout?: number; +} +export declare interface SceneCommandResult { + value: unknown; + version: SceneVersion; +} +export declare namespace SceneCommon { + export { + SceneReadyChannel, + SceneProcessEventTag, + INodeProperties, + IUpdateNodeParams, + IUpdateNodeResult, + INodeIdentifier, + INodeInfo, + IComponentIdentifier, + IComponentInfo, + ISetPropertyOptionsInfo, + ISceneInfo, + OptimizationPolicy, + IPrefabInstance, + IMountedChildrenInfo, + IPropertyOverrideInfo, + ITargetInfo, + IMountedComponentsInfo, + ITargetOverrideDetail, + IPrefabDetail, + IPrefabInfo, + INodeTreeComponent, + INodeTreeItem, + IQueryNodeTreeParams, + SerializedNodeData, + ISerializeNodesParams, + ICreateBySerializedDataParams, + NodeType, + PrefabCanvasHandling, + ICreateNodePreflightResult, + INodeDumpOptions, + IQueryNodeParams, + IPrefab, + INode, + IDeleteNodeParams, + IDeleteNodeResult, + IClipboardState, + ISetParentParams, + IReorderParams, + ICopyParams, + IPasteParams, + IDuplicateParams, + ICutParams, + IMoveArrayElementParams, + IRemoveArrayElementParams, + IChangeNodeLockParams, + ICreateByNodeTypeParams, + ICreateByAssetParams, + ICreateDragItem, + ICreateDragPointer, + IBeginCreateDragParams, + IUpdateCreateDragParams, + ICommitCreateDragParams, + CreateDragCancelReason, + ICancelCreateDragParams, + ICreateDragConfirmation, + CreateDragSession, + CreateDragErrorCode, + CreateDragError, + CreateDragResult, + BeginCreateDragResult, + UpdateCreateDragResult, + CommitCreateDragResult, + CancelCreateDragResult, + IChangeNodeOptions, + INodeService, + NodeEventType, + MobilityMode, + INodeEvents, + IPublicNodeService, + EventSourceType, + BUILTIN_NODE_CREATE_TARGETS_2 as BUILTIN_NODE_CREATE_TARGETS, + BuiltinNodeCreateEntryId_2 as BuiltinNodeCreateEntryId, + IPrefabEvents, + IPublicPrefabService, + IPrefabService, + ICreatePrefabFromNodeParams, + IApplyPrefabChangesParams, + IRevertToPrefabParams, + IUnpackPrefabInstanceParams, + IIsPrefabInstanceParams, + IGetPrefabInfoParams, + IUnlinkPrefabParams, + ITargetOverrideInfo, + PrefabState, + IPrefabStateInfo, + ICompPrefabInfo, + TEditorEntity, + IEditorService, + TEditorInstance, + IEditorEvents, + IEditorTarget, + IPublicEditorService, + SCENE_TEMPLATE_TYPE, + TSceneTemplateType, + CREATE_TYPES, + ICreateType, + ReloadResult, + IBaseIdentifier, + ICreateOptions, + ISaveOptions, + IOpenOptions, + IReloadOptions, + ICloseOptions, + IScene, + IScriptService, + IScriptEvents, + IPublicScriptService, + IComponent, + IAddComponentOptions, + IRemoveComponentOptions, + IRemovedComponentInfo, + IQueryComponentOptions, + IRecalculateLODGroupBoundsOptions, + ILODGroupBoundsResult, + IInsertLODOptions, + IEraseLODOptions, + IQueryLODGroupRelativeHeightOptions, + ILODGroupLevelsResult, + ISetPropertyOptions, + IExecuteComponentMethodOptions, + Polygon2DPointsSource, + IRegeneratePolygon2DPointsOptions, + IRegeneratePolygon2DPointsResult, + IQueryClassesOptions, + IComponentService, + IComponentEvents, + IPublicComponentService, + IAssetService, + IAssetEvents, + IPublicAssetService, + ICustomLayerConfig, + IEngineService, + IEngineEvents, + IPublicEngineService, + AnimationMode, + AnimationEditorType, + AnimationPlayOperation, + IAnimationValue, + IAnimationPropertyType, + IAnimationKeyValueDump, + IAnimationCurveKeyData, + IAnimationCurveKeyDump, + IAnimationCurveChannelDump, + IAnimationCurveDump, + IAnimationTargetOptions, + IAnimationEnterOptions, + IAnimationExitOptions, + IAnimationTimeOptions, + IAnimationQueryClipOptions, + IAnimationQueryPropertyValueAtFrameOptions, + IAnimationQueryAuxiliaryCurveValueAtFrameOptions, + IAnimationSetTimeOptions, + IAnimationPlayStateOptions, + IAnimationEditClipOptions, + IAnimationRootResult, + IAnimationClipMenuItem, + IAnimationEventDump, + IAnimationEmbeddedPlayable, + IAnimationEmbeddedPlayerDump, + IAnimationEmbeddedPlayerGroup, + IAnimationAuxiliaryKeyDump, + IAnimationAuxiliaryCurveDump, + IAnimationClipDump, + IAnimationClipsInfo, + IAnimationPropertyInfo, + IAnimationOperation, + IAnimationOperationOptions, + IAnimationOperationResult, + IAnimationSaveOptions, + IAnimationService, + AnimationPlayState_2 as AnimationPlayState, + AnimationEventReason, + IAnimationRootInfo, + IAnimationStateInfo, + IAnimationStateChangedEvent, + IAnimationClipEvent, + IAnimationTimeChangedEvent, + IAnimationPropertyCommittedEvent, + IAnimationEvents, + IPublicAnimationService, + ISelectionService, + IPublicSelectionService, + ISelectionEvents, + IOperationService, + OperationEvent, + ISceneMouseEvent, + ISceneKeyboardEvent, + OperationPriority, + IPublicOperationService, + IUndoScope, + IUndoCommandMeta, + IUndoRedoResult, + IUndoOperationOptions, + IUndoCheckpoint, + IUndoPushWithPreviousOptions, + IUndoCommand, + IUndoGroupOptions, + IUndoBeginOptions, + IUndoService, + IRedoService, + IPublicUndoService, + IPublicRedoService, + IUndoEvents, + ICameraConfig, + IOriginAxesConfig, + ICameraService, + IPublicCameraService, + ICameraEvents, + IRectSnapConfigData, + IGizmoService, + IPublicGizmoService, + IGizmoEvents, + ISceneViewService, + IPublicSceneViewService, + ISceneViewEvents, + IPreviewInstance, + IPreviewService, + MotionPreviewDescNode_2 as MotionPreviewDescNode, + MotionPreviewVariable_2 as MotionPreviewVariable, + MotionPreviewDesc_2 as MotionPreviewDesc, + IMotionPreviewService, + IMaterialPreviewInstance, + ISpinePreviewInstance, + IPublicPreviewService, + IPreviewEvents, + PreviewPlayState, + IPreviewPlayStartOptions, + IPreviewPlayService, + IPreviewPlayEvents, + IPublicPreviewPlayService, + UIAlignType, + IUIService, + IPublicUIService, + IUIEvents, + IReflectionProbeSceneIdentity, + IReflectionProbeBakeOptions, + IReflectionProbeBakeResult, + IReflectionProbeBakeAllOptions, + IReflectionProbeBakeFailure, + IReflectionProbeBakeAllResult, + IReflectionProbeClearOptions, + IReflectionProbeClearFailure, + IReflectionProbeClearResult, + IReflectionProbeCancelOptions, + IReflectionProbeTaskState, + IReflectionProbeService, + IReflectionProbeEvents, + IPublicReflectionProbeService, + ITerrainTarget, + TerrainEditorMode, + TerrainSculptTool, + TerrainBrushKind, + ITerrainManageState, + ITerrainLayerState, + ITerrainLayerPatch, + ITerrainBrushState, + ITerrainPaintBrushState, + ITerrainSculptState, + ITerrainPaintState, + ITerrainEditorState, + ITerrainSnapshot, + ITerrainInvalidSnapshot, + TerrainReadResult, + ITerrainBrushPatch, + ITerrainPaintBrushPatch, + ITerrainSculptSessionPatch, + ITerrainPaintSessionPatch, + ITerrainBlockLayerSlot, + ITerrainBlockData, + ITerrainBlockSnapshot, + TerrainBlockReadResult, + ITerrainService, + TerrainLayerErrorCode, + TerrainLayerError, + IPublicTerrainService, + ITerrainEvents, + ISceneEvents, + IMessageManagerEvents, + normalizeReferenceImageConfig, + validateReferenceImageParameters, + IReferenceImageConfigItem, + IReferenceImageItem, + ReferenceImageVisibilityReason, + IReferenceImageError, + IReferenceImageState, + IReferenceImageParameters, + IReferenceImagePreviewOptions, + IReferenceImageCommitOptions, + IReferenceImageCancelOptions, + IReferenceImagePathOptions, + IReferenceImageVisibilityOptions, + IReferenceImageService, + IReferenceImageConfig, + IReferenceImageAuthoritySnapshot, + IReferenceImageAuthorityMutation, + IReferenceImageAuthorityStore, + IReferenceImageEvents, + IPublicReferenceImageService, + IReferenceImageFileService, + ILightProbeBakeOptions, + ILightProbeSetting, + ILightProbeSettings, + ILightProbeBakeCapabilities, + ILightProbeBakeResult, + ILightmapBakeOptions, + ILightmapBakeCapabilities, + ILightmapBakeResult, + ILightmapBakeInfo, + ILightmapClearResult, + ILightFXCancelResult, + ILightProbeBakeService, + ILightmapBakeService, + ILightFXBakeEvents, + IPublicLightProbeBakeService, + IPublicLightmapBakeService, + IParticlePlayInfo, + IParticleService, + IPublicParticleService + } +} +declare class SceneConfig { + private defaultConfig; + private configInstance; + private static readonly PERSONAL_KEYS; + init(): Promise; + private _migratePersonalKeysToLocal; + private resolveSetScope; + get(path?: string, scope?: ConfigurationScope): Promise; + queryDesignResolution(): Promise; + recordInitialView(uuid: string, mode: '2d' | '3d'): Promise; + set(path: string, value: any, scope?: ConfigurationScope): Promise; +} +export declare namespace SceneConfig_2 { + export { + IOriginAxesConfig, + ICameraConfig, + IRectSnapConfig, + IGizmoConfig, + ISceneViewConfig, + ISceneConfig, + sceneConfigInstance + } +} +declare const sceneConfigInstance: SceneConfig; +export declare namespace SceneContext { + export { + BaseService, + register, + Service, + queryRegisteredService, + getServiceAll, + ServiceEvents, + registerViewUpdate, + registerTerrainSessionResolver, + TerrainSession, + registerNodeCreateDragFactory, + ICreateDragHost, + INodeCreateDragController + } +} +export declare namespace SceneDump { + export { + _default_3 as default + } +} +export declare namespace SceneEditorSession { + export { + IEditorSessionSnapshot, + IEditorSessionService + } +} +export declare namespace SceneEngine { + export { + EngineService, + NeedAnimState + } +} +export declare interface SceneEventBatch { + version: SceneVersion; + sequence: number; + resync: boolean; + events: SceneSessionEvent[]; +} +declare class SceneHostLocalExecutor { + private readonly modules; + private readonly rpc; + constructor(modules?: SceneHostModules); + executeLocal(module: string, method: string, args?: any[]): Promise; + dispose(): void; +} +declare interface SceneHostModules { + assetManager: typeof typedAssetManager; + programming: typeof _default; + sceneConfigInstance: typeof sceneConfigInstance; + i18n: typeof _default_2; + referenceImageFiles: typeof referenceImageFiles; + referenceImageStore: typeof referenceImageStore; + lightFXBakeHost: typeof lightFXBakeHost; + reflectionProbeBakeHost: typeof reflectionProbeBakeHost; +} +export declare namespace SceneI18n { + export { + i18n_2 as default, + initLocalI18n, + reloadLocalI18n + } +} +export declare namespace SceneLightProbeNormalReset { + export { + installLightProbeNormalReset + } +} +export declare namespace SceneMessage { + export { + messageManager, + MessageManager + } +} +declare enum SceneModeType { + General = "general", + Prefab = "prefab", + Animation = "animation", + Preview = "preview", + Unset = "" +} +export declare namespace SceneNode { + export { + nodeManager as default, + NodeManager + } +} +export declare namespace SceneNodeNodeCreate { + export { + loadAny, + createNodeByAsset, + queryCanvasRequiredByAsset, + createShouldHideInHierarchyCanvasNode + } +} +export declare namespace SceneNodeNodeTypeConfig { + export { + NODE_CONFIGS as default, + NodeConfig, + NodeMap, + NODE_CONFIGS + } +} +export declare namespace SceneNodeNodeUtils { + export { + getUICanvasNode, + getUITransformParentNode, + hasOneKindOfComponent, + getNodeName, + setLayer, + isEditorNode, + isPartOfNode + } +} +export declare namespace SceneNodePrefabCanvasMutation { + export { + createPendingPrefabCanvasMutation, + restorePrefabRoot, + removePrefabPreviewCanvasNode, + IPrefabCanvasUndoRecord, + IPendingPrefabCanvasMutation, + IPrefabCanvasMutationEffects + } +} +export declare namespace SceneOperationTypes { + export { + ISceneMouseEvent, + SceneMouseEvent, + SceneKeyboardEvent, + SceneDragEvent, + OperationEvent, + ISceneKeyboardEvent, + OperationPriority + } +} +export declare namespace ScenePrefabPrefabEditorUtils { + export { + editorPrefabUtils + } +} +declare const SceneProcessEventTag = "scene-worker-event"; +declare const SceneReadyChannel = "scene-worker:ready"; +export declare interface SceneRecordedChange { + uuid: string; + kind: 'node' | 'component'; + dump: any; +} +export declare namespace SceneReferenceImage { + export { + ReferenceImageService + } +} +export declare interface SceneRenderSnapshot { + serializedScene: string; + rootUuid: string; + assetUuid: string; + kind: 'scene' | 'prefab'; + prefabUUIDs: unknown; +} +declare const sceneResourceRoutes: ({ + url: string; + handler(req: Request_2, res: Response_2, next: NextFunction): Promise> | undefined>; +} | { + url: RegExp; + handler(req: Request_2, res: Response_2, next: NextFunction): Promise; +} | { + url: string; + handler(req: Request_2, res: Response_2, next: NextFunction): Promise; +})[]; +export declare namespace SceneRpc { + export { + RpcProxy_2 as RpcProxy, + Rpc_2 as Rpc + } +} +declare interface SceneRpcClient { + request(module: K, method: M, ...rest: Parameters> extends [] ? [args?: [], options?: SceneCommandRequestOptions_2] : [args: Parameters>, options?: SceneCommandRequestOptions_2]): Promise>>>; + notify(module: K, method: M, args?: Parameters>): void; + executeLocal(module: string, method: string, args?: any[]): Promise; + isConnect(): boolean | undefined; +} +export declare namespace SceneSceneLightProbeSnapshot { + export { + beginLightProbeRestore, + isLightProbeRestoreInProgress, + getLightProbeSnapshotScenes, + captureLightProbeData, + restoreLightProbeData, + captureLightProbeGroup, + restoreLightProbeGroup, + LightProbeDataSnapshot, + LightProbeGroupSnapshot + } +} +export declare namespace SceneSceneLightProbeTransform { + export { + isLightProbeTransformInProgress, + flushLightProbeTransformEdit, + beginLightProbeTransformEdit, + getLightProbeTransformScene, + synchronizeLightProbeTransform, + withLightProbeTransformScenes + } +} +export declare namespace SceneSceneUtils { + export { + withTimeout, + sceneUtils + } +} +export declare namespace SceneServiceManager { + export { + ServiceManager, + serviceManager + } +} +declare type SceneServiceMethod = Extract; +export declare class SceneSessionClient { + readonly descriptor: SceneSessionDescriptor; + constructor(descriptor: SceneSessionDescriptor); + snapshot(signal?: AbortSignal): Promise; + command(command: SceneSessionCommand, signal?: AbortSignal): Promise; + events(version: SceneVersion, after: number, signal?: AbortSignal): Promise; + private fetch; +} +export declare namespace SceneSessionClient_2 { + export { + SceneSessionClient_3 as SceneSessionClient + } } export declare interface SceneSessionCommand extends SceneCommand { source: string; operationId: string; expected: SceneVersion; } +declare class SceneSessionCoordinator { + private readonly provider; + private epoch; + private revision; + private sequence; + private tail; + private active; + private history; + private operations; + private listeners; + private resourceNotifications; + constructor(provider: () => ISceneCommandProvider_2 | null); + get version(): SceneVersion_2; + get cursor(): number; + reset(): void; + invalidate(event: string): void; + subscribe(listener: () => void): () => void; + events(epoch: string, after: number): SceneEventBatch_2; + read(read: (provider: ISceneCommandProvider_2) => Promise): Promise; + request(module: string, method: string, args: any[], options?: SceneCommandRequestOptions_2): Promise; + command(command: SceneSessionCommand_2): Promise; + private execute; + private requestResourceNotification; + private waitForResourceNotifications; + private enqueue; + private getProvider; + private assertEpoch; + private publish; +} export declare interface SceneSessionDescriptor { protocol: 1; project: string; @@ -11254,6 +18585,27 @@ export declare interface SceneSessionEvent { operationId?: string; events: string[]; } +export declare namespace SceneSessionMethods { + export { + sceneSessionMethods + } +} +declare const sceneSessionMethods: Record; +export declare namespace SceneSessionProtocol { + export { + SceneVersion_2 as SceneVersion, + SceneCommand_2 as SceneCommand, + SceneSessionCommand_2 as SceneSessionCommand, + SceneSessionEvent_2 as SceneSessionEvent, + SceneSessionSnapshot_2 as SceneSessionSnapshot, + SceneRenderSnapshot_2 as SceneRenderSnapshot, + SceneRecordedChange_2 as SceneRecordedChange, + SceneSessionDescriptor_2 as SceneSessionDescriptor, + SceneCommandResult_2 as SceneCommandResult, + SceneEventBatch_2 as SceneEventBatch, + SceneSessionError_2 as SceneSessionError + } +} export declare interface SceneSessionServer { descriptor: SceneSessionDescriptor; close(): Promise; @@ -11274,13 +18626,527 @@ export declare interface SceneSessionSnapshot { canUndo: boolean; canRedo: boolean; } +declare class SceneUtil { + static readonly Timeout: number; + runScene(sceneAsset: cc_2.SceneAsset | cc_2.Scene): Promise; + runSceneImmediateByJson(serializeJSON: Record): Promise; + generateComponentInfo(component: cc_2.Component): { + cid: any; + path: string; + uuid: string; + name: string; + type: string; + enabled: boolean; + }; + enrichPrefabDump(prefab: any, enginePrefab: any): void; + generateNodeIdentifier(node: cc_2.Node): { + nodeId: string; + path: string; + name: string; + }; + generateComponentIdentifier(component: cc_2.Component): { + cid: any; + path: string; + uuid: string; + name: string; + type: string; + enabled: boolean; + }; + generatePrefabDump(node: cc_2.Node): IPrefab | null; + generateNodeDump(node: cc_2.Node, options?: INodeDumpOptions): INode | IScene; + serialize(scene: cc_2.Scene): any; + loadAny(uuid: string): Promise; +} +declare const sceneUtils: SceneUtil; +export declare namespace SceneUtilsAssetReload { + export { + setAssetBundleRefresher, + refreshAssetBundles, + removePreviewAssetCache, + loadPreviewAsset + } +} +export declare namespace SceneUtilsEditorNode { + export { + getEditorNodeByPath, + getEditorNodeByUuid, + getEditorNodeUuidByPath, + getEditorNodePath + } +} +export declare namespace SceneUtilsStateMachineFiniteStateMachine { + export { + FiniteStateMachine as default + } +} +export declare namespace SceneUtilsStateMachineStateInterface { + export { + IState as default + } +} export declare interface SceneVersion { epoch: string; revision: number; } +declare class SceneWorker { + static ExitWorkerEvent: string; + private _process; + get process(): ChildProcess; + private eventEmitter; + private maxRestartAttempts; + private currentRestartCount; + private enginePath; + private projectPath; + private isRestarting; + private isManualStop; + private commandProviderRegistration; + start(enginePath: string, projectPath: string): Promise; + stop(): Promise; + private isCrashExit; + private restart; + registerListener(): Promise; + private releaseCommandProvider; + on>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void; + on(event: string, listener: (...args: any[]) => void): void; + once>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void; + once(event: string, listener: (...args: any[]) => void): void; + off>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void; + off(event: string, listener: (...args: any[]) => void): void; + emit>(event: keyof TEvents, ...args: TEvents[keyof TEvents] extends void ? [] : [TEvents[keyof TEvents]]): void; + emit(event: string, ...args: any[]): void; + clear(event?: string): void; +} +declare const scriptingRoutes: ({ + url: RegExp; + handler(req: Request_2, res: Response_2, next: NextFunction): Promise; +} | { + url: string; + handler(req: Request_2, res: Response_2, next: NextFunction): Promise; +})[]; +declare class ScriptManager { + on(type: EventType, listener: (arg: any) => void): CustomEvent_2; + off(type: EventType, listener: (arg: any) => void): CustomEvent_2; + once(type: EventType, listener: (arg: any) => void): CustomEvent_2; + private _initialized; + private _pendingCompileTimer; + private _pendingCompileTaskId; + private _projectPath; + private _scriptRevision; + private _loadedScripts; + constructor(); + initialize(projectPath: string, enginePath: string, features: string[]): Promise; + get projectPath(): string; + queryScriptUsers(path: string): Promise; + queryScriptDependencies(path: string): Promise; + querySharedSettings(): Promise; + generateDeclarations(): Promise; + dispatchAssetChange(assetChange: AssetChangeInfo): void; + compileScripts(assetChanges?: AssetChangeInfo[]): Promise; + postCompileScripts(delay: number): string; + isCompiling(): boolean; + getCurrentTaskId(): string | null; + isTargetReady(targetName: string): boolean; + ensureScriptsLoaded(scriptUuids: string[], pluginScripts?: IPluginScriptInfo[]): Promise; + loadScript(scriptUuids: string[], pluginScripts?: IPluginScriptInfo[]): Promise; + queryCCEModuleMap(): CCEModuleMap; + getPackerDriverLoaderContext(targetName: string): SerializedLoaderContext | undefined; + clearCacheAndRebuild(): Promise; + updateDatabases(dbInfo: DBInfo, dbChangeType: DBChangeType): Promise; + close(): Promise; +} +declare class ScriptService extends BaseService implements IScriptService { + private _executor; + private _isInited; + private _isWebEnv; + private _suspendPromise; + private _syncPluginScripts; + private _reloadScripts; + private customComponents; + constructor(); + suspend(condition: Promise): void; + init(): Promise; + investigatePackerDriver(): Promise; + queryScriptName(uuid: string): Promise; + queryScriptCid(uuid: string): Promise; + isCustomComponent(classConstructor: Function): boolean; + _loadScripts(): Promise; + loadScript(): Promise; + removeScript(): Promise; + scriptChange(): Promise; + private _executeAsync; + private _execute; + private _refreshWebImportMap; + private _syncPluginScriptListAsync; + private _syncPluginScriptList; + private _handleImportException; +} +declare class SelectionService extends BaseService implements ISelectionService { + private _selections; + private _onNodeChangedHandler?; + init(): void; + destroy(): void; + private _onNodePathChanged; + select(path: string): void; + unselect(path: string): void; + clear(): void; + query(): string[]; + isSelect(path: string): boolean; + reset(): void; + private _getPaths; + private _callFocusInEditor; + private _callLostFocusInEditor; +} +declare type SerializedAssetDump = Record | IProperty; +declare type SerializedAssetPatch = SerializedAssetDump | Partial>; +declare interface SerializedAssetQueryResult { + uuid: string; + url: string; + type: string; + importer: string; + dump: SerializedAssetDump; +} +declare namespace serializedData { + export { + querySerializedData, + saveSerializedData, + encodePropertyObject, + applyPropertyObjectPatch, + applyEncodedPropertyPatch, + applyPropertyObjectOperation, + applyEncodedPropertyOperation, + queryPropertyObjectOperationCapabilities, + getEncodedPropertyOperationCapabilities, + encodeSerializedObject, + getDefaultValueByType, + SerializedAssetDump, + SerializedAssetPatch, + EncodedPropertyOperation, + EncodedPropertyOperationCapabilities, + SerializedAssetQueryResult + } +} +declare const Service: IServiceManager; +declare const ServiceEvents: GlobalEventManager; +declare class ServiceManager { + private initialized; + private eventHandlers; + private serverUrl; + initialize(serverUrl: string): void; + getServerUrl(): string; + initAllServices(options?: { + strict?: boolean; + }): Promise; + dispose(): void; + private registerAutoForwardEvents; + private registerAutoForwardEvent; + private registerMessageOnlyForwardEvents; + private unregisterAutoForwardEvents; +} +declare const serviceManager: ServiceManager; +declare type ServiceName = keyof IServiceManager; +declare function setAssetBundleRefresher(refresher: typeof bundleRefresher): void; export declare function setCommandProvider(provider: ISceneCommandProvider): SceneCommandProviderRegistration; +declare function setLayer(node: Node_2, layer: number, deep: boolean): void; export declare function startSessionServer(options: SceneSessionServerOptions): Promise; +declare function startupScene(enginePath: string, projectPath: string): Promise; export declare function startupWorker(projectPath: string): Promise; +declare function synchronizeLightProbeTransform(node: Node_2, preserveCoefficients?: boolean): void; +declare type TEditorInstance = Scene | Node_2; +declare class TerrainLayerError extends Error { + readonly code: TerrainLayerErrorCode; + constructor(code: TerrainLayerErrorCode, message: string, options?: ErrorOptions); +} +declare type TerrainLayerErrorCode = 'DEFAULT_DETAIL_MAP_UNAVAILABLE'; +declare class TerrainService extends BaseService implements ITerrainService { + readonly name: "cc.Terrain"; + readonly editedComponents: Terrain[]; + readonly selectedComponents: Terrain[]; + private _terrainUndoSequence; + private dataSessions; + init(): void; + private isTerrainComponent; + private terrainOfNode; + private terrainOfUuid; + private resolveTarget; + private invalidResult; + private getTerrainAssetUuid; + private readResolved; + read(target: ITerrainTarget): TerrainReadResult; + setMode(target: ITerrainTarget, mode: TerrainEditorMode): TerrainReadResult; + setCurrentLayer(target: ITerrainTarget, currentLayer: number): TerrainReadResult; + setSculptSession(target: ITerrainTarget, patch: ITerrainSculptSessionPatch): TerrainReadResult; + setSculptBrushAsset(target: ITerrainTarget, assetUuid: string | null): Promise; + setPaintBrushAsset(target: ITerrainTarget, assetUuid: string | null): Promise; + private setBrushAsset; + setPaintSession(target: ITerrainTarget, patch: ITerrainPaintSessionPatch): TerrainReadResult; + readBlock(target: ITerrainTarget): TerrainBlockReadResult; + saveManage(target: ITerrainTarget, manage: ITerrainManageState): Promise; + addLayer(target: ITerrainTarget, layer?: ITerrainLayerState): Promise; + removeLayer(target: ITerrainTarget, index: number): Promise; + updateLayer(target: ITerrainTarget, index: number, patch: ITerrainLayerPatch): Promise; + private isLayerIndex; + private isAttachedTerrain; + private createTerrainInfo; + private createTerrainLayer; + private loadTerrainTexture; + private loadDefaultTerrainLayerAssets; + private loadLayerAssets; + private applyTerrainManageState; + private addTerrainLayer; + private removeTerrainLayer; + private updateTerrainLayer; + private applyTerrainLayerStates; + private reportTerrainAuthoringChange; + private getTerrainUndoService; + private pushTerrainUndo; + private setManager; + private setDirty; + get isTerrainChange(): boolean; + set isTerrainChange(value: boolean); + select(nodeUuid: string): void; + unselect(nodeUuid: string): void; + onSelectionSelect(path: string): void; + onSelectionUnselect(path: string): void; + onSelectionClear(): void; + onNodeRemoved(node: any): void; + onComponentRemoved(component: Component): void; + private removeComponent; + onSculpt(node: any): void; + serialize(component: Terrain): Uint8Array; + saveAsset(isClose?: boolean, component?: Terrain): Promise<0 | 1 | 2>; + saveAssetDialog(file?: string, isClose?: boolean): Promise<0 | 1 | 2>; + close(): Promise<0 | 1 | 2>; + addAssetToComp(assetUuid: string): Promise; + onAssetDeleted(uuid: string): void; + onEditorClosed(): void; + onEditorDisposed(): void; +} +declare interface TerrainSession { + target: Terrain | null; + readTerrainState(): ITerrainEditorState; + setTerrainMode(mode: TerrainEditorMode): void; + setTerrainCurrentLayer(index: number): void; + updateTerrainSculptSession(patch: ITerrainSculptSessionPatch): void; + updateTerrainPaintSession(patch: ITerrainPaintSessionPatch): void; + setSculptBrushTexture(texture: Texture2D | null): void; + setPaintBrushTexture(texture: Texture2D | null): void; + readTerrainBlock(): ITerrainBlockData | null; +} +declare class Transition { + fromState: TState; + toState: TState; + testConditionFunc: Function | null; + constructor(from: TState, to: TState, testConditionFunc?: Function | null); + testCondition(opts?: any): Promise; + Complete(): Promise; +} +declare interface TypedAssetManager extends EventEmitter { + on(event: K, listener: AssetManagerEvents[K]): this; + once(event: K, listener: AssetManagerEvents[K]): this; + emit(event: K, ...args: Parameters): boolean; + removeListener(event: K, listener: AssetManagerEvents[K]): this; + removeAllListeners(event?: K): this; + listeners(event: K): Function[]; + listenerCount(event: K): number; + onAssetAdded(listener: (info: IAssetInfo) => void): () => void; + onAssetChanged(listener: (info: IAssetInfo) => void): () => void; + onAssetRemoved(listener: (info: IAssetInfo) => void): () => void; + queryAssets: typeof assetQuery_2.queryAssets; + queryAssetDependencies: typeof assetQuery_2.queryAssetDependencies; + queryAssetUsers: typeof assetQuery_2.queryAssetUsers; + queryAsset: typeof assetQuery_2.queryAsset; + queryAssetInfo: typeof assetQuery_2.queryAssetInfo; + queryAssetInfoByUUID: typeof assetQuery_2.queryAssetInfoByUUID; + queryAssetInfos: typeof assetQuery_2.queryAssetInfos; + querySortedPlugins: typeof assetQuery_2.querySortedPlugins; + queryUUID: typeof assetQuery_2.queryUUID; + queryPath: typeof assetQuery_2.queryPath; + queryUrl: typeof assetQuery_2.queryUrl; + generateAvailableURL: typeof assetQuery_2.generateAvailableURL; + queryDBAssetInfo: typeof assetQuery_2.queryDBAssetInfo; + encodeAsset: typeof assetQuery_2.encodeAsset; + queryAssetProperty: typeof assetQuery_2.queryAssetProperty; + queryAssetMeta: typeof assetQuery_2.queryAssetMeta; + querySubAssetName: typeof assetQuery_2.querySubAssetName; + queryAssetMtime: typeof assetQuery_2.queryAssetMtime; + importAsset: typeof assetOperation.importAsset; + copyAsset: typeof assetOperation.copyAsset; + saveAssetMeta: typeof assetOperation.saveAssetMeta; + saveAsset: typeof assetOperation.saveAsset; + createAsset: typeof assetOperation.createAsset; + refreshAsset: typeof assetOperation.refreshAsset; + refreshAssetOnly: typeof assetOperation.refreshAssetOnly; + reimportAsset: typeof assetOperation.reimportAsset; + renameAsset: typeof assetOperation.renameAsset; + removeAsset: typeof assetOperation.removeAsset; + moveAsset: typeof assetOperation.moveAsset; + generateExportData: typeof assetOperation.generateExportData; + outputExportData: typeof assetOperation.outputExportData; + createAssetByType: typeof assetOperation.createAssetByType; + updateUserData: typeof assetOperation.updateUserData; + updateUserDataByPath: typeof assetOperation.updateUserDataByPath; + querySerializedData: typeof serializedData.querySerializedData; + saveSerializedData: typeof serializedData.saveSerializedData; + queryMaterial: typeof materialService.queryMaterial; + queryMaterialEffect: typeof materialService.queryEffect; + queryMaterialAllEffects: typeof materialService.queryAllEffects; + saveMaterial: typeof materialService.saveMaterial; + queryAnimationGraph: typeof animationGraph.query; + queryAnimationGraphInspector: typeof animationGraph.queryInspector; + queryAnimationGraphMotionPreviewData: typeof animationGraph.queryMotionPreviewData; + queryAnimationGraphPoseGraphAssetDragHandlers: typeof animationGraph.queryPoseGraphAssetDragHandlers; + queryAnimationGraphStateMachineComponentTypes: typeof animationGraph.queryStateMachineComponentTypes; + setAnimationGraphInspectorProperty: typeof animationGraph.setInspectorProperty; + resetAnimationGraphInspectorProperty: typeof animationGraph.resetInspectorProperty; + createAnimationGraphInspectorProperty: typeof animationGraph.createInspectorProperty; + executeAnimationGraphCommand: typeof animationGraph.execute; + saveAnimationGraph: typeof animationGraph.save; + reloadAnimationGraph: typeof animationGraph.reload; + onAnimationGraphChanged: typeof animationGraph.onChanged; + queryAnimationGraphVariant: typeof animationGraphVariant.query; + changeAnimationGraphVariant: typeof animationGraphVariant.change; + saveAnimationGraphVariant: typeof animationGraphVariant.save; + queryAssetConfigMap: typeof assetHandlerManager.queryAssetConfigMap; + queryPropertySchema: typeof assetHandlerManager.queryPropertySchema; + updateDefaultUserData: typeof assetHandlerManager.updateDefaultUserData; + getCreateMap: typeof assetHandlerManager.getCreateMap; + queryAssetUserDataConfig: typeof assetHandlerManager.queryUserDataConfig; + queryThumbnailHandlers: typeof assetHandlerManager.queryThumbnailHandlers; + getEffectBinPath: typeof assetHandlerManager.getEffectBinPath; + generateThumbnail(urlOrUUIDOrPath: string, size?: ThumbnailSize): Promise; + extractImagePixels(urlOrUUIDOrPath: string, options: IImagePixelExtractionOptions): Promise; + onReady: typeof assetManager.onReady; + onDBReady: typeof assetManager.onDBReady; + onProgress: typeof assetManager.onProgress; + url2uuid(url: string): string; + url2path(url: string): string; + path2url(url: string, dbName?: string): string; + init(): Promise; + destroyed(): void; +} +declare const typedAssetManager: TypedAssetManager; +declare class UndoService extends BaseService implements IUndoService { + private _undoMgr; + constructor(); + beginRecording(uuids: string[], options?: IUndoBeginOptions): string; + endRecording(commandId: string): Promise; + cancelRecording(commandId: string): void; + undo(options?: IUndoOperationOptions): Promise; + redo(options?: IUndoOperationOptions): Promise; + reset(): void; + clearHistory(): void; + isDirty(): boolean; + createCheckpoint(): IUndoCheckpoint; + hasScopedDifference(checkpoint: IUndoCheckpoint, scope: Partial): boolean; + hasScopedDifferenceAfterCheckpoint(checkpoint: IUndoCheckpoint, scope: Partial): boolean; + discardScopedChangesAfterCheckpoint(checkpoint: IUndoCheckpoint, scope: Partial): Promise; + hasDifferenceOutsideScope(checkpoint: IUndoCheckpoint, scope: Partial): boolean; + canUndo(options?: IUndoOperationOptions): boolean; + canRedo(options?: IUndoOperationOptions): boolean; + beginGroup(options?: IUndoGroupOptions): string; + endGroup(groupId: string): IUndoRedoResult; + cancelGroup(groupId: string): IUndoRedoResult; + isGroupActive(): boolean; + push(command: IUndoCommand): void; + pushWithPrevious(command: IUndoCommand, options: IUndoPushWithPreviousOptions): void; + markSaved(): void; + hasActiveRecording(uuid?: string): boolean; + isApplying(): boolean; + private _emitDirtyIfChanged; + private _createSceneSnapshotAdapter; + private _captureSceneSnapshots; + private _captureNodeSnapshot; + private _captureComponentSnapshot; + private _applySceneSnapshots; + private _applyNodeSnapshot; + private _applyComponentSnapshot; + private _notifyRestoredNode; + private _restoreComponentSnapshot; + private _restoreNodeDump; + private _restoreComponentDump; + private _findNode; + private _findComponent; + private _isNodeInCurrentScene; + private _isComponentInCurrentScene; + private _getNodePath; + private _getComponentPath; + private _getComponentType; + private _getEditorNodeManager; + private _getEditorComponentManager; + private _getEditorExtends; + private _snapshotMapsEqual; + private _cloneDump; +} +declare type UUIDMap = Map; +declare function validateReferenceImageParameters(patch: unknown): IReferenceImageParameters; +declare class VirtualAsset extends VirtualAsset_2 { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} +declare class VirtualAsset_2 { + versionCode: number; + _init: boolean; + importError: Error | any; + get init(): boolean; + set init(bool: boolean); + _waitInitHandle: Function[]; + waitInit(): Promise; + action: AssetActionEnum; + task: number; + invalid: boolean; + uuid2recycle: { + [index: string]: Meta; + }; + get source(): string; + get url(): string; + get library(): string; + get temp(): string; + get uuid(): string; + get displayName(): string; + getData(key: string): any; + setData(key: string, value: any): void; + generate(): void; + meta: Meta; + subAssets: { + [name: string]: VirtualAsset_2; + }; + set imported(imported: boolean); + get imported(): boolean; + _lock: boolean; + _waitLockHandler: Function[]; + lock(): Promise; + unlock(): void; + _assetDB: AssetDB; + _parent: VirtualAsset_2 | Asset | null; + _name: string; + _id: string; + _swapSpace: any; + _isDirectory?: boolean; + get parent(): Asset | VirtualAsset_2 | null; + get userData(): { + [index: string]: any; + }; + constructor(meta: Meta, name: string, id: string, assetDB: AssetDB); + assignUserData(json: Object, overwrite?: boolean): void; + save(): any; + reset(): Promise; + getFilePath(extOrFile: string): string; + saveToLibrary(extOrFile: string, buffer: Buffer | string): Promise; + copyToLibrary(extOrFile: string, target: string): Promise; + deleteFromLibrary(extOrFile: string): Promise; + existsInLibrary(extOrFile: string): Promise; + isDirectory(): boolean; + createSubAsset(name: string, importer: string, options?: { + displayName?: string; + id?: string; + }): Promise; + depend(fileOrUuidOrUrl: string): void; + getSwapSpace(): T; +} +declare function withLightProbeTransformScenes(nodes: Node_2[]): Node_2[]; +declare function withTimeout(promise: Promise, timeoutMs: number, message?: string): Promise; export declare class WorkerSceneCommandProvider implements ISceneCommandProvider { private readonly rpc; constructor(process: ChildProcess | NodeJS.Process); @@ -11294,7 +19160,14 @@ export { } `; exports[`DTS API compatibility scripting.d.ts should match snapshot 1`] = ` -"import { ChunkInfo } from '@cocos/creator-programming-quick-pack/lib/loader'; +"import { AssetChangeInfo as AssetChangeInfo_2 } from './scripting'; +import { AssetChangeType as AssetChangeType_2 } from './scripting'; +import { CCEModuleMap } from './engine'; +import { ChunkInfo } from '@cocos/creator-programming-quick-pack/lib/loader'; +import { EventEmitter } from 'events'; +import { IPluginScriptInfo as IPluginScriptInfo_2 } from './assets'; +import { SerializedLoaderContext } from '@cocos/creator-programming-quick-pack/lib/utils/loader-context'; +import { SharedSettings as SharedSettings_2 } from './scripting'; export declare enum AssetActionEnum { 'add' = 0, 'change' = 1, @@ -11309,6 +19182,40 @@ export declare interface AssetChangeInfo { userData: object; } export declare type AssetChangeType = AssetActionEnum; +export declare namespace CoreScriptingIndex { + export { + title, + _default as default, + AssetChangeInfo_2 as AssetChangeInfo, + AssetChangeType_2 as AssetChangeType, + SharedSettings_2 as SharedSettings, + IPluginScriptInfo_2 as IPluginScriptInfo, + CCEModuleMap, + EventType, + TypeScriptAssetInfoCache + } +} +declare class CustomEvent_2 extends EventEmitter { + on(type: EventType, listener: (...arg: any[]) => void): this; + off(type: EventType, listener: (...arg: any[]) => void): this; + once(type: EventType, listener: (...arg: any[]) => void): this; + emit(type: EventType, ...arg: any[]): boolean; +} +declare enum DBChangeType { + add = 0, + remove = 1 +} +declare interface DBInfo { + dbID: string; + target: string; +} +declare const _default: ScriptManager; +export declare namespace Editor { + export { + Host + } +} +declare type EventType = 'pack-build-end' | 'pack-build-start' | 'compiled' | 'compile-start'; export declare interface FilterPluginOptions { loadPluginInEditor?: boolean; loadPluginInWeb?: boolean; @@ -11316,6 +19223,11 @@ export declare interface FilterPluginOptions { loadPluginInMiniGame?: boolean; } export declare function getProgrammingFacet(): Promise; +export declare namespace Host { + export { + CoreScriptingIndex + } +} export declare interface IEngineOptions { root: string; distRoot: string; @@ -11331,6 +19243,7 @@ export declare function initProgrammingFacet(): Promise; export declare interface IPluginScriptInfo extends PluginScriptInfo { url: string; } +declare type MTime = string; export declare function onCompiled(listener: (e: { scope: string; }) => void): () => void; @@ -11384,6 +19297,37 @@ export declare class ProgrammingFacet { private _buildSystemJs; private _resetQuickPackLoader; } +declare class ScriptManager { + on(type: EventType, listener: (arg: any) => void): CustomEvent_2; + off(type: EventType, listener: (arg: any) => void): CustomEvent_2; + once(type: EventType, listener: (arg: any) => void): CustomEvent_2; + private _initialized; + private _pendingCompileTimer; + private _pendingCompileTaskId; + private _projectPath; + private _scriptRevision; + private _loadedScripts; + constructor(); + initialize(projectPath: string, enginePath: string, features: string[]): Promise; + get projectPath(): string; + queryScriptUsers(path: string): Promise; + queryScriptDependencies(path: string): Promise; + querySharedSettings(): Promise; + generateDeclarations(): Promise; + dispatchAssetChange(assetChange: AssetChangeInfo_2): void; + compileScripts(assetChanges?: AssetChangeInfo_2[]): Promise; + postCompileScripts(delay: number): string; + isCompiling(): boolean; + getCurrentTaskId(): string | null; + isTargetReady(targetName: string): boolean; + ensureScriptsLoaded(scriptUuids: string[], pluginScripts?: IPluginScriptInfo_2[]): Promise; + loadScript(scriptUuids: string[], pluginScripts?: IPluginScriptInfo_2[]): Promise; + queryCCEModuleMap(): CCEModuleMap; + getPackerDriverLoaderContext(targetName: string): SerializedLoaderContext | undefined; + clearCacheAndRebuild(): Promise; + updateDatabases(dbInfo: DBInfo, dbChangeType: DBChangeType): Promise; + close(): Promise; +} export declare interface SharedSettings { useDefineForClassFields: boolean; allowDeclareFields: boolean; @@ -11400,16 +19344,46 @@ export declare interface SharedSettings { }; } export declare function startCompileScript(assetChanges?: AssetChangeInfo[]): Promise; +declare const title = "i18n:builder.tasks.load_script"; +declare interface TypeScriptAssetInfoCache { + version?: MTime; + content?: string; + filePath: string; + uuid: string; + isPluginScript: boolean; + url: Readonly; +} export { } " `; exports[`DTS API compatibility simulator.d.ts should match snapshot 1`] = ` -"export declare const build: (enginePath?: string) => Promise; +"import { build as build_2 } from './simulator'; +import { buildNative as buildNative_2 } from './simulator'; +import { buildRuntime as buildRuntime_2 } from './simulator'; +import { getExecutablePath as getExecutablePath_2 } from './simulator'; +import { getManifest as getManifest_2 } from './simulator'; +import { isBuilt as isBuilt_2 } from './simulator'; +import { ISimulatorBuildState as ISimulatorBuildState_2 } from './simulator'; +import { ISimulatorLogEntry as ISimulatorLogEntry_2 } from './simulator'; +import { ISimulatorManifest as ISimulatorManifest_2 } from './simulator'; +import { onDidChangeBuildState as onDidChangeBuildState_2 } from './simulator'; +import { onLog as onLog_2 } from './simulator'; +export declare const build: (enginePath?: string) => Promise; export declare const buildNative: (enginePath?: string) => Promise; export declare const buildRuntime: (enginePath?: string) => Promise; +export declare namespace Editor { + export { + Host + } +} export declare const getExecutablePath: (enginePath?: string) => Promise; export declare const getManifest: (enginePath?: string) => Promise; +export declare namespace Host { + export { + LibSimulatorSimulator + } +} export declare const isBuilt: (enginePath?: string) => Promise; export declare interface ISimulatorBuildState { step: 'native' | 'runtime'; @@ -11432,6 +19406,21 @@ export declare interface ISimulatorManifest { artifactRoot: string; formatVersion: 1; } +export declare namespace LibSimulatorSimulator { + export { + ISimulatorBuildState_2 as ISimulatorBuildState, + ISimulatorLogEntry_2 as ISimulatorLogEntry, + ISimulatorManifest_2 as ISimulatorManifest, + build_2 as build, + buildNative_2 as buildNative, + buildRuntime_2 as buildRuntime, + isBuilt_2 as isBuilt, + getManifest_2 as getManifest, + getExecutablePath_2 as getExecutablePath, + onLog_2 as onLog, + onDidChangeBuildState_2 as onDidChangeBuildState + } +} export declare const onDidChangeBuildState: (listener: (state: ISimulatorBuildState) => void) => () => void; export declare const onLog: (listener: (entry: ISimulatorLogEntry) => void) => () => void; export { } diff --git a/src/core/assets/@types/protected/asset.d.ts b/src/core/assets/@types/protected/asset.d.ts index f8615c046..6e3147f47 100644 --- a/src/core/assets/@types/protected/asset.d.ts +++ b/src/core/assets/@types/protected/asset.d.ts @@ -1,5 +1,7 @@ -import { Asset, VirtualAsset } from '@cocos/asset-db'; +import { Asset as DatabaseAsset, VirtualAsset as DatabaseVirtualAsset } from '@cocos/asset-db'; import { CCON } from 'cc/editor/serialization'; +import type { IAssetInfo } from '../public'; +import type { IAssetDBInfo } from './plugin'; export type IAssetEvent = 'asset-add' | 'asset-change' | 'asset-delete'; export type IAssetEventCallback = (asset: IAsset) => void; export interface IExportData { @@ -33,15 +35,22 @@ export interface AssetManagerEvents { export * from '../public'; export * from './plugin'; -export class VirtualAsset extends VirtualAsset { +export class VirtualAsset extends DatabaseVirtualAsset { /** * 获取资源的导出数据 */ - getData: (name: 'output') => IExportData; - setData: (name: 'output', data: IExportData) => void; + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; } -export class Asset extends Asset, IVirtualAsset { }; +export class Asset extends DatabaseAsset { + getData(name: 'output'): IExportData; + getData(name: string): any; + setData(name: 'output', data: IExportData): void; + setData(name: string, data: any): void; +} export type IAsset = VirtualAsset | Asset; diff --git a/src/core/builder/@types/protected/bundle-config.ts b/src/core/builder/@types/protected/bundle-config.ts index 86ab9b2c3..4b35bb6f8 100644 --- a/src/core/builder/@types/protected/bundle-config.ts +++ b/src/core/builder/@types/protected/bundle-config.ts @@ -2,7 +2,7 @@ import { BundleCompressionType } from '../public'; export type BundlePlatformType = 'native' | 'miniGame' | 'web'; export type BundleConfigProperty = 'compressionType' | 'isRemote'; -export const enum BundleCompressionTypes { +export enum BundleCompressionTypes { NONE = 'none', MERGE_DEP = 'merge_dep', MERGE_ALL_JSON = 'merge_all_json', @@ -10,7 +10,7 @@ export const enum BundleCompressionTypes { ZIP = 'zip', } -export const enum BuiltinBundleName { +export enum BuiltinBundleName { RESOURCES = 'resources', MAIN = 'main', START_SCENE = 'start-scene', diff --git a/src/core/builder/@types/protected/options.ts b/src/core/builder/@types/protected/options.ts index 6a5fec060..310d97ffc 100644 --- a/src/core/builder/@types/protected/options.ts +++ b/src/core/builder/@types/protected/options.ts @@ -42,7 +42,7 @@ export interface fileMap { export type Physics = 'cannon' | 'ammo' | 'builtin'; export type Url = string; // 需要的是符合 url 标准的字符串 export type AssetInfoArr = Array; // 固定两位或三位数组 [url,ccType,isSubAsset] -export const enum TaskAddResult { +export enum TaskAddResult { BUSY, SUCCESS, PARAM_ERROR, @@ -377,7 +377,7 @@ export interface IBuildStageOptions { export type BuildStageProgressCallback = (message: string, progress: number) => void; -export const enum BuildExitCode { +export enum BuildExitCode { PARAM_ERROR = 32, BUILD_FAILED = 34, BUILD_SUCCESS = 0, diff --git a/src/core/scene/runtime/browser-assets/editor-stub-preload.js b/src/core/scene/runtime/browser-assets/editor-stub-preload.js new file mode 100644 index 000000000..d677e90d3 --- /dev/null +++ b/src/core/scene/runtime/browser-assets/editor-stub-preload.js @@ -0,0 +1,107 @@ +/* global window */ + +window.CC_EDITOR = true; +const serverUrl = window.WebEnv.serverURL; + +window.Editor = { + Message: { + request: async function (target, method, uuid) { + if (method === 'query-asset-info') { + return await fetch(`${serverUrl}/query-asset-info/${uuid}`) + .then(function (r) { return r.ok ? r.json() : null; }) + .catch(function () { return null; }); + } else if (method === 'query-engine-info') { + return await fetch(`${serverUrl}/engine/query-engine-info`) + .then(function (r) { return r.ok ? r.json() : null; }) + .catch(function () { return null; }); + } + return Promise.resolve(null); + }, + }, + Selection: { + getSelected: function (_type) { return []; }, + getLastSelected: function (_type) { return ''; }, + select: function (_type, _uuid) {}, + unselect: function (_type, _uuid) {}, + clear: function (_type) {}, + }, + Profile: { + load: function () { return Promise.resolve({}); }, + getConfig: function () { return undefined; }, + setConfig: function () {}, + }, + Panel: { + open: function () {}, + close: function () {}, + }, + Utils: { + refreshSelectedInspector: function () {}, + }, + Clipboard: { + read: function () { return ''; }, + write: function () {}, + }, +}; + +if (typeof window.require === 'undefined') { + const fsMock = { + readFile: function (filePath) { + const requestUrl = `${serverUrl}/engine/read-file-sync?path=${encodeURIComponent(filePath)}`; + return fetch(requestUrl).then(function (res) { + if (res.ok) { + return res.arrayBuffer(); + } + throw new Error('Failed to read file: ' + filePath); + }); + }, + readFileSync: function (filePath) { + const requestUrl = `${serverUrl}/engine/read-file-sync?path=${encodeURIComponent(filePath)}`; + const xhr = new XMLHttpRequest(); + xhr.open('GET', requestUrl, false); // synchronous + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + xhr.send(null); + + if (xhr.status === 200) { + const val = xhr.responseText; + const len = val.length; + const buf = new Uint8Array(len); + for (let i = 0; i < len; i++) { + buf[i] = val.charCodeAt(i) & 0xff; + } + return buf; + } + throw new Error('Failed to read file synchronously: ' + filePath); + } + }; + + window.require = function (name) { + if (window.require.cache[name]) { + return window.require.cache[name].exports; + } + + if (name === 'fs' || name === 'fs-extra') { + return fsMock; + } + + if (name.endsWith('.js') || name.includes('\\') || name.includes('/')) { + try { + const buf = fsMock.readFileSync(name); + const decoder = new TextDecoder('utf-8'); + const content = decoder.decode(buf); + const module = { exports: {} }; + const wrapper = new Function('exports', 'require', 'module', '__filename', '__dirname', content); + + const dirname = name.includes('\\') ? name.substring(0, name.lastIndexOf('\\')) : name.substring(0, name.lastIndexOf('/')); + wrapper(module.exports, window.require, module, name, dirname); + + window.require.cache[name] = module; + return module.exports; + } catch (e) { + throw new Error('Failed to require dynamically ' + name + ': ' + e.message); + } + } + + throw new Error('Module ' + name + ' not found in editor-stub-preload require mock'); + }; + window.require.cache = {}; +} diff --git a/src/core/scene/runtime/browser-assets/host.js b/src/core/scene/runtime/browser-assets/host.js new file mode 100644 index 000000000..83fc2e6e3 --- /dev/null +++ b/src/core/scene/runtime/browser-assets/host.js @@ -0,0 +1,31 @@ +/** Host-owned adapter: consumers receive functions and never resolve CLI modules. */ +export function createBrowserHost(backendBaseUrl) { + if (!backendBaseUrl) throw new Error('backendBaseUrl is required'); + let loader; + let environment; + let capabilities; + async function getLoader() { + return loader ??= (async () => { + const manifestUrl = new URL('scripting/scene-runtime/manifest.json', backendBaseUrl.endsWith('/') ? backendBaseUrl : backendBaseUrl + '/'); + const response = await fetch(manifestUrl, { cache: 'no-store' }); + if (!response.ok) throw new Error('CLI browser runtime manifest failed: ' + response.status); + const manifest = await response.json(); + if (manifest.apiVersion !== 1 || manifest.capabilitiesApiVersion !== 1 || !/^[a-f0-9]{16}$/.test(manifest.buildId)) throw new Error('Browser host requires runtime API 1 with capabilities API 1'); + const url = new URL(manifest.loader, manifestUrl); + if (url.href !== new URL('./' + manifest.buildId + '/loader.js', manifestUrl).href) throw new Error('Invalid browser runtime loader'); + return import(url.href); + })(); + } + return Object.freeze({ + apiVersion: 1, + async loadEngine(options = {}) { + return environment ??= (async () => (await getLoader()).loadEngine({ ...options, backendBaseUrl }))(); + }, + async prepareScene(options = {}) { + return capabilities ??= (async () => { + const env = await this.loadEngine(options); + return (await getLoader()).prepareSceneCapabilities(env); + })(); + }, + }); +} diff --git a/src/core/scene/runtime/browser-assets/loader.js b/src/core/scene/runtime/browser-assets/loader.js new file mode 100644 index 000000000..555d45efa --- /dev/null +++ b/src/core/scene/runtime/browser-assets/loader.js @@ -0,0 +1,99 @@ +import { installModuleMapDiagnostics } from './module-map-runtime.js'; +/* global window, document, System, fetch */ +import { runtimeResource, backendResource, resolveImportMap } from './runtime-resources.js'; +let capabilityIds; +let pageSystem; + +/** + * 引擎加载公共流程。 + * + * 浏览器游戏预览(game-boot.js)与场景编辑器预览(scene-editor-boot.js)共用这一段 + * 「web-env + SystemJS + import-map + 引擎 bundle」加载流程,唯一区别是运行模式: + * 预览以 PREVIEW 模式(EDITOR=false / PREVIEW=true)加载,场景编辑器以默认编辑器模式加载。 + * 加载完成后各调用方自行 System.import('cc') 跑游戏,或 import scene-bundle 启服务。 + * + * @param {{ preview?: boolean, backendBaseUrl?: string, runtimeResourceBase?: string }} [options] preview=true 时以 PREVIEW 模式加载引擎。 + * @returns {Promise} 填充后的 window.WebEnv(含 serverURL / enginePath 等)。 + */ +export async function loadEngine(options = {}) { + const env = window.WebEnv = window.WebEnv || {}; + const backendBaseUrl = options.backendBaseUrl || env.serverURL; + const runtimeResourceBase = options.runtimeResourceBase; + const cliResourceBase = new URL('./', import.meta.url).href; + const backend = name => backendResource(name, backendBaseUrl); + const runtime = name => runtimeResource(name, cliResourceBase); + const envRes = await fetch(backend('scripting/web-env')); + if (!envRes.ok) throw new Error(`Web environment query failed: ${envRes.status}`); + Object.assign(env, await envRes.json(), { serverURL: backendBaseUrl, runtimeResourceBase }); + + await import(runtime('polyfills.bundle.js')); + await import(backend('scripting/systemjs/system.js')); + await import(backend('scripting/systemjs/extras/named-register.js')); + + // 注入 import map。动态注入外部 src import-map 存在时序问题(System.import 可能 + // 在其 fetch 完成前就解析 'cc'),因此先 fetch 再以内联方式注入,保证同步解析就绪。 + const sources = [ + new URL('import-map.json', cliResourceBase).href, + '/scripting/engine-dist/import-map.json', + '/scripting/x/pack-import-map-url', + '/scripting/import-map-global', + ]; + for (const src of sources) { + const sourceUrl = src.startsWith('http:') || src.startsWith('https:') ? src : backend(src); + const res = await fetch(sourceUrl, { cache: 'no-store' }); + if (!res.ok) throw new Error(`Import map query failed: ${sourceUrl} (${res.status})`); + const map = resolveImportMap(await res.json(), sourceUrl); + if (sourceUrl === sources[0]) capabilityIds = Object.keys(map.imports).filter(id => id.startsWith('cocos-cli/browser/')); + const script = document.createElement('script'); + script.type = 'systemjs-importmap'; + script.textContent = JSON.stringify(map); + document.head.appendChild(script); + } + + System.setResolutionDetailMapCallback(function () { + const url = new URL(backend('scripting/x/resolution-detail-map')); + return fetch(url).then((response) => response.json()).then((json) => ({ json, url: url.href })); + }); + + await System.prepareImport(true); + pageSystem = System; + const packMapURL = backend('scripting/x/pack-import-map-url'); + installModuleMapDiagnostics(System, backendBaseUrl, { + packMapURL, + diagnosticURL: backend('scripting/module-diagnostic'), + mapBaseURL: packMapURL, + }); + + await import(runtime('editor-stub-preload.js')); + if (options.preview) { + // 游戏预览必须以 PREVIEW 模式运行,而不是编辑器编辑模式。 + // editor-stub-preload 会设置 window.CC_EDITOR=true(场景编辑器预览需要), + // 但在游戏预览里这会让引擎 internal:constants 解析出 EDITOR=true, + // 进而 physics-selector 的 runInEditor=!EDITOR=false,导致物理世界不被创建 + // (PhysicsSystem.physicsWorld 为 null,setDefaultPhysicsMaterial 崩溃)。 + // 这里在引擎加载前覆盖为 PREVIEW 模式:EDITOR=false / PREVIEW=true。 + window.CC_EDITOR = false; + window.CC_PREVIEW = true; + } + await import(runtime('editor-extends.bundle.js')); + await import(backend('scripting/engine-dist/bundled/index.js')); + + return env; +} + +/** Resolve shared implementations before evaluating the private view service classes. */ +export async function prepareSceneCapabilities(environment) { + if (!capabilityIds?.length) throw new Error('Load the engine before preparing scene capabilities'); + // ScriptService bundles an Executor-owned SystemJS that assigns globalThis.System + // while evaluating. Keep the page loader instance so the import maps stay available + // for the remaining capability modules and for the private view bundle. + const system = pageSystem ?? System; + await system.import('cocos-cli/browser/scene'); + if (globalThis.System !== system) globalThis.System = system; + const modules = Object.create(null); + for (const id of capabilityIds) { + const namespace = await system.import(id); + modules[id.slice('cocos-cli/browser/'.length)] = namespace.default || namespace; + } + return Object.freeze({ apiVersion: 1, identity: system, modules: Object.freeze(modules), environment }); +} diff --git a/src/core/scene/runtime/browser-assets/module-map-runtime.js b/src/core/scene/runtime/browser-assets/module-map-runtime.js new file mode 100644 index 000000000..739c9be03 --- /dev/null +++ b/src/core/scene/runtime/browser-assets/module-map-runtime.js @@ -0,0 +1,84 @@ +/* global fetch, URL, console, AbortController, setTimeout, clearTimeout */ + +// QuickPack placeholders are ordinary scoped imports, not proof of missing source files. +export function findPackMapping(map, specifier, importer, baseURL) { + const scopes = Object.entries(map.scopes || {}) + .map(([scope, imports]) => [new URL(scope, baseURL).href, imports]) + .filter(([scope]) => importer === scope || (scope.endsWith('/') && importer.startsWith(scope))) + .sort((a, b) => b[0].length - a[0].length); + for (const [, imports] of scopes) { + if (Object.prototype.hasOwnProperty.call(imports, specifier)) { + return typeof imports[specifier] === 'string' ? new URL(imports[specifier], baseURL).href : undefined; + } + } + return undefined; +} + +export function installModuleMapDiagnostics(system, serverURL, options = {}) { + if (system.__pinkModuleMapDiagnostics) return; + system.__pinkModuleMapDiagnostics = true; + const backendBase = serverURL.endsWith('/') ? serverURL : serverURL + '/'; + const packMapURL = options.packMapURL || new URL('scripting/x/pack-import-map-url', backendBase).href; + const diagnosticURL = options.diagnosticURL || new URL('scripting/module-diagnostic', backendBase).href; + const mapBaseURL = options.mapBaseURL || backendBase; + const resolve = system.resolve; + const timeoutMs = Number.isFinite(options.requestTimeoutMs) && options.requestTimeoutMs > 0 + ? options.requestTimeoutMs : 1500; + // Bound both fetch and response.json(); an unavailable diagnostic must not hang resolution. + const readJSON = async url => { + const controller = new AbortController(); + let timer; + try { + return await Promise.race([ + (async () => { + const response = await fetch(url, { cache: 'no-store', signal: controller.signal }); + if (!response.ok) throw new Error('Module diagnostic HTTP ' + response.status); + return await response.json(); + })(), + new Promise((_, reject) => { + timer = setTimeout(() => { controller.abort(); reject(new Error('Module diagnostic request timed out')); }, timeoutMs); + }), + ]); + } finally { clearTimeout(timer); } + }; + let pending; + const freshMap = () => { + if (!pending) { + pending = readJSON(new URL(packMapURL)).finally(() => { pending = undefined; }); + } + return pending; + }; + system.resolve = async function (specifier, importer, ...rest) { + try { + return await resolve.call(this, specifier, importer, ...rest); + } catch (original) { + if (!/^__unresolved_\d+$/.test(specifier) || typeof importer !== 'string') throw original; + let mapped; + try { + const map = await freshMap(); + mapped = findPackMapping(map, specifier, importer, mapBaseURL); + } catch (error) { + console.warn('[ScriptModuleRuntimeError] Could not refresh import map:', error); + } + let diagnostic; + try { + const url = new URL(diagnosticURL); + url.searchParams.set('chunk', importer); + url.searchParams.set('specifier', specifier); + diagnostic = await readJSON(url); + } catch { /* Preserve the original error if diagnostics are unavailable. */ } + const details = diagnostic + ? `\nLatest compiled source: ${diagnostic.source}\nLatest compiled import: ${diagnostic.import}\nLocation: ${diagnostic.line || '?'}:${diagnostic.column || '?'}` + : `\nChunk: ${importer}\nSpecifier: ${specifier}`; + // Chunk IDs identify module URLs, not source revisions. Never combine a loaded + // old chunk with a newer mapping. Let the host/user reload the runtime, preserving + // unsaved editor state instead of forcing a page reload here. + const reloadRequired = mapped + ? '\n[ScriptModuleRuntimeReloadRequired] A newer mapping exists, but its source revision cannot be verified. Reload the preview or runtime before retrying.' + : ''; + const error = new Error(String(original && original.message || original) + '\n[ScriptModuleRuntimeError]' + details + reloadRequired); + error.cause = original; + throw error; + } + }; +} diff --git a/src/core/scene/runtime/browser-assets/runtime-resources.js b/src/core/scene/runtime/browser-assets/runtime-resources.js new file mode 100644 index 000000000..ca43ae50d --- /dev/null +++ b/src/core/scene/runtime/browser-assets/runtime-resources.js @@ -0,0 +1,22 @@ +/** Resolve assets relative to the resource base of the package that owns them. */ +export function runtimeResource(name, base = new URL('./', import.meta.url).href) { + return new URL(name, base.endsWith('/') ? base : base + '/').href; +} + +export function backendResource(name, base) { + if (!base) throw new Error('backendBaseUrl is required'); + return new URL(name.replace(/^\//, ''), base.endsWith('/') ? base : base + '/').href; +} + +/** Inline import maps lose their source URL; resolve addresses before inserting them in the Webview. */ +export function resolveImportMap(map, sourceUrl) { + // SystemJS resolves bare targets through earlier maps (cc/env -> cc/editor/...). + // Only URL-like values lose their base when a fetched map is inlined. + const isUrlLike = value => typeof value === 'string' && /^(\.\.?\/|\/|[a-zA-Z][\w+.-]*:)/.test(value); + const address = value => isUrlLike(value) ? new URL(value, sourceUrl).href : value; + const key = address; + const imports = values => Object.fromEntries(Object.entries(values || {}).map(([name, value]) => [key(name), address(value)])); + return { ...map, imports: imports(map.imports), scopes: Object.fromEntries( + Object.entries(map.scopes || {}).map(([scope, values]) => [new URL(scope, sourceUrl).href, imports(values)]) + ) }; +} diff --git a/src/core/scene/runtime/editor-types-contract.ts b/src/core/scene/runtime/editor-types-contract.ts new file mode 100644 index 000000000..e405c5d9d --- /dev/null +++ b/src/core/scene/runtime/editor-types-contract.ts @@ -0,0 +1,88 @@ +/** Versioned capability contract, published through @cocos/cocos-cli-types/scene. */ +export interface HostModules { + 'commands/base': typeof import('../../../commands/base'); + 'core/assets/index': typeof import('../../assets/index'); + 'core/base/editor-shim': typeof import('../../base/editor-shim'); + 'core/base/i18n': typeof import('../../base/i18n'); + 'core/base/utils/uuid': typeof import('../../base/utils/uuid'); + 'core/builder/@types/protected': typeof import('../../builder/@types/protected'); + 'core/builder/index': typeof import('../../builder/index'); + 'core/builder/platforms/web-common/utils': typeof import('../../builder/platforms/web-common/utils'); + 'core/builder/share/common-options-validator': typeof import('../../builder/share/common-options-validator'); + 'core/configuration/index': typeof import('../../configuration/index'); + 'core/configuration/script/interface': typeof import('../../configuration/script/interface'); + 'core/extension-roots': typeof import('../../extension-roots'); + 'core/launcher': typeof import('../../launcher'); + 'core/project/index': typeof import('../../project/index'); + 'core/scene/common/index': typeof import('../common/index'); + 'core/scene/common/preview': typeof import('../common/preview'); + 'core/scene/common/reflection-probe': typeof import('../common/reflection-probe'); + 'core/scene/index': typeof import('../index'); + 'core/scene/main-process/index': typeof import('../main-process/index'); + 'core/scene/main-process/rpc': typeof import('../main-process/rpc'); + 'core/scene/runtime/resources/scene-routes': typeof import('./resources/scene-routes'); + 'core/scene/runtime/resources/scripting-routes': typeof import('./resources/scripting-routes'); + 'core/scene/runtime/resources/settings': typeof import('./resources/settings'); + 'core/scripting/index': typeof import('../../scripting/index'); + 'global': typeof import('../../../global'); + 'lib/simulator/simulator': typeof import('../../../lib/simulator/simulator'); + 'server/index': typeof import('../../../server/index'); + 'server/interfaces': typeof import('../../../server/interfaces'); + 'server/middleware/index': typeof import('../../../server/middleware/index'); + 'server/socket': typeof import('../../../server/socket'); +} +export interface BrowserModules { + 'scene': Omit; + 'scene/context': Omit; + 'scene/common': Omit; + // Configuration interfaces are type exports, with no browser runtime members. + 'scene/config': Record; + 'scene/i18n': typeof import('../scene-process/i18n'); + 'scene/rpc': Omit; + 'scene/light-probe-normal-reset': Omit; + 'scene/animation/property-commit-event': Omit; + 'scene/editor-session': Omit; + 'scene/dump': typeof import('../scene-process/service/dump/index'); + 'scene/engine': Omit; + 'scene/message': Omit; + 'scene/node': typeof import('../scene-process/service/node/index'); + 'scene/node/node-create': Omit; + 'scene/node/node-type-config': typeof import('../scene-process/service/node/node-type-config'); + 'scene/node/node-utils': Omit; + 'scene/node/prefab-canvas-mutation': Omit; + 'scene/operation/types': Omit; + 'scene/prefab/prefab-editor-utils': Omit; + 'scene/reference-image': Omit; + 'scene/scene/light-probe-snapshot': Omit; + 'scene/scene/light-probe-transform': Omit; + 'scene/scene/utils': Omit; + 'scene/service-manager': Omit; + 'scene/utils/asset-reload': Omit; + 'scene/utils/editor-node': Omit; + 'scene/utils/state-machine/finite-state-machine': typeof import('../scene-process/service/utils/state-machine/finite-state-machine'); + 'scene/utils/state-machine/state-interface': typeof import('../scene-process/service/utils/state-machine/state-interface'); + 'scene/session/client': Omit; + 'scene/session/methods': Omit; + 'scene/session/protocol': Omit; + 'engine/editor-extends': Omit; + 'engine/node-path': Omit; + 'engine/serialize': Omit; + 'engine/deserialize': Omit; + 'engine/geometry': Omit; + 'engine/prefab': Omit; + 'engine/graphics-config': Omit; + 'engine/polyfill': Record; + // TypeScript exposes the CommonJS export-assignment member on this namespace. + 'engine/overwrite': { default: typeof import('cc/overwrite'); 'export=': typeof import('cc/overwrite') }; + 'engine/editor/2d-misc': Omit; + 'engine/editor/new-gen-anim': Omit; + 'engine/editor/lod-group-utils': Omit; +} +export interface HostCapabilities { + readonly apiVersion: 1; + readonly cliVersion: string; + readonly identity: object; + readonly modules: HostModules; + readonly portable: Pick; + readonly browserHostPath: string; +} diff --git a/src/core/scene/runtime/plugin-host.ts b/src/core/scene/runtime/plugin-host.ts new file mode 100644 index 000000000..736b2989d --- /dev/null +++ b/src/core/scene/runtime/plugin-host.ts @@ -0,0 +1,50 @@ +import type { HostCapabilities } from './editor-types-contract'; +let capabilities: HostCapabilities | undefined; +const identity = Object.freeze({}); + +/** The CLI owns implementation loading; private packages receive shared objects only. */ +export function createSceneEditorHostCapabilities(): HostCapabilities { + return capabilities ??= { + apiVersion: 1, + cliVersion: require('../../../../package.json').version, + identity, + browserHostPath: '/scripting/scene-runtime/host.js', + modules: { + 'commands/base': require('../../../commands/base'), + 'core/assets/index': require('../../assets/index'), + 'core/base/editor-shim': require('../../base/editor-shim'), + 'core/base/i18n': require('../../base/i18n'), + 'core/base/utils/uuid': require('../../base/utils/uuid'), + 'core/builder/@types/protected': require('../../builder/@types/protected'), + 'core/builder/index': require('../../builder/index'), + 'core/builder/platforms/web-common/utils': require('../../builder/platforms/web-common/utils'), + 'core/builder/share/common-options-validator': require('../../builder/share/common-options-validator'), + 'core/configuration/index': require('../../configuration/index'), + 'core/configuration/script/interface': require('../../configuration/script/interface'), + 'core/extension-roots': require('../../extension-roots'), + 'core/launcher': require('../../launcher'), + 'core/project/index': require('../../project/index'), + 'core/scene/common/index': require('../common/index'), + 'core/scene/common/preview': require('../common/preview'), + 'core/scene/common/reflection-probe': require('../common/reflection-probe'), + 'core/scene/index': require('../index'), + 'core/scene/main-process/index': require('../main-process/index'), + 'core/scene/main-process/rpc': require('../main-process/rpc'), + 'core/scene/runtime/resources/scene-routes': require('./resources/scene-routes'), + 'core/scene/runtime/resources/scripting-routes': require('./resources/scripting-routes'), + 'core/scene/runtime/resources/settings': require('./resources/settings'), + 'core/scripting/index': require('../../scripting/index'), + 'global': require('../../../global'), + 'lib/simulator/simulator': require('../../../lib/simulator/simulator'), + 'server/index': require('../../../server/index'), + 'server/interfaces': require('../../../server/interfaces'), + 'server/middleware/index': require('../../../server/middleware/index'), + 'server/socket': require('../../../server/socket'), + }, + portable: { + 'scene/session/client': require('../session/client'), + 'scene/session/methods': require('../session/methods'), + 'scene/session/protocol': require('../session/protocol'), + }, + }; +} diff --git a/src/core/scene/runtime/resources/browser-runtime.ts b/src/core/scene/runtime/resources/browser-runtime.ts new file mode 100644 index 000000000..f40f852a1 --- /dev/null +++ b/src/core/scene/runtime/resources/browser-runtime.ts @@ -0,0 +1,39 @@ +import type { Request, Response, NextFunction } from 'express'; +import { join, relative, isAbsolute } from 'path'; +import { readJSON, pathExists, stat } from 'fs-extra'; +import { GlobalPaths } from '../../../../global'; + +/** CLI-owned browser artifacts. Build IDs prevent mixing chunks from different releases. */ +export const browserRuntimeRoutes = [{ + url: /^\/scripting\/scene-runtime(?:\/|$)/, + async handler(req: Request, res: Response, next: NextFunction): Promise { + try { + const root = join(GlobalPaths.workspace, 'dist', 'scene-runtime'); + const manifestFile = join(root, 'manifest.json'); + if (!(await pathExists(manifestFile))) { + return res.status(503).json({ error: 'CLI browser runtime is unavailable; run npm run build:scene-runtime in cocos-cli' }); + } + const manifest = await readJSON(manifestFile); + if (req.path === '/scripting/scene-runtime/manifest.json') { + res.setHeader('Cache-Control', 'no-store'); + return res.json(manifest); + } + if (req.path === '/scripting/scene-runtime/host.js') { + res.setHeader('Cache-Control', 'no-store'); + res.sendFile(join(root, 'host.js'), { dotfiles: 'allow' }); + return; + } + const prefix = `/scripting/scene-runtime/${manifest.buildId}/`; + if (!req.path.startsWith(prefix)) return res.sendStatus(404); + const name = decodeURIComponent(req.path.slice(prefix.length)); + const file = join(root, name); + const within = relative(root, file); + if (within.startsWith('..') || isAbsolute(within) || name.includes('\\')) return res.sendStatus(403); + if (!/\.(?:js|json|map)$/.test(name) || name === 'manifest.json' || !(await pathExists(file)) || !(await stat(file)).isFile()) { + return res.sendStatus(404); + } + res.setHeader('Cache-Control', 'public, max-age=31536000, immutable'); + res.sendFile(file, { dotfiles: 'allow' }); + } catch (error) { next(error); } + }, +}]; diff --git a/src/core/scene/runtime/resources/scripting-routes.ts b/src/core/scene/runtime/resources/scripting-routes.ts index aaacc70eb..8aff00341 100644 --- a/src/core/scene/runtime/resources/scripting-routes.ts +++ b/src/core/scene/runtime/resources/scripting-routes.ts @@ -1,4 +1,5 @@ import { describeChunkImport } from './module-diagnostic'; +import { browserRuntimeRoutes } from './browser-runtime'; import type { Request, Response, NextFunction } from 'express'; import path, { isAbsolute, join, relative } from 'path'; import { pathExists, stat, readFile } from 'fs-extra'; @@ -107,6 +108,7 @@ function getAssetLibraryBaseUrl(serverBaseUrl: string): string { * 不包含各自专属的 `/` 入口路由。 */ export const scriptingRoutes = [ + ...browserRuntimeRoutes, { url: '/scripting/module-diagnostic', async handler(req: Request, res: Response, next: NextFunction): Promise { diff --git a/src/core/scene/runtime/resources/test/browser-runtime.test.ts b/src/core/scene/runtime/resources/test/browser-runtime.test.ts new file mode 100644 index 000000000..3ff841f0c --- /dev/null +++ b/src/core/scene/runtime/resources/test/browser-runtime.test.ts @@ -0,0 +1,52 @@ +import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'fs'; +import { tmpdir } from 'os'; +import { join } from 'path'; +import { GlobalPaths } from '../../../../../global'; +import { browserRuntimeRoutes } from '../browser-runtime'; + +describe('CLI browser runtime resources', () => { + const original = GlobalPaths.workspace; + let directory: string; + const buildId = '0123456789abcdef'; + beforeEach(() => { + directory = mkdtempSync(join(tmpdir(), 'cli-browser-resources-')); + GlobalPaths.workspace = directory; + mkdirSync(join(directory, 'dist/scene-runtime'), { recursive: true }); + }); + afterEach(() => { + GlobalPaths.workspace = original; + rmSync(directory, { recursive: true, force: true }); + }); + function manifest() { + writeFileSync(join(directory, 'dist/scene-runtime/manifest.json'), JSON.stringify({ apiVersion: 1, buildId })); + } + async function request(path: string) { + const res: any = { setHeader: jest.fn(), json: jest.fn(), sendFile: jest.fn(), sendStatus: jest.fn() }; + res.status = jest.fn(() => res); + const next = jest.fn(); + await browserRuntimeRoutes[0].handler({ path } as any, res, next); + expect(next).not.toHaveBeenCalled(); + return res; + } + it('reports an unbuilt CLI instead of falling through to project asset routes', async () => { + const res = await request('/scripting/scene-runtime/manifest.json'); + expect(res.status).toHaveBeenCalledWith(503); + }); + it('serves a fresh descriptor and immutable files from the selected build', async () => { + manifest(); + const descriptor = await request('/scripting/scene-runtime/manifest.json'); + expect(descriptor.setHeader).toHaveBeenCalledWith('Cache-Control', 'no-store'); + expect(descriptor.json).toHaveBeenCalledWith({ apiVersion: 1, buildId }); + writeFileSync(join(directory, 'dist/scene-runtime/loader.js'), 'export {};'); + const resource = await request(`/scripting/scene-runtime/${buildId}/loader.js`); + expect(resource.sendFile).toHaveBeenCalledWith(join(directory, 'dist/scene-runtime/loader.js'), { dotfiles: 'allow' }); + expect(resource.setHeader).toHaveBeenCalledWith('Cache-Control', 'public, max-age=31536000, immutable'); + }); + it('rejects stale builds, missing files and paths outside the artifact directory', async () => { + manifest(); + expect((await request('/scripting/scene-runtime/old/loader.js')).sendStatus).toHaveBeenCalledWith(404); + expect((await request(`/scripting/scene-runtime/${buildId}/missing.js`)).sendStatus).toHaveBeenCalledWith(404); + expect((await request(`/scripting/scene-runtime/${buildId}/%2e%2e%2fsecret.json`)).sendStatus).toHaveBeenCalledWith(403); + expect((await request(`/scripting/scene-runtime/${buildId}/%2e%2e%5csecret.json`)).sendStatus).toHaveBeenCalledWith(403); + }); +}); diff --git a/tests/browser-runtime/deferred-module-proxy.test.js b/tests/browser-runtime/deferred-module-proxy.test.js new file mode 100644 index 000000000..2f862a757 --- /dev/null +++ b/tests/browser-runtime/deferred-module-proxy.test.js @@ -0,0 +1,82 @@ +const { + DEFERRED_MODULE_CACHE_KEY, + createDeferredModule, + createDeferredModuleSource, + getDeferredModule, +} = require('../../workflow/deferred-module-proxy'); + +describe('scene bundle deferred module proxy', () => { + it('reads an imported module through its resolved registry ID', () => { + const moduleId = 'cc/editor/lod-group-utils'; + const resolvedId = 'q-bundled:///fs/editor/exports/lod-group-utils.js'; + const loadedModule = { + LODGroupEditorUtility: { + getVisibleLOD: jest.fn(), + }, + }; + const system = { + resolve: jest.fn(() => resolvedId), + get: jest.fn((id) => id === resolvedId ? loadedModule : undefined), + }; + const proxy = createDeferredModule(moduleId, () => system, getDeferredModule); + + expect(proxy.LODGroupEditorUtility).toBe(loadedModule.LODGroupEditorUtility); + expect('LODGroupEditorUtility' in proxy).toBe(true); + expect(system.resolve).toHaveBeenCalledWith(moduleId); + expect(system.get).toHaveBeenCalledWith(resolvedId); + }); + + it('falls back to the original ID when the module cannot be resolved', () => { + const loadedModule = { value: 42 }; + const system = { + resolve: jest.fn(() => { + throw new Error('unresolved'); + }), + get: jest.fn((id) => id === 'named-module' ? loadedModule : undefined), + }; + + expect(getDeferredModule(system, 'named-module')).toBe(loadedModule); + expect(system.get).toHaveBeenCalledWith('named-module'); + }); + + it('reads a preloaded module when System.resolve is asynchronous', () => { + const moduleId = 'cc/editor/lod-group-utils'; + const loadedModule = { + LODGroupEditorUtility: { + getVisibleLOD: jest.fn(), + }, + }; + const system = { + resolve: jest.fn(() => Promise.resolve('q-bundled:///fs/editor/exports/lod-group-utils.js')), + get: jest.fn(), + }; + const moduleCache = { + [moduleId]: loadedModule, + }; + const proxy = createDeferredModule(moduleId, () => system, getDeferredModule, () => moduleCache); + + expect(proxy.LODGroupEditorUtility).toBe(loadedModule.LODGroupEditorUtility); + expect('LODGroupEditorUtility' in proxy).toBe(true); + expect(system.resolve).not.toHaveBeenCalled(); + expect(system.get).not.toHaveBeenCalled(); + }); + + it('does not pass an asynchronous resolver result to System.get', () => { + const system = { + resolve: jest.fn(() => Promise.resolve('resolved-module')), + get: jest.fn((id) => id === 'named-module' ? { value: 42 } : undefined), + }; + + expect(getDeferredModule(system, 'named-module')).toEqual({ value: 42 }); + expect(system.get).toHaveBeenCalledTimes(1); + expect(system.get).toHaveBeenCalledWith('named-module'); + }); + + it('generates the same resolver used by the browser bundle', () => { + const source = createDeferredModuleSource(); + + expect(source).toContain('const candidate = system.resolve(id)'); + expect(source).toContain(`globalThis[${JSON.stringify(DEFERRED_MODULE_CACHE_KEY)}]`); + expect(source).toContain('_createDeferredModule(id, _getSystem, _getDeferredModule, _getModuleCache)'); + }); +}); diff --git a/tests/browser-runtime/module-map-runtime.test.ts b/tests/browser-runtime/module-map-runtime.test.ts new file mode 100644 index 000000000..336cdfcaa --- /dev/null +++ b/tests/browser-runtime/module-map-runtime.test.ts @@ -0,0 +1,87 @@ +import fs from 'fs'; +import path from 'path'; +import vm from 'vm'; +import os from 'os'; + +const importer = 'http://localhost:9527/chunks/aa/source.js'; +const newerMap = {scopes:{'./chunks/aa/source.js':{'__unresolved_1':'./chunks/bb/different.js'}}}; +const diagnostic = {source:'/project/Probe.ts',import:'./Different',line:2,column:3}; +const source = () => fs.readFileSync(path.resolve(__dirname,'../../src/core/scene/runtime/browser-assets/module-map-runtime.js'),'utf8').replace(/export function /g,'function '); +function setup(map: object = newerMap, fetchOverride?: any, options: object = {}) { + const fetch = jest.fn(fetchOverride || (async (url: URL) => ({ok:true,json:async()=>url.pathname.endsWith('module-diagnostic')?diagnostic:map}))); + const context:any={URL,AbortController,setTimeout,clearTimeout,fetch,console:{warn:jest.fn()}}; + vm.runInNewContext(source()+';globalThis.install=installModuleMapDiagnostics;',context); + const original=new Error('SystemJS failed'); + const system={resolve:jest.fn(async (_specifier:string,_importer:string)=>{throw original;})}; + context.install(system,'http://localhost:9527',{requestTimeoutMs:15,...options}); + return {system,fetch,original,context}; +} +test('requires a reload instead of accepting an unverified latest mapping',async()=>{ + const {system,fetch}=setup(); + await expect(system.resolve('__unresolved_1',importer)).rejects.toThrow('ScriptModuleRuntimeReloadRequired'); + expect(fetch.mock.calls[0][1]).toEqual(expect.objectContaining({cache:'no-store'})); +}); +test('reports latest compilation details without claiming they describe the loaded revision',async()=>{ + const {system}=setup({scopes:{}}); + await expect(system.resolve('__unresolved_1',importer)).rejects.toThrow('Latest compiled import: ./Different'); +}); +test('leaves ordinary resolution errors unchanged',async()=>{ + const {system,fetch,original}=setup(); + await expect(system.resolve('some-package',importer)).rejects.toBe(original); + expect(fetch).not.toHaveBeenCalled(); +}); +test('supports explicit backend endpoints and map base',async()=>{ + const {system,fetch}=setup(newerMap,undefined,{ + packMapURL:'http://localhost:9527/backend/scripting/x/pack-import-map-url', + diagnosticURL:'http://localhost:9527/backend/scripting/module-diagnostic', + mapBaseURL:'http://localhost:9527/backend/scripting/x/pack-import-map-url', + }); + await expect(system.resolve('__unresolved_1','http://localhost:9527/backend/scripting/x/chunks/aa/source.js')).rejects.toThrow('ScriptModuleRuntimeReloadRequired'); + expect(fetch.mock.calls[0][0].pathname).toBe('/backend/scripting/x/pack-import-map-url'); + expect(fetch.mock.calls[1][0].pathname).toBe('/backend/scripting/module-diagnostic'); +}); +test.each(['request','body','map-request','map-body'])('bounds stalled %s without losing the original failure',async stall=>{ + const never=new Promise(()=>{}); + const {system,fetch}=setup(newerMap,async(url:URL)=>{ + const isMap=url.pathname.endsWith('pack-import-map-url'); + if((stall==='request'&&!isMap)||(stall==='map-request'&&isMap))return never; + return {ok:true,json:()=>((stall==='body'&&!isMap)||(stall==='map-body'&&isMap))?never:Promise.resolve(isMap?newerMap:diagnostic)}; + }); + await expect(system.resolve('__unresolved_1',importer)).rejects.toThrow('SystemJS failed'); + expect(fetch.mock.calls.some(call=>(call[1] as any).signal.aborted)).toBe(true); +}); +test('real Cocos SystemJS does not execute an old chunk with a different revision dependency',async()=>{ + const host=process.env.COCOS_CLI_ROOT || path.dirname(require.resolve('cocos-cli/package.json')); + const {build}=require(require.resolve('@cocos/module-system',{paths:[host]})); + const directory=fs.mkdtempSync(path.join(os.tmpdir(),'module-revision-loader-')); + const output=path.join(directory,'system.js'); + const {context}=setup(); + Object.assign(context,{location:{href:'http://localhost:9527/',origin:'http://localhost:9527'},document:{querySelector:()=>null,querySelectorAll:()=>[]},addEventListener:()=>undefined}); + context.self=context.window=context.global=context; + try { + await build({out:output,minify:false,sourceMap:false,platform:'web-mobile',editor:true}); + vm.runInNewContext(fs.readFileSync(output,'utf8'),context); + const system=context.System; + system.setResolutionDetailMapCallback(async()=>({json:{},url:'http://localhost:9527/details'})); + context.install(system,'http://localhost:9527',{requestTimeoutMs:100}); + let executed=false; + const instantiate=jest.fn(async(url:string)=>{ + if(url!==importer)throw Error('Different dependency must not be loaded: '+url); + // Saved old revision imported ./Existing. The new revision reused this URL + // and placeholder for ./Different; accepting the map would produce old:DIFFERENT. + system.register(['__unresolved_1'],(exporter:any)=>{ + let value:string; + return {setters:[(module:any)=>{value=module.value;}],execute(){executed=true;exporter('value','old:'+value);}}; + }); + return system.getRegister(); + }); + system.instantiate=instantiate; + await expect(system.import(importer)).rejects.toThrow('ScriptModuleRuntimeReloadRequired'); + expect(executed).toBe(false); + expect(instantiate).toHaveBeenCalledTimes(1); + } finally { + expect(path.basename(directory).startsWith('module-revision-loader-')).toBe(true); + expect(path.resolve(directory).startsWith(path.resolve(os.tmpdir())+path.sep)).toBe(true); + fs.rmSync(directory,{recursive:true,force:true}); + } +}); diff --git a/tests/browser-runtime/scene-runtime-facade.test.js b/tests/browser-runtime/scene-runtime-facade.test.js new file mode 100644 index 000000000..38ff2eab1 --- /dev/null +++ b/tests/browser-runtime/scene-runtime-facade.test.js @@ -0,0 +1,73 @@ +const path = require('node:path'); +const vm = require('node:vm'); +const ts = require('typescript'); +const { rollup } = require('rollup'); +const virtual = require('@rollup/plugin-virtual'); +const { createBrowserRuntimeFacade } = require('../../workflow/build-scene-runtime'); + +function declarations(implementation) { + const normalize = file => file.replace(/\\/g, '/'); + const entry = normalize(path.join(__dirname, 'facade-fixture.d.ts')); + const target = normalize(path.join(__dirname, 'implementation-fixture.d.ts')); + const files = new Map([ + [entry, "export * from './implementation-fixture'; export { default } from './implementation-fixture';"], + [target, implementation], + ]); + const options = { module: ts.ModuleKind.CommonJS, esModuleInterop: true, types: [], noLib: true }; + const host = ts.createCompilerHost(options); + const getSourceFile = host.getSourceFile.bind(host); + const fileExists = host.fileExists.bind(host); + host.getSourceFile = (file, ...args) => files.has(normalize(file)) + ? ts.createSourceFile(file, files.get(normalize(file)), ts.ScriptTarget.Latest, true) + : getSourceFile(file, ...args); + host.fileExists = file => files.has(normalize(file)) || fileExists(file); + const program = ts.createProgram([...files.keys()], options, host); + return { checker: program.getTypeChecker(), source: program.getSourceFile(entry) }; +} + +async function loadFacade(fixture, api) { + const source = createBrowserRuntimeFacade(fixture.checker, fixture.source, 'implementation'); + const bundle = await rollup({ + input: 'facade', + plugins: [virtual({ facade: source, implementation: 'export default globalThis.api;' })], + }); + try { + const { output } = await bundle.generate({ format: 'cjs', exports: 'named' }); + const exports = {}; + vm.runInNewContext(output[0].code, { exports, api }); + return exports; + } finally { + await bundle.close(); + } +} + +test('bundles export-assignment declarations and preserves the CommonJS value', async () => { + const fixture = declarations('declare function overwrite(engine: unknown): void; export = overwrite;'); + // Match cc/overwrite after a fresh build-cc-module, even with stale local engine declarations. + const symbols = fixture.checker.getExportsOfModule(fixture.checker.getSymbolAtLocation(fixture.source)); + expect(symbols.map(symbol => symbol.name)).toContain('export='); + const overwrite = jest.fn(); + const exports = await loadFacade(fixture, overwrite); + expect(Object.keys(exports)).toEqual(['default']); + expect(exports.default).toBe(overwrite); +}); + +test('preserves runtime classes, enums and aliases while excluding type-only declarations', async () => { + const fixture = declarations(` + export declare class SceneNode {} + export declare enum Mode { Edit } + export { Mode as SceneMode }; + export interface SceneOptions { name: string; } + export type SceneId = string; + declare const api: unknown; + export default api; + `); + const api = { SceneNode: class SceneNode {}, Mode: { Edit: 0 } }; + api.SceneMode = api.Mode; + const exports = await loadFacade(fixture, api); + expect(Object.keys(exports).sort()).toEqual(['Mode', 'SceneMode', 'SceneNode', 'default']); + expect(exports.default).toBe(api); + expect(exports.SceneNode).toBe(api.SceneNode); + expect(exports.Mode).toBe(api.Mode); + expect(exports.SceneMode).toBe(api.Mode); +}); diff --git a/tests/public-editor-types.test.ts b/tests/public-editor-types.test.ts new file mode 100644 index 000000000..0d45d5ec7 --- /dev/null +++ b/tests/public-editor-types.test.ts @@ -0,0 +1,109 @@ +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import * as ts from 'typescript'; + +const root = path.resolve(__dirname, '..'); +const packageRoot = path.join(root, 'packages/cocos-cli-types'); +const { domainEntries } = require('../workflow/public-dts-rollup'); +const { browserFacadePath } = require('../workflow/scene-browser-api'); +const entries = require('../workflow/scene-api-entries.json'); + +interface DomainEntry { kind: 'host' | 'browser'; id: string; domain: string; namespace: string; } + +describe('editor types integrated into public declarations', () => { + const mappings: DomainEntry[] = domainEntries(); + const fixture = path.join(root, 'tests/.public-editor-types-fixture.ts'); + const code = ` +import type { HostCapabilities, BrowserCapabilities, BrowserHost, Editor } from '../packages/cocos-cli-types/scene'; +import type { IAssetInfo } from '../packages/cocos-cli-types/assets'; +import type { ConfigInterface, rollup as Rollup } from '../packages/cocos-cli-types/builder'; +import { editorExtrasTag, Node } from 'cc'; +declare const host: HostCapabilities; +declare const browser: BrowserHost; +declare const capabilities: BrowserCapabilities; +declare const node: Node; +const queried = host.modules['core/assets/index'].assetManager.queryAssetInfo('db://assets/test'); +const asset: IAssetInfo | null = queried; +type IsAny = 0 extends (1 & T) ? true : false; +type AssertTyped = T; +type AssetIsTyped = AssertTyped>; +type Session = Editor.Browser.SceneSessionProtocol.SceneSessionDescriptor; +type BuilderConfigIsTyped = AssertTyped>; +type RollupOptionsIsTyped = AssertTyped>; +type Manager = typeof Editor.Browser.SceneNode.default; +type ManagerIsTyped = AssertTyped>; +const manager: Manager = capabilities.modules['scene/node'].default; +const queriedNode: Node | null = manager.query('test-node'); +const mountedRoot: Node | undefined = node[editorExtrasTag].mountedRoot; +const portable = host.portable['scene/session/client']; +const prepared = browser.prepareScene({}); +const overwrite: typeof import('cc/overwrite') = capabilities.modules['engine/overwrite']['export=']; +`; + const options: ts.CompilerOptions = { + target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.CommonJS, + moduleResolution: ts.ModuleResolutionKind.Node10, esModuleInterop: true, + skipLibCheck: true, strict: true, types: ['node'], noEmit: true, + }; + const oldFile = (entry: DomainEntry) => path.join(root, 'dist', + (entry.kind === 'browser' ? browserFacadePath(entry.id) : entries.host[entry.id]) + '.d.ts'); + function createFixtureProgram(source = code) { + const compilerHost = ts.createCompilerHost(options); + const getSourceFile = compilerHost.getSourceFile.bind(compilerHost); + compilerHost.getSourceFile = (file, languageVersion, onError, shouldCreateNewSourceFile) => path.resolve(file) === fixture + ? ts.createSourceFile(file, source, languageVersion, true) + : getSourceFile(file, languageVersion, onError, shouldCreateNewSourceFile); + return ts.createProgram([fixture, ...mappings.map(oldFile), + ...new Set(mappings.map(entry => path.join(packageRoot, entry.domain + '.d.ts')))], options, compilerHost); + } + function fixtureDiagnostics(program: ts.Program) { + const source = program.getSourceFile(fixture); + expect(source).toBeDefined(); + // SourceFile identity is independent of Windows/POSIX path separators. + return [...program.getSyntacticDiagnostics(), ...program.getSemanticDiagnostics()] + .filter(diagnostic => diagnostic.file === source) + .map(diagnostic => ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')); + } + const program = createFixtureProgram(); + const checker = program.getTypeChecker(); + const resolve = (symbol: ts.Symbol): ts.Symbol => symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol; + const exportsOf = (symbol: ts.Symbol) => checker.getExportsOfModule(resolve(symbol)); + + it('removes the old declaration tree and explicit package exports', () => { + expect(fs.existsSync(path.join(packageRoot, 'scene-editor'))).toBe(false); + expect(fs.existsSync(path.join(packageRoot, 'scene-editor.d.ts'))).toBe(false); + const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8')); + expect(Object.keys(manifest.exports).some(key => key.includes('scene-editor'))).toBe(false); + expect(manifest.files).toEqual(['*.d.ts']); + }); + + it('type-checks public capabilities, default exports, shared assets and engine augmentation', () => { + expect(fixtureDiagnostics(program)).toEqual([]); + }); + + it('detects fixture type errors on every platform', () => { + const invalid = createFixtureProgram(code + '\nconst invalid: number = "not a number";'); + expect(fixtureDiagnostics(invalid)).toEqual(["Type 'string' is not assignable to type 'number'."]); + }); + + it.each(mappings)('preserves $kind/$id exports in $domain.Editor', entry => { + const oldSource = program.getSourceFile(oldFile(entry))!; + // export= is the compiler's export-assignment symbol, not a named export. + // Its capability-object member is checked in the consumer fixture above. + const oldExports = exportsOf(checker.getSymbolAtLocation(oldSource)!).filter(item => item.name !== 'export='); + const newSource = program.getSourceFile(path.join(packageRoot, entry.domain + '.d.ts'))!; + let symbol = checker.getSymbolAtLocation(newSource)!; + for (const name of ['Editor', entry.kind === 'host' ? 'Host' : 'Browser', entry.namespace]) { + const next = exportsOf(symbol).find(item => item.name === name); + expect(next).toBeDefined(); + symbol = next!; + } + const actual = exportsOf(symbol); + expect(actual.map(item => item.name).sort()).toEqual(oldExports.map(item => item.name).sort()); + for (const expected of oldExports) { + const exported = actual.find(item => item.name === expected.name)!; + // Classes/enums must remain usable as both values and types. + const flags = ts.SymbolFlags.Type | ts.SymbolFlags.Value; + expect(resolve(exported).flags & flags).toBe(resolve(expected).flags & flags); + } + }); +}); diff --git a/tests/scene-editor-browser-host.test.ts b/tests/scene-editor-browser-host.test.ts new file mode 100644 index 000000000..9e485724b --- /dev/null +++ b/tests/scene-editor-browser-host.test.ts @@ -0,0 +1,49 @@ +import { readFileSync } from 'fs'; +import { join } from 'path'; +import { runInNewContext } from 'vm'; +import { transpileModule, ModuleKind, ScriptTarget } from 'typescript'; + +function loadHost(manifest: object, loader: object) { + const file = join(__dirname, '../src/core/scene/runtime/browser-assets/host.js'); + const source = transpileModule(readFileSync(file, 'utf8'), { compilerOptions: { module: ModuleKind.CommonJS, target: ScriptTarget.ES2022 } }).outputText; + const exports: any = {}; + const fetch = jest.fn(async () => ({ ok: true, json: async () => manifest })); + runInNewContext(source, { exports, URL, fetch, require: (id: string) => { + expect(id).toBe('http://localhost:7456/scripting/scene-runtime/0123456789abcdef/loader.js'); + return loader; + } }); + return { host: exports.createBrowserHost('http://localhost:7456'), fetch }; +} + +describe('scene editor browser host manifest compatibility', () => { + const manifest = { apiVersion: 1, capabilitiesApiVersion: 1, buildId: '0123456789abcdef', loader: './0123456789abcdef/loader.js' }; + it('keeps the API 1 manifest usable by old extensions and injects capabilities for new ones', async () => { + // The former extension requires exactly API 1 and this versioned loader URL. + const built = JSON.parse(readFileSync(join(__dirname, '../dist/scene-runtime/manifest.json'), 'utf8')); + expect(built.apiVersion).toBe(1); + expect(built.capabilitiesApiVersion).toBe(1); + expect(new URL(built.loader, 'http://localhost:7456/scripting/scene-runtime/manifest.json').href) + .toBe(`http://localhost:7456/scripting/scene-runtime/${built.buildId}/loader.js`); + const environment = { serverURL: 'http://localhost:7456', runtimeResourceBase: 'http://private.example/web/' }; + const capabilities = { apiVersion: 1, identity: {}, modules: {}, environment }; + const loader = { loadEngine: jest.fn(async () => environment), prepareSceneCapabilities: jest.fn(async () => capabilities) }; + const { host, fetch } = loadHost(manifest, loader); + expect(loader.loadEngine).not.toHaveBeenCalled(); + expect(await host.prepareScene({ runtimeResourceBase: environment.runtimeResourceBase })).toBe(capabilities); + expect(await host.loadEngine()).toBe(environment); + expect(await host.prepareScene()).toBe(capabilities); + expect(loader.loadEngine).toHaveBeenCalledTimes(1); + expect(loader.prepareSceneCapabilities).toHaveBeenCalledWith(environment); + expect(fetch).toHaveBeenCalledTimes(1); + }); + it.each([ + { ...manifest, apiVersion: 2 }, + { ...manifest, capabilitiesApiVersion: undefined }, + { ...manifest, capabilitiesApiVersion: 2 }, + { ...manifest, loader: 'https://unexpected.example/loader.js' }, + ])('rejects incompatible injection or loader URLs before loading the engine', async value => { + const loader = { loadEngine: jest.fn() }; + await expect(loadHost(value, loader).host.prepareScene()).rejects.toThrow(/API 1|Invalid browser runtime loader/); + expect(loader.loadEngine).not.toHaveBeenCalled(); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 0cf25cf64..457229bae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,6 +36,7 @@ "**/*.test.ts", "src/core/builder/platforms/**/src/view/**", "tests/**", - "e2e/**" + "e2e/**", + "src/core/scene/runtime/browser-assets/**" ] } diff --git a/workflow/build-scene-polyfills.js b/workflow/build-scene-polyfills.js new file mode 100644 index 000000000..6dc532c2b --- /dev/null +++ b/workflow/build-scene-polyfills.js @@ -0,0 +1,47 @@ +/** + * 构建预览用的 polyfills bundle + * + * 包含: + * - core-js-bundle (ES 标准 API 垫片) + * - regenerator-runtime (async/await 支持) + * + * 输出到 dist/scene-runtime/polyfills.bundle.js + */ +const path = require('path'); +const fs = require('fs-extra'); + +function buildScenePolyfills(outDir = path.join(__dirname, '..', 'dist', 'scene-runtime')) { + fs.ensureDirSync(outDir); + + const outFile = path.join(outDir, 'polyfills.bundle.js'); + + console.log('📦 Building polyfills bundle...'); + + // 1. core-js-bundle (prebuilt) + const coreJsPath = path.join(require.resolve('core-js-bundle/package.json'), '..', 'minified.js'); + const coreJsCode = fs.readFileSync(coreJsPath, 'utf8').replace(/\/\/# sourceMappingURL=.*$/m, ''); + console.log(` ✅ core-js-bundle: ${(coreJsCode.length / 1024).toFixed(1)} KB`); + + // 2. regenerator-runtime + const regeneratorPath = require.resolve('regenerator-runtime/runtime'); + const regeneratorCode = fs.readFileSync(regeneratorPath, 'utf8'); + console.log(` ✅ regenerator-runtime: ${(regeneratorCode.length / 1024).toFixed(1)} KB`); + + // 3. Bundle together + const bundle = [ + '// Polyfills bundle for browser preview', + '// Generated by workflow/build-scene-polyfills.js', + '// Includes: core-js (ES API polyfills) + regenerator-runtime (async/await)', + '', + coreJsCode, + '', + regeneratorCode, + ].join('\n'); + + fs.writeFileSync(outFile, bundle, 'utf8'); + console.log(`\n✅ Polyfills bundle → ${outFile}`); + console.log(` Total: ${(bundle.length / 1024).toFixed(1)} KB`); + +} +module.exports = { buildScenePolyfills }; +if (require.main === module) buildScenePolyfills(); diff --git a/workflow/build-scene-runtime.js b/workflow/build-scene-runtime.js new file mode 100644 index 000000000..fc2cc12b8 --- /dev/null +++ b/workflow/build-scene-runtime.js @@ -0,0 +1,634 @@ +const { rollup } = require('rollup'); +const commonjs = require('@rollup/plugin-commonjs'); +const { nodeResolve } = require('@rollup/plugin-node-resolve'); +const virtual = require('@rollup/plugin-virtual'); +const json = require('@rollup/plugin-json'); +const path = require('path'); +const { createDeferredModuleSource } = require('./deferred-module-proxy'); +const { browserFacadePath, generateBrowserFacades } = require('./scene-browser-api'); +// Runtime bundles and declarations share the same browser module IDs and targets. +const browserEntries = require('./scene-api-entries.json').browser; + +function createBrowserRuntimeFacade(checker, source, file) { + const ts = require('typescript'); + const symbol = source && checker.getSymbolAtLocation(source); + if (!symbol) throw new Error('Missing browser API declarations: ' + source?.fileName); + const names = checker.getExportsOfModule(symbol).filter(item => { + // export= is TypeScript's CommonJS assignment symbol, not a named JS export. + // The raw CommonJS value is already preserved by the facade's default export. + if (item.name === 'default' || item.name === 'export=') return false; + const value = item.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(item) : item; + return value.flags & ts.SymbolFlags.Value; + }).map(item => item.name); + return `import api from '${file.replace(/\\/g, '/')}'; export default api;\n` + + names.map(name => `export const ${name} = api.${name};`).join('\n'); +} + +async function buildSceneRuntime(options = {}) { + generateBrowserFacades(); + const workspaceDir = path.resolve(__dirname, '..'); + const editorDir = workspaceDir; + const entries = Object.entries(browserEntries); + const publicEntries = Object.fromEntries(entries.map(([id]) => [id, 'browser:' + id])); + // CommonJS re-export helpers cannot be statically discovered by Rollup. + // Use published declarations to emit explicit ESM exports, retaining the raw + // CommonJS namespace as default for compiled TypeScript consumers. + const ts = require('typescript'); + const declarations = entries.map(([id]) => path.join(workspaceDir, 'dist', browserFacadePath(id) + '.d.ts')); + const program = ts.createProgram(declarations, { skipLibCheck: true, types: [] }); + const checker = program.getTypeChecker(); + const facades = Object.fromEntries(entries.map(([id], index) => { + const file = path.join(workspaceDir, 'dist', browserFacadePath(id) + '.js'); + const source = program.getSourceFile(declarations[index]); + return ['browser:' + id, createBrowserRuntimeFacade(checker, source, file)]; + })); + + console.log('[Build] Bundling scene services for preview...'); + + const bundle = await rollup({ + input: publicEntries, + onwarn(warning, warn) { + if (warning.code === 'UNRESOLVED_IMPORT') throw new Error(warning.message); + warn(warning); + }, + preserveEntrySignatures: 'strict', + external: (id) => { + if (id === 'cc') return true; + return false; + }, + plugins: [ + json(), + virtual(facades), + { + name: 'smart-node-builtins', + resolveId(id, importer) { + // editor-extends root: resolve to globalThis.EditorExtends (pre-loaded bundle) + // Only match root import, not subpaths like utils/serialize + if (importer && (id.match(/engine[/\\]editor-extends[/\\]?$/) || id.match(/engine[/\\]editor-extends[/\\]index(\.js|\.ts)?$/))) { + return '\0global-editor-extends'; + } + // Resolve the public host prefix only after the shared editor singleton. + // Otherwise scene-bundle gets a second Node manager, disconnected from + // the engine hooks that populate editor-extends.bundle's node paths. + if (id.startsWith('cocos-cli/host/')) return path.join(workspaceDir, 'dist', id.slice('cocos-cli/host/'.length) + '.js'); + + const stubs = [ + 'fs', 'node:fs', 'fs-extra', 'graceful-fs', 'lodash', 'package.json', '@cocos/asset-db', + 'constants', 'stream', 'assert', 'crypto', 'child_process', 'vm', 'buffer', + 'tty', 'zlib', 'http', 'https', 'net', 'tls', 'dns', 'readline', 'punycode', + 'cc/mods-mgr', 'inherits', 'sys', 'url', 'process', 'proper-lockfile', 'sharp' + ]; + if (stubs.includes(id)) { + return '\0smart-' + id; + } + if (['cc/preload', 'cc/editor/populate-internal-constants', 'cc/env', 'cce.env'].includes(id)) { + return '\0alias-cc-' + id; + } + if (id === 'cc/editor/serialization') { + return '\0alias-cc-editor-serialization'; + } + if (id.startsWith('cc/')) { + return require.resolve(id, { paths: [workspaceDir] }); + } + + const polyfills = { + events: require.resolve('events/'), + path: require.resolve('path-browserify'), + util: require.resolve('util/'), + os: require.resolve('os-browserify/browser'), + 'reflect-metadata': require.resolve('reflect-metadata') + }; + if (polyfills[id]) { + return polyfills[id]; + } + + if (id.endsWith('/package.json')) { + return '\0smart-' + id; + } + return null; + }, + load(id) { + if (id === '\0global-editor-extends') { + return ` + // Patch EventEmitter.prototype.off for scene-bundle's events module + // (previously patched by inlined editor-extends, now in separate bundle) + import EventEmitter from 'events'; + if (!EventEmitter.prototype.off) { + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + } + var _ee = globalThis.EditorExtends || {}; + export var emit = function() { return _ee.emit.apply(_ee, arguments); }; + export var on = function() { return _ee.on.apply(_ee, arguments); }; + export var off = function() { return (_ee.off || _ee.removeListener).apply(_ee, arguments); }; + export var removeListener = function() { return _ee.removeListener.apply(_ee, arguments); }; + export var Component = _ee.Component; + export var Node = _ee.Node; + export var Script = _ee.Script; + export var UuidUtils = _ee.UuidUtils; + export var MissingReporter = _ee.MissingReporter; + export var serialize = _ee.serialize; + export var serializeCompiled = _ee.serializeCompiled; + export var deserializeFull = _ee.deserializeFull; + export var GeometryUtils = _ee.GeometryUtils; + export var PrefabUtils = _ee.PrefabUtils; + export var walkProperties = function() {}; + export function init() { return _ee.init ? _ee.init() : Promise.resolve(); } + export default _ee; + `; + } + if (id.startsWith('\0smart-')) { + const originalId = id.substring('\0smart-'.length); + // graceful-fs patches the fs object it receives — give it a plain + // mutable object so assignment to its properties doesn't throw. + if (originalId === 'graceful-fs') { + return ` + // graceful-fs stub: plain writable object so monkey-patching works + var _gfs = { + existsSync: function() { return false; }, + readFileSync: function() { return ''; }, + writeFileSync: function() {}, + statSync: function() { return { isFile: function() { return false; }, isDirectory: function() { return false; }, mtime: new Date(0) }; }, + stat: function(p, cb) { cb && cb(null, { isFile: function() { return false; }, isDirectory: function() { return false; }, mtime: new Date(0) }); }, + lstat: function(p, cb) { cb && cb(null, { isFile: function() { return false; }, isDirectory: function() { return false; }, mtime: new Date(0) }); }, + lstatSync: function() { return { isFile: function() { return false; }, isDirectory: function() { return false; }, mtime: new Date(0) }; }, + readdir: function(p, cb) { cb && cb(null, []); }, + readdirSync: function() { return []; }, + mkdir: function(p, o, cb) { var fn = typeof o === 'function' ? o : cb; fn && fn(null); }, + mkdirSync: function() {}, + rmdir: function(p, o, cb) { var fn = typeof o === 'function' ? o : cb; fn && fn(null); }, + rmdirSync: function() {}, + realpath: function(p, o, cb) { var fn = typeof o === 'function' ? o : cb; fn && fn(null, p); }, + realpathSync: function(p) { return p; }, + utimes: function(p, a, m, cb) { cb && cb(null); }, + utimesSync: function() {}, + open: function(p, f, m, cb) { var fn = typeof f === 'function' ? f : (typeof m === 'function' ? m : cb); fn && fn(new Error('ENOENT')); }, + close: function(fd, cb) { cb && cb(null); }, + read: function(fd, buf, off, len, pos, cb) { cb && cb(null, 0); }, + write: function(fd, buf, off, len, pos, cb) { cb && cb(null, 0); }, + readJSON: async function() { return { chunks: {}, entries: {} }; }, + readJson: async function() { return { chunks: {}, entries: {} }; }, + }; + export default _gfs; + export var existsSync = _gfs.existsSync; + export var readFileSync = _gfs.readFileSync; + export var writeFileSync = _gfs.writeFileSync; + export var statSync = _gfs.statSync; + export var stat = _gfs.stat; + export var lstat = _gfs.lstat; + export var lstatSync = _gfs.lstatSync; + export var readdir = _gfs.readdir; + export var readdirSync = _gfs.readdirSync; + export var mkdir = _gfs.mkdir; + export var mkdirSync = _gfs.mkdirSync; + export var rmdir = _gfs.rmdir; + export var rmdirSync = _gfs.rmdirSync; + export var realpath = _gfs.realpath; + export var realpathSync = _gfs.realpathSync; + export var utimes = _gfs.utimes; + export var utimesSync = _gfs.utimesSync; + export var open = _gfs.open; + export var close = _gfs.close; + export var read = _gfs.read; + export var write = _gfs.write; + export var readJSON = _gfs.readJSON; + export var readJson = _gfs.readJson; + `; + } + if (originalId === 'cc/mods-mgr') { + return createDeferredModuleSource(); + } + if (originalId === 'proper-lockfile') { + return ` + const _lockfile = { + lock: async () => (async () => {}), + unlock: async () => {}, + check: async () => false + }; + export default _lockfile; + export const lock = _lockfile.lock; + export const unlock = _lockfile.unlock; + export const check = _lockfile.check; + `; + } + if (originalId === 'process') { + return ` + const _process = { + cwd: () => '/', + platform: 'browser', + nextTick: (fn, ...args) => setTimeout(() => fn(...args), 0), + env: {}, + versions: { node: '16.0.0' }, + stdout: { write: () => {} }, + stderr: { write: () => {} }, + binding: () => ({}), + on: () => {}, + once: () => {}, + removeListener: () => {}, + emit: () => {}, + }; + if (typeof window !== 'undefined' && !window.process) { + window.process = _process; + } + export default _process; + export const cwd = _process.cwd; + export const platform = _process.platform; + export const nextTick = _process.nextTick; + export const env = _process.env; + export const versions = _process.versions; + `; + } + if (originalId === 'url') { + const urlPolyfillPath = require.resolve('url/').replace(/\\/g, '/'); + return ` + import * as _url from '${urlPolyfillPath}'; + export const URL = _url.URL || window.URL; + export const URLSearchParams = _url.URLSearchParams || window.URLSearchParams; + export const parse = _url.parse; + export const format = _url.format; + export const resolve = _url.resolve; + + export function pathToFileURL(p) { + let resolved = p.replace(/\\\\/g, '/'); + // Handle Windows drive letters: D:/... -> /D:/... + if (resolved.match(/^[a-zA-Z]:/)) resolved = '/' + resolved; + if (!resolved.startsWith('/')) resolved = '/' + resolved; + return new URL('file://' + encodeURI(resolved).replace(/#/g, '%23').replace(/\\?/g, '%3F')); + } + + export function fileURLToPath(u) { + if (typeof u === 'string') u = new URL(u); + if (u.protocol !== 'file:') return u.href; + let p = decodeURIComponent(u.pathname); + if (p.match(/^\\/[a-zA-Z]:/)) { + p = p.substring(1).replace(/\\//g, '\\\\'); + } + return p; + } + + export default { + ..._url, + URL, + URLSearchParams, + pathToFileURL, + fileURLToPath + }; + `; + } + return ` + let realMod = {}; + const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; + const isNode = typeof process !== 'undefined' && process.versions && process.versions.node; + // Allow explicit override via global flag + const useRealNode = (isNode && !isBrowser && globalThis.__ENABLE_NODE_BUILTINS__ !== false) || globalThis.__ENABLE_NODE_BUILTINS__ === true; + + if (useRealNode) { + // Dynamic require to hide it from static analysis + const req = typeof require !== 'undefined' ? require : (typeof _cc_require !== 'undefined' ? _cc_require : null); + if (req) { + try { + const modName = '${originalId.startsWith('node:') ? originalId.substring(5) : originalId}'; + realMod = req(modName); + } catch(e) { + console.warn('Smart polyfill: failed to require ${originalId}'); + } + } + } + + export const existsSync = realMod.existsSync || function() { return false; }; + export const readFileSync = realMod.readFileSync || function() { return ''; }; + export const writeFileSync = realMod.writeFileSync || function() {}; + export const remove = realMod.remove || async function() {}; + export const readJSON = realMod.readJSON || async function() { return { chunks: {}, entries: {} }; }; + export const readJson = realMod.readJson || async function() { return { chunks: {}, entries: {} }; }; + export const statSync = realMod.statSync || function() { return { isFile: () => false, isDirectory: () => false, mtime: new Date(0) }; }; + export const stat = realMod.stat || function(p, cb) { cb && cb(null, { isFile: () => false, isDirectory: () => false, mtime: new Date(0) }); }; + export const lstat = realMod.lstat || function(p, cb) { cb && cb(null, { isFile: () => false, isDirectory: () => false, mtime: new Date(0) }); }; + export const lstatSync = realMod.lstatSync || function() { return { isFile: () => false, isDirectory: () => false, mtime: new Date(0) }; }; + export const mkdir = realMod.mkdir || function(p, o, cb) { var fn = typeof o === 'function' ? o : cb; fn && fn(null); }; + export const mkdirSync = realMod.mkdirSync || function() {}; + export const rmdir = realMod.rmdir || function(p, o, cb) { var fn = typeof o === 'function' ? o : cb; fn && fn(null); }; + export const rmdirSync = realMod.rmdirSync || function() {}; + export const realpath = realMod.realpath || function(p, o, cb) { + var fn = typeof o === 'function' ? o : cb; + if (typeof fn === 'function') fn(null, p); + }; + export const realpathSync = realMod.realpathSync || function(p) { return p; }; + export const utimes = realMod.utimes || function(p, a, m, cb) { cb && cb(null); }; + export const utimesSync = realMod.utimesSync || function() {}; + + export default new Proxy({}, { + get(target, prop) { + if (prop === 'existsSync') return existsSync; + if (prop === 'readFileSync') return readFileSync; + if (prop === 'writeFileSync') return writeFileSync; + if (prop === 'remove') return remove; + if (prop === 'readJSON') return readJSON; + if (prop === 'readJson') return readJson; + if (prop === 'statSync') return statSync; + if (prop === 'stat') return stat; + if (prop === 'lstat') return lstat; + if (prop === 'lstatSync') return lstatSync; + if (prop === 'mkdir') return mkdir; + if (prop === 'mkdirSync') return mkdirSync; + if (prop === 'rmdir') return rmdir; + if (prop === 'rmdirSync') return rmdirSync; + if (prop === 'realpath') return realpath; + if (prop === 'realpathSync') return realpathSync; + if (prop === 'utimes') return utimes; + if (prop === 'utimesSync') return utimesSync; + + if (realMod && prop in realMod) { + return realMod[prop]; + } + + // Fallback for missing methods + if (typeof prop === 'string') { + return function() {}; + } + return undefined; + } + }); + `; + } + if (id === '\0alias-cc-editor-serialization') { + return [ + `import * as cc from 'cc';`, + `function _getInternal() {`, + ` return (cc && cc.internal) || (typeof globalThis !== 'undefined' && globalThis.cc && globalThis.cc.internal) || {};`, + `}`, + `export const BufferBuilder = new Proxy(function() {}, {`, + ` construct(target, args) {`, + ` const C = _getInternal().BufferBuilder;`, + ` if (!C) throw new Error('cc.internal.BufferBuilder is not available. Please ensure engine is correctly compiled.');`, + ` return new C(...args);`, + ` },`, + ` get(target, prop) {`, + ` const C = _getInternal().BufferBuilder;`, + ` return C ? C[prop] : target[prop];`, + ` }`, + `});`, + `export const CCON = new Proxy(function() {}, {`, + ` construct(target, args) {`, + ` const C = _getInternal().CCON;`, + ` if (!C) throw new Error('cc.internal.CCON is not available.');`, + ` return new C(...args);`, + ` },`, + ` get(target, prop) {`, + ` const C = _getInternal().CCON;`, + ` return C ? C[prop] : target[prop];`, + ` }`, + `});`, + `export function encodeCCONBinary(...args) { return _getInternal().encodeCCONBinary(...args); }`, + `export function decodeCCONBinary(...args) { return _getInternal().decodeCCONBinary(...args); }`, + ].join('\n'); + } + if (id.startsWith('\0alias-cc-')) { + return `import * as cc from 'cc';\nexport * from 'cc';\nexport default cc;`; + } + return null; + } + }, + { + // Post-process: fix default import interop for external ESM modules (like cc) + // that are loaded via SystemJS but don't have a "default" export. + // Rollup emits: `require$$0__default = module["default"]` + // but cc's SystemJS registration has no default export. + // Fix: `module["default"] || module` + name: 'fix-external-default-interop', + renderChunk(code) { + let fixed = code.replace(/= module\["default"\];/g, '= module["default"] || module;'); + // Fix url polyfill missing the URL constructor + fixed = fixed.replace(/url_1\.URL/g, 'window.URL'); + return { code: fixed, map: null }; + } + }, + { + // reload 时清除 System-A 中的 pack chunk 缓存。 + // 双实例下 _invalidateAllPackMods 只删 System-B 的 pack:/// URL, + // System-A 中通过 DOM import map 加载的 HTTP chunk 不会被删除, + // 导致 re-import 返回缓存,类不重新注册。 + name: 'clear-pack-chunks-before-reimport', + renderChunk(code) { + return { code: code.replace( + "await System.import('cce:/internal/x/prerequisite-imports')", + "/* 清除 System-A 中的 pack chunk 缓存 */ " + + "(function() { try { for (var e of System.entries()) { if (e[0].indexOf('/chunks/') !== -1) System.delete(e[0]); } } catch(_e) {} })(); " + + "await System.import('cce:/internal/x/prerequisite-imports')" + ), map: null }; + } + }, + { + // Bare global references to EditorExtends (not imported) need live access + // to globalThis.EditorExtends (the pre-loaded bundle's live-binding wrapper). + name: 'alias-editor-extends-global', + renderChunk(code) { + return { + code: 'var EditorExtends = globalThis.EditorExtends;\n' + code, + map: null + }; + } + }, + nodeResolve({ + preferBuiltins: true, + browser: true, + }), + commonjs({ + ignoreDynamicRequires: true, + ignoreTryCatch: false, + defaultIsModuleExports: true + }), + ], + }); + + const bundleOutputFile = options.output || path.join(editorDir, 'dist', 'scene-runtime'); + const sceneBundleOutput = await bundle.write({ + dir: bundleOutputFile, + entryFileNames: '[name].js', + chunkFileNames: 'chunks/[name]-[hash].js', + format: 'system', + sourcemap: true, + banner: ` +(function() { + var _process = { + platform: 'browser', + nextTick: function(fn) { + var args = Array.prototype.slice.call(arguments, 1); + setTimeout(function() { if (typeof fn === 'function') fn.apply(null, args); }, 0); + }, + env: { NODE_ENV: 'development' }, + versions: { node: '16.0.0' }, + stdout: { write: function() {} }, + stderr: { write: function() {} }, + binding: function() { return {}; }, + on: function() {}, + once: function() {}, + removeListener: function() {}, + emit: function() {}, + }; + if (typeof window !== 'undefined') { + if (!window.process) { + window.process = _process; + } + } + if (typeof globalThis !== 'undefined' && !globalThis.process) { + globalThis.process = _process; + } +})(); + ` + }); + + const emittedFiles = new Set(sceneBundleOutput.output.map(item => item.fileName)); + const unexpectedImports = sceneBundleOutput.output + .filter((item) => item.type === 'chunk') + .flatMap((item) => item.imports) + .filter((id) => id !== 'cc' && !emittedFiles.has(id)); + if (unexpectedImports.length) { + throw new Error(`Scene Web bundle contains unsupported external imports: ${[...new Set(unexpectedImports)].join(', ')}`); + } + + await bundle.close(); + console.log('[Build] Successfully bundled to', bundleOutputFile); +} + +async function buildEditorExtends() { + const workspaceDir = path.resolve(__dirname, '..'); + const editorDir = path.join(__dirname, '..'); + const editorExtendsDir = path.join(workspaceDir, 'dist', 'core', 'engine', 'editor-extends').replace(/\\/g, '/'); + const eventsPolyfill = require.resolve('events/'); + + console.log('[Build] Bundling editor-extends for preview...'); + + const bundle = await rollup({ + input: 'editor-extends-entry', + inlineDynamicImports: true, + plugins: [ + json(), + virtual({ + 'editor-extends-entry': ` + import * as _ee from '${editorExtendsDir}/index.js'; + // Patch UuidUtils aliases (engine uses uuid/compressUuid/decompressUuid/isUuid) + if (_ee.UuidUtils) { + var U = _ee.UuidUtils; + U.uuid = U.uuid || U.generate; + U.compressUuid = U.compressUuid || U.compressUUID; + U.decompressUuid = U.decompressUuid || U.decompressUUID; + U.isUuid = U.isUuid || U.isUUID; + } + // Live-binding wrapper: getter 始终从模块命名空间读取最新值, + // 使 init() 后赋值的 serialize/GeometryUtils 等能通过 globalThis.EditorExtends 访问 + var editorExtends = {}; + var keys = Object.keys(_ee); + for (var i = 0; i < keys.length; i++) { + (function(key) { + Object.defineProperty(editorExtends, key, { + get: function() { return _ee[key]; }, + set: function(v) { + Object.defineProperty(editorExtends, key, { + value: v, writable: true, configurable: true + }); + }, + enumerable: true, + configurable: true, + }); + })(keys[i]); + } + globalThis.EditorExtends = editorExtends; + // Override init: inlined serialize/geometry/prefab depends on stubbed cc. + // Just set allow flags here; serialize is loaded by engine-bootstrap after engine. + Object.defineProperty(editorExtends, 'init', { + value: async function() { + _ee.Component.allow = true; + _ee.Node.allow = true; + _ee.Script.allow = true; + }, + writable: true, + configurable: true, + }); + ` + }), + { + name: 'editor-extends-deps', + resolveId(id) { + if (id === 'events') return eventsPolyfill; + if (id === 'semver') return '\0ee-stub-semver'; + if (id === 'cc' || id.startsWith('cc/')) return '\0ee-stub-cc'; + var stubs = ['fs', 'fs-extra', 'lodash', '@cocos/asset-db', 'child_process', 'path']; + if (stubs.includes(id)) return '\0ee-stub-empty'; + if (id === 'crypto') return '\0ee-stub-crypto'; + if (id === 'node-uuid') return '\0ee-stub-uuid'; + if (id.endsWith('/package.json')) return '\0ee-stub-json'; + return null; + }, + load(id) { + if (id === '\0ee-stub-semver') return 'export function rsort(arr) { return arr.sort().reverse(); }'; + if (id === '\0ee-stub-cc') return 'export default {};'; + if (id === '\0ee-stub-empty') return 'export default {};'; + if (id === '\0ee-stub-json') return 'export default {};'; + if (id === '\0ee-stub-crypto') return ` + export function createHash() { + var data = ''; + return { + update: function(d) { data += d; return this; }, + digest: function() { return data.substring(0, 32); } + }; + } + export default { createHash: createHash }; + `; + if (id === '\0ee-stub-uuid') return ` + function v4() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0; + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); + }); + } + export default { v4: v4 }; + export { v4 }; + `; + return null; + } + }, + nodeResolve({ preferBuiltins: false, browser: true }), + commonjs(), + ], + }); + + const outputFile = path.join(editorDir, 'dist', 'scene-runtime', 'editor-extends.bundle.js'); + await bundle.write({ + file: outputFile, + format: 'es', + sourcemap: false, + banner: '(async function() {', + footer: '})();', + }); + + await bundle.close(); + console.log('[Build] Successfully bundled editor-extends to', outputFile); +} + +async function main() { + const root = path.resolve(__dirname, '..'); + const out = path.join(root, 'dist/scene-runtime'); + const fs = require('fs'); + const { createHash } = require('crypto'); + if (path.relative(root, out).replace(/\\/g, '/') !== 'dist/scene-runtime') throw new Error('Invalid runtime output directory'); + fs.rmSync(out, { recursive: true, force: true }); + fs.mkdirSync(out, { recursive: true }); + await buildEditorExtends(); + await buildSceneRuntime(); + require('./build-scene-polyfills').buildScenePolyfills(out); + for (const name of ['editor-stub-preload.js', 'module-map-runtime.js', 'runtime-resources.js', 'loader.js', 'host.js']) { + fs.copyFileSync(path.join(root, 'src/core/scene/runtime/browser-assets', name), path.join(out, name)); + } + const files = []; + function collect(dir) { for (const item of fs.readdirSync(dir, { withFileTypes: true }).sort((a,b) => a.name.localeCompare(b.name))) { const file = path.join(dir, item.name); if (item.isDirectory()) collect(file); else if (item.name !== 'manifest.json' && item.name !== 'import-map.json' && !item.name.endsWith('.map')) files.push(file); } } + collect(out); + const hash = createHash('sha256'); + for (const file of files) hash.update(path.relative(out, file)).update(fs.readFileSync(file)); + const buildId = hash.digest('hex').slice(0, 16); + fs.writeFileSync(path.join(out, 'import-map.json'), JSON.stringify({ imports: Object.fromEntries(Object.keys(browserEntries).map(id => ['cocos-cli/browser/' + id, './' + id + '.js'])) }, null, 2)); + // loadEngine remains API 1. Capability injection is an additive, independently + // versioned feature so existing protocol 2 extensions can keep using this manifest. + fs.writeFileSync(path.join(out, 'manifest.json'), JSON.stringify({ apiVersion: 1, capabilitiesApiVersion: 1, cliVersion: require('../package.json').version, buildId, loader: './' + buildId + '/loader.js', importMap: './' + buildId + '/import-map.json' }, null, 2)); +} +module.exports = { createBrowserRuntimeFacade, buildSceneRuntime, buildEditorExtends, main }; +if (require.main === module) main().catch(error => { console.error(error.message); process.exitCode = 1; }); diff --git a/workflow/deferred-module-proxy.js b/workflow/deferred-module-proxy.js new file mode 100644 index 000000000..63ff0e6aa --- /dev/null +++ b/workflow/deferred-module-proxy.js @@ -0,0 +1,67 @@ +const DEFERRED_MODULE_CACHE_KEY = '__cocosCliDeferredEngineModules'; + +function getDeferredModule(system, id, moduleCache) { + if (moduleCache && Object.prototype.hasOwnProperty.call(moduleCache, id)) { + return moduleCache[id]; + } + + if (!system || !system.get) { + return undefined; + } + + let resolvedId = id; + if (system.resolve) { + try { + const candidate = system.resolve(id); + // @cocos/systemjs resolves import maps asynchronously. A Proxy getter + // cannot await that Promise, so only use synchronous resolver results. + if (typeof candidate === 'string') { + resolvedId = candidate; + } + } catch { + // Some named modules are registered without an import-map entry. + // Fall back to the original ID for those modules. + } + } + + return system.get(resolvedId) || (resolvedId !== id ? system.get(id) : undefined); +} + +function createDeferredModule(id, getSystem, getModule, getModuleCache = () => undefined) { + return new Proxy({}, { + get(target, prop) { + const real = getModule(getSystem(), id, getModuleCache()); + return real ? real[prop] : undefined; + }, + has(target, prop) { + const real = getModule(getSystem(), id, getModuleCache()); + return real ? prop in real : false; + }, + }); +} + +function createDeferredModuleSource() { + return ` + const _getDeferredModule = ${getDeferredModule.toString()}; + const _createDeferredModule = ${createDeferredModule.toString()}; + function _getSystem() { + return typeof System === 'undefined' ? undefined : System; + } + function _getModuleCache() { + return typeof globalThis === 'undefined' + ? undefined + : globalThis[${JSON.stringify(DEFERRED_MODULE_CACHE_KEY)}]; + } + export function syncImport(id) { + return _createDeferredModule(id, _getSystem, _getDeferredModule, _getModuleCache); + } + export default { syncImport: syncImport }; + `; +} + +module.exports = { + DEFERRED_MODULE_CACHE_KEY, + createDeferredModule, + createDeferredModuleSource, + getDeferredModule, +}; diff --git a/workflow/extend-public-dts.js b/workflow/extend-public-dts.js new file mode 100644 index 000000000..aa5e23132 --- /dev/null +++ b/workflow/extend-public-dts.js @@ -0,0 +1,362 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const ts = require('typescript'); + +const PACKAGE_NAME = '@cocos/cocos-cli-types'; +const root = path.resolve(__dirname, '..'); +const entries = require('./scene-api-entries.json'); +const { browserFacadePath, generateBrowserFacades } = require('./scene-browser-api'); +const normalize = file => path.resolve(file).replace(/\\/g, '/'); +const printer = ts.createPrinter({ removeComments: true }); + +function publicEntries(packageRoot) { + return fs.readdirSync(packageRoot).filter(name => name.endsWith('.d.ts')).flatMap(name => { + const id = name.slice(0, -5); + const source = [path.join(root, 'dist/lib', id, id + '.d.ts'), path.join(root, 'dist/lib', id + '.d.ts')].find(file => fs.existsSync(file)); + return source ? [{ source, output: path.join(packageRoot, name), module: PACKAGE_NAME + (id === 'index' ? '' : '/' + id) }] : []; + }); +} + +function declarationSymbol(node, checker) { + if (!node.name || !ts.isIdentifier(node.name)) return undefined; + return checker.getSymbolAtLocation(node.name); +} + +function originalSymbol(symbol, checker) { + return symbol && symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol; +} + +function isModuleSpecifier(node) { + const parent = node.parent; + return ts.isStringLiteral(node) && parent && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent) + || ts.isExternalModuleReference(parent) || ts.isLiteralTypeNode(parent) && ts.isImportTypeNode(parent.parent)); +} + +function declarationText(node) { + const stripped = ts.canHaveModifiers(node) ? ts.factory.replaceModifiers(node, (ts.getModifiers(node) || []).filter(modifier => + ![ts.SyntaxKind.ExportKeyword, ts.SyntaxKind.DeclareKeyword, ts.SyntaxKind.DefaultKeyword].includes(modifier.kind))) : node; + const text = printer.printNode(ts.EmitHint.Unspecified, stripped, node.getSourceFile()); + const scanner = ts.createScanner(ts.ScriptTarget.Latest, true, ts.LanguageVariant.Standard, text); + const tokens = []; + for (let token = scanner.scan(); token !== ts.SyntaxKind.EndOfFileToken; token = scanner.scan()) { + tokens.push(token === ts.SyntaxKind.StringLiteral ? JSON.stringify(scanner.getTokenValue()) : scanner.getTokenText()); + } + return tokens.join(' '); +} + +/** Track original symbols, including declarations promoted by the public API rollup. */ +function reusableSymbols(program, published) { + const checker = program.getTypeChecker(); + const reused = new Map(); + const publicApis = []; + for (const entry of published) { + const rolled = ts.createSourceFile(entry.output, fs.readFileSync(entry.output, 'utf8'), ts.ScriptTarget.Latest, true); + const declarations = new Map(); + for (const node of rolled.statements.flatMap(node => ts.isVariableStatement(node) ? [...node.declarationList.declarations] : [node])) { + if (!node.name || !ts.isIdentifier(node.name)) continue; + if (!declarations.has(node.name.text)) declarations.set(node.name.text, []); + declarations.get(node.name.text).push(node); + } + const source = program.getSourceFile(entry.source); + const module = source && checker.getSymbolAtLocation(source); + if (!module) continue; + const exported = checker.getExportsOfModule(module); + for (const item of exported) { + const symbol = originalSymbol(item, checker); + if (declarations.has(item.name) && !reused.has(symbol)) reused.set(symbol, { module: entry.module, name: item.name }); + } + publicApis.push({ entry, exported, declarations }); + } + // Prefer the public module's explicit exports over types incidentally inlined + // into another module's rollup (for example scene types also present in cli). + for (const { entry, exported, declarations } of publicApis) { + // A rollup also exports types reachable through its API. Only reuse those + // when both their source provenance and their complete declaration match. + const visited = new Set(); + const candidates = new Map(); + function follow(symbol) { + symbol = originalSymbol(symbol, checker); + if (!symbol || visited.has(symbol)) return; + visited.add(symbol); + for (const node of symbol.declarations || []) { + const topLevel = node.parent && (ts.isSourceFile(node.parent) || ts.isVariableDeclaration(node) && node.parent.parent?.parent && ts.isSourceFile(node.parent.parent.parent)); + if (!topLevel || !node.name || !ts.isIdentifier(node.name)) continue; + const name = node.name.text; + if (!candidates.has(name)) candidates.set(name, new Map()); + candidates.get(name).set(symbol, node); + function visit(child) { + if (ts.isIdentifier(child)) follow(checker.getSymbolAtLocation(child)); + ts.forEachChild(child, visit); + } + ts.forEachChild(node, visit); + } + } + for (const item of exported) follow(item); + for (const [name, possible] of candidates) { + const rolledDeclarations = declarations.get(name); + if (!rolledDeclarations) continue; + const expected = rolledDeclarations.map(declarationText).sort(); + const matching = [...possible].filter(([symbol]) => { + const actual = (symbol.declarations || []).map(declarationText).sort(); + return actual.length === expected.length && actual.every((text, index) => text === expected[index]); + }); + if (matching.length === 1 && !reused.has(matching[0][0])) reused.set(matching[0][0], { module: entry.module, name }); + } + } + return reused; +} + +function namedImports(module, bindings) { + return `import { ${bindings.map(([name, local]) => name === local ? name : `${name} as ${local}`).join(', ')} } from '${module}';`; +} + +function namedExports(module, bindings) { + return `export { ${bindings.map(([name, local]) => name === local ? name : `${name} as ${local}`).join(', ')} } from '${module}';`; +} + +/** Drop dependencies used only by declarations that now live in a public rollup. */ +function pruneImports(code, file) { + const source = ts.createSourceFile(file, code, ts.ScriptTarget.Latest); + const used = new Set(); + function visit(node) { + if (ts.isIdentifier(node)) used.add(node.text); + ts.forEachChild(node, visit); + } + for (const node of source.statements) if (!ts.isImportDeclaration(node)) visit(node); + const edits = []; + for (const node of source.statements) { + if (!ts.isImportDeclaration(node) || !node.importClause) continue; + const clause = node.importClause; + const defaultName = clause.name && used.has(clause.name.text) ? clause.name.text : undefined; + const namespace = clause.namedBindings && ts.isNamespaceImport(clause.namedBindings) && used.has(clause.namedBindings.name.text) ? clause.namedBindings.name.text : undefined; + const names = clause.namedBindings && ts.isNamedImports(clause.namedBindings) + ? clause.namedBindings.elements.filter(item => used.has(item.name.text)).map(item => item.getText(source)) : []; + const bindings = [defaultName, namespace ? '* as ' + namespace : names.length ? '{ ' + names.join(', ') + ' }' : undefined].filter(Boolean); + edits.push({ start: node.getStart(source), end: node.end, text: bindings.length + ? `import ${clause.isTypeOnly ? 'type ' : ''}${bindings.join(', ')} from ${node.moduleSpecifier.getText(source)};` : '' }); + } + for (const edit of edits.reverse()) code = code.slice(0, edit.start) + edit.text + code.slice(edit.end); + return code; +} + +/** Extend the existing domain rollups with the editor's reachable API. */ +async function extendPublicDts() { + generateBrowserFacades(); + const packageRoot = path.join(root, 'packages/cocos-cli-types'); + const output = path.join(packageRoot, 'scene-editor'); + if (path.relative(root, output).replace(/\\/g, '/') !== 'packages/cocos-cli-types/scene-editor') throw new Error('Invalid declaration output'); + const published = publicEntries(packageRoot); + if (!published.some(entry => entry.module === PACKAGE_NAME + '/scene')) throw new Error('Generate public CLI declarations first: npm run generate:dts'); + const publicTargets = new Map(); + for (const kind of ['host', 'browser']) for (const [id, target] of Object.entries(entries[kind])) { + const file = path.join(root, 'dist', (kind === 'browser' ? browserFacadePath(id) : target) + '.d.ts'); + if (!fs.existsSync(file)) throw new Error('Build CLI declarations first: ' + file); + publicTargets.set(normalize(file), `${kind}/${id}.d.ts`); + } + const cc = path.join(root, 'packages/cc-module/cc.d.ts'); + const options = { + target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.CommonJS, + moduleResolution: ts.ModuleResolutionKind.Node10, esModuleInterop: true, + skipLibCheck: true, types: ['node'], baseUrl: root, + paths: { cc: [cc], 'cc/*': [path.join(root, 'packages/cc-module/*')] }, + }; + const program = ts.createProgram([...publicTargets.keys(), ...published.map(entry => entry.source), cc], options); + const checker = program.getTypeChecker(); + const host = ts.createCompilerHost(options); + const reused = reusableSymbols(program, published); + const sources = new Map(); + const destinations = new Map(); + const nodeBuiltin = new Set(require('node:module').builtinModules.flatMap(id => [id, 'node:' + id])); + function destination(file) { + if (publicTargets.has(normalize(file))) return publicTargets.get(normalize(file)); + const relative = path.relative(root, file).replace(/\\/g, '/'); + if (relative.startsWith('../') || path.isAbsolute(relative)) throw new Error('Declaration outside CLI dependency graph: ' + file); + return 'internal/' + relative.replace(/^dist\//, 'cli/').replace(/node_modules\//g, 'dependencies/').replace(/^src\//, 'declarations/'); + } + for (const source of program.getSourceFiles()) { + if (program.isSourceFileDefaultLibrary(source) || /[/\\]@types[/\\]node[/\\]/.test(source.fileName)) continue; + const name = destination(source.fileName).replace(/\.d\.[cm]ts$/, '.d.ts'); + if (destinations.has(name)) throw new Error('Declaration path collision: ' + name); + destinations.set(name, source.fileName); + sources.set(normalize(source.fileName), { source, destination: name }); + } + const generated = new Map(); + const unresolved = new Set(); + const engineShims = { + 'pal/audio/type': `export type AudioType = import('cc').__private._pal_audio_type__AudioType;\nexport type AudioState = import('cc').__private._pal_audio_type__AudioState;\nexport type AudioPCMDataView = import('cc').AudioPCMDataView;\nexport type AudioLoadOptions = unknown;\n`, + 'pal/input/input-source': `export interface InputSource { getValue(): T; }\nexport type InputSourceButton = InputSource;\nexport type InputSourceDpad = InputSource;\nexport type InputSourceStick = InputSource;\nexport type InputSourcePosition = InputSource;\nexport type InputSourceOrientation = InputSource;\n`, + '../foundation/node-shell': `export type NodeInputPath = readonly [string] | readonly [string, number];\n`, + }; + function modulePath(target, from) { + const relative = path.posix.relative(path.posix.dirname(from), target.replace(/\.d\.ts$/, '')); + return relative.startsWith('.') ? relative : './' + relative; + } + function declarationModule(id, importer) { + if (id === 'cc' || id.startsWith('cc/') || nodeBuiltin.has(id)) return id; + const resolved = ts.resolveModuleName(id, importer.source.fileName, options, host).resolvedModule; + if (!resolved && id in engineShims) { + const name = 'internal/engine-shims/' + id.replace(/[^a-zA-Z0-9_-]/g, '_') + '.d.ts'; + generated.set(name, engineShims[id]); + return modulePath(name, importer.destination); + } + if (!resolved) { unresolved.add(id + ' (' + importer.source.fileName + ')'); return id; } + if (/[/\\]@types[/\\]node[/\\]/.test(resolved.resolvedFileName)) return id; + // Match the existing public rollups: keep ordinary third-party packages + // external, including CommonJS export-assignment namespaces such as express. + if (!id.startsWith('.') && /[/\\]node_modules[/\\]/.test(resolved.resolvedFileName) + && !id.startsWith('@cocos/asset-db')) return id; + const target = sources.get(normalize(resolved.resolvedFileName)); + if (!target || !target.source.isDeclarationFile) { + if (!/\.[cm]?js$/.test(resolved.resolvedFileName)) throw new Error('Dependency has no declaration: ' + resolved.resolvedFileName); + const name = 'internal/opaque/' + id.replace(/[^a-zA-Z0-9_-]/g, '_') + '.d.ts'; + generated.set(name, `/** Upstream ${id} supplies no declarations. */\ndeclare const value: unknown;\nexport = value;\n`); + return modulePath(name, importer.destination); + } + return modulePath(target.destination, importer.destination); + } + for (const info of sources.values()) { + const { source, destination: name } = info; + if (!source.isDeclarationFile) continue; + const edits = []; + const aliases = new Map(); + function replacement(node) { return reused.get(originalSymbol(checker.getSymbolAtLocation(node), checker)); } + function reuse(node, statement) { + const target = reused.get(declarationSymbol(node, checker)); + if (!target || !ts.isIdentifier(node.name)) return false; + const local = node.name.text; + if (!aliases.has(local)) { + const exported = statement.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword); + const isDefault = statement.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.DefaultKeyword); + aliases.set(local, namedImports(target.module, [[target.name, local]]) + '\n' + + (isDefault ? `export default ${local};\n` : exported ? `export { ${local} };\n` : '')); + } + return true; + } + function visit(node) { + let literal; + if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) literal = node.moduleSpecifier; + else if (ts.isExternalModuleReference(node) && node.expression && ts.isStringLiteral(node.expression)) literal = node.expression; + else if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteral(node.argument.literal)) { + literal = node.argument.literal; + let qualifier = node.qualifier; + while (qualifier && ts.isQualifiedName(qualifier)) qualifier = qualifier.left; + const target = qualifier && replacement(qualifier); + if (target) { + edits.push({ start: literal.getStart(source), end: literal.end, text: JSON.stringify(target.module) }); + edits.push({ start: qualifier.getStart(source), end: qualifier.end, text: target.name }); + return; + } + } + if (literal) edits.push({ start: literal.getStart(source), end: literal.end, text: JSON.stringify(declarationModule(literal.text, info)) }); + ts.forEachChild(node, visit); + } + function redirectBindings(statement) { + const isImport = ts.isImportDeclaration(statement); + const bindings = isImport ? statement.importClause?.namedBindings : statement.exportClause; + if (!statement.moduleSpecifier || !bindings || !(isImport ? ts.isNamedImports(bindings) : ts.isNamedExports(bindings))) return false; + // A default or namespace import must retain its original module shape. + if (isImport && statement.importClause.name) return false; + const groups = new Map(); + const remaining = []; + for (const item of bindings.elements) { + const target = replacement(isImport ? item.name : item.propertyName || item.name); + if (!target) { remaining.push(item.getText(source)); continue; } + if (!groups.has(target.module)) groups.set(target.module, []); + groups.get(target.module).push([target.name, item.name.text]); + } + if (!groups.size) return false; + const code = [...groups].map(([module, names]) => (isImport ? namedImports : namedExports)(module, names)); + if (remaining.length) code.push(`${isImport ? 'import' : 'export'} ${!isImport && statement.isTypeOnly ? 'type ' : ''}{ ${remaining.join(', ')} } from '${declarationModule(statement.moduleSpecifier.text, info)}';`); + edits.push({ start: statement.getStart(source), end: statement.end, text: code.join('\n') }); + return true; + } + for (const statement of source.statements) { + if (ts.isExportDeclaration(statement) && !statement.exportClause && statement.moduleSpecifier + && ts.isStringLiteral(statement.moduleSpecifier) && !statement.moduleSpecifier.text.startsWith('.')) { + const module = checker.getSymbolAtLocation(statement.moduleSpecifier); + const names = module ? checker.getExportsOfModule(module).filter(symbol => !['default', 'export='].includes(symbol.name)) : []; + edits.push({ start: statement.getStart(source), end: statement.end, text: names.length + ? namedExports(declarationModule(statement.moduleSpecifier.text, info), names.map(symbol => [symbol.name, symbol.name])) : 'export {};' }); + continue; + } + if (ts.isVariableStatement(statement) && statement.declarationList.declarations.length === 1 && reuse(statement.declarationList.declarations[0], statement) + || !ts.isVariableStatement(statement) && reuse(statement, statement)) { + edits.push({ start: statement.getStart(source), end: statement.end, text: '' }); + } else if (!redirectBindings(statement)) visit(statement); + } + for (const reference of source.referencedFiles) { + const target = sources.get(normalize(path.resolve(path.dirname(source.fileName), reference.fileName.replace(/\\/g, '/')))); + if (!target) throw new Error('Missing referenced declaration: ' + reference.fileName); + const relative = path.posix.relative(path.posix.dirname(name), target.destination); + edits.push({ start: reference.pos, end: reference.end, text: relative.startsWith('.') ? relative : './' + relative }); + } + let code = source.text; + for (const edit of edits.sort((a, b) => b.start - a.start)) code = code.slice(0, edit.start) + edit.text + code.slice(edit.end); + code = [...aliases.values()].join('') + code.replace(/\bconst enum\b/g, 'enum'); + code = pruneImports(code, name); + const parsed = ts.createSourceFile(name, code, ts.ScriptTarget.Latest, true); + const publicImports = []; + function usePublicFile(node) { + if (isModuleSpecifier(node) && (node.text === PACKAGE_NAME || node.text.startsWith(PACKAGE_NAME + '/'))) { + const id = node.text === PACKAGE_NAME ? 'index' : node.text.slice(PACKAGE_NAME.length + 1); + publicImports.push({ start: node.getStart(parsed), end: node.end, text: JSON.stringify(modulePath('../' + id + '.d.ts', name)) }); + } + ts.forEachChild(node, usePublicFile); + } + usePublicFile(parsed); + for (const edit of publicImports.reverse()) code = code.slice(0, edit.start) + edit.text + code.slice(edit.end); + generated.set(name, code); + } + + // Resolve the rewritten graph, not every file loaded by the compiler program. + const reachable = new Set(); + function include(name) { + if (reachable.has(name)) return; + const code = generated.get(name); + if (code === undefined) throw new Error('Missing generated declaration: ' + name); + reachable.add(name); + const references = ts.preProcessFile(code, true, true); + for (const item of [...references.importedFiles, ...references.referencedFiles]) { + if (!item.fileName.startsWith('.')) continue; + const target = path.posix.normalize(path.posix.join(path.posix.dirname(name), item.fileName)); + if (target.startsWith('../')) { + const publicFile = path.resolve(output, target + '.d.ts'); + if (!published.some(entry => normalize(entry.output) === normalize(publicFile))) throw new Error('Unknown shared declaration: ' + target); + continue; + } + const resolved = [target, target + '.d.ts', target + '/index.d.ts'].find(file => generated.has(file)); + if (!resolved) throw new Error('Missing declaration reference: ' + name + ': ' + item.fileName); + include(resolved); + } + } + const exportedSymbols = new Map([...publicTargets].map(([fileName, name]) => [name, + checker.getExportsOfModule(checker.getSymbolAtLocation(program.getSourceFile(fileName)))])); + for (const [name, symbols] of exportedSymbols) { + if (symbols.every(symbol => reused.has(originalSymbol(symbol, checker)))) { + const groups = new Map(); + for (const symbol of symbols) { + const target = reused.get(originalSymbol(symbol, checker)); + const id = target.module === PACKAGE_NAME ? 'index' : target.module.slice(PACKAGE_NAME.length + 1); + const module = modulePath('../' + id + '.d.ts', name); + if (!groups.has(module)) groups.set(module, []); + groups.get(module).push([target.name, symbol.name]); + } + generated.set(name, groups.size ? [...groups].map(([module, names]) => namedExports(module, names)).join('\n') : 'export {};'); + } + include(name); + } + // Keep diagnostics scoped to the graph the editor actually uses. + for (const message of unresolved) { + const importer = message.slice(message.lastIndexOf(' (') + 2, -1); + if (reachable.has(sources.get(normalize(importer))?.destination)) throw new Error('Unresolved type dependency: ' + message); + } + const workspace = fs.mkdtempSync(path.join(root, 'dist', '.public-dts-')); + if (!normalize(workspace).startsWith(normalize(path.join(root, 'dist')) + '/.public-dts-')) throw new Error('Invalid temporary declaration directory'); + try { + return await require('./public-dts-rollup').rollupDomains({ workspace, packageRoot, generated, reachable, publicTargets, published, reused }); + } finally { + fs.rmSync(workspace, { recursive: true, force: true }); + } +} + +module.exports = { extendPublicDts }; diff --git a/workflow/generate-dts.ts b/workflow/generate-dts.ts index 1ca93ac4f..b1a13c78d 100644 --- a/workflow/generate-dts.ts +++ b/workflow/generate-dts.ts @@ -17,6 +17,7 @@ import { promisify } from 'util'; // 主线程(tsx CLI) / worker(tsx ESM) 下都能解析。workflow/ 不在 tsc 编译范围,不影响构建。 import { normalizeDtsRollupContent } from './generate-dts-postprocess.ts'; import { isMainThread } from 'worker_threads'; +import publicDts from './extend-public-dts.js'; const execAsync = promisify(exec);// Dynamically build the real PlatformType union from @cocos/ccbuild enums. // This is needed because api-extractor incorrectly resolves @@ -299,6 +300,8 @@ async function generate() { } } + await publicDts.extendPublicDts(); + const packageJSONPath = path.join(dtsExportRoot, 'package.json'); // 用 fs.readJSONSync 而非 require:worker 内以 ESM 加载,没有 require。 const rootVersion = fs.readJSONSync(path.join(projectRoot, 'package.json')).version; diff --git a/workflow/prepare-dts.js b/workflow/prepare-dts.js index dec7e54a8..e30afc71f 100644 --- a/workflow/prepare-dts.js +++ b/workflow/prepare-dts.js @@ -1,9 +1,10 @@ /** * 准备 DTS 文件 * - * 包括两个步骤: + * 包括三个步骤: * 1. 生成 i18n 类型定义(自动生成的类型文件) * 2. 复制源码中的 .d.ts 文件到 dist 目录 + * 3. 根据入口清单生成浏览器兼容入口 * * TypeScript 编译器只生成新的 .d.ts,不会复制源码中已存在的 .d.ts 文件 * 这个脚本确保所有类型定义文件都能正确复制到输出目录 @@ -13,6 +14,7 @@ const fs = require('fs-extra'); const path = require('path'); const glob = require('glob'); const { generateI18nTypes } = require('./generate-i18n-types'); +const { generateBrowserFacades } = require('./scene-browser-api'); const SRC_DIR = path.resolve(__dirname, '../src'); const DIST_DIR = path.resolve(__dirname, '../dist'); @@ -112,6 +114,7 @@ async function prepareDts() { // 步骤 2: 复制 .d.ts 文件 await copyDtsFiles(); + generateBrowserFacades(); console.log('='.repeat(60)); console.log('🎉 所有 DTS 文件准备完成!\n'); diff --git a/workflow/public-dts-rollup.js b/workflow/public-dts-rollup.js new file mode 100644 index 000000000..7566b0c49 --- /dev/null +++ b/workflow/public-dts-rollup.js @@ -0,0 +1,192 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const ts = require('typescript'); +const entries = require('./scene-api-entries.json'); + +const PACKAGE_NAME = '@cocos/cocos-cli-types'; +const root = path.resolve(__dirname, '..'); + +function domainOf(kind, id) { + if (kind === 'browser') return id.startsWith('engine/') ? 'engine' : 'scene'; + const domain = id.split('/')[1]; + if (id.startsWith('core/') && ['assets', 'base', 'builder', 'configuration', 'project', 'scene', 'scripting'].includes(domain)) return domain; + if (id === 'lib/simulator/simulator') return 'simulator'; + return id.startsWith('commands/') ? 'base' : 'cli'; +} + +function namespaceOf(id) { + return id.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(part => part[0].toUpperCase() + part.slice(1)).join(''); +} + +function restoreNamespaceExports(code) { + // API Extractor strips the export keyword when rolling up an already emitted + // namespace export list. Its remaining bare block is invalid in a .d.ts file. + return code.replace(/^((?:export )?declare namespace [\w$]+ \{\r?\n)([ \t]+)\{(?=\r?\n)/gm, '$1$2export {'); +} + +function domainEntries() { + return ['host', 'browser'].flatMap(kind => Object.keys(entries[kind]).map(id => ({ + kind, id, domain: domainOf(kind, id), namespace: namespaceOf(id), file: kind + '/' + id + '.d.ts', + }))); +} + +function isModuleSpecifier(node) { + const parent = node.parent; + return ts.isStringLiteral(node) && parent && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent) + || ts.isExternalModuleReference(parent) || ts.isLiteralTypeNode(parent) && ts.isImportTypeNode(parent.parent)); +} + +/** Shared public types stay external to extraction instead of being inlined again. */ +function externalizePublicImports(code, name) { + const source = ts.createSourceFile(name, code, ts.ScriptTarget.Latest, true); + const edits = []; + const namespaceImports = []; + function visit(node) { + // API Extractor cannot roll up a bare typeof import() of a local module. + // An equivalent namespace import retains its value/type shape. + if (ts.isImportTypeNode(node) && node.isTypeOf && !node.qualifier + && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteral(node.argument.literal) + && node.argument.literal.text.startsWith('.')) { + const alias = '__EditorModule' + namespaceImports.length; + namespaceImports.push(`import * as ${alias} from '${node.argument.literal.text}';`); + edits.push({ start: node.getStart(source), end: node.end, text: 'typeof ' + alias }); + return; + } + if (isModuleSpecifier(node) && node.text.startsWith('.')) { + const target = path.posix.normalize(path.posix.join(path.posix.dirname(name), node.text)); + if (target.startsWith('../')) edits.push({ start: node.getStart(source), end: node.end, + text: JSON.stringify(PACKAGE_NAME + '/' + target.slice(3).replace(/\.d\.ts$/, '')) }); + } + ts.forEachChild(node, visit); + } + visit(source); + for (const edit of edits.reverse()) code = code.slice(0, edit.start) + edit.text + code.slice(edit.end); + return namespaceImports.join('\n') + '\n' + code; +} + +function capabilityDeclarations() { + const fields = kind => domainEntries().filter(entry => entry.kind === kind).map(entry => { + const namespace = `typeof import('${PACKAGE_NAME}/${entry.domain}').Editor.${kind === 'host' ? 'Host' : 'Browser'}.${entry.namespace}`; + // export= is a compiler-internal module member, not a named namespace + // export. Preserve the existing capability object shape explicitly. + const assignment = kind === 'browser' && entry.id === 'engine/overwrite' + ? " & { 'export=': typeof import('cc/overwrite') }" : ''; + return ` '${entry.id}': ${namespace}${assignment};`; + }).join('\n'); + return ` +export interface HostModules { +${fields('host')} +} +export interface BrowserModules { +${fields('browser')} +} +export interface HostCapabilities { + readonly apiVersion: 1; + readonly cliVersion: string; + readonly identity: object; + readonly modules: HostModules; + readonly portable: Pick; + readonly browserHostPath: string; +} +export interface BrowserEnvironment { serverURL: string; runtimeResourceBase: string; [key: string]: unknown; } +export interface BrowserCapabilities { + readonly apiVersion: 1; + readonly identity: object; + readonly modules: BrowserModules; + readonly environment: BrowserEnvironment; +} +export interface BrowserHost { + readonly apiVersion: 1; + loadEngine(options: Record): Promise; + prepareScene(options: Record): Promise; +} +`; +} + +async function rollupDomains({ workspace, packageRoot, generated, reachable, publicTargets, published, reused }) { + const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor'); + const graph = path.join(workspace, 'graph'); + const write = (file, code) => { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, code); }; + write(path.join(graph, 'package.json'), JSON.stringify({ name: '@cocos/public-dts-graph', version: '1.0.0' })); + fs.mkdirSync(path.join(graph, 'node_modules/@cocos'), { recursive: true }); + fs.symlinkSync(packageRoot, path.join(graph, 'node_modules/@cocos/cocos-cli-types'), 'junction'); + // Reused-only modules still need facades in the temporary graph for namespace exports. + for (const name of new Set([...reachable, ...publicTargets.values()])) { + write(path.join(graph, name), externalizePublicImports(generated.get(name), name)); + } + const mappings = domainEntries(); + const domains = [...new Set(mappings.map(entry => entry.domain))]; + const staged = new Map(); + for (const domain of domains) { + const baseline = published.find(entry => entry.module === PACKAGE_NAME + '/' + domain); + if (!baseline) throw new Error('Missing domain declaration: ' + domain); + const baselineCode = fs.readFileSync(baseline.output, 'utf8'); + write(path.join(graph, domain + '-baseline.d.ts'), baselineCode + (domain === 'scene' ? capabilityDeclarations() : '')); + const groups = []; + for (const kind of ['host', 'browser']) { + const modules = mappings.filter(entry => entry.domain === domain && entry.kind === kind); + if (!modules.length) continue; + write(path.join(graph, domain + '-' + kind + '.d.ts'), modules.map(entry => + `export * as ${entry.namespace} from './${entry.file.replace(/\.d\.ts$/, '')}';`).join('\n')); + groups.push(`export * as ${kind === 'host' ? 'Host' : 'Browser'} from './${domain}-${kind}';`); + } + write(path.join(graph, domain + '-editor.d.ts'), groups.join('\n')); + const main = path.join(graph, domain + '-entry.d.ts'); + write(main, `export * from './${domain}-baseline';\nexport * as Editor from './${domain}-editor';\n`); + const output = path.join(workspace, domain + '.d.ts'); + const config = ExtractorConfig.prepare({ + configObject: { + projectFolder: root, + mainEntryPointFilePath: main, + compiler: { overrideTsconfig: { compilerOptions: { + target: 'es2022', module: 'commonjs', moduleResolution: 'node', + esModuleInterop: true, skipLibCheck: true, types: ['node'], baseUrl: root, + }, files: [main, path.join(root, 'packages/cc-module/statics/cc-template.d.ts')] } }, + dtsRollup: { enabled: true, untrimmedFilePath: output }, + docModel: { enabled: false }, apiReport: { enabled: false }, tsdocMetadata: { enabled: false }, + messages: { + compilerMessageReporting: { default: { logLevel: 'warning' } }, + extractorMessageReporting: { default: { logLevel: 'warning', addToApiReportFile: false } }, + }, + }, + configObjectFullPath: undefined, + packageJsonFullPath: path.join(graph, 'package.json'), + }); + console.log('Extending ' + domain + '.d.ts...'); + const result = Extractor.invoke(config, { localBuild: true, messageCallback(message) { + if (message.logLevel !== 'error') message.handled = true; + } }); + if (!result.succeeded) throw new Error('Failed to extend ' + domain + '.d.ts: ' + result.errorCount + ' errors'); + let code = restoreNamespaceExports(fs.readFileSync(output, 'utf8')); + code = code.replace(/^[ \t]+/gm, indent => indent.replace(/\t/g, ' ')); + code = code.replace(/(['"])@cocos\/cocos-cli-types(?:\/([^'"\r\n]+))?\1/g, (_, quote, id) => quote + './' + (id || 'index') + quote); + if (domain === 'scene') code = '/// \n/// \n' + code; + staged.set(path.join(packageRoot, domain + '.d.ts'), code); + } + for (const name of ['cc.d.ts', 'cc.editor.d.ts']) staged.set(path.join(packageRoot, name), fs.readFileSync(path.join(root, 'packages/engine/bin/.declarations', name), 'utf8')); + const editorDeclarations = path.join(packageRoot, 'cc.editor.d.ts'); + // The engine rollup leaks one source-relative import. Its public InputKey + // alias already names the same NodeInputPath type in this namespace. + const editorCode = staged.get(editorDeclarations).replace(/import\(['"]\.\.\/foundation\/node-shell['"]\)\.NodeInputPath/g, 'InputKey'); + staged.set(editorDeclarations, editorCode + '\n' + fs.readFileSync(path.join(root, 'packages/cc-module/statics/cc-template.d.ts'), 'utf8')); + for (const [file, code] of staged) { + const references = ts.preProcessFile(code, true, true); + for (const item of [...references.importedFiles, ...references.referencedFiles]) { + if (!item.fileName.startsWith('.')) continue; + const target = path.resolve(path.dirname(file), item.fileName); + const insidePackage = path.dirname(target) === packageRoot; + const exists = [target, target + '.d.ts'].some(candidate => staged.has(candidate) || fs.existsSync(candidate)); + if (!insidePackage || !exists) throw new Error('Invalid public declaration reference: ' + file + ': ' + item.fileName); + } + } + // Publish the set only after every domain and its references have validated. + for (const [file, code] of staged) fs.writeFileSync(file, code); + const legacy = path.resolve(packageRoot, 'scene-editor'); + if (legacy !== path.resolve(root, 'packages/cocos-cli-types/scene-editor')) throw new Error('Invalid legacy declaration directory'); + fs.rmSync(legacy, { recursive: true, force: true }); + fs.rmSync(path.join(packageRoot, 'scene-editor.d.ts'), { force: true }); + console.log('Extended ' + domains.length + ' public declaration files; reused ' + reused.size + ' public symbols.'); + return packageRoot; +} + +module.exports = { rollupDomains, domainEntries }; diff --git a/workflow/scene-api-entries.json b/workflow/scene-api-entries.json new file mode 100644 index 000000000..0da42187a --- /dev/null +++ b/workflow/scene-api-entries.json @@ -0,0 +1,108 @@ +{ + "host": { + "commands/base": "commands/base", + "core/assets/index": "core/assets/index", + "core/base/editor-shim": "core/base/editor-shim", + "core/base/i18n": "core/base/i18n", + "core/base/utils/uuid": "core/base/utils/uuid", + "core/builder/@types/protected": "core/builder/@types/protected", + "core/builder/index": "core/builder/index", + "core/builder/platforms/web-common/utils": "core/builder/platforms/web-common/utils", + "core/builder/share/common-options-validator": "core/builder/share/common-options-validator", + "core/configuration/index": "core/configuration/index", + "core/configuration/script/interface": "core/configuration/script/interface", + "core/extension-roots": "core/extension-roots", + "core/launcher": "core/launcher", + "core/project/index": "core/project/index", + "core/scene/common/index": "core/scene/common/index", + "core/scene/common/preview": "core/scene/common/preview", + "core/scene/common/reflection-probe": "core/scene/common/reflection-probe", + "core/scene/index": "core/scene/index", + "core/scene/main-process/index": "core/scene/main-process/index", + "core/scene/main-process/rpc": "core/scene/main-process/rpc", + "core/scene/runtime/resources/scene-routes": "core/scene/runtime/resources/scene-routes", + "core/scene/runtime/resources/scripting-routes": "core/scene/runtime/resources/scripting-routes", + "core/scene/runtime/resources/settings": "core/scene/runtime/resources/settings", + "core/scripting/index": "core/scripting/index", + "global": "global", + "lib/simulator/simulator": "lib/simulator/simulator", + "server/index": "server/index", + "server/interfaces": "server/interfaces", + "server/middleware/index": "server/middleware/index", + "server/socket": "server/socket" + }, + "browser": { + "scene": "core/scene/runtime/core", + "scene/context": "core/scene/runtime/context", + "scene/common": "core/scene/common/index", + "scene/config": "core/scene/scene-configs", + "scene/i18n": "core/scene/scene-process/i18n", + "scene/rpc": "core/scene/scene-process/rpc", + "scene/light-probe-normal-reset": "core/scene/scene-process/light-probe-normal-reset", + "scene/animation/property-commit-event": "core/scene/scene-process/service/animation/property-commit-event", + "scene/editor-session": "core/scene/scene-process/service/core/editor-session", + "scene/dump": "core/scene/scene-process/service/dump/index", + "scene/engine": "core/scene/scene-process/service/engine", + "scene/message": "core/scene/scene-process/service/message", + "scene/node": "core/scene/scene-process/service/node/index", + "scene/node/node-create": "core/scene/scene-process/service/node/node-create", + "scene/node/node-type-config": "core/scene/scene-process/service/node/node-type-config", + "scene/node/node-utils": "core/scene/scene-process/service/node/node-utils", + "scene/node/prefab-canvas-mutation": "core/scene/scene-process/service/node/prefab-canvas-mutation", + "scene/operation/types": "core/scene/scene-process/service/operation/types", + "scene/prefab/prefab-editor-utils": "core/scene/scene-process/service/prefab/prefab-editor-utils", + "scene/reference-image": "core/scene/scene-process/service/reference-image", + "scene/scene/light-probe-snapshot": "core/scene/scene-process/service/scene/light-probe-snapshot", + "scene/scene/light-probe-transform": "core/scene/scene-process/service/scene/light-probe-transform", + "scene/scene/utils": "core/scene/scene-process/service/scene/utils", + "scene/service-manager": "core/scene/scene-process/service/service-manager", + "scene/utils/asset-reload": "core/scene/scene-process/service/utils/asset-reload", + "scene/utils/editor-node": "core/scene/scene-process/service/utils/editor-node", + "scene/utils/state-machine/finite-state-machine": "core/scene/scene-process/service/utils/state-machine/finite-state-machine", + "scene/utils/state-machine/state-interface": "core/scene/scene-process/service/utils/state-machine/state-interface", + "scene/session/client": "core/scene/session/client", + "scene/session/methods": "core/scene/session/methods", + "scene/session/protocol": "core/scene/session/protocol", + "engine/editor-extends": "core/engine/editor-extends/index", + "engine/node-path": "core/engine/editor-extends/manager/path-utils", + "engine/serialize": "core/engine/editor-extends/utils/serialize/index", + "engine/deserialize": "core/engine/editor-extends/utils/deserialize", + "engine/geometry": "core/engine/editor-extends/utils/geometry", + "engine/prefab": "core/engine/editor-extends/utils/prefab", + "engine/graphics-config": "core/engine/graphics-config", + "engine/polyfill": "cc/polyfill/engine", + "engine/overwrite": "cc/overwrite", + "engine/editor/2d-misc": "cc/editor/2d-misc", + "engine/editor/new-gen-anim": "cc/editor/new-gen-anim", + "engine/editor/lod-group-utils": "cc/editor/lod-group-utils" + }, + "browserOptions": { + "scene/config": { + "typeOnly": true + }, + "scene/i18n": { + "default": true + }, + "scene/dump": { + "default": true + }, + "scene/node": { + "default": true + }, + "scene/node/node-type-config": { + "default": true + }, + "scene/utils/state-machine/finite-state-machine": { + "default": true + }, + "scene/utils/state-machine/state-interface": { + "default": true + }, + "engine/polyfill": { + "sideEffect": true + }, + "engine/overwrite": { + "default": true + } + } +} diff --git a/workflow/scene-browser-api.js b/workflow/scene-browser-api.js new file mode 100644 index 000000000..d621df713 --- /dev/null +++ b/workflow/scene-browser-api.js @@ -0,0 +1,35 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const ts = require('typescript'); +const { browser, browserOptions = {} } = require('./scene-api-entries.json'); + +const root = path.resolve(__dirname, '..'); +const facadeRoot = 'core/scene/runtime/browser'; + +/** Stable package exports are generated artifacts, not hand-maintained source proxies. */ +function browserFacadePath(id) { + return facadeRoot + '/' + id; +} + +function generateBrowserFacades() { + const config = ts.readConfigFile(path.join(root, 'tsconfig.json'), ts.sys.readFile); + if (config.error) throw new Error(ts.flattenDiagnosticMessageText(config.error.messageText, '\n')); + const { options, errors } = ts.convertCompilerOptionsFromJson(config.config.compilerOptions, root); + if (errors.length) throw new Error(ts.flattenDiagnosticMessageText(errors[0].messageText, '\n')); + for (const [id, target] of Object.entries(browser)) { + const relativePath = browserFacadePath(id); + const file = path.join(root, 'dist', relativePath); + const relative = path.relative(path.dirname(file), path.join(root, 'dist', target)).replace(/\\/g, '/'); + const specifier = target.startsWith('cc/') ? target : relative.startsWith('.') ? relative : './' + relative; + const settings = browserOptions[id] || {}; + const source = '/** Generated from workflow/scene-api-entries.json. */\n' + (settings.sideEffect + ? `import '${specifier}';\nexport {};\n` + : `export ${settings.typeOnly ? 'type ' : ''}* from '${specifier}';\n` + (settings.default ? `export { default } from '${specifier}';\n` : '')); + const compiled = ts.transpileModule(source, { compilerOptions: options, fileName: path.join(root, 'src', relativePath + '.ts') }); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file + '.js', compiled.outputText); + fs.writeFileSync(file + '.d.ts', source); + } +} + +module.exports = { browserFacadePath, generateBrowserFacades };