Skip to content

Conversation

Copy link

Copilot AI commented Nov 6, 2025

Complete the ECS-only refactor by updating documentation to reflect that legacy Source, Profile, Session, and SessionDebugUI classes are no longer exported from core.

Changes

README.md

  • Replace "Legacy API" section with "Migration to ECS-only Core" explaining:
    • Legacy classes removed from core exports
    • Future adapter package may provide compatibility layer
    • Three.js integration moved to separate arjs-plugin-threejs repository
  • Add explicit ESM/CJS import examples showing package name (ar.js-core) vs. file paths (arjs-core.mjs/arjs-core.js)

Current exports

// ECS core
import { Engine, ECS, EventBus, PluginManager } from 'ar.js-core';

// Systems
import { CaptureSystem, FramePumpSystem } from 'ar.js-core';

// Plugins
import { webcamPlugin, videoPlugin, imagePlugin, defaultProfilePlugin } from 'ar.js-core';

// Constants
import { COMPONENTS, RESOURCES, EVENTS, CAPTURE_STATES, SOURCE_TYPES, 
         DEVICE_PROFILES, QUALITY_TIERS } from 'ar.js-core';

Note: src/index.js and examples were already refactored to ECS-only in previous commits. This PR completes the migration by updating user-facing documentation.

Original prompt

Goal
Refactor AR.js-core to be ECS-only (AR.js-next foundation). Remove legacy/non-ECS exports from src/index.js, update examples to use only the bundled ECS library, and add a README migration note. Keep the project in JavaScript (no TypeScript).

Scope

  • Remove legacy exports from src/index.js (Source, Profile, Session, SessionDebugUI) and ensure ECS/public plugin exports are intact.
  • Ensure ECS systems exposed include CaptureSystem and FramePumpSystem.
  • Keep plugin exports (webcamPlugin, videoPlugin, imagePlugin, defaultProfilePlugin) public from the main entry.
  • Update examples to import from the bundled library ESM: ../../dist/arjs-core.mjs, and ensure no legacy classes are referenced.
  • Update README.md:
    • Add an "ECS-only core" migration note (legacy API removed from core and will live in a separate adapter/package if needed).
    • Show current import examples for ESM/CJS and note the .mjs change.
  • No changes to build scripts beyond existing Vite library build; CI remains intact.
  • Base branch: dev-arjs-next. Create a feature branch and open a PR.

Changes to implement

  1. src/index.js — remove legacy exports and ensure ECS/public API exports are present.

Replace the bottom section that re-exports legacy classes with nothing, and ensure we also export FramePumpSystem. The file should export:

  • Engine, ECS, EventBus, PluginManager
  • COMPONENTS, RESOURCES, EVENTS, CAPTURE_STATES, SOURCE_TYPES, DEVICE_PROFILES, QUALITY_TIERS
  • CaptureSystem, FramePumpSystem
  • webcamPlugin, videoPlugin, imagePlugin, defaultProfilePlugin
  1. examples — ensure imports reference the bundled library only:
  • examples/minimal/main.js: import { Engine, CaptureSystem, SOURCE_TYPES } from '../../dist/arjs-core.mjs'
  • examples/vite-artoolkit/main.js: import Engine/CaptureSystem/FramePumpSystem/SOURCE_TYPES/plugins from '../../dist/arjs-core.mjs'
  • Remove any references to legacy classes.
  1. README.md — add a Migration/ECS section and clarify distribution filenames:
  • Add a short "ECS-only core" section with bullet points: legacy API removed from core, focus on ECS and plugins; Three.js integration will come via a separate repository (arjs-plugin-threejs).
  • Keep the distribution/import instructions (ESM .mjs and CJS .js). Ensure examples reference .mjs.

Acceptance criteria

  • Build: npm run build:vite succeeds; dist contains arjs-core.mjs and arjs-core.js.
  • Examples run with only ECS imports from ../../dist/arjs-core.mjs.
  • README has a migration note and updated import instructions.
  • No remaining exports of Source/Profile/Session/SessionDebugUI from core.

Notes

  • All code remains in JavaScript.
  • Three.js integration will be developed as a separate repository: arjs-plugin-threejs.

This pull request was created as a result of the following prompt from Copilot chat.

Goal
Refactor AR.js-core to be ECS-only (AR.js-next foundation). Remove legacy/non-ECS exports from src/index.js, update examples to use only the bundled ECS library, and add a README migration note. Keep the project in JavaScript (no TypeScript).

Scope

  • Remove legacy exports from src/index.js (Source, Profile, Session, SessionDebugUI) and ensure ECS/public plugin exports are intact.
  • Ensure ECS systems exposed include CaptureSystem and FramePumpSystem.
  • Keep plugin exports (webcamPlugin, videoPlugin, imagePlugin, defaultProfilePlugin) public from the main entry.
  • Update examples to import from the bundled library ESM: ../../dist/arjs-core.mjs, and ensure no legacy classes are referenced.
  • Update README.md:
    • Add an "ECS-only core" migration note (legacy API removed from core and will live in a separate adapter/package if needed).
    • Show current import examples for ESM/CJS and note the .mjs change.
  • No changes to build scripts beyond existing Vite library build; CI remains intact.
  • Base branch: dev-arjs-next. Create a feature branch and open a PR.

Changes to implement

  1. src/index.js — remove legacy exports and ensure ECS/public API exports are present.

Replace the bottom section that re-exports legacy classes with nothing, and ensure we also export FramePumpSystem. The file should export:

  • Engine, ECS, EventBus, PluginManager
  • COMPONENTS, RESOURCES, EVENTS, CAPTURE_STATES, SOURCE_TYPES, DEVICE_PROFILES, QUALITY_TIERS
  • CaptureSystem, FramePumpSystem
  • webcamPlugin, videoPlugin, imagePlugin, defaultProfilePlugin
  1. examples — ensure imports reference the bundled library only:
  • examples/minimal/main.js: import { Engine, CaptureSystem, SOURCE_TYPES } from '../../dist/arjs-core.mjs'
  • examples/vite-artoolkit/main.js: import Engine/CaptureSystem/FramePumpSystem/SOURCE_TYPES/plugins from '../../dist/arjs-core.mjs'
  • Remove any references to legacy classes.
  1. README.md — add a Migration/ECS section and clarify distribution filenames:
  • Add a short "ECS-only core" section with bullet points: legacy API removed from core, focus on ECS and plugins; Three.js integration will come via a separate repository (arjs-plugin-threejs).
  • Keep the distribution/import instructions (ESM .mjs and CJS .js). Ensure examples reference .mjs.

Acceptance criteria

  • Build: npm run build:vite succeeds; dist contains arjs-core.mjs and arjs-core.js.
  • Examples run with only ECS imports from ../../dist/arjs-core.mjs.
  • README has a migration note and updated import instructions.
  • No remaining exports of Source/Profile/Session/SessionDebugUI from core.

Notes

  • All code remains in JavaScript.
  • Three.js integration will be developed as a separate repository: arjs-plugin-threejs.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: kalwalt <1275858+kalwalt@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor AR.js-core to be ECS-only and remove legacy exports docs: Replace legacy API section with ECS-only migration guide Nov 6, 2025
Copilot AI requested a review from kalwalt November 6, 2025 13:22
@kalwalt kalwalt marked this pull request as ready for review November 6, 2025 13:47
@kalwalt kalwalt merged commit 179968c into dev-arjs-next Nov 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants