Skip to content

Commit

Permalink
Mod type of moduleMainPaths
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinobuTakahashi committed Apr 24, 2024
1 parent 7b119d4 commit 970ae47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/AssetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class AssetManager implements AssetLoadHandler {
* package.json のパスをキーに、その main フィールドの内容を値に持つテーブル
* @private
*/
_moduleMainPaths: ModuleMainPathsMap;
_moduleMainPaths: ModuleMainPathsMap | null;

/**
* 各アセットに対する参照の数。
Expand Down Expand Up @@ -286,7 +286,7 @@ export class AssetManager implements AssetLoadHandler {
this._liveAssetVirtualPathTable = {};
this._liveAssetPathTable = {};
this._moduleMainScripts = moduleMainScripts ? moduleMainScripts : {};
this._moduleMainPaths = moduleMainPaths ?? {};
this._moduleMainPaths = moduleMainPaths ?? null;
this._refCounts = {};
this._loadings = {};
this._generatedAssetCount = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/ModuleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class ModuleManager {

// akashic-engine独自仕様: 対象の `path` が `moduleMainScripts` に指定されていたらそちらを参照する
// moduleMainScripts は将来的に非推奨となるため、moduleMainPaths が存在しない場合だけ参照する
if (Object.keys(moduleMainPaths).length === 0 && moduleMainScripts[path]) {
if (!moduleMainPaths && moduleMainScripts[path]) {
targetScriptAsset = liveAssetVirtualPathTable[resolvedPath];
} else {
targetScriptAsset = this._findAssetByPathAsFile(resolvedPath, liveAssetVirtualPathTable);
Expand Down Expand Up @@ -184,7 +184,7 @@ export class ModuleManager {

// akashic-engine独自仕様: 対象の `path` が `moduleMainScripts` に指定されていたらそちらを返す
// moduleMainScripts は将来的に非推奨となるため、moduleMainPaths が存在しない場合だけ参照する
if (Object.keys(moduleMainPaths).length === 0 && moduleMainScripts[path]) {
if (!moduleMainPaths && moduleMainScripts[path]) {
return moduleMainScripts[path];
}

Expand Down Expand Up @@ -255,7 +255,7 @@ export class ModuleManager {
let path = resolvedPath + "/package.json";
const asset = liveAssetPathTable[path];
const moduleMainPaths = this._assetManager._moduleMainPaths;
if (moduleMainPaths[path]) {
if (moduleMainPaths && moduleMainPaths[path]) {
return moduleMainPaths[path];
}
// liveAssetPathTable[path] != null だけではpathと同名のprototypeプロパティがある場合trueになってしまうので hasOwnProperty() を利用
Expand Down

0 comments on commit 970ae47

Please sign in to comment.