@cobol-ts/trees 0.0.0-stage → 0.0.1

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.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # @cobol-ts/trees
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Purpose
4
+
5
+ Format-independent functional traversals over tree structures. The COBOL [layout compiler](../../cursor-loader/layout/README.md) uses these operations to transform storage declarations and perform ordered geometry passes. This package knows nothing about COBOL syntax, byte buffers or projection lifetimes.
6
+
7
+ ## Tree contracts
8
+
9
+ `Tree<Leaf, Child>` provides `isLeaf(node)` and `children(child)`. `MutableTree` extends that with `setChildren`. Callers supply these operations rather than inheriting from a fixed tree-node class.
10
+
11
+ ## Traversals
12
+
13
+ `transformTree(roots, tree, transform)` visits children before transforming their parent and returns `ErrorsOr`, allowing independent errors to accumulate through the [errors module](../errors/README.md). The transform callback can return multiple output nodes, so the operation also supports expansions and removals. `foldTreeLeft` walks in left-to-right depth-first order; its optional `exit` callback runs after the children of a branch. `foldTreeRight` walks in the complementary order used by suffix calculations.
14
+
15
+ For geometry passes, traversal order is part of the algorithm: prefix placement and suffix sizing cannot be interchanged. See [`src/tree.ts`](src/tree.ts) and its tests for exact callback arguments and accumulation semantics.
@@ -0,0 +1 @@
1
+ export * from './src/tree';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/tree"), exports);
18
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@cobol-ts/trees",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "utilities walking, transforming and making trees",
4
+ "version": "0.0.1",
5
+ "main": "dist/index",
6
+ "types": "dist/index",
7
+ "browserslist": {
8
+ "development": [
9
+ "last 1 chrome version",
10
+ "last 1 firefox version",
11
+ "last 1 safari version"
12
+ ],
13
+ "production": [
14
+ ">0.2%",
15
+ "not dead",
16
+ "not op_mini all"
17
+ ]
18
+ },
19
+ "devDependencies": {
20
+ "@testing-library/jest-dom": "^6.1.4",
21
+ "@types/jest": "^29.0.0",
22
+ "@types/node": "^14.0.0",
23
+ "jest": "^29.0.0",
24
+ "ts-jest": "^29.0.0",
25
+ "typescript": "^5.2.2"
26
+ },
27
+ "eslintConfig": {
28
+ "extends": [
29
+ "react-app",
30
+ "react-app/jest"
31
+ ],
32
+ "overrides": [
33
+ {
34
+ "files": [
35
+ "**/*.stories.*"
36
+ ],
37
+ "rules": {
38
+ "import/no-anonymous-default-export": "off"
39
+ }
40
+ }
41
+ ]
42
+ },
43
+ "files": [
44
+ "dist/index.js",
45
+ "dist/index.d.ts",
46
+ "dist/src/",
47
+ "build/"
48
+ ],
49
+ "keywords": [
50
+ "indexing"
51
+ ],
52
+ "license": "MIT",
53
+ "repository": "git@github.com:intellimaintain/intellimaintain.git",
54
+ "scripts": {
55
+ "test": "jest --config jest.config.json --env node",
56
+ "test:watch": "npm run test -- --watch",
57
+ "start": "react-scripts start"
58
+ }
6
59
  }