New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@akashic/akashic-engine

Package Overview
Dependencies
Maintainers
0
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@akashic/akashic-engine - npm Package Compare versions

Comparing version 3.18.3 to 3.19.0

lib/auxiliary/BundledScriptAsset.d.ts

16

lib/AssetManager.d.ts

@@ -1,2 +0,2 @@

import type { AssetConfigurationMap, AudioSystemConfigurationMap, ModuleMainScriptsMap, AssetConfigurationCommonBase, ImageAssetConfigurationBase, ScriptAssetConfigurationBase, TextAssetConfigurationBase, AudioAssetConfigurationBase, VideoAssetConfigurationBase, VectorImageAssetConfigurationBase, BinaryAssetConfigurationBase, ModuleMainPathsMap } from "@akashic/game-configuration";
import type { AssetConfigurationMap, AudioSystemConfigurationMap, ModuleMainScriptsMap, AssetConfigurationCommonBase, ImageAssetConfigurationBase, ScriptAssetConfigurationBase, TextAssetConfigurationBase, AudioAssetConfigurationBase, VideoAssetConfigurationBase, VectorImageAssetConfigurationBase, BinaryAssetConfigurationBase, ModuleMainPathsMap, AssetBundleConfiguration } from "@akashic/game-configuration";
import type { Asset, AssetLoadHandler, AudioAsset, AssetLoadError, ImageAsset, ResourceFactory, ScriptAsset, TextAsset, VideoAsset, VectorImageAsset, BinaryAsset } from "@akashic/pdi-types";

@@ -121,2 +121,6 @@ import type { AssetGenerationConfiguration } from "./AssetGenerationConfiguration";

/**
* アセットバンドル。
*/
private _assetBundle;
/**
* `AssetManager` のインスタンスを生成する。

@@ -150,5 +154,5 @@ *

/**
* プリロードすべきスクリプトアセットのIDを全て返す。
* プリロードすべきスクリプトアセットの path を全て返す。
*/
preloadScriptAssetIds(): string[];
preloadScriptAssetPaths(): string[];
/**

@@ -234,2 +238,8 @@ * パターンまたはフィルタに合致するパスを持つアセットIDを全て返す。

/**
* アセットバンドルを設定する。
*
* @param assetBundle アセットバンドル
*/
setAssetBundle(assetBundle: AssetBundleConfiguration | null): void;
/**
* @ignore

@@ -236,0 +246,0 @@ */

87

lib/AssetManager.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssetManager = void 0;
var BundledScriptAsset_1 = require("./auxiliary/BundledScriptAsset");
var EmptyBinaryAsset_1 = require("./auxiliary/EmptyBinaryAsset");

@@ -114,2 +126,3 @@ var EmptyGeneratedVectorImageAsset_1 = require("./auxiliary/EmptyGeneratedVectorImageAsset");

this._generatedAssetCount = 0;
this._assetBundle = null;
var assetIds = Object.keys(this.configuration);

@@ -136,2 +149,3 @@ for (var i = 0; i < assetIds.length; ++i) {

this._loadings = undefined;
this._assetBundle = undefined;
};

