@willwade/aac-processors 0.1.1 → 0.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.
@@ -507,7 +507,14 @@ class GridsetProcessor extends BaseProcessor {
507
507
  }
508
508
  // Debug: log all entry names
509
509
  console.log('[Gridset] Total zip entries:', entries.length);
510
- const gridEntries = entries.filter((e) => e.entryName.startsWith('Grids/') && e.entryName.endsWith('grid.xml'));
510
+ const normalizeEntryName = (entryName) => entryName.replace(/\\/g, '/').toLowerCase();
511
+ const isGridXmlEntry = (entryName) => {
512
+ const normalized = normalizeEntryName(entryName);
513
+ if (!normalized.endsWith('grid.xml'))
514
+ return false;
515
+ return normalized.startsWith('grids/') || normalized.includes('/grids/');
516
+ };
517
+ const gridEntries = entries.filter((e) => isGridXmlEntry(e.entryName));
511
518
  console.log('[Gridset] Grid XML entries found:', gridEntries.length);
512
519
  if (gridEntries.length > 0) {
513
520
  console.log('[Gridset] First few grid entries:', gridEntries.slice(0, 3).map((e) => e.entryName));
@@ -516,7 +523,7 @@ class GridsetProcessor extends BaseProcessor {
516
523
  const gridNameToIdMap = new Map();
517
524
  const gridIdToNameMap = new Map();
518
525
  for (const entry of entries) {
519
- if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
526
+ if (isGridXmlEntry(entry.entryName)) {
520
527
  try {
521
528
  const xmlContent = decodeText(await readEntryBuffer(entry));
522
529
  const data = parser.parse(xmlContent);
@@ -549,7 +556,7 @@ class GridsetProcessor extends BaseProcessor {
549
556
  // Second pass: process each grid file in the gridset
550
557
  for (const entry of entries) {
551
558
  // Only process files named grid.xml under Grids/ (any subdir)
552
- if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
559
+ if (isGridXmlEntry(entry.entryName)) {
553
560
  let xmlContent;
554
561
  try {
555
562
  const buffer = await readEntryBuffer(entry);
@@ -341,7 +341,7 @@ class ObfProcessor extends BaseProcessor {
341
341
  return null;
342
342
  }
343
343
  // If input is a string path and ends with .obf, treat as JSON
344
- if (typeof filePathOrBuffer === 'string' && filePathOrBuffer.endsWith('.obf')) {
344
+ if (typeof filePathOrBuffer === 'string' && filePathOrBuffer.toLowerCase().endsWith('.obf')) {
345
345
  try {
346
346
  const content = readTextFromInput(filePathOrBuffer);
347
347
  const boardData = tryParseObfJson(content);
@@ -393,8 +393,10 @@ class ObfProcessor extends BaseProcessor {
393
393
  }
394
394
  // Otherwise, try as ZIP (.obz). Detect likely zip signature first; throw if neither JSON nor ZIP
395
395
  function isLikelyZip(input) {
396
- if (typeof input === 'string')
397
- return input.endsWith('.zip') || input.endsWith('.obz');
396
+ if (typeof input === 'string') {
397
+ const lowered = input.toLowerCase();
398
+ return lowered.endsWith('.zip') || lowered.endsWith('.obz');
399
+ }
398
400
  const bytes = readBinaryFromInput(input);
399
401
  return bytes.length >= 2 && bytes[0] === 0x50 && bytes[1] === 0x4b;
400
402
  }
@@ -420,7 +422,7 @@ class ObfProcessor extends BaseProcessor {
420
422
  zip.forEach((relativePath, file) => {
421
423
  if (file.dir)
422
424
  return;
423
- if (relativePath.endsWith('.obf')) {
425
+ if (relativePath.toLowerCase().endsWith('.obf')) {
424
426
  obfEntries.push({ name: relativePath, file });
425
427
  }
426
428
  });
@@ -533,7 +533,14 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
533
533
  }
534
534
  // Debug: log all entry names
535
535
  console.log('[Gridset] Total zip entries:', entries.length);
536
- const gridEntries = entries.filter((e) => e.entryName.startsWith('Grids/') && e.entryName.endsWith('grid.xml'));
536
+ const normalizeEntryName = (entryName) => entryName.replace(/\\/g, '/').toLowerCase();
537
+ const isGridXmlEntry = (entryName) => {
538
+ const normalized = normalizeEntryName(entryName);
539
+ if (!normalized.endsWith('grid.xml'))
540
+ return false;
541
+ return normalized.startsWith('grids/') || normalized.includes('/grids/');
542
+ };
543
+ const gridEntries = entries.filter((e) => isGridXmlEntry(e.entryName));
537
544
  console.log('[Gridset] Grid XML entries found:', gridEntries.length);
538
545
  if (gridEntries.length > 0) {
539
546
  console.log('[Gridset] First few grid entries:', gridEntries.slice(0, 3).map((e) => e.entryName));
@@ -542,7 +549,7 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
542
549
  const gridNameToIdMap = new Map();
543
550
  const gridIdToNameMap = new Map();
544
551
  for (const entry of entries) {
545
- if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
552
+ if (isGridXmlEntry(entry.entryName)) {
546
553
  try {
547
554
  const xmlContent = (0, io_1.decodeText)(await readEntryBuffer(entry));
548
555
  const data = parser.parse(xmlContent);
@@ -575,7 +582,7 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
575
582
  // Second pass: process each grid file in the gridset
576
583
  for (const entry of entries) {
577
584
  // Only process files named grid.xml under Grids/ (any subdir)
578
- if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
585
+ if (isGridXmlEntry(entry.entryName)) {
579
586
  let xmlContent;
580
587
  try {
581
588
  const buffer = await readEntryBuffer(entry);
@@ -367,7 +367,7 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
367
367
  return null;
368
368
  }
369
369
  // If input is a string path and ends with .obf, treat as JSON
370
- if (typeof filePathOrBuffer === 'string' && filePathOrBuffer.endsWith('.obf')) {
370
+ if (typeof filePathOrBuffer === 'string' && filePathOrBuffer.toLowerCase().endsWith('.obf')) {
371
371
  try {
372
372
  const content = (0, io_1.readTextFromInput)(filePathOrBuffer);
373
373
  const boardData = tryParseObfJson(content);
@@ -419,8 +419,10 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
419
419
  }
420
420
  // Otherwise, try as ZIP (.obz). Detect likely zip signature first; throw if neither JSON nor ZIP
421
421
  function isLikelyZip(input) {
422
- if (typeof input === 'string')
423
- return input.endsWith('.zip') || input.endsWith('.obz');
422
+ if (typeof input === 'string') {
423
+ const lowered = input.toLowerCase();
424
+ return lowered.endsWith('.zip') || lowered.endsWith('.obz');
425
+ }
424
426
  const bytes = (0, io_1.readBinaryFromInput)(input);
425
427
  return bytes.length >= 2 && bytes[0] === 0x50 && bytes[1] === 0x4b;
426
428
  }
@@ -446,7 +448,7 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
446
448
  zip.forEach((relativePath, file) => {
447
449
  if (file.dir)
448
450
  return;
449
- if (relativePath.endsWith('.obf')) {
451
+ if (relativePath.toLowerCase().endsWith('.obf')) {
450
452
  obfEntries.push({ name: relativePath, file });
451
453
  }
452
454
  });
@@ -4,7 +4,11 @@ import path from 'path';
4
4
  export default defineConfig({
5
5
  resolve: {
6
6
  alias: {
7
- 'aac-processors': path.resolve(__dirname, '../../src/index.browser.ts')
7
+ 'aac-processors': path.resolve(__dirname, '../../src/index.browser.ts'),
8
+ stream: path.resolve(__dirname, 'node_modules/stream-browserify'),
9
+ events: path.resolve(__dirname, 'node_modules/events'),
10
+ timers: path.resolve(__dirname, 'node_modules/timers-browserify'),
11
+ util: path.resolve(__dirname, 'node_modules/util')
8
12
  }
9
13
  },
10
14
  optimizeDeps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willwade/aac-processors",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/browser/index.browser.js",
@@ -94,6 +94,7 @@
94
94
  "format": "prettier --write \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\" \"*.{js,ts,json,md}\"",
95
95
  "format:check": "prettier --check \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\" \"*.{js,ts,json,md}\"",
96
96
  "smoke:browser": "node scripts/smoke-browser-bundle.js",
97
+ "verify:browser-build": "node scripts/verify-browser-build.js",
97
98
  "test": "npm run build && jest",
98
99
  "test:watch": "npm run build && jest --watch",
99
100
  "test:coverage": "npm run build && jest --coverage",
@@ -102,8 +103,8 @@
102
103
  "docs": "typedoc",
103
104
  "coverage:report": "node scripts/coverage-analysis.js",
104
105
  "type-check": "tsc --noEmit",
105
- "prepublishOnly": "npm run build",
106
- "prepack": "npm run build"
106
+ "prepublishOnly": "npm run build:all && npm run verify:browser-build",
107
+ "prepack": "npm run build:all && npm run verify:browser-build"
107
108
  },
108
109
  "keywords": [
109
110
  "aac",