@ignifx/core 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/{environment-CvVC1lPa.js → environment-CTM7BAyb.js} +3 -3
  2. package/dist/{environment-CvVC1lPa.js.map → environment-CTM7BAyb.js.map} +1 -1
  3. package/dist/{ignifx-error-R1ma_Lzv.js → ignifx-error-CRh89KUJ.js} +4 -1
  4. package/dist/ignifx-error-CRh89KUJ.js.map +1 -0
  5. package/dist/index.d.ts +24 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +95 -15
  8. package/dist/index.js.map +1 -1
  9. package/dist/{material-plugin-CTaWZXEk.js → material-plugin-Cfw_h_Mg.js} +2 -2
  10. package/dist/{material-plugin-CTaWZXEk.js.map → material-plugin-Cfw_h_Mg.js.map} +1 -1
  11. package/dist/{post-effect-compiler-Cq6cshjL.js → post-effect-compiler-Rce26Eue.js} +2 -2
  12. package/dist/{post-effect-compiler-Cq6cshjL.js.map → post-effect-compiler-Rce26Eue.js.map} +1 -1
  13. package/dist/{shader-material-fOI9Upt3.js → shader-material-CJxMJEUO.js} +3 -3
  14. package/dist/{shader-material-fOI9Upt3.js.map → shader-material-CJxMJEUO.js.map} +1 -1
  15. package/dist/{shader-material-BzVY0ySR.js → shader-material-F-CL4D70.js} +2 -2
  16. package/dist/{shader-material-BzVY0ySR.js.map → shader-material-F-CL4D70.js.map} +1 -1
  17. package/dist/{shader-pragma-CNAK4SIb.js → shader-pragma-D4HKC9vP.js} +2 -2
  18. package/dist/{shader-pragma-CNAK4SIb.js.map → shader-pragma-D4HKC9vP.js.map} +1 -1
  19. package/dist/{surface-shader-fJ2MOez0.js → surface-shader-Chs7wOAE.js} +4 -4
  20. package/dist/{surface-shader-fJ2MOez0.js.map → surface-shader-Chs7wOAE.js.map} +1 -1
  21. package/package.json +1 -1
  22. package/dist/ignifx-error-R1ma_Lzv.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ignifx-error-R1ma_Lzv.js","names":[],"sources":["../src/errors/error-codes.ts","../src/errors/ignifx-error.ts"],"sourcesContent":["/**\n * The error code registry data: the subsystem ranges from\n * `docs/architecture/15-devtools-and-diagnostics.md` §1, the codes `@ignifx/core` itself owns, and\n * the format rule every code must satisfy.\n *\n * This module is pure data plus one predicate; it imports nothing, which is what lets\n * {@link IgnifxError} depend on it without a cycle (coding standards §4).\n */\n\n/**\n * The two-digit prefix each subsystem owns inside the `IGX-####` space\n * (`docs/architecture/15-devtools-and-diagnostics.md` §1). A code is the prefix followed by a\n * two-digit ordinal, so `rendering` owns `IGX-0700` through `IGX-0799`.\n *\n * @example\n * ```ts\n * const code = `IGX-${ErrorRange.rendering}01` satisfies ErrorCode; // \"IGX-0701\"\n * ```\n *\n * @public\n */\nexport const ErrorRange = {\n /** App lifecycle, phases, time, coroutines, destruction. */\n lifecycle: \"01\",\n /** Components, scripts, and their registration. */\n components: \"02\",\n /** Scenes, scene instances, layers. */\n scenes: \"03\",\n /** The extension host and its contract. */\n extensions: \"04\",\n /** Asset handles, loaders, and caching. */\n assets: \"05\",\n /** Schemas, scene/prefab JSON, references. */\n serialization: \"06\",\n /** The renderer and the Babylon Lite adapter. */\n rendering: \"07\",\n /** Input devices, actions, and bindings. */\n input: \"08\",\n /** 3D physics. */\n physics: \"09\",\n /** Audio buses, sources, and clips. */\n audio: \"10\",\n /** The 2D toolkit. */\n twoD: \"11\",\n /** The 3D toolkit. */\n threeD: \"12\",\n /** The UI overlay. */\n ui: \"13\",\n /** Platform integration (browser, Electron). */\n platform: \"14\",\n /** Devtools, logging, and diagnostics. */\n devtools: \"15\",\n /** Terrain assets, chunks, and queries. */\n terrain: \"16\",\n /** Particle systems, 3D and 2D. */\n particles: \"17\",\n} as const;\n\n/**\n * The union of the two-digit subsystem prefixes declared by `ErrorRange`.\n *\n * @public\n */\nexport type ErrorRange = (typeof ErrorRange)[keyof typeof ErrorRange];\n\n/**\n * The first digit of the range reserved for extensions published outside the `@ignifx` scope\n * (`IGX-9000` through `IGX-9999`). First-party subsystems never allocate here.\n *\n * @public\n */\nexport const THIRD_PARTY_ERROR_PREFIX = \"9\";\n\n/**\n * The shape of every ignifx diagnostic code: the literal `IGX-` followed by four digits.\n *\n * @remarks\n * The template literal is the widest useful type; it accepts strings such as `\"IGX-1\"` that are not\n * real codes. {@link isValidErrorCode} is the runtime check, `CoreErrorCode` is the narrowed\n * string-literal union for the codes this package owns, and extensions narrow their own the same\n * way.\n *\n * @public\n */\nexport type ErrorCode = `IGX-${number}`;\n\n/**\n * Every diagnostic code `@ignifx/core` can throw, keyed by an intention-revealing name so call\n * sites read as prose and the compiler catches typos (coding standards §5.2 — `as const` objects in\n * place of enums).\n *\n * @example\n * ```ts\n * throw new IgnifxError(CoreErrorCode.mutationAfterDestroy, \"The entity has been destroyed.\", {\n * context: { entity: entity.uid },\n * });\n * ```\n *\n * @remarks\n * Code blocks reserved for other first-party packages, which cannot import this table\n * (`docs/architecture/00-overview.md` §2): `@ignifx/cli` owns `IGX-1401`–`IGX-1419`; `@ignifx/electron`\n * owns `IGX-1460`–`IGX-1499` (core's own platform codes therefore stop at `IGX-1459`); `@ignifx/devtools`\n * owns `IGX-1550`–`IGX-1599` (core's own devtools-range codes stop at `IGX-1549`);\n * `@ignifx/vite-plugin` owns `IGX-0550`–`IGX-0599` and `IGX-0650`–`IGX-0699`. Core allocates its\n * own codes from the bottom of each range and, in the platform range, from `IGX-1420` upward —\n * which is where `app.platform` and `app.storage` live, because storage is a *platform* service:\n * the same three calls resolve to IndexedDB, a directory, or the Electron bridge depending only on\n * the host, so a failure is a platform failure and not a serialization or asset one.\n *\n * @public\n */\nexport const CoreErrorCode = {\n /** An entity, component, or app was used after it had been destroyed or disposed. */\n mutationAfterDestroy: \"IGX-0101\",\n /** `destroyImmediate()` was called from inside a lifecycle callback. */\n destroyImmediateInCallback: \"IGX-0102\",\n /** A signal handler asked for deferred delivery on a signal that has no scheduler. */\n deferredSignalWithoutScheduler: \"IGX-0103\",\n /** A signal handler threw and no handler-error reporter was installed. */\n signalHandlerThrew: \"IGX-0104\",\n /** `app.step()` was called while Babylon Lite's render loop was driving the frames. */\n stepOutsideHeadless: \"IGX-0105\",\n /** An app was used after `app.dispose()` had run. */\n appDisposed: \"IGX-0106\",\n /** A part of the app was reached before `createApp()` had finished building it. */\n appNotReady: \"IGX-0107\",\n /** A `Time` property was set to a value outside its documented domain. */\n invalidTimeValue: \"IGX-0108\",\n /** A `app.tweens.to(...)` option was outside its documented domain. */\n invalidTweenOptions: \"IGX-0109\",\n /** A tweened field is not a number, `Vec2`, `Vec3`, or `Quat`, or is not writable. */\n tweenFieldNotTweenable: \"IGX-0110\",\n /** A component declared through `requires` is missing from the entity. */\n requiredComponentMissing: \"IGX-0201\",\n /** A second instance of a component type that does not allow multiples was added. */\n multipleComponentsNotAllowed: \"IGX-0202\",\n /** Two component types were registered under the same `typeId`. */\n duplicateComponentTypeId: \"IGX-0203\",\n /** A component without a `typeId` was serialized. */\n componentTypeIdMissing: \"IGX-0204\",\n /** `Transform` was removed or disabled; every entity must keep exactly one enabled transform. */\n transformIsNotRemovable: \"IGX-0205\",\n /** A component's engine-assigned state was read before the engine attached it to an entity. */\n componentNotAttached: \"IGX-0206\",\n /** A hot-reloaded class kept the `\"patch\"` policy while its schema shape changed. */\n hotReloadSchemaChanged: \"IGX-0207\",\n /** `app.hotReload.apply()` was called from inside a lifecycle callback. */\n hotReloadInsideCallback: \"IGX-0208\",\n /** A scene was instantiated before it had finished loading. */\n sceneNotLoaded: \"IGX-0301\",\n /** Instantiating a scene would place an instance inside itself. */\n sceneInstanceCycle: \"IGX-0302\",\n /** A layer name that the project settings do not declare was used. */\n unknownLayer: \"IGX-0303\",\n /** Two layer slots were given the same name. */\n duplicateLayerName: \"IGX-0304\",\n /** The project settings declare more layer names than the 32 available slots. */\n tooManyLayers: \"IGX-0305\",\n /** Reparenting an entity under its own descendant would make the scene tree cyclic. */\n parentingCycle: \"IGX-0306\",\n /** A scene file names a component `typeId` that no extension has registered. */\n unknownComponentTypeId: \"IGX-0307\",\n /** A file handed to the scene loader does not carry the `ignifx.scene` format header. */\n notASceneFile: \"IGX-0308\",\n /** An operation that only accepts a scene root was given an entity that has a parent. */\n entityIsNotSceneRoot: \"IGX-0309\",\n /** Two extensions defined the same app property. */\n appPropertyAlreadyDefined: \"IGX-0401\",\n /** The `requires` graph of the registered extensions contains a cycle. */\n extensionRequiresCycle: \"IGX-0402\",\n /** An extension declares a `requires` entry that was never registered. */\n extensionMissing: \"IGX-0403\",\n /** An extension's `engine` range does not match the running core version. */\n extensionEngineMismatch: \"IGX-0404\",\n /** `ctx.require()` asked for a service that no earlier extension registered. */\n serviceNotRegistered: \"IGX-0405\",\n /** Two extensions were registered under the same name. */\n duplicateExtensionName: \"IGX-0406\",\n /** `ctx.settings()` asked for a settings section that was never registered. */\n unknownSettingsSection: \"IGX-0407\",\n /** A project settings section did not validate against the schema its extension registered. */\n invalidSettings: \"IGX-0408\",\n /** An extension dispatched a physics callback from outside the fixed loop. */\n physicsCallbackOutsideFixedStep: \"IGX-0409\",\n /** A second, different simulation scene was handed to a world that already has one. */\n simulationSceneAlreadySet: \"IGX-0410\",\n /** An asset's value was read before the asset finished loading. */\n assetNotLoaded: \"IGX-0501\",\n /** An asset load was aborted through its `AbortSignal`. */\n assetLoadAborted: \"IGX-0502\",\n /** An asset promise outlived the app that owned it. */\n assetAppDisposed: \"IGX-0503\",\n /** No registered loader claims the address's type or extension. */\n assetNoLoader: \"IGX-0504\",\n /** An asset load failed after its last retry. */\n assetLoadFailed: \"IGX-0505\",\n /** Two loaders were registered for the same asset type. */\n duplicateAssetLoader: \"IGX-0506\",\n /** A serialized number was `NaN` or infinite. */\n nonFiniteNumber: \"IGX-0601\",\n /** A serialized `$entity`/`$component` reference could not be resolved. */\n unresolvedReference: \"IGX-0602\",\n /** A scene, prefab, or manifest declares a format version this build cannot read. */\n unsupportedFormatVersion: \"IGX-0603\",\n /** A scene instance's override hash does not match the scene file it was recorded against. */\n instanceHashMismatch: \"IGX-0604\",\n /** A value had the wrong JavaScript or JSON type for its schema field kind. */\n schemaTypeMismatch: \"IGX-0605\",\n /** A value had the right type but fell outside its schema field's declared value domain. */\n schemaOutOfRange: \"IGX-0606\",\n /** A schema declaration or a property bag named a field the schema does not declare. */\n schemaUnknownField: \"IGX-0607\",\n /** A scene file failed structural validation against the generated scene-file JSON Schema. */\n sceneFileInvalid: \"IGX-0608\",\n /** An instance override declares a `path` the override grammar does not accept. */\n invalidOverridePath: \"IGX-0609\",\n /** WebGPU is not available in the current environment. */\n webGpuUnavailable: \"IGX-0701\",\n /** A runtime handle was used after disposal, or was not created by ignifx. */\n invalidRuntime: \"IGX-0702\",\n /** Shadows were requested from a light kind Babylon Lite cannot shadow. */\n shadowsUnsupportedForLight: \"IGX-0703\",\n /** A rendering feature opt-in was requested after the render scene had been registered. */\n renderingFeatureTooLate: \"IGX-0704\",\n /** A second `Environment` was enabled in one world; the most recent one wins. */\n multipleEnvironments: \"IGX-0705\",\n /** A world rendered with no enabled camera, so nothing was drawn. */\n noEnabledCamera: \"IGX-0706\",\n /** A screenshot was requested with no render loop running, so no frame will ever be presented. */\n screenshotNeedsRenderLoop: \"IGX-0707\",\n /** A material file declares a family this build cannot construct. */\n unsupportedMaterialKind: \"IGX-0708\",\n /** An asset file does not carry the format header its loader requires. */\n invalidAssetFile: \"IGX-0709\",\n /** A `PostProcessStack` was attached without the `postProcessing` rendering feature. */\n postProcessingFeatureOff: \"IGX-0710\",\n /** An `Environment.skybox` asks for a background the environment it installed cannot draw. */\n skyboxFixedAtLoad: \"IGX-0711\",\n /** A shader material was asked for a uniform, texture, or storage buffer its shader never declared. */\n unknownShaderBinding: \"IGX-0712\",\n /** A shader uniform was written with a value whose shape does not match its declared type. */\n shaderValueMismatch: \"IGX-0713\",\n /** A shader declares a main-light uniform, but the world has no enabled directional light. */\n shaderLightUniformWithoutLight: \"IGX-0714\",\n /** A shader failed to compile or rebuild; the previous material stays in use. */\n shaderCompileFailed: \"IGX-0715\",\n /** A surface shader was attached without the `materialPlugins` rendering feature. */\n surfaceShaderFeatureOff: \"IGX-0716\",\n /** An `InstancedMeshRenderer` setting Lite fixes at scene registration was changed afterwards. */\n instancingSettingTooLate: \"IGX-0717\",\n /** A shader-material method was called on a PBR or Standard material. */\n notAShaderMaterial: \"IGX-0718\",\n /** A `.wgsl` file carries an `@ignifx` pragma this build cannot read. */\n invalidShaderPragma: \"IGX-0719\",\n /** A storage buffer update reaches past the buffer's capacity. */\n storageBufferOutOfRange: \"IGX-0720\",\n /** More instances were written to an `InstancedMeshRenderer` than its capacity holds. */\n instancedCapacityExceeded: \"IGX-0721\",\n /** Pixel data handed to a texture does not match its declared size. */\n invalidPixelData: \"IGX-0722\",\n /** A surface shader cannot run on its host: no hook, a hook the host lacks, or a Standard host. */\n surfaceHookMissing: \"IGX-0723\",\n /** A shader-material mesh was left out of an ESM shadow caster list, which Lite cannot render for it. */\n shaderMaterialEsmCasterSkipped: \"IGX-0724\",\n /** A `MeshAsset` vertex update named a range the geometry cannot hold. */\n invalidGeometryUpdate: \"IGX-0725\",\n /** The surface shaders attached to one material declare more samplers than fit beside the host material. */\n surfaceSamplerBudgetExceeded: \"IGX-0726\",\n /** The host exposes no Web Crypto implementation. */\n cryptoUnavailable: \"IGX-1420\",\n /** A storage namespace name is not a legal namespace segment. */\n storageInvalidNamespace: \"IGX-1421\",\n /** A storage key is empty, too long, or contains a control character. */\n storageInvalidKey: \"IGX-1422\",\n /** A value handed to `app.storage.set` has no JSON form. */\n storageValueNotSerializable: \"IGX-1423\",\n /** The storage backend refused a write because the host is out of quota or disk space. */\n storageQuotaExceeded: \"IGX-1424\",\n /** The storage backend failed for a reason the engine cannot classify. */\n storageBackendFailed: \"IGX-1425\",\n /** A stored value could not be read back; the store was damaged or written by something else. */\n storageValueCorrupt: \"IGX-1426\",\n /** An error code was registered twice. */\n duplicateErrorCode: \"IGX-1501\",\n /** An error code does not match `IGX-####` in a known range. */\n malformedErrorCode: \"IGX-1502\",\n /** A diagnostics counter group was registered twice. */\n duplicateDiagnosticsGroup: \"IGX-1503\",\n /** A diagnostics counter name was not declared when its group was registered. */\n unknownDiagnosticsCounter: \"IGX-1504\",\n /** A `switch` over a union reached a case the type system said was impossible. */\n unreachableCase: \"IGX-1505\",\n /** `app.hotReload.reloadScene()` was given an instance that was not built from a scene asset. */\n sceneNotReloadable: \"IGX-1506\",\n} as const;\n\n/**\n * The union of the codes `@ignifx/core` owns. Use it to narrow `catch` blocks to core failures.\n *\n * @public\n */\nexport type CoreErrorCode = (typeof CoreErrorCode)[keyof typeof CoreErrorCode];\n\n/**\n * The one-line message template for every `CoreErrorCode`. Templates name context keys in\n * braces (`{entity}`); the throwing call site substitutes the values it has and puts the same\n * identifiers in {@link IgnifxError.context} so production builds stay useful without the prose.\n *\n * @public\n */\nexport const CORE_ERROR_MESSAGES: Readonly<Record<CoreErrorCode, string>> = {\n \"IGX-0101\": \"{target} has been destroyed and can no longer be used.\",\n \"IGX-0102\": \"destroyImmediate() cannot run inside the {phase} callback; use destroy() instead.\",\n \"IGX-0103\": \"Deferred signal delivery needs a scheduler; construct the signal with a deferred queue.\",\n \"IGX-0104\": \"A signal handler threw.\",\n \"IGX-0105\": \"step() is only available in headless mode or while the render loop is stopped.\",\n \"IGX-0106\": \"The app has been disposed; {member} is no longer available.\",\n \"IGX-0107\": \"{member} is not available until createApp() resolves.\",\n \"IGX-0108\": \"{property} must be {domain}; got {value}.\",\n \"IGX-0109\": \"The tween option {option} must be {domain}; got {value}.\",\n \"IGX-0110\": \"{field} is not a number, Vec2, Vec3, or Quat on the tween target.\",\n \"IGX-0201\": \"{component} requires {required} on the same entity.\",\n \"IGX-0202\": \"{component} does not allow multiple instances on one entity.\",\n \"IGX-0203\": \"The component type id {typeId} is already registered by {owner}.\",\n \"IGX-0204\": \"{component} cannot be serialized because it has no typeId.\",\n \"IGX-0205\": \"Transform cannot be removed or disabled.\",\n \"IGX-0206\": \"{component} is not attached to an entity yet.\",\n \"IGX-0207\":\n '{component} changed its schema shape under the \"patch\" hot-reload policy; its instances were re-created.',\n \"IGX-0208\": \"app.hotReload.apply() cannot run inside the {phase} callback; apply it between frames.\",\n \"IGX-0301\": \"The scene {scene} is not loaded yet.\",\n \"IGX-0302\": \"Instantiating {scene} under {entity} would nest the scene inside itself.\",\n \"IGX-0303\": \"{layer} is not a layer declared in the project settings.\",\n \"IGX-0304\": \"The layer name {layer} is declared twice.\",\n \"IGX-0305\": \"The project settings declare {count} layers; at most {limit} fit in the 32 slots.\",\n \"IGX-0306\": \"{entity} cannot be parented to {parent}, which is inside its own subtree.\",\n \"IGX-0307\": \"{typeId} is not a registered component type.\",\n \"IGX-0308\": \"{file} is not an ignifx scene file.\",\n \"IGX-0309\": \"{entity} is not a scene root; only roots can move between scene instances.\",\n \"IGX-0401\": \"The app property {property} is already defined by {owner}.\",\n \"IGX-0402\": \"The extension requires graph contains a cycle: {cycle}.\",\n \"IGX-0403\": \"{extension} requires {required}, which is not registered.\",\n \"IGX-0404\": \"{extension} supports engine {range} but the running core is {version}.\",\n \"IGX-0405\": \"The service {service} required by {extension} is not registered.\",\n \"IGX-0406\": \"The extension name {extension} is registered twice.\",\n \"IGX-0407\": \"{section} is not a registered settings section.\",\n \"IGX-0408\": \"The {section} settings section is invalid: {issues}.\",\n \"IGX-0409\": \"Physics callbacks are dispatched inside the fixed loop only; {callback} was not.\",\n \"IGX-0410\": \"A world has one simulation scene, and this world already has a different one.\",\n \"IGX-0501\": \"The asset {asset} has no value yet because it is still loading.\",\n \"IGX-0502\": \"Loading {asset} was aborted.\",\n \"IGX-0503\": \"The app that owned the asset {asset} was disposed before loading finished.\",\n \"IGX-0504\": \"No loader is registered for {asset}.\",\n \"IGX-0505\": \"Loading {asset} from {url} failed after {attempts} attempts.\",\n \"IGX-0506\": \"A loader for the asset type {type} is already registered.\",\n \"IGX-0601\": \"{field} must be a finite number.\",\n \"IGX-0602\": \"The reference {reference} in {scene} could not be resolved.\",\n \"IGX-0603\": \"{file} declares format version {version}, which this build cannot read.\",\n \"IGX-0604\": \"The overrides recorded for {scene} do not match the scene file.\",\n \"IGX-0605\": \"{field} has the wrong type for a {kind} field.\",\n \"IGX-0606\": \"{field} is outside the declared value domain.\",\n \"IGX-0607\": \"{field} is not a field this schema declares.\",\n \"IGX-0608\": \"{file} does not match the scene file schema.\",\n \"IGX-0609\": \"{path} is not a valid instance override path.\",\n \"IGX-0701\": \"WebGPU is not available in this environment.\",\n \"IGX-0702\": \"This handle was already disposed, or was not created by ignifx.\",\n \"IGX-0703\": \"Babylon Lite has no shadow generator for a {lightType} light.\",\n \"IGX-0704\": \"The rendering feature {feature} must be enabled before the scene is registered.\",\n \"IGX-0705\": \"{entity} enabled a second Environment in this world; the most recent one wins.\",\n \"IGX-0706\": \"This world has no enabled camera, so nothing is drawn.\",\n \"IGX-0707\": \"captureScreenshot() needs a running render loop; a headless app never presents a frame.\",\n \"IGX-0708\": \"{asset} declares the material kind {kind}, which this build cannot construct.\",\n \"IGX-0709\": \"{file} is not an {format} file.\",\n \"IGX-0710\": \"{entity} attached a PostProcessStack, but rendering.features.postProcessing is off.\",\n \"IGX-0711\":\n \"{entity} asks for an Environment.skybox that {asset} was not loaded with; declare it in the .environment.json.\",\n \"IGX-0712\": \"{name} is not a uniform, texture, storage buffer, or plugin binding that is declared.\",\n \"IGX-0713\": \"{name} on {material} expects {expected}, not {actual}.\",\n \"IGX-0714\": \"{material} declares {name}, but this world has no enabled directional light; zeros are uploaded.\",\n \"IGX-0715\": \"{asset} failed to compile; the previous material stays in use. {message}\",\n \"IGX-0716\": \"{material} carries a surface shader, but rendering.features.materialPlugins is off.\",\n \"IGX-0717\": \"{entity} changed {field} on an InstancedMeshRenderer after the scene was registered.\",\n \"IGX-0718\": \"{material} is a {kind} material; {method} needs a shader material.\",\n \"IGX-0719\": \"{asset} line {line}: {message}\",\n \"IGX-0720\": \"{buffer}: an update of {bytes} bytes at offset {offset} exceeds the {capacity}-byte buffer.\",\n \"IGX-0721\": \"{entity}: {count} instances exceed the capacity of {capacity}.\",\n \"IGX-0722\": \"{asset}: {bytes} bytes of pixel data do not match {width}x{height} RGBA.\",\n \"IGX-0723\":\n \"A surface shader or post effect declares no hook this host can run: displace, surface, composite, or mainFragment.\",\n \"IGX-0724\":\n \"{entity} uses a shader material under ESM shadows; Babylon Lite 1.27.0 cannot render it into an ESM map, so it casts no shadow. Use pcf shadows or castShadows: false.\",\n \"IGX-0725\": \"{asset}: an update of {count} vertices at offset {offset} does not fit the {total}-vertex mesh.\",\n \"IGX-0726\": \"{samplers} plugin samplers are declared; {budget} fit beside a textured PBR material.\",\n \"IGX-1420\": \"This host does not expose Web Crypto.\",\n \"IGX-1421\": \"{namespace} is not a valid storage namespace.\",\n \"IGX-1422\": \"That storage key is empty, too long, or contains a control character.\",\n \"IGX-1423\": \"The value stored at {key} has no JSON form.\",\n \"IGX-1424\": \"The {backend} storage backend has no quota left for {operation}.\",\n \"IGX-1425\": \"The {backend} storage backend could not {operation}.\",\n \"IGX-1426\": \"The value stored at {key} could not be read back.\",\n \"IGX-1501\": \"The error code {code} is already registered by {owner}.\",\n \"IGX-1502\": \"{code} is not a valid IGX-#### code in a known range.\",\n \"IGX-1503\": \"The diagnostics group {group} is already registered.\",\n \"IGX-1504\": \"{counter} is not a counter of the diagnostics group {group}.\",\n \"IGX-1505\": \"Unreachable case reached for {what}.\",\n \"IGX-1506\": \"The scene instance {scene} was not built from a scene asset, so it cannot be reloaded.\",\n};\n\n/** The fixed length of an `IGX-####` code. */\nconst ERROR_CODE_LENGTH = 8;\n\n/** Where the four digits start inside an `IGX-####` code. */\nconst ERROR_CODE_DIGITS_OFFSET = 4;\n\n/** The characters allowed in the numeric part of a code. */\nconst DIGITS = \"0123456789\";\n\n/**\n * Reports whether a string is a well-formed ignifx error code.\n *\n * @remarks\n * The rule has exactly two parts and the `ignifx/error-code-format` lint rule mirrors it:\n *\n * 1. the string is `IGX-` followed by four ASCII digits, and\n * 2. the first two digits are one of the fifteen `ErrorRange` prefixes, or the first digit is\n * {@link THIRD_PARTY_ERROR_PREFIX} (the third-party block `IGX-9000`–`IGX-9999`).\n *\n * @param code - The candidate code.\n * @returns `true` when the code is well formed and inside an allocated range. The signature is a\n * type predicate, so a validated string narrows to {@link ErrorCode} without a type assertion.\n *\n * @example\n * ```ts\n * isValidErrorCode(\"IGX-0701\"); // true — rendering\n * isValidErrorCode(\"IGX-9042\"); // true — third party\n * isValidErrorCode(\"IGX-1801\"); // false — no subsystem owns 18\n * ```\n *\n * @public\n */\nexport function isValidErrorCode(code: string): code is ErrorCode {\n // The literal below is the prefix the `ignifx/error-code-format` rule looks for. This function is\n // the validator that rule mirrors, not a throw site, so the rule is switched off for one line.\n // eslint-disable-next-line ignifx/error-code-format -- see the comment above\n if (code.length !== ERROR_CODE_LENGTH || !code.startsWith(\"IGX-\")) {\n return false;\n }\n const digits = code.slice(ERROR_CODE_DIGITS_OFFSET);\n for (const digit of digits) {\n if (!DIGITS.includes(digit)) {\n return false;\n }\n }\n const prefix = digits.slice(0, 2);\n if (prefix.startsWith(THIRD_PARTY_ERROR_PREFIX)) {\n return true;\n }\n for (const range of Object.values(ErrorRange)) {\n if (range === prefix) {\n return true;\n }\n }\n return false;\n}\n","import { CoreErrorCode, type ErrorCode } from \"./error-codes.js\";\n\n/**\n * The identifiers that make a failure actionable: entity and component uids, asset keys, layer\n * names, extension names. Values are primitives so the whole record survives being sent to a\n * devtools panel or a log sink without cloning engine objects.\n *\n * @public\n */\nexport type ErrorContext = Readonly<Record<string, string | number | boolean | null>>;\n\n/**\n * How much of an error is spelled out in `Error.message`.\n *\n * @remarks\n * `\"development\"` writes the full sentence, the context values, and the hint. `\"production\"` keeps\n * the code and the *names* of the context keys and drops every value and the prose, so shipped\n * games neither leak content paths nor pay for message strings (`CONSTITUTION.md` §3.9). The\n * structured `code`, `context`, and `hint` properties are populated in both modes.\n *\n * @public\n */\nexport type ErrorFormatMode = \"development\" | \"production\";\n\n/**\n * Options accepted by {@link IgnifxError}. Extends the standard `ErrorOptions`, so `cause` keeps\n * the original failure when an error is wrapped.\n *\n * @public\n */\nexport interface IgnifxErrorOptions extends ErrorOptions {\n /** Identifiers that locate the failure. Defaults to an empty record. */\n readonly context?: ErrorContext;\n /** One sentence telling the developer what to do about it. Defaults to `null`. */\n readonly hint?: string | null;\n /** How verbose `message` should be. Defaults to `\"development\"`. */\n readonly mode?: ErrorFormatMode;\n}\n\n/** Shared empty context so the common case allocates nothing. */\nconst EMPTY_CONTEXT: ErrorContext = {};\n\n/**\n * Builds the `Error.message` of an {@link IgnifxError}.\n *\n * @remarks\n * Development messages read `IGX-0201: Mover requires Rigidbody. [entity=01J…] Hint: add it.`\n * Production messages read `IGX-0201 [entity]` — enough to look the code up in the registry and to\n * know which identifiers the `context` property carries, with no prose in the bundle.\n *\n * @param code - The stable diagnostic code.\n * @param message - The actionable development sentence.\n * @param context - Identifiers that locate the failure.\n * @param hint - A remedy sentence, or `null`.\n * @param mode - Whether to format for development or production.\n * @returns The formatted message.\n *\n * @example\n * ```ts\n * formatErrorMessage(\"IGX-0303\", \"Enemy is not a declared layer.\", { layer: \"Enemy\" }, null, \"production\");\n * // \"IGX-0303 [layer]\"\n * ```\n *\n * @public\n */\nexport function formatErrorMessage(\n code: ErrorCode,\n message: string,\n context: ErrorContext,\n hint: string | null,\n mode: ErrorFormatMode,\n): string {\n const keys = Object.keys(context);\n if (mode === \"production\") {\n return keys.length === 0 ? code : `${code} [${keys.join(\", \")}]`;\n }\n let formatted = `${code}: ${message}`;\n if (keys.length > 0) {\n const parts: string[] = [];\n for (const key of keys) {\n parts.push(`${key}=${String(context[key] ?? null)}`);\n }\n formatted += ` [${parts.join(\", \")}]`;\n }\n if (hint !== null && hint.length > 0) {\n formatted += ` Hint: ${hint}`;\n }\n return formatted;\n}\n\n/**\n * The error every ignifx API throws for misuse (`CONSTITUTION.md` §3.9). It always carries a stable\n * `IGX-####` `code` and the `context` identifiers needed to find the offending object,\n * so a production build can compact the human-readable half without losing meaning.\n *\n * @example\n * ```ts\n * try {\n * world.instantiate(scene);\n * } catch (error) {\n * if (isIgnifxError(error) && error.code === CoreErrorCode.sceneNotLoaded) {\n * await scene.load();\n * }\n * }\n * ```\n *\n * @public\n */\nexport class IgnifxError extends Error {\n /** The stable diagnostic code for this failure. */\n readonly code: ErrorCode;\n\n /** Identifiers that locate the failure (entity uid, component type id, asset key, …). */\n readonly context: ErrorContext;\n\n /** One sentence telling the developer how to fix it, or `null` when there is nothing to add. */\n readonly hint: string | null;\n\n /**\n * Creates an ignifx error.\n *\n * @param code - The stable `IGX-####` code for the failure.\n * @param message - An actionable description of what went wrong, used in development mode.\n * @param options - Context, hint, format mode, and the standard `cause`.\n */\n constructor(code: ErrorCode, message: string, options?: IgnifxErrorOptions) {\n const context = options?.context ?? EMPTY_CONTEXT;\n const hint = options?.hint ?? null;\n super(formatErrorMessage(code, message, context, hint, options?.mode ?? \"development\"), options);\n this.name = \"IgnifxError\";\n this.code = code;\n this.context = context;\n this.hint = hint;\n }\n}\n\n/**\n * Narrows an unknown value — a `catch` binding, a rejected promise, a signal payload — to an\n * {@link IgnifxError}.\n *\n * @param value - The value to test.\n * @returns `true` when the value is an ignifx error produced by this copy of `@ignifx/core`.\n *\n * @example\n * ```ts\n * app.onError.connect((report) => {\n * if (isIgnifxError(report.error)) {\n * console.warn(report.error.code, report.error.context);\n * }\n * });\n * ```\n *\n * @public\n */\nexport function isIgnifxError(value: unknown): value is IgnifxError {\n return value instanceof IgnifxError;\n}\n\n/**\n * The default branch of an exhaustive `switch` (coding standards §5.2). The compiler rejects the\n * call as soon as a new union member is left unhandled, and at runtime it throws rather than\n * falling through silently.\n *\n * @param value - The value the type system proved impossible.\n * @param what - What was being switched over, for the message.\n * @throws IgnifxError with code `IGX-1505`; the function never returns.\n *\n * @example\n * ```ts\n * switch (level) {\n * case \"debug\":\n * return 10;\n * default:\n * return assertNever(level, \"log level\");\n * }\n * ```\n *\n * @public\n */\nexport function assertNever(value: never, what: string): never {\n throw new IgnifxError(CoreErrorCode.unreachableCase, `Unreachable case reached for ${what}.`, {\n context: { what, value: String(value) },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,aAAa;;CAExB,WAAW;;CAEX,YAAY;;CAEZ,QAAQ;;CAER,YAAY;;CAEZ,QAAQ;;CAER,eAAe;;CAEf,WAAW;;CAEX,OAAO;;CAEP,SAAS;;CAET,OAAO;;CAEP,MAAM;;CAEN,QAAQ;;CAER,IAAI;;CAEJ,UAAU;;CAEV,UAAU;;CAEV,SAAS;;CAET,WAAW;AACb;;;;;;;AAeA,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCxC,MAAa,gBAAgB;;CAE3B,sBAAsB;;CAEtB,4BAA4B;;CAE5B,gCAAgC;;CAEhC,oBAAoB;;CAEpB,qBAAqB;;CAErB,aAAa;;CAEb,aAAa;;CAEb,kBAAkB;;CAElB,qBAAqB;;CAErB,wBAAwB;;CAExB,0BAA0B;;CAE1B,8BAA8B;;CAE9B,0BAA0B;;CAE1B,wBAAwB;;CAExB,yBAAyB;;CAEzB,sBAAsB;;CAEtB,wBAAwB;;CAExB,yBAAyB;;CAEzB,gBAAgB;;CAEhB,oBAAoB;;CAEpB,cAAc;;CAEd,oBAAoB;;CAEpB,eAAe;;CAEf,gBAAgB;;CAEhB,wBAAwB;;CAExB,eAAe;;CAEf,sBAAsB;;CAEtB,2BAA2B;;CAE3B,wBAAwB;;CAExB,kBAAkB;;CAElB,yBAAyB;;CAEzB,sBAAsB;;CAEtB,wBAAwB;;CAExB,wBAAwB;;CAExB,iBAAiB;;CAEjB,iCAAiC;;CAEjC,2BAA2B;;CAE3B,gBAAgB;;CAEhB,kBAAkB;;CAElB,kBAAkB;;CAElB,eAAe;;CAEf,iBAAiB;;CAEjB,sBAAsB;;CAEtB,iBAAiB;;CAEjB,qBAAqB;;CAErB,0BAA0B;;CAE1B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