Skip to content

Commit

Permalink
385 revert $ (#17912)
Browse files Browse the repository at this point in the history
* Remove dollar suffix for private property definition.

* (\._[a-z][a-zA-Z0-9]{3,})\$ to \1

* (protected _[a-z][a-zA-Z0-9]{3,})\$ and (public _[a-z][a-zA-Z0-9]{3,})\$ to \1

* ( _[a-z][a-zA-Z0-9]{3,})\$([^0-9]) to \1\2

* Remove $ suffix manually for gfx-webgl backend.

* (public [a-z][a-zA-Z0-9]{3,})\$ to \1

* (\.[a-z][a-zA-Z0-9]{3,})\$ to \1


* Remove mangle hack.
  • Loading branch information
dumganhar authored Nov 25, 2024
1 parent 8884807 commit 42384e2
Show file tree
Hide file tree
Showing 176 changed files with 7,644 additions and 7,660 deletions.
32 changes: 16 additions & 16 deletions cocos/asset/asset-manager/asset-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ export class AssetManager {
*/
public references = references;

private _releaseManager$ = releaseManager;
private _files$ = files;
private _parsed$ = parsed;
private _parsePipeline$ = BUILD ? null : new Pipeline('parse existing json', [this.loadPipe]);
private _projectBundles$: string[] = [];
private _releaseManager = releaseManager;
private _files = files;
private _parsed = parsed;
private _parsePipeline = BUILD ? null : new Pipeline('parse existing json', [this.loadPipe]);
private _projectBundles: string[] = [];
private static _instance: AssetManager;
private _eventTarget$ = new EventTarget();
private _eventTarget = new EventTarget();

/**
* @en
Expand All @@ -335,14 +335,14 @@ export class AssetManager {
* @engineInternal
*/
public get files(): Cache {

Check warning on line 337 in cocos/asset/asset-manager/asset-manager.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing space before function parentheses
return this._files$;
return this._files;
}

/**
* @engineInternal
*/
public getReleaseManager (): ReleaseManager {
return this._releaseManager$;
return this._releaseManager;
}

/**
Expand Down Expand Up @@ -381,7 +381,7 @@ export class AssetManager {
* @engineInternal
*/
public onAssetMissing (func: (parentAsset: Asset, owner: any, propName: string, uuid: string) => void, target?: any): void {
this._eventTarget$.on(EVENT_ASSET_MISSING, func, target);
this._eventTarget.on(EVENT_ASSET_MISSING, func, target);
}

/**
Expand All @@ -395,7 +395,7 @@ export class AssetManager {
* @engineInternal
*/
public offAssetMissing (func: (parentAsset: Asset, owner: any, propName: string, uuid: string) => void, target?: any): void {
this._eventTarget$.off(EVENT_ASSET_MISSING, func, target);
this._eventTarget.off(EVENT_ASSET_MISSING, func, target);
}

/**
Expand All @@ -411,7 +411,7 @@ export class AssetManager {
* @engineInternal
*/
public dispatchAssetMissing (parentAsset: Asset, owner: any, propName: string, uuid: string): void {
this._eventTarget$.emit(EVENT_ASSET_MISSING, parentAsset, owner, propName, uuid);
this._eventTarget.emit(EVENT_ASSET_MISSING, parentAsset, owner, propName, uuid);
}

/**
Expand All @@ -434,9 +434,9 @@ export class AssetManager {
this.downloader.maxConcurrency = downloadMaxConcurrency;
}

this._files$.clear();
this._parsed$.clear();
this._releaseManager$.init();
this._files.clear();
this._parsed.clear();
this._releaseManager.init();
this.assets.clear();
this.bundles.clear();
this.packManager.init();
Expand All @@ -453,7 +453,7 @@ export class AssetManager {
}
this.generalImportBase = importBase;
this.generalNativeBase = nativeBase;
this._projectBundles$ = settings.querySettings(SettingsCategory.ASSETS, 'projectBundles') || [];
this._projectBundles = settings.querySettings(SettingsCategory.ASSETS, 'projectBundles') || [];
const assetsOverride = settings.querySettings(SettingsCategory.ASSETS, 'assetsOverrides') || {};
for (const key in assetsOverride) {
this.assetsOverrideMap.set(key, assetsOverride[key] as string);
Expand Down Expand Up @@ -827,7 +827,7 @@ export class AssetManager {
if (onComp) { onComp(err, data); }
}),
});
this._parsePipeline$!.async(task);
this._parsePipeline!.async(task);
}
}

Expand Down
22 changes: 11 additions & 11 deletions cocos/asset/asset-manager/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ import type { AssetManager } from './asset-manager';
*
*/
export default class Bundle {
private _config$: Config = new Config();
private _config: Config = new Config();

/**
* For internal use.
* @engineInternal
*/
public get config (): Config {
return this._config$;
return this._config;
}

/**
Expand All @@ -61,7 +61,7 @@ export default class Bundle {
*
*/
public get name (): string {
return this._config$.name;
return this._config.name;
}

/**
Expand All @@ -73,7 +73,7 @@ export default class Bundle {
*
*/
public get deps (): string[] {
return this._config$.deps!;
return this._config.deps!;
}

/**
Expand All @@ -85,7 +85,7 @@ export default class Bundle {
*
*/
public get base (): string {
return this._config$.base;
return this._config.base;
}

/**
Expand All @@ -104,7 +104,7 @@ export default class Bundle {
*
*/
public getInfoWithPath (path: string, type?: Constructor<Asset> | null): IAddressableInfo | null {
return this._config$.getInfoWithPath(path, type);
return this._config.getInfoWithPath(path, type);
}

/**
Expand All @@ -126,7 +126,7 @@ export default class Bundle {
* bundle.getDirWithPath('images', Texture2D, infos);
*/
public getDirWithPath (path: string, type?: Constructor<Asset> | null, out?: IAddressableInfo[]): IAddressableInfo[] {
return this._config$.getDirWithPath(path, type, out);
return this._config.getDirWithPath(path, type, out);
}

/**
Expand All @@ -144,7 +144,7 @@ export default class Bundle {
*
*/
public getAssetInfo (uuid: string): IAssetInfo | null {
return this._config$.getAssetInfo(uuid);
return this._config.getAssetInfo(uuid);
}

/**
Expand All @@ -162,7 +162,7 @@ export default class Bundle {
*
*/
public getSceneInfo (name: string): ISceneInfo | null {
return this._config$.getSceneInfo(name);
return this._config.getSceneInfo(name);
}

/**
Expand All @@ -177,7 +177,7 @@ export default class Bundle {
*
*/
public init (options: IConfigOption): void {
this._config$.init(options);
this._config.init(options);
bundles.add(options.name, this);
}

Expand Down Expand Up @@ -639,7 +639,7 @@ export default class Bundle {
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public _destroy (): void {
this._config$.destroy();
this._config.destroy();
}
}

Expand Down
24 changes: 12 additions & 12 deletions cocos/asset/asset-manager/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ export default class Config {
this.name = options.name || '';
this.deps = options.deps || [];
// init
this._initUuid$(options.uuids);
this._initPath$(options.paths);
this._initScene$(options.scenes);
this._initPackage$(options.packs);
this._initVersion$(options.versions);
this._initRedirect$(options.redirect);
this._initUuid(options.uuids);
this._initPath(options.paths);
this._initScene(options.scenes);
this._initPackage(options.packs);
this._initVersion(options.versions);
this._initRedirect(options.redirect);
for (const ext in options.extensionMap) {
if (!Object.prototype.hasOwnProperty.call(options.extensionMap, ext)) {
continue;
Expand Down Expand Up @@ -333,7 +333,7 @@ export default class Config {
this.assetInfos.destroy();
}

private _initUuid$ (uuidList: string[]): void {
private _initUuid (uuidList: string[]): void {
if (!uuidList) {
return;
}
Expand All @@ -344,7 +344,7 @@ export default class Config {
}
}

private _initPath$ (pathList: Record<string, string[]>): void {
private _initPath (pathList: Record<string, string[]>): void {
if (!pathList) { return; }
const paths = this.paths;
paths.clear();
Expand All @@ -369,7 +369,7 @@ export default class Config {
}
}

private _initScene$ (sceneList: Record<string, string>): void {
private _initScene (sceneList: Record<string, string>): void {
if (!sceneList) { return; }
const scenes = this.scenes;
scenes.clear();
Expand All @@ -382,7 +382,7 @@ export default class Config {
}
}

private _initPackage$ (packageList: Record<string, string[]>): void {
private _initPackage (packageList: Record<string, string[]>): void {
if (!packageList) { return; }
const assetInfos = this.assetInfos;
for (const packUuid in packageList) {
Expand All @@ -407,7 +407,7 @@ export default class Config {
}
}

private _initVersion$ (versions: { import?: string[], native?: string[] }): void {
private _initVersion (versions: { import?: string[], native?: string[] }): void {
if (!versions) { return; }
const assetInfos = this.assetInfos;
let entries = versions.import;
Expand All @@ -428,7 +428,7 @@ export default class Config {
}
}

private _initRedirect$ (redirect: string[]): void {
private _initRedirect (redirect: string[]): void {
if (!redirect) { return; }
const assetInfos = this.assetInfos;
for (let i = 0, l = redirect.length; i < l; i += 2) {
Expand Down
16 changes: 8 additions & 8 deletions cocos/asset/asset-manager/depend-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class DependUtil {
public getDepsRecursively (uuid: string): string[] {
const exclude = Object.create(null);
const depends = [];
this._descend$(uuid, exclude, depends);
this._descend(uuid, exclude, depends);

Check failure on line 146 in cocos/asset/asset-manager/depend-util.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe argument of type `any` assigned to a parameter of type `Record<string, any>`
return depends;
}

Expand Down Expand Up @@ -184,12 +184,12 @@ export class DependUtil {
// issue: https://github.com/cocos/cocos-engine/issues/14642
if (Array.isArray(json) && (!(BUILD || isCompiledJson(json)) || !hasNativeDep(json as any))) {

Check failure on line 185 in cocos/asset/asset-manager/depend-util.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe argument of type `any` assigned to a parameter of type `[FileInfo & DeserializeContext, 0 | string[], 0 | string[], (string | IClass | AnyCCClass)[], 0 | IMask[], any[], ... 4 more ..., (string | number)[]]`
out = {
deps: this._parseDepsFromJson$(json),
deps: this._parseDepsFromJson(json),
};
} else {
try {
const asset = deserialize(json, { __uuid__: uuid });

Check failure on line 191 in cocos/asset/asset-manager/depend-util.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe argument of type `any` assigned to a parameter of type `Record<string, any>`
out = this._parseDepsFromAsset$(asset);
out = this._parseDepsFromAsset(asset);
if (out.nativeDep) {
out.nativeDep.uuid = uuid;
}
Expand All @@ -206,14 +206,14 @@ export class DependUtil {
return out;
}
}
out = this._parseDepsFromAsset$(json);
out = this._parseDepsFromAsset(json);

Check failure on line 209 in cocos/asset/asset-manager/depend-util.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe argument of type `any` assigned to a parameter of type `Asset`
}
// cache dependency list
this._depends.add(uuid, out);
return out;
}

private _parseDepsFromAsset$ (asset: Asset): IDependencies {
private _parseDepsFromAsset (asset: Asset): IDependencies {
const out: IDependencies = {
deps: [],
parsedFromExistAsset: true,
Expand All @@ -232,20 +232,20 @@ export class DependUtil {
return out;
}

private _parseDepsFromJson$ (json: any[]): string[] {
private _parseDepsFromJson (json: any[]): string[] {
const depends = parseUuidDependencies(json);
depends.forEach((uuid, index): string => depends[index] = decodeUuid(uuid));
return depends;
}

private _descend$ (uuid: string, exclude: Record<string, any>, depends: string[]): void {
private _descend (uuid: string, exclude: Record<string, any>, depends: string[]): void {
const deps = this.getDeps(uuid);
for (let i = 0; i < deps.length; i++) {
const depend = deps[i];
if (!exclude[depend]) {
exclude[depend] = true;
depends.push(depend);
this._descend$(depend, exclude, depends);
this._descend(depend, exclude, depends);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions cocos/asset/asset-manager/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class CCLoader {
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public _autoReleaseSetting: Record<string, boolean> = Object.create(null);
private _parseLoadResArgs$ = parseLoadResArgs;
private _parseLoadResArgs = parseLoadResArgs;

/**
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
Expand Down Expand Up @@ -307,7 +307,7 @@ export class CCLoader {
progressCallback?: LoadProgressCallback | LoadCompleteCallback<T>,
completeCallback?: LoadCompleteCallback<T>,
): any {
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs$(
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs(
type as any,
progressCallback as LoadProgressCallback,
completeCallback as LoadCompleteCallback<T>,
Expand Down Expand Up @@ -358,7 +358,7 @@ type as any,
progressCallback?: LoadProgressCallback,
completeCallback?: LoadCompleteCallback<T[]>,
): void {
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs$<LoadCompleteCallback<Asset[]>>(
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs<LoadCompleteCallback<Asset[]>>(
type as any,
progressCallback as LoadProgressCallback,
completeCallback as LoadCompleteCallback<Asset[]>,
Expand Down Expand Up @@ -447,7 +447,7 @@ type as any,
progressCallback?: LoadProgressCallback | LoadDirCompleteCallback<T>,
completeCallback?: LoadDirCompleteCallback<T>,
): any {
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs$<LoadDirCompleteCallback<Asset>>(
const { type: _type, onProgress, onComplete } = this._parseLoadResArgs<LoadDirCompleteCallback<Asset>>(
type as any,
progressCallback as LoadProgressCallback,
completeCallback as LoadDirCompleteCallback<Asset>,
Expand Down
Loading

0 comments on commit 42384e2

Please sign in to comment.