Skip to content

Commit 2159cc7

Browse files
Copilotkalwalt
andcommitted
Update README with ECS-only migration note and improved imports documentation
Co-authored-by: kalwalt <[email protected]>
1 parent 2bab50e commit 2159cc7

File tree

1 file changed

+48
-30
lines changed

1 file changed

+48
-30
lines changed

README.md

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
# AR.js-core
22

3-
An attempt to convert the Ar.js threex library into an agnostic library that can be used with any 3D library.
3+
A renderer-agnostic AR library built on a modern Entity-Component-System (ECS) architecture with a plugin system.
44

5-
## New: ECS Architecture
5+
## ECS-Only Core
66

7-
AR.js Core now includes a modern Entity-Component-System (ECS) architecture with a plugin system! This provides:
7+
**Migration Note:** As of version 0.2.0, AR.js-core is **ECS-only**. The legacy API (Source, Profile, Session, SessionDebugUI classes) has been removed from the core library to focus on:
88

99
- Modular design with a clean plugin system
1010
- Data-oriented ECS for efficient processing
1111
- Event-driven architecture with pub/sub messaging
12-
- Backward compatible with existing Source and Profile APIs
12+
- Renderer-agnostic foundation for AR.js-next
13+
14+
**Renderer integrations** (e.g., Three.js) now live in external repositories:
15+
16+
- [arjs-plugin-threejs](https://github.com/AR-js-org/arjs-plugin-threejs) - Three.js integration plugin
17+
18+
If you need the legacy API, please use version 0.1.x or migrate to the new ECS architecture documented below.
1319

1420
### Quick Start with ECS
1521

1622
```javascript
17-
import { Engine, CaptureSystem, SOURCE_TYPES } from 'ar.js-core';
18-
import { webcamPlugin } from './plugins/source/webcam.js';
19-
import { defaultProfilePlugin } from './plugins/profile/default-policy.js';
23+
import {
24+
Engine,
25+
CaptureSystem,
26+
SOURCE_TYPES,
27+
webcamPlugin,
28+
defaultProfilePlugin,
29+
} from 'ar.js-core';
2030

2131
// Create engine and register plugins
2232
const engine = new Engine();
@@ -47,9 +57,7 @@ Detection plugins (e.g., ArtoolkitPlugin) expect frames to arrive as `ImageBitma
4757
### Basic integration
4858

4959
```js
50-
import { CaptureSystem } from './src/systems/capture-system.js';
51-
import { SOURCE_TYPES } from './src/core/components.js';
52-
import { FramePumpSystem } from './src/systems/frame-pump-system.js';
60+
import { CaptureSystem, SOURCE_TYPES, FramePumpSystem } from 'ar.js-core';
5361

5462
// 1) Initialize capture (provides a playing <video>)
5563
await CaptureSystem.initialize(
@@ -98,24 +106,44 @@ FramePumpSystem.stop(ctx);
98106
- Capture System: Unified interface for webcam, video, and image sources
99107
- Profile Policies: Automatic device detection and performance tuning
100108

101-
## Build library bundle with Vite
109+
## Distribution and imports
102110

103-
AR.js Core can be bundled with Vite in library mode to produce importable ESM and CommonJS files.
111+
AR.js Core is distributed as both ESM and CommonJS modules:
104112

105-
**Commands**
113+
- **ESM (recommended)**: `dist/arjs-core.mjs` - Use with modern bundlers and browsers
114+
- **CommonJS**: `dist/arjs-core.js` - Use with Node.js or older bundlers
106115

107-
```bash
108-
npm run build:vite
116+
### Import examples
117+
118+
**ESM (Browser/Vite/Webpack 5+):**
119+
120+
```javascript
121+
import { Engine, CaptureSystem, webcamPlugin } from 'ar.js-core';
122+
```
123+
124+
**CommonJS (Node.js):**
125+
126+
```javascript
127+
const { Engine, CaptureSystem, webcamPlugin } = require('ar.js-core');
109128
```
110129

111-
**Outputs** (written to dist/)
130+
**Direct script tag (not recommended for production):**
112131

113-
- `dist/arjs-core.mjs` (ESM — used by `exports.import` / `module`)
114-
- `dist/arjs-core.js` (CommonJS — used by `exports.require` / `main`)
132+
```html
133+
<script type="module">
134+
import { Engine } from './node_modules/ar.js-core/dist/arjs-core.mjs';
135+
</script>
136+
```
137+
138+
### Build from source
139+
140+
```bash
141+
npm run build:vite
142+
```
115143

116-
**Notes**
144+
This builds both `dist/arjs-core.mjs` (ESM) and `dist/arjs-core.js` (CommonJS).
117145

118-
- Webpack scripts remain for legacy/dev workflows; Vite handles the library bundles.
146+
**Note:** Webpack scripts remain for legacy/dev workflows; Vite handles the library bundles.
119147

120148
## Documentation
121149

@@ -268,13 +296,3 @@ Use this checklist when the example or your integration doesn’t behave as expe
268296

269297
- Prefer `HTMLVideoElement.requestVideoFrameCallback` when available; it syncs to decoder frames.
270298
- If needed, throttle frame emission in the pump to reduce CPU usage (e.g., skip frames).
271-
272-
## Legacy API
273-
274-
The original Source and Profile classes are still available and fully supported:
275-
276-
```javascript
277-
import { Source, Profile } from 'arjs-core';
278-
```
279-
280-
See existing documentation for legacy API usage.

0 commit comments

Comments
 (0)