@@ -180,14 +194,17 @@ /**

/**
* プリロードすべきスクリプトアセットのIDを全て返す。
* プリロードすべきスクリプトアセットの path を全て返す。
*/
AssetManager.prototype.preloadScriptAssetIds = function () {
return Object.entries(this.configuration)
.filter(function (_a) {
var conf = _a[1];
return conf.type === "script" && conf.global && conf.preload;
})
.map(function (_a) {
var assetId = _a[0];
return assetId;
});
AssetManager.prototype.preloadScriptAssetPaths = function () {
var assetPaths = [];
if (this._assetBundle) {
assetPaths.push.apply(assetPaths, Object.values(this._assetBundle.assets)
.filter(function (conf) { return conf.type === "script" && conf.preload; })
.map(function (conf) { return conf.path; }));
}
assetPaths.push.apply(assetPaths, Object.values(this.configuration)
.filter(function (conf) { return conf.type === "script" && conf.global && conf.preload; })
.map(function (conf) { return conf.virtualPath; }) // この箇所ではすでに virtualPath が補完されていることが前提
);
assetPaths = assetPaths.map(function (path) { return (path.startsWith("./") ? path : "./".concat(path)); });
return assetPaths;
};

@@ -389,2 +406,10 @@ /**

/**
* アセットバンドルを設定する。
*
* @param assetBundle アセットバンドル
*/
AssetManager.prototype.setAssetBundle = function (assetBundle) {
this._assetBundle = assetBundle;
};
/**
* @ignore

@@ -467,3 +492,15 @@ */

var conf;
if (typeof idOrConf === "string") {
if (this._assetBundle && typeof idOrConf === "string") {
var id_1 = idOrConf;
var conf_2 = this._assetBundle.assets[id_1];
var type_1 = conf_2.type;
switch (type_1) {
case "script":
var asset = new BundledScriptAsset_1.BundledScriptAsset(__assign({ id: id_1 }, conf_2));
return asset;
default:
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("AssertionError#_createAssetFor: unknown asset type ".concat(type_1, " for asset ID: ").concat(id_1));
}
}
else if (typeof idOrConf === "string") {
id = idOrConf;

@@ -663,15 +700,21 @@ conf = this.configuration[id];

this._assets[asset.id] = asset;
var path;
// DynamicAsset の場合は configuration に書かれていないので以下の判定が偽になる
if (this.configuration[asset.id]) {
var virtualPath = this.configuration[asset.id].virtualPath; // virtualPath の存在は _normalize() で確認済みのため 非 null アサーションとする
if (!this._liveAssetVirtualPathTable.hasOwnProperty(virtualPath)) {
this._liveAssetVirtualPathTable[virtualPath] = asset;
}
else {
if (this._liveAssetVirtualPathTable[virtualPath].path !== asset.path)
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("AssetManager#_onAssetLoad(): duplicated asset path");
}
if (!this._liveAssetPathTable.hasOwnProperty(asset.path))
this._liveAssetPathTable[asset.path] = virtualPath;
path = this.configuration[asset.id].virtualPath; // virtualPath の存在は _normalize() で確認済みのため 非 null アサーションとする
}
else if (this._assetBundle && this._assetBundle.assets[asset.id]) {
path = this._assetBundle.assets[asset.id].path;
}
if (!path)
return;
if (!this._liveAssetVirtualPathTable.hasOwnProperty(path)) {
this._liveAssetVirtualPathTable[path] = asset;
}
else {
if (this._liveAssetVirtualPathTable[path].path !== asset.path)
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("AssetManager#_onAssetLoad(): duplicated asset path");
}
if (!this._liveAssetPathTable.hasOwnProperty(asset.path))
this._liveAssetPathTable[asset.path] = path;
};

@@ -678,0 +721,0 @@ AssetManager.MAX_ERROR_COUNT = 3;

@@ -15,2 +15,3 @@ import type { GameConfiguration } from "@akashic/game-configuration";

import type { GameMainParameterObject } from "./GameMainParameterObject";
import { InitialScene } from "./InitialScene";
import { LoadingScene } from "./LoadingScene";

@@ -24,3 +25,3 @@ import type { LocalTickModeString } from "./LocalTickModeString";

import type { RandomGenerator } from "./RandomGenerator";
import { Scene } from "./Scene";
import type { Scene } from "./Scene";
import type { SnapshotSaveRequest } from "./SnapshotSaveRequest";

@@ -439,3 +440,3 @@ import { SurfaceAtlasSet } from "./SurfaceAtlasSet";

*/
_initialScene: Scene;
_initialScene: InitialScene;
/**

@@ -442,0 +443,0 @@ * デフォルトローディングシーン。

@@ -12,2 +12,3 @@ "use strict";

var ExceptionFactory_1 = require("./ExceptionFactory");
var InitialScene_1 = require("./InitialScene");
var LoadingScene_1 = require("./LoadingScene");

@@ -17,3 +18,2 @@ var ModuleManager_1 = require("./ModuleManager");

var PointEventResolver_1 = require("./PointEventResolver");
var Scene_1 = require("./Scene");
var SurfaceAtlasSet_1 = require("./SurfaceAtlasSet");

@@ -146,3 +146,3 @@ var WeakRefKVS_1 = require("./WeakRefKVS");

this.onUpdate = new trigger_1.Trigger();
this._initialScene = new Scene_1.Scene({
this._initialScene = new InitialScene_1.InitialScene({
game: this,

@@ -153,3 +153,3 @@ assetIds: this._assetManager.globalAssetIds(),

});
this._initialScene.onLoad.add(this._handleInitialSceneLoad, this);
this._initialScene.onAllAssetsLoad.add(this._handleInitialSceneLoad, this);
this._reset({ age: 0 });

@@ -1138,8 +1138,8 @@ }

this.operationPlugins = this.operationPluginManager.plugins;
var preloadAssetIds = this._assetManager.preloadScriptAssetIds();
for (var _a = 0, preloadAssetIds_1 = preloadAssetIds; _a < preloadAssetIds_1.length; _a++) {
var preloadAssetId = preloadAssetIds_1[_a];
var fun = this._moduleManager._internalRequire(preloadAssetId);
var preloadAssetPaths = this._assetManager.preloadScriptAssetPaths();
for (var _a = 0, preloadAssetPaths_1 = preloadAssetPaths; _a < preloadAssetPaths_1.length; _a++) {
var preloadAssetPath = preloadAssetPaths_1[_a];
var fun = this._moduleManager._internalRequire(preloadAssetPath);
if (!fun || typeof fun !== "function")
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("Game#_handleLoad: ".concat(preloadAssetId, " has no-exported function."));
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("Game#_handleLoad: ".concat(preloadAssetPath, " has no-exported function."));
fun();

@@ -1146,0 +1146,0 @@ }

@@ -46,2 +46,3 @@ export * from "@akashic/game-configuration";

export * from "./GameMainParameterObject";
export * from "./InitialScene";
export * from "./InternalOperationPluginInfo";

@@ -48,0 +49,0 @@ export * from "./LoadingScene";

@@ -72,2 +72,3 @@ "use strict";

__exportStar(require("./GameMainParameterObject"), exports);
__exportStar(require("./InitialScene"), exports);
__exportStar(require("./InternalOperationPluginInfo"), exports);

@@ -74,0 +75,0 @@ __exportStar(require("./LoadingScene"), exports);

@@ -132,3 +132,3 @@ "use strict";

if (!currentModule._virtualDirname) {
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("g._require.resolve: couldn't resolve the moudle path without virtualPath");
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("g._require.resolve: couldn't resolve the module path without virtualPath");
}

@@ -138,6 +138,11 @@ resolvedPath = PathUtil_1.PathUtil.resolvePath(currentModule._virtualDirname, path);

else {
if (!/^\.\//.test(path)) {
if (/^\.\//.test(path)) {
resolvedPath = path.substring(2);
}
else if (/^\//.test(path)) {
resolvedPath = path.substring(1);
}
else {
throw ExceptionFactory_1.ExceptionFactory.createAssertionError("g._require.resolve: entry point path must start with './'");
}
resolvedPath = path.substring(2);
}

@@ -144,0 +149,0 @@ // 2.a. LOAD_AS_FILE(Y + X)

{
"name": "@akashic/akashic-engine",
"version": "3.18.3",
"version": "3.19.0",
"description": "The core library of Akashic Engine",
"main": "index.js",
"dependencies": {
"@akashic/game-configuration": "~2.3.0",
"@akashic/game-configuration": "~2.4.0",
"@akashic/pdi-types": "^1.13.0",

@@ -9,0 +9,0 @@ "@akashic/playlog": "~3.3.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc