@srsergio/taptapp-ar 1.0.101 → 1.1.2

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 (63) hide show
  1. package/dist/compiler/node-worker.js +1 -197
  2. package/dist/compiler/offline-compiler.js +1 -207
  3. package/dist/core/constants.js +1 -38
  4. package/dist/core/detector/crop-detector.js +1 -88
  5. package/dist/core/detector/detector-lite.js +1 -455
  6. package/dist/core/detector/freak.js +1 -89
  7. package/dist/core/estimation/estimate.js +1 -16
  8. package/dist/core/estimation/estimator.js +1 -30
  9. package/dist/core/estimation/morph-refinement.js +1 -116
  10. package/dist/core/estimation/non-rigid-refine.js +1 -70
  11. package/dist/core/estimation/pnp-solver.js +1 -109
  12. package/dist/core/estimation/refine-estimate.js +1 -311
  13. package/dist/core/estimation/utils.js +1 -67
  14. package/dist/core/features/auto-rotation-feature.js +1 -30
  15. package/dist/core/features/crop-detection-feature.js +1 -26
  16. package/dist/core/features/feature-base.js +1 -1
  17. package/dist/core/features/feature-manager.js +1 -55
  18. package/dist/core/features/one-euro-filter-feature.js +1 -44
  19. package/dist/core/features/temporal-filter-feature.js +1 -57
  20. package/dist/core/image-list.js +1 -54
  21. package/dist/core/input-loader.js +1 -87
  22. package/dist/core/matching/hamming-distance.js +1 -66
  23. package/dist/core/matching/hdc.js +1 -102
  24. package/dist/core/matching/hierarchical-clustering.js +1 -130
  25. package/dist/core/matching/hough.js +1 -170
  26. package/dist/core/matching/matcher.js +1 -66
  27. package/dist/core/matching/matching.js +1 -401
  28. package/dist/core/matching/ransacHomography.js +1 -132
  29. package/dist/core/perception/bio-inspired-engine.js +1 -232
  30. package/dist/core/perception/foveal-attention.js +1 -280
  31. package/dist/core/perception/index.js +1 -17
  32. package/dist/core/perception/predictive-coding.js +1 -278
  33. package/dist/core/perception/saccadic-controller.js +1 -269
  34. package/dist/core/perception/saliency-map.js +1 -254
  35. package/dist/core/perception/scale-orchestrator.js +1 -68
  36. package/dist/core/protocol.js +1 -254
  37. package/dist/core/tracker/extract-utils.js +1 -29
  38. package/dist/core/tracker/extract.js +1 -306
  39. package/dist/core/tracker/tracker.js +1 -352
  40. package/dist/core/utils/cumsum.js +1 -37
  41. package/dist/core/utils/delaunay.js +1 -125
  42. package/dist/core/utils/geometry.js +1 -101
  43. package/dist/core/utils/gpu-compute.js +1 -231
  44. package/dist/core/utils/homography.js +1 -138
  45. package/dist/core/utils/images.js +1 -108
  46. package/dist/core/utils/lsh-binarizer.js +1 -37
  47. package/dist/core/utils/lsh-direct.js +1 -76
  48. package/dist/core/utils/projection.js +1 -51
  49. package/dist/core/utils/randomizer.js +1 -25
  50. package/dist/core/utils/worker-pool.js +1 -89
  51. package/dist/index.js +1 -7
  52. package/dist/libs/one-euro-filter.js +1 -70
  53. package/dist/react/TaptappAR.js +1 -151
  54. package/dist/react/types.js +1 -16
  55. package/dist/react/use-ar.js +1 -118
  56. package/dist/runtime/aframe.js +1 -272
  57. package/dist/runtime/bio-inspired-controller.js +1 -358
  58. package/dist/runtime/controller.js +1 -592
  59. package/dist/runtime/controller.worker.js +1 -93
  60. package/dist/runtime/index.js +1 -5
  61. package/dist/runtime/three.js +1 -304
  62. package/dist/runtime/track.js +1 -381
  63. package/package.json +9 -3
@@ -1,381 +1 @@
1
- /**
2
- * TapTapp AR - Easy Tracking Configuration
3
- *
4
- * Simple API for configuring image target tracking with minimal setup.
5
- * Based on the reliable configuration from reliability-test.html.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { createTracker } from 'taptapp-ar';
10
- *
11
- * const tracker = await createTracker({
12
- * targetSrc: './my-target.png',
13
- * container: document.getElementById('ar-container')!,
14
- * overlay: document.getElementById('overlay')!,
15
- * callbacks: {
16
- * onFound: () => console.log('Target found!'),
17
- * onLost: () => console.log('Target lost'),
18
- * onUpdate: (data) => console.log('Update:', data)
19
- * }
20
- * });
21
- *
22
- * // Start tracking from camera
23
- * tracker.startCamera();
24
- *
25
- * // Or track from a video/canvas element
26
- * tracker.startVideo(videoElement);
27
- *
28
- * // Stop tracking
29
- * tracker.stop();
30
- * ```
31
- */
32
- import { BioInspiredController } from './bio-inspired-controller.js';
33
- import { OfflineCompiler } from '../compiler/offline-compiler.js';
34
- import { projectToScreen } from '../core/utils/projection.js';
35
- // ============================================================================
36
- // Implementation
37
- // ============================================================================
38
- /**
39
- * Load an image from a URL
40
- */
41
- async function loadImage(url) {
42
- return new Promise((resolve, reject) => {
43
- const img = new Image();
44
- img.crossOrigin = 'anonymous';
45
- img.onload = () => resolve(img);
46
- img.onerror = () => reject(new Error(`Failed to load image: ${url}`));
47
- img.src = url;
48
- });
49
- }
50
- /**
51
- * Get ImageData from various source types
52
- */
53
- async function getImageData(source) {
54
- let img;
55
- if (typeof source === 'string') {
56
- img = await loadImage(source);
57
- }
58
- else if (source instanceof HTMLImageElement) {
59
- img = source;
60
- if (!img.complete) {
61
- await new Promise((resolve, reject) => {
62
- img.onload = resolve;
63
- img.onerror = reject;
64
- });
65
- }
66
- }
67
- else {
68
- // Already ImageData
69
- return { imageData: source, width: source.width, height: source.height };
70
- }
71
- const canvas = document.createElement('canvas');
72
- canvas.width = img.width;
73
- canvas.height = img.height;
74
- const ctx = canvas.getContext('2d');
75
- ctx.drawImage(img, 0, 0);
76
- const imageData = ctx.getImageData(0, 0, img.width, img.height);
77
- return { imageData, width: img.width, height: img.height };
78
- }
79
- /**
80
- * Solve homography for overlay positioning (from reliability-test.html)
81
- */
82
- function solveHomography(w, h, p1, p2, p3, p4) {
83
- const x1 = p1.sx, y1 = p1.sy;
84
- const x2 = p2.sx, y2 = p2.sy;
85
- const x3 = p3.sx, y3 = p3.sy;
86
- const x4 = p4.sx, y4 = p4.sy;
87
- const dx1 = x2 - x4, dx2 = x3 - x4, dx3 = x1 - x2 + x4 - x3;
88
- const dy1 = y2 - y4, dy2 = y3 - y4, dy3 = y1 - y2 + y4 - y3;
89
- const det = dx1 * dy2 - dx2 * dy1;
90
- const g = (dx3 * dy2 - dx2 * dy3) / det;
91
- const h_coeff = (dx1 * dy3 - dx3 * dy1) / det;
92
- const a = x2 - x1 + g * x2;
93
- const b = x3 - x1 + h_coeff * x3;
94
- const c = x1;
95
- const d = y2 - y1 + g * y2;
96
- const e = y3 - y1 + h_coeff * y3;
97
- const f = y1;
98
- return [
99
- a / w, d / w, 0, g / w,
100
- b / h, e / h, 0, h_coeff / h,
101
- 0, 0, 1, 0,
102
- c, f, 0, 1
103
- ];
104
- }
105
- /**
106
- * Create and configure an AR tracker with minimal setup
107
- */
108
- export async function createTracker(config) {
109
- const { targetSrc, container, overlay, callbacks = {}, cameraConfig = {
110
- facingMode: 'environment',
111
- width: { ideal: 1280 },
112
- height: { ideal: 960 }
113
- }, viewportWidth = 1280, viewportHeight = 960, debugMode = false, bioInspiredEnabled = true, scale = 1.0 } = config;
114
- // State
115
- let isActive = false;
116
- let wasTracking = false;
117
- let mediaStream = null;
118
- let videoElement = null;
119
- let targetDimensions = [0, 0];
120
- // Create video canvas for camera input
121
- const videoCanvas = document.createElement('canvas');
122
- videoCanvas.width = viewportWidth;
123
- videoCanvas.height = viewportHeight;
124
- videoCanvas.style.width = '100%';
125
- videoCanvas.style.height = '100%';
126
- videoCanvas.style.objectFit = 'cover';
127
- videoCanvas.style.position = 'absolute';
128
- videoCanvas.style.top = '0';
129
- videoCanvas.style.left = '0';
130
- videoCanvas.style.zIndex = '0';
131
- const videoCtx = videoCanvas.getContext('2d');
132
- // Setup overlay styles if provided
133
- if (overlay) {
134
- overlay.style.position = 'absolute';
135
- overlay.style.transformOrigin = '0 0';
136
- overlay.style.display = 'none';
137
- overlay.style.pointerEvents = 'none';
138
- }
139
- // Compile target or load pre-compiled data
140
- let compiledBuffer;
141
- if (targetSrc instanceof ArrayBuffer) {
142
- compiledBuffer = targetSrc;
143
- }
144
- else if (typeof targetSrc === 'string' && targetSrc.toLowerCase().split('?')[0].endsWith('.taar')) {
145
- // Pre-compiled .taar file URL
146
- if (debugMode)
147
- console.log(`[TapTapp AR] Fetching pre-compiled target: ${targetSrc}`);
148
- const response = await fetch(targetSrc);
149
- if (!response.ok)
150
- throw new Error(`Failed to fetch .taar file: ${response.statusText}`);
151
- compiledBuffer = await response.arrayBuffer();
152
- }
153
- else {
154
- // Source is an image or ImageData that needs compilation
155
- if (debugMode)
156
- console.log('[TapTapp AR] Compiling image target...');
157
- const { imageData, width, height } = await getImageData(targetSrc);
158
- targetDimensions = [width, height];
159
- const compiler = new OfflineCompiler();
160
- await compiler.compileImageTargets([{ width, height, data: imageData.data }], (progress) => callbacks.onCompileProgress?.(progress));
161
- const exported = compiler.exportData();
162
- compiledBuffer = exported.buffer.slice(exported.byteOffset, exported.byteOffset + exported.byteLength);
163
- }
164
- // Create controller with bio-inspired perception
165
- const controller = new BioInspiredController({
166
- inputWidth: viewportWidth,
167
- inputHeight: viewportHeight,
168
- debugMode,
169
- bioInspired: {
170
- enabled: bioInspiredEnabled,
171
- aggressiveSkipping: false // Keep stable for real-world conditions
172
- },
173
- onUpdate: (data) => handleControllerUpdate(data)
174
- });
175
- // Load compiled targets
176
- const loadResult = await controller.addImageTargetsFromBuffer(compiledBuffer);
177
- if (loadResult.dimensions && loadResult.dimensions[0]) {
178
- targetDimensions = loadResult.dimensions[0];
179
- }
180
- /**
181
- * Handle controller updates and dispatch to user callbacks
182
- */
183
- function handleControllerUpdate(data) {
184
- if (data.type === 'processDone')
185
- return;
186
- if (data.type !== 'updateMatrix')
187
- return;
188
- const { targetIndex, worldMatrix, modelViewTransform, screenCoords = [], reliabilities = [], stabilities = [] } = data;
189
- const isTracking = worldMatrix !== null;
190
- // Calculate averages
191
- const avgReliability = reliabilities.length > 0
192
- ? reliabilities.reduce((a, b) => a + b, 0) / reliabilities.length
193
- : 0;
194
- const avgStability = stabilities.length > 0
195
- ? stabilities.reduce((a, b) => a + b, 0) / stabilities.length
196
- : 0;
197
- const updateData = {
198
- isTracking,
199
- worldMatrix,
200
- modelViewTransform,
201
- screenCoords,
202
- reliabilities,
203
- stabilities,
204
- avgReliability,
205
- avgStability,
206
- controller,
207
- targetIndex,
208
- targetDimensions
209
- };
210
- // Dispatch state change callbacks
211
- if (isTracking && !wasTracking) {
212
- callbacks.onFound?.(updateData);
213
- }
214
- else if (!isTracking && wasTracking) {
215
- callbacks.onLost?.(updateData);
216
- }
217
- // Always call onUpdate when tracking
218
- if (isTracking || wasTracking) {
219
- callbacks.onUpdate?.(updateData);
220
- }
221
- // Update overlay position if provided
222
- if (overlay && modelViewTransform && worldMatrix) {
223
- positionOverlay(modelViewTransform);
224
- }
225
- else if (overlay && !isTracking) {
226
- overlay.style.display = 'none';
227
- }
228
- wasTracking = isTracking;
229
- }
230
- /**
231
- * Position the overlay element using homography transform
232
- */
233
- function positionOverlay(modelViewTransform) {
234
- if (!overlay)
235
- return;
236
- const [markerW, markerH] = targetDimensions;
237
- const proj = controller.projectionTransform;
238
- const containerRect = container.getBoundingClientRect();
239
- // Get corners in screen space
240
- const pUL = projectToScreen(0, 0, 0, modelViewTransform, proj, viewportWidth, viewportHeight, containerRect, false);
241
- const pUR = projectToScreen(markerW, 0, 0, modelViewTransform, proj, viewportWidth, viewportHeight, containerRect, false);
242
- const pLL = projectToScreen(0, markerH, 0, modelViewTransform, proj, viewportWidth, viewportHeight, containerRect, false);
243
- const pLR = projectToScreen(markerW, markerH, 0, modelViewTransform, proj, viewportWidth, viewportHeight, containerRect, false);
244
- const matrix = solveHomography(markerW, markerH, pUL, pUR, pLL, pLR);
245
- overlay.style.width = `${markerW}px`;
246
- overlay.style.height = `${markerH}px`;
247
- // Apply custom scale if provided
248
- let matrixString = matrix.join(',');
249
- if (scale !== 1.0) {
250
- overlay.style.transform = `matrix3d(${matrixString}) scale(${scale})`;
251
- }
252
- else {
253
- overlay.style.transform = `matrix3d(${matrixString})`;
254
- }
255
- overlay.style.display = 'block';
256
- }
257
- /**
258
- * Draw video frame to canvas
259
- */
260
- function drawVideoToCanvas(source) {
261
- if (source instanceof HTMLVideoElement) {
262
- videoCtx.drawImage(source, 0, 0, viewportWidth, viewportHeight);
263
- }
264
- else {
265
- videoCtx.drawImage(source, 0, 0, viewportWidth, viewportHeight);
266
- }
267
- }
268
- // ========================================================================
269
- // Public API
270
- // ========================================================================
271
- const tracker = {
272
- async startCamera() {
273
- if (isActive)
274
- return;
275
- try {
276
- // Try environment mode first (mobile back camera)
277
- try {
278
- mediaStream = await navigator.mediaDevices.getUserMedia({
279
- video: cameraConfig,
280
- audio: false
281
- });
282
- }
283
- catch (e) {
284
- console.warn('[TapTapp AR] Failed to open environment camera, falling back to default:', e);
285
- // Fallback to any camera
286
- mediaStream = await navigator.mediaDevices.getUserMedia({
287
- video: true,
288
- audio: false
289
- });
290
- }
291
- videoElement = document.createElement('video');
292
- videoElement.srcObject = mediaStream;
293
- videoElement.playsInline = true;
294
- videoElement.muted = true;
295
- await videoElement.play();
296
- // Add video canvas to container (at the beginning to be behind)
297
- container.style.position = 'relative';
298
- if (container.firstChild) {
299
- container.insertBefore(videoCanvas, container.firstChild);
300
- }
301
- else {
302
- container.appendChild(videoCanvas);
303
- }
304
- isActive = true;
305
- // Start processing loop
306
- const processLoop = () => {
307
- if (!isActive || !videoElement)
308
- return;
309
- drawVideoToCanvas(videoElement);
310
- requestAnimationFrame(processLoop);
311
- };
312
- processLoop();
313
- controller.processVideo(videoCanvas);
314
- }
315
- catch (error) {
316
- console.error('[TapTapp AR] Camera access failed:', error);
317
- throw error;
318
- }
319
- },
320
- startVideo(source) {
321
- if (isActive)
322
- return;
323
- container.style.position = 'relative';
324
- container.appendChild(videoCanvas);
325
- isActive = true;
326
- // Start processing loop
327
- const processLoop = () => {
328
- if (!isActive)
329
- return;
330
- drawVideoToCanvas(source);
331
- requestAnimationFrame(processLoop);
332
- };
333
- processLoop();
334
- controller.processVideo(videoCanvas);
335
- },
336
- stop() {
337
- isActive = false;
338
- controller.stopProcessVideo();
339
- if (mediaStream) {
340
- mediaStream.getTracks().forEach(track => track.stop());
341
- mediaStream = null;
342
- }
343
- if (videoElement) {
344
- videoElement.srcObject = null;
345
- videoElement = null;
346
- }
347
- if (videoCanvas.parentNode) {
348
- videoCanvas.parentNode.removeChild(videoCanvas);
349
- }
350
- if (overlay) {
351
- overlay.style.display = 'none';
352
- }
353
- },
354
- get isActive() {
355
- return isActive;
356
- },
357
- get isTracking() {
358
- return wasTracking;
359
- },
360
- get controller() {
361
- return controller;
362
- },
363
- get targetDimensions() {
364
- return targetDimensions;
365
- },
366
- getProjectionMatrix() {
367
- return controller.getProjectionMatrix();
368
- }
369
- };
370
- return tracker;
371
- }
372
- /**
373
- * Convenience function to create a tracker with camera autostart
374
- */
375
- export async function startTracking(config) {
376
- const tracker = await createTracker(config);
377
- await tracker.startCamera();
378
- return tracker;
379
- }
380
- // Default export for easy importing
381
- export default createTracker;
1
+ import{BioInspiredController as e}from"./bio-inspired-controller.js";import{OfflineCompiler as t}from"../compiler/offline-compiler.js";import{projectToScreen as i}from"../core/utils/projection.js";export async function createTracker(a){const{targetSrc:r,container:n,overlay:o,callbacks:s={},cameraConfig:l={facingMode:"environment",width:{ideal:1280},height:{ideal:960}},viewportWidth:c=1280,viewportHeight:d=960,debugMode:g=!1,bioInspiredEnabled:p=!0,scale:m=1}=a;let h=!1,f=!1,u=null,y=null,w=[0,0];const b=document.createElement("canvas");b.width=c,b.height=d,b.style.width="100%",b.style.height="100%",b.style.objectFit="cover",b.style.position="absolute",b.style.top="0",b.style.left="0",b.style.zIndex="0";const v=b.getContext("2d");let x;if(o&&(o.style.position="absolute",o.style.transformOrigin="0 0",o.style.display="none",o.style.pointerEvents="none"),r instanceof ArrayBuffer)x=r;else if("string"==typeof r&&r.toLowerCase().split("?")[0].endsWith(".taar")){g&&console.log(`[TapTapp AR] Fetching pre-compiled target: ${r}`);const e=await fetch(r);if(!e.ok)throw new Error(`Failed to fetch .taar file: ${e.statusText}`);x=await e.arrayBuffer()}else{g&&console.log("[TapTapp AR] Compiling image target...");const{imageData:e,width:i,height:a}=await async function(e){let t;if("string"==typeof e)t=await async function(e){return new Promise((t,i)=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t(a),a.onerror=()=>i(new Error(`Failed to load image: ${e}`)),a.src=e})}(e);else{if(!(e instanceof HTMLImageElement))return{imageData:e,width:e.width,height:e.height};t=e,t.complete||await new Promise((e,i)=>{t.onload=e,t.onerror=i})}const i=document.createElement("canvas");i.width=t.width,i.height=t.height;const a=i.getContext("2d");return a.drawImage(t,0,0),{imageData:a.getImageData(0,0,t.width,t.height),width:t.width,height:t.height}}(r);w=[i,a];const n=new t;await n.compileImageTargets([{width:i,height:a,data:e.data}],e=>s.onCompileProgress?.(e));const o=n.exportData();x=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}const T=new e({inputWidth:c,inputHeight:d,debugMode:g,bioInspired:{enabled:p,aggressiveSkipping:!1},onUpdate:e=>function(e){if("processDone"===e.type)return;if("updateMatrix"!==e.type)return;const{targetIndex:t,worldMatrix:a,modelViewTransform:r,screenCoords:l=[],reliabilities:g=[],stabilities:p=[]}=e,h=null!==a,u=g.length>0?g.reduce((e,t)=>e+t,0)/g.length:0,y=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:0,b={isTracking:h,worldMatrix:a,modelViewTransform:r,screenCoords:l,reliabilities:g,stabilities:p,avgReliability:u,avgStability:y,controller:T,targetIndex:t,targetDimensions:w};h&&!f?s.onFound?.(b):!h&&f&&s.onLost?.(b),(h||f)&&s.onUpdate?.(b),o&&r&&a?function(e){if(!o)return;const[t,a]=w,r=T.projectionTransform,s=n.getBoundingClientRect(),l=function(e,t,i,a,r,n){const o=i.sx,s=i.sy,l=a.sx,c=a.sy,d=r.sx,g=r.sy,p=n.sx,m=n.sy,h=l-p,f=d-p,u=o-l+p-d,y=c-m,w=g-m,b=s-c+m-g,v=h*w-f*y,x=(u*w-f*b)/v,T=(h*b-u*y)/v;return[(l-o+x*l)/e,(c-s+x*c)/e,0,x/e,(d-o+T*d)/t,(g-s+T*g)/t,0,T/t,0,0,1,0,o,s,0,1]}(t,a,i(0,0,0,e,r,c,d,s,!1),i(t,0,0,e,r,c,d,s,!1),i(0,a,0,e,r,c,d,s,!1),i(t,a,0,e,r,c,d,s,!1));o.style.width=`${t}px`,o.style.height=`${a}px`;let g=l.join(",");o.style.transform=1!==m?`matrix3d(${g}) scale(${m})`:`matrix3d(${g})`,o.style.display="block"}(r):o&&!h&&(o.style.display="none"),f=h}(e)}),C=await T.addImageTargetsFromBuffer(x);function I(e){HTMLVideoElement,v.drawImage(e,0,0,c,d)}return C.dimensions&&C.dimensions[0]&&(w=C.dimensions[0]),{async startCamera(){if(!h)try{try{u=await navigator.mediaDevices.getUserMedia({video:l,audio:!1})}catch(e){console.warn("[TapTapp AR] Failed to open environment camera, falling back to default:",e),u=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1})}y=document.createElement("video"),y.srcObject=u,y.playsInline=!0,y.muted=!0,await y.play(),n.style.position="relative",n.firstChild?n.insertBefore(b,n.firstChild):n.appendChild(b),h=!0;const e=()=>{h&&y&&(I(y),requestAnimationFrame(e))};e(),T.processVideo(b)}catch(e){throw console.error("[TapTapp AR] Camera access failed:",e),e}},startVideo(e){if(h)return;n.style.position="relative",n.appendChild(b),h=!0;const t=()=>{h&&(I(e),requestAnimationFrame(t))};t(),T.processVideo(b)},stop(){h=!1,T.stopProcessVideo(),u&&(u.getTracks().forEach(e=>e.stop()),u=null),y&&(y.srcObject=null,y=null),b.parentNode&&b.parentNode.removeChild(b),o&&(o.style.display="none")},get isActive(){return h},get isTracking(){return f},get controller(){return T},get targetDimensions(){return w},getProjectionMatrix:()=>T.getProjectionMatrix()}}export async function startTracking(e){const t=await createTracker(e);return await t.startCamera(),t}export default createTracker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srsergio/taptapp-ar",
3
- "version": "1.0.101",
3
+ "version": "1.1.2",
4
4
  "description": "Ultra-fast Augmented Reality (AR) SDK for Node.js and Browser. Image tracking with 100% pure JavaScript, zero-dependencies, and high-performance compilation.",
5
5
  "keywords": [
6
6
  "augmented reality",
@@ -41,7 +41,10 @@
41
41
  "types": "./dist/index.d.ts",
42
42
  "import": "./dist/index.js"
43
43
  },
44
- "./compiler/*": "./dist/compiler/*"
44
+ "./compiler": {
45
+ "types": "./dist/compiler/offline-compiler.d.ts",
46
+ "import": "./dist/compiler/offline-compiler.js"
47
+ }
45
48
  },
46
49
  "files": [
47
50
  "dist",
@@ -49,7 +52,9 @@
49
52
  "LICENSE"
50
53
  ],
51
54
  "scripts": {
52
- "build": "tsc",
55
+ "build": "tsc && node scripts/minify-dist.mjs",
56
+ "build:dev": "tsc",
57
+ "minify": "node scripts/minify-dist.mjs",
53
58
  "prepublishOnly": "npm run build",
54
59
  "test": "vitest",
55
60
  "test:react": "vite --port 4321 --open tests/reliability-test.html",
@@ -88,6 +93,7 @@
88
93
  "jimp": "^1.6.0",
89
94
  "react": "^18.3.1",
90
95
  "react-dom": "^18.3.1",
96
+ "terser": "^5.44.1",
91
97
  "typescript": "^5.4.5",
92
98
  "vitest": "^4.0.16"
93
99
  },