Skip to content

Commit db46cb6

Browse files
committed
Normalize formatting and add Gridset helpers
Apply code-style and formatting changes across the codebase (quote normalization to double-quotes, consistent trailing commas/line breaks, spacing, and minor string/console formatting fixes). Update CLI and core modules for consistent formatting and improved readability. Add new Gridset helper files and utilities for the gridset processor (src/processors/gridset/cellHelpers.ts, gridCalculations.ts, xmlFormatter.ts) and adjust related gridset processor modules. Update docs (README, CHANGELOG) and numerous tests to reflect these changes.
1 parent bc8b008 commit db46cb6

170 files changed

Lines changed: 13917 additions & 10505 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ processor.saveFromTree(tree, output);
2727
// After (v3.x)
2828
const tree: AACTree = await processor.loadIntoTree(file);
2929
const texts: string[] = await processor.extractTexts(file);
30-
const result: Uint8Array = await processor.processTexts(file, translations, output);
30+
const result: Uint8Array = await processor.processTexts(
31+
file,
32+
translations,
33+
output,
34+
);
3135
await processor.saveFromTree(tree, output);
3236
```
3337

@@ -39,18 +43,19 @@ const symbols: ButtonForTranslation[] = processor.extractSymbolsForLLM(file);
3943
processor.processLLMTranslations(file, translations, output);
4044

4145
// After
42-
const symbols: ButtonForTranslation[] = await processor.extractSymbolsForLLM(file);
46+
const symbols: ButtonForTranslation[] =
47+
await processor.extractSymbolsForLLM(file);
4348
await processor.processLLMTranslations(file, translations, output);
4449
```
4550

4651
#### Helper Functions (BREAKING)
4752

4853
```typescript
4954
// Before
50-
const result = analyze(file, format); // Returns { tree }
55+
const result = analyze(file, format); // Returns { tree }
5156

5257
// After
53-
const result = await analyze(file, format); // Returns Promise<{ tree }>
58+
const result = await analyze(file, format); // Returns Promise<{ tree }>
5459
```
5560

5661
### Migration Guide
@@ -103,7 +108,7 @@ async function processMultipleFiles(files: string[]) {
103108
const processor = getProcessor(file);
104109
const tree = await processor.loadIntoTree(file);
105110
return tree;
106-
})
111+
}),
107112
);
108113
return results;
109114
}
@@ -154,6 +159,7 @@ async function processMultipleFiles(files: string[]) {
154159
### Browser Compatibility Progress
155160

156161
This change enables the following browser-compatible processors:
162+
157163
- ✅ DotProcessor
158164
- ✅ OpmlProcessor
159165
- ✅ ObfProcessor (JSZip migration complete!)
@@ -164,6 +170,7 @@ This change enables the following browser-compatible processors:
164170
**Note:** Gridset `.gridsetx` encrypted files require Node.js for crypto operations. Regular `.gridset` files work in browser.
165171

166172
Still Node-only (deferred):
173+
167174
- ❌ SnapProcessor (sqlite - needs wasm sqlite)
168175
- ❌ TouchChatProcessor (sqlite - needs wasm sqlite)
169176
- ❌ ExcelProcessor (fs dependencies - needs audit)

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ npm install @willwade/aac-processors
1313
## Dual Build Targets
1414

1515
### Node.js (default)
16+
1617
Full feature set, including filesystem access, SQLite-backed formats, and
1718
ZIP/encrypted formats.
1819

1920
```ts
20-
import { getProcessor, SnapProcessor } from '@willwade/aac-processors';
21+
import { getProcessor, SnapProcessor } from "@willwade/aac-processors";
2122

22-
const processor = getProcessor('board.sps');
23-
const tree = await processor.loadIntoTree('board.sps');
23+
const processor = getProcessor("board.sps");
24+
const tree = await processor.loadIntoTree("board.sps");
2425

2526
const snap = new SnapProcessor();
26-
const texts = await snap.extractTexts('board.sps');
27+
const texts = await snap.extractTexts("board.sps");
2728
```
2829

2930
### Browser
31+
3032
Browser-safe entry that avoids Node-only dependencies. It expects `Buffer`,
3133
`Uint8Array`, or `ArrayBuffer` inputs rather than file paths.
3234

@@ -36,7 +38,10 @@ and either include `<script src="sql-wasm.js"></script>` in your HTML, or
3638
`window.initSqlJs = require('sql.js');` in your app.
3739

3840
```ts
39-
import { configureSqlJs, SnapProcessor } from '@willwade/aac-processors/browser';
41+
import {
42+
configureSqlJs,
43+
SnapProcessor,
44+
} from "@willwade/aac-processors/browser";
4045

4146
configureSqlJs({
4247
locateFile: (file) => new URL(`./${file}`, import.meta.url).toString(),
@@ -47,7 +52,7 @@ const tree = await snap.loadIntoTree(snapUint8Array);
4752
```
4853

4954
```ts
50-
import { GridsetProcessor } from '@willwade/aac-processors/browser';
55+
import { GridsetProcessor } from "@willwade/aac-processors/browser";
5156

5257
const processor = new GridsetProcessor();
5358
const tree = await processor.loadIntoTree(gridsetUint8Array);
@@ -70,19 +75,20 @@ const tree = await processor.loadIntoTree(gridsetUint8Array);
7075
All processors implement `processTexts()` to get all strings eg
7176

7277
```ts
73-
import { DotProcessor } from '@willwade/aac-processors';
78+
import { DotProcessor } from "@willwade/aac-processors";
7479

7580
const processor = new DotProcessor();
76-
const texts = await processor.extractTexts('board.dot');
81+
const texts = await processor.extractTexts("board.dot");
7782

7883
const translations = new Map([
79-
['Hello', 'Hola'],
80-
['Food', 'Comida'],
84+
["Hello", "Hola"],
85+
["Food", "Comida"],
8186
]);
8287

83-
await processor.processTexts('board.dot', translations, 'board-es.dot');
88+
await processor.processTexts("board.dot", translations, "board-es.dot");
8489
```
85-
NB: Please use [https://aactools.co.uk](https://aactools.co.uk) for a far more comphrensive translation logic - where we do far far more than this...
90+
91+
NB: Please use [https://aactools.co.uk](https://aactools.co.uk) for a far more comphrensive translation logic - where we do far far more than this...
8692

8793
## Documentation
8894

src/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
* This is separate from pageset metrics.
66
*/
77

8-
export * from './utilities/analytics/history';
8+
export * from "./utilities/analytics/history";

src/applePanels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
// Processor class
8-
export { ApplePanelsProcessor } from './processors/applePanelsProcessor';
8+
export { ApplePanelsProcessor } from "./processors/applePanelsProcessor";
99

1010
// Note: Apple Panels doesn't currently have platform-specific helpers
1111
// Future helper functions can be added here

src/astericsGrid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
// Processor class
8-
export { AstericsGridProcessor } from './processors/astericsGridProcessor';
8+
export { AstericsGridProcessor } from "./processors/astericsGridProcessor";
99

1010
// Note: Asterics Grid doesn't currently have platform-specific helpers
1111
// Future helper functions can be added here

0 commit comments

Comments
 (0)