Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitecs

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitecs - npm Package Compare versions

Comparing version 0.3.17 to 0.3.18

dist/index.cjs

129

dist/index.d.ts

@@ -1,128 +0,1 @@

declare module 'bitecs' {
export type Type =
'i8' |
'ui8' |
'ui8c' |
'i16' |
'ui16' |
'i32' |
'ui32' |
'f32' |
'f64'
export type ListType = readonly [Type, number];
export const Types: {
i8: "i8"
ui8: "ui8"
ui8c: "ui8c"
i16: "i16"
ui16: "ui16"
i32: "i32"
ui32: "ui32"
f32: "f32"
f64: "f64"
};
export type TypedArray =
Uint8Array |
Int8Array |
Uint8Array |
Uint8ClampedArray |
Int16Array |
Uint16Array |
Int32Array |
Uint32Array |
Float32Array |
Float64Array
export type ArrayByType = {
[Types.i8]: Int8Array;
[Types.ui8]: Uint8Array;
[Types.ui8c]: Uint8ClampedArray;
[Types.i16]: Int16Array;
[Types.ui16]: Uint16Array;
[Types.i32]: Int32Array;
[Types.ui32]: Uint32Array;
[Types.f32]: Float32Array;
[Types.f64]: Float64Array;
}
export enum DESERIALIZE_MODE {
REPLACE,
APPEND,
MAP
}
export type ComponentType<T extends ISchema> = {
[key in keyof T]: T[key] extends Type
? ArrayByType[T[key]]
: T[key] extends [infer RT, number]
? RT extends Type
? Array<ArrayByType[RT]>
: unknown
: T[key] extends ISchema
? ComponentType<T[key]>
: unknown;
};
export interface IWorld {
[key: string]: any
}
export interface ISchema {
[key: string]: Type | ListType | ISchema
}
export interface IComponentProp {
[key: string]: TypedArray | Array<TypedArray>
}
export interface IComponent {
[key: string]: TypedArray | IComponentProp
}
export type Component = IComponent | ComponentType<ISchema>
export type QueryModifier = (c: (IComponent | IComponentProp)[]) => (world: IWorld) => IComponent | QueryModifier
export type Query = (world: IWorld, clearDiff?: Boolean) => number[]
export type System = (world: IWorld, ...args: any[]) => IWorld
export type Serializer = (target: IWorld | number[]) => ArrayBuffer
export type Deserializer = (world: IWorld, packet: ArrayBuffer, mode?: DESERIALIZE_MODE) => void
export function setDefaultSize(size: number): void
export function createWorld(): IWorld
export function resetWorld(world: IWorld): IWorld
export function deleteWorld(world: IWorld): void
export function addEntity(world: IWorld): number
export function removeEntity(world: IWorld, eid: number): void
export function registerComponent(world: IWorld, component: Component): void
export function registerComponents(world: IWorld, components: Component[]): void
export function defineComponent<T extends ISchema>(schema?: T): ComponentType<T>
export function addComponent(world: IWorld, component: Component, eid: number): void
export function removeComponent(world: IWorld, component: Component, eid: number): void
export function hasComponent(world: IWorld, component: Component, eid: number): boolean
export function getEntityComponents(world: IWorld, eid: number): Component[]
export function defineQuery(components: (Component | QueryModifier)[]): Query
export function Changed(c: Component): Component | QueryModifier
export function Not(c: Component): Component | QueryModifier
export function enterQuery(query: Query): Query
export function exitQuery(query: Query): Query
export function resetChangedQuery(world: IWorld, query: Query): Query
export function removeQuery(world: IWorld, query: Query): Query
export function commitRemovals(world: IWorld): void
export function defineSystem(update: (world: IWorld, ...args: any[]) => IWorld): System
export function defineSerializer(target: IWorld | Component[] | IComponentProp[] | QueryModifier, maxBytes?: number): Serializer
export function defineDeserializer(target: IWorld | Component[] | IComponentProp[] | QueryModifier): Deserializer
export function pipe(...fns: ((...args: any[]) => any)[]): (...input: any[]) => any
export const parentArray: Symbol
}
//# sourceMappingURL=index.d.ts.map

@@ -0,0 +0,0 @@ # FAQ

@@ -81,2 +81,3 @@

const Tag = defineComponent()
const Reference = defineComponent({ entity: Types.eid }) // Types.eid is used as a reference type
```

@@ -90,2 +91,3 @@

addComponent(world, Tag, eid)
addComponent(world, Reference, eid)
```

@@ -99,2 +101,7 @@

References to other entities can be stored as such:
```js
Reference.entity[eid] = eid2
```
Array types are regular fixed-size TypedArrays:

@@ -130,7 +137,7 @@ ```js

class PositionProxy extends Vector2Proxy {
class PositionProxy extends Vector3Proxy {
constructor(eid) { super(Position, eid) }
}
class VelocityProxy extends Vector2Proxy {
class VelocityProxy extends Vector3Proxy {
constructor(eid) { super(Velocity, eid) }

@@ -343,2 +350,3 @@ }

- useful when deserializing server ECS state onto a client ECS world to avoid EID collisions but still maintain the server-side EID relationship
- this maintains reference relationships made with `Types.eid`

@@ -345,0 +353,0 @@ ```js

@@ -0,0 +0,0 @@ declare module 'bitecs' {

{
"name": "bitecs",
"version": "0.3.17",
"version": "0.3.18",
"description": "Functional, minimal, data-driven, ultra-high performance ECS library written in Javascript",
"license": "MPL-2.0",
"main": "./dist/index.js",
"module": "./dist/index.es.js",
"repository": {
"type": "git",
"url": "https://github.com/NateTheGreatt/bitECS"
},
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
"import": "./dist/index.es.js",
"require": "./dist/index.js"
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},

@@ -26,33 +33,28 @@ "author": {

"scripts": {
"build": "rollup -c",
"test": "c8 mocha test --recursive",
"build": "node scripts/build.js",
"watch": "npm run build -- -w",
"twatch": "npm run build -- -w -t",
"docs": "node scripts/docs.js",
"dist": "npm run test && npm run build && npm run docs"
"dist": "npm run test && npm run build -- -t && npm run docs"
},
"devDependencies": {
"@babel/core": "^7.13.16",
"@babel/preset-env": "^7.12.1",
"@rollup/plugin-babel": "^5.3.0",
"babel": "^6.23.0",
"boxen": "^5.0.1",
"brotli-size": "^4.0.0",
"c8": "^7.7.2",
"chalk": "^2.4.2",
"dmd-readable": "^1.2.4",
"esbuild": "^0.12.22",
"fs-extra": "^8.1.0",
"globby": "^11.0.1",
"gradient-string": "^1.2.0",
"gzip-size": "^6.0.0",
"human-readable": "^0.2.1",
"jsdoc-to-markdown": "^7.0.1",
"minimist": "^1.2.5",
"mocha": "^8.3.2",
"rollup": "^2.32.1",
"rollup-plugin-copy": "^3.4.0"
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
},
"type": "module"
"ora": "^5.4.1",
"sloc": "^0.2.1",
"typescript": "^4.3.5"
}
}

@@ -1,9 +0,5 @@

<center>
# 👾 bitECS 👾 [![npm](https://img.shields.io/npm/v/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![Minzipped](https://badgen.net/bundlephobia/minzip/bitecs)](https://www.npmjs.com/package/bitecs) [![npm](https://img.shields.io/npm/dt/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![License](https://badgen.net/npm/license/bitecs)](https://www.npmjs.com/package/bitecs)
<img src="bitecs-logo.png" width="420"/>
Functional, minimal, [data-oriented](https://www.dataorienteddesign.com), ultra-high performance [ECS](https://en.wikipedia.org/wiki/Entity_component_system) library written using JavaScript TypedArrays.
[![npm](https://img.shields.io/npm/v/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![Minzipped](https://badgen.net/bundlephobia/minzip/bitecs)](https://www.npmjs.com/package/bitecs) [![npm](https://img.shields.io/npm/dt/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![License](https://badgen.net/npm/license/bitecs)](https://www.npmjs.com/package/bitecs)
Functional, minimal, data-oriented, ultra-high performance [ECS](https://en.wikipedia.org/wiki/Entity_component_system) library written using JavaScript TypedArrays.
</center>

@@ -10,0 +6,0 @@

@@ -0,0 +0,0 @@ import assert from 'assert'

@@ -0,0 +0,0 @@ import { strictEqual } from 'assert'

@@ -0,0 +0,0 @@ import { strictEqual } from 'assert'

@@ -0,0 +0,0 @@ import { strictEqual } from 'assert'

import assert, { strictEqual } from 'assert'
import { getDefaultSize } from '../../src/Entity.js'
import { Types } from '../../src/index.js'
import { createStore, resizeStore, TYPES } from '../../src/Storage.js'
import { createStore, resizeStore } from '../../src/Storage.js'
import { TYPES } from '../../src/Constants.js'

@@ -6,0 +7,0 @@ let defaultSize = getDefaultSize()

@@ -0,0 +0,0 @@ import { strictEqual } from 'assert'

@@ -0,0 +0,0 @@ import assert, { strictEqual } from 'assert'

@@ -9,3 +9,3 @@ import assert, { strictEqual } from 'assert'

describe('World Integration Tests', () => {
describe('World Unit Tests', () => {
afterEach(() => {

@@ -12,0 +12,0 @@ resetGlobals()

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