@cobol-ts/file-display 0.0.6 → 0.0.8

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/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './src/configured.file';
1
2
  export * from './src/file.display';
2
3
  export * from './src/projection.json';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/configured.file"), exports);
17
18
  __exportStar(require("./src/file.display"), exports);
18
19
  __exportStar(require("./src/projection.json"), exports);
19
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,wDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,qDAAkC;AAClC,wDAAqC"}
@@ -0,0 +1,23 @@
1
+ import type { TextFiles } from '@cobol-ts/files';
2
+ import type { YamlParser } from '@cobol-ts/yaml';
3
+ import type { ProjectionAuthoring } from '@cobol-ts/cursor-loader-types';
4
+ import type { CobolFileOptions } from '@cobol-ts/cursor-loader-cobol';
5
+ import { type ErrorsOr } from '@cobol-ts/errors';
6
+ export interface ConfiguredFileOptions {
7
+ readonly configDirectory: string;
8
+ readonly logicalName: string;
9
+ readonly input?: string;
10
+ readonly catalogue?: string;
11
+ readonly data?: string;
12
+ readonly bufferSize?: number;
13
+ }
14
+ export interface ConfiguredCobolFile {
15
+ readonly filename: string;
16
+ readonly copybook: string;
17
+ readonly projection: ProjectionAuthoring;
18
+ readonly runtimeProjection: CobolFileOptions<unknown>['projection'];
19
+ readonly framing: CobolFileOptions<unknown>['framing'];
20
+ readonly bufferSize?: number;
21
+ }
22
+ /** Shared prepared-source path for both display and compiled CEL execution. */
23
+ export declare function openConfiguredCobolFile(options: ConfiguredFileOptions, files?: TextFiles, yaml?: YamlParser): Promise<ErrorsOr<ConfiguredCobolFile>>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openConfiguredCobolFile = openConfiguredCobolFile;
4
+ const node_path_1 = require("node:path");
5
+ const files_1 = require("@cobol-ts/files");
6
+ const yaml_jsyaml_1 = require("@cobol-ts/yaml-jsyaml");
7
+ const copybook_1 = require("@cobol-ts/copybook");
8
+ const default_projection_typescript_1 = require("@cobol-ts/default-projection-typescript");
9
+ const cursor_projection_1 = require("@cobol-ts/cursor-projection");
10
+ const errors_1 = require("@cobol-ts/errors");
11
+ const file_catalogue_1 = require("@cobol-ts/file-catalogue");
12
+ async function readDataPath(files, options, catalogue, directory, yaml) {
13
+ if (options.input !== undefined) {
14
+ if (!options.input.trim())
15
+ return { errors: ['Display input filename must not be empty'] };
16
+ return (0, errors_1.value)((0, node_path_1.resolve)(options.input));
17
+ }
18
+ const dataFilename = (0, node_path_1.resolve)(directory, options.data ?? 'data.yaml');
19
+ const data = await (0, file_catalogue_1.readDataFileConfiguration)(files, dataFilename, yaml);
20
+ if ('errors' in data)
21
+ return data;
22
+ const resolved = (0, file_catalogue_1.resolveDataFiles)(catalogue, data.value, directory);
23
+ if ('errors' in resolved)
24
+ return resolved;
25
+ const found = resolved.value.find(entry => entry.logicalName === options.logicalName);
26
+ return found ? (0, errors_1.value)(found.filename) : { errors: [`No data file configured for ${JSON.stringify(options.logicalName)} in ${dataFilename}`] };
27
+ }
28
+ /** Shared prepared-source path for both display and compiled CEL execution. */
29
+ async function openConfiguredCobolFile(options, files = files_1.nodeTextFiles, yaml = yaml_jsyaml_1.jsYamlParser) {
30
+ if (!options.logicalName.trim())
31
+ return { errors: ['Display logical name must not be empty'] };
32
+ const directory = (0, node_path_1.resolve)(options.configDirectory);
33
+ const catalogueFilename = (0, node_path_1.resolve)(directory, options.catalogue ?? 'files.yaml');
34
+ const catalogue = await (0, file_catalogue_1.readFileCatalogue)(files, catalogueFilename, yaml);
35
+ if ('errors' in catalogue)
36
+ return catalogue;
37
+ const definition = catalogue.value.files[options.logicalName];
38
+ if (!definition)
39
+ return { errors: [`Unknown logical file ${JSON.stringify(options.logicalName)}`] };
40
+ if (definition.type !== 'cobol')
41
+ return { errors: [`Display of ${JSON.stringify(options.logicalName)}: Format ${JSON.stringify(definition.type)} is not yet supported`] };
42
+ const sourceRoot = (0, node_path_1.resolve)(directory, catalogue.value.root);
43
+ if ((0, node_path_1.isAbsolute)(definition.copybook) || node_path_1.win32.isAbsolute(definition.copybook))
44
+ return { errors: [`Copybook for ${options.logicalName}: Expected a relative filename`] };
45
+ const sourcePath = (0, node_path_1.resolve)(sourceRoot, definition.copybook);
46
+ const suffix = (0, node_path_1.relative)(sourceRoot, sourcePath);
47
+ if (!suffix || suffix === '..' || suffix.startsWith('../') || suffix.startsWith('..\\'))
48
+ return { errors: [`Copybook for ${options.logicalName}: Path escapes source root`] };
49
+ const filename = await readDataPath(files, options, catalogue.value, directory, yaml);
50
+ if ('errors' in filename)
51
+ return filename;
52
+ let copybook;
53
+ try {
54
+ copybook = await files.read(sourcePath);
55
+ }
56
+ catch (error) {
57
+ return { errors: [`Reading copybook for ${options.logicalName} (${sourcePath}): ${error instanceof Error ? error.message : String(error)}`] };
58
+ }
59
+ const ast = (0, copybook_1.parseCopybook)(copybook);
60
+ if ('errors' in ast)
61
+ return ast;
62
+ const projected = (0, default_projection_typescript_1.createDefaultProjection)(ast.value);
63
+ if ('errors' in projected)
64
+ return projected;
65
+ const projection = projected.value;
66
+ return (0, errors_1.value)({
67
+ filename: filename.value,
68
+ copybook: sourcePath,
69
+ projection,
70
+ runtimeProjection: (0, cursor_projection_1.canonicalProjection)(projection),
71
+ framing: definition.options?.framing,
72
+ ...(options.bufferSize ? { bufferSize: options.bufferSize } : {})
73
+ });
74
+ }
75
+ //# sourceMappingURL=configured.file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configured.file.js","sourceRoot":"","sources":["../../src/configured.file.ts"],"names":[],"mappings":";;AAuDA,0DAyCC;AAhGD,yCAA8D;AAE9D,2CAA6C;AAE7C,uDAAkD;AAClD,iDAAgD;AAChD,2FAA+E;AAC/E,mEAA+D;AAG/D,6CAAqD;AACrD,6DAGiC;AAoBjC,KAAK,UAAU,YAAY,CACvB,KAAgB,EAChB,OAA8B,EAC9B,SAAwB,EACxB,SAAiB,EACjB,IAAgB;IAEhB,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;YAAE,OAAO,EAAC,MAAM,EAAE,CAAC,0CAA0C,CAAC,EAAC,CAAA;QACxF,OAAO,IAAA,cAAK,EAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACxC,CAAC;IACD,MAAM,YAAY,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC,CAAA;IACpE,MAAM,IAAI,GAAG,MAAM,IAAA,0CAAyB,EAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IACvE,IAAI,QAAQ,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACjC,MAAM,QAAQ,GAAG,IAAA,iCAAgB,EAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACnE,IAAI,QAAQ,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,CA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AAM,GAAG,GAAG,IAAA,wBAAa,EAAC,QAAQ,CAAC,CAAA;IACnC,IAAI,QAAQ,IAAI,GAAG;QAAE,OAAO,GAAG,CAAA;IAC/B,MAAM,SAAS,GAAG,IAAA,uDAAuB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpD,IAAI,QAAQ,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAC3C,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAA;IAClC,OAAO,IAAA,cAAK,EAAC;QACT,QAAQ,EAAE,QAAQ,CAAC,KAAK;QACxB,QAAQ,EAAE,UAAU;QACpB,UAAU;QACV,iBAAiB,EAAE,IAAA,uCAAmB,EAAC,UAAU,CAAuD;QACxG,OAAO,EAAG,UAAkC,CAAC,OAAO,EAAE,OAAO;QAC7D,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC,CAAA;AACN,CAAC"}
@@ -1,26 +1,14 @@
1
1
  import type { TextFiles } from '@cobol-ts/files';
2
2
  import { type ErrorsOr } from '@cobol-ts/errors';
3
- export interface DisplayOptions {
4
- readonly configDirectory: string;
5
- readonly logicalName: string;
6
- /** Defaults to 10 unless all is true. */
3
+ import { type ConfiguredFileOptions } from './configured.file';
4
+ export interface DisplayOptions extends ConfiguredFileOptions {
7
5
  readonly count?: number;
8
6
  readonly all?: boolean;
9
7
  readonly skip?: number;
10
- /** Physical path, relative to the caller's working directory if not absolute. */
11
- readonly input?: string;
12
- /** Optional configuration name within .cobolts. */
13
- readonly catalogue?: string;
14
- readonly data?: string;
15
- readonly bufferSize?: number;
16
8
  }
17
9
  export interface DisplayStream {
18
10
  readonly filename: string;
19
- /** Each item is one JSON value, without a newline. */
20
11
  readonly lines: AsyncIterable<string>;
21
12
  }
22
- /**
23
- * Resolve the configured input and create a one-pass JSONL stream. Neither
24
- * generation.yaml nor generated TypeScript participates in this operation.
25
- */
13
+ /** Produce JSONL only at the display boundary. CEL calls openConfiguredCobolFile directly. */
26
14
  export declare function openFileDisplay(options: DisplayOptions, files?: TextFiles): Promise<ErrorsOr<DisplayStream>>;
@@ -1,89 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.openFileDisplay = openFileDisplay;
4
- const node_path_1 = require("node:path");
5
4
  const files_1 = require("@cobol-ts/files");
6
- const copybook_1 = require("@cobol-ts/copybook");
7
- const default_projection_typescript_1 = require("@cobol-ts/default-projection-typescript");
8
- const cursor_projection_1 = require("@cobol-ts/cursor-projection");
9
- const cobol_file_node_1 = require("@cobol-ts/cursor-loader-cobol/src/cobol.file.node");
5
+ const cursor_loader_cobol_1 = require("@cobol-ts/cursor-loader-cobol");
10
6
  const errors_1 = require("@cobol-ts/errors");
11
- const file_catalogue_1 = require("@cobol-ts/file-catalogue");
7
+ const configured_file_1 = require("./configured.file");
12
8
  const projection_json_1 = require("./projection.json");
13
9
  function validateOptions(options) {
14
10
  const diagnostics = [];
15
11
  if (!options.logicalName.trim())
16
12
  diagnostics.push('Display logical name must not be empty');
17
- if (options.count !== undefined && (!Number.isSafeInteger(options.count) || options.count < 1)) {
13
+ if (options.count !== undefined && (!Number.isSafeInteger(options.count) || options.count < 1))
18
14
  diagnostics.push('Display count must be a positive integer');
19
- }
20
- if (options.skip !== undefined && (!Number.isSafeInteger(options.skip) || options.skip < 0)) {
15
+ if (options.skip !== undefined && (!Number.isSafeInteger(options.skip) || options.skip < 0))
21
16
  diagnostics.push('Display skip must be a nonnegative integer');
22
- }
23
17
  if (options.all && options.count !== undefined)
24
18
  diagnostics.push('Display --all and --count cannot be combined');
25
19
  return diagnostics;
26
20
  }
27
- /**
28
- * Resolve the configured input and create a one-pass JSONL stream. Neither
29
- * generation.yaml nor generated TypeScript participates in this operation.
30
- */
21
+ /** Produce JSONL only at the display boundary. CEL calls openConfiguredCobolFile directly. */
31
22
  async function openFileDisplay(options, files = files_1.nodeTextFiles) {
32
23
  const invalid = validateOptions(options);
33
24
  if (invalid.length)
34
25
  return { errors: [...invalid] };
35
- const directory = (0, node_path_1.resolve)(options.configDirectory);
36
- const catalogueFilename = (0, node_path_1.resolve)(directory, options.catalogue ?? 'files.yaml');
37
- const catalogue = await (0, file_catalogue_1.readFileCatalogue)(files, catalogueFilename);
38
- if ('errors' in catalogue)
39
- return catalogue;
40
- const definition = catalogue.value.files[options.logicalName];
41
- if (!definition)
42
- return { errors: [`Unknown logical file ${JSON.stringify(options.logicalName)}`] };
43
- if (definition.type !== 'cobol') {
44
- return { errors: [`Display of ${JSON.stringify(options.logicalName)}: Format ${JSON.stringify(definition.type)} is not yet supported`] };
45
- }
46
- const sourceRoot = (0, node_path_1.resolve)(directory, catalogue.value.root);
47
- if ((0, node_path_1.isAbsolute)(definition.copybook) || node_path_1.win32.isAbsolute(definition.copybook)) {
48
- return { errors: [`Copybook for ${options.logicalName}: Expected a relative filename`] };
49
- }
50
- const sourcePath = (0, node_path_1.resolve)(sourceRoot, definition.copybook);
51
- const suffix = (0, node_path_1.relative)(sourceRoot, sourcePath);
52
- if (!suffix || suffix === '..' || suffix.startsWith('../') || suffix.startsWith('..\\')) {
53
- return { errors: [`Copybook for ${options.logicalName}: Path escapes source root`] };
54
- }
55
- // The configuration's source-root escape rules are shared with the manifest resolver.
56
- const resolvedFile = await readDataPath(files, options, catalogue.value, directory);
57
- if ('errors' in resolvedFile)
58
- return resolvedFile;
59
- let copybook;
60
- try {
61
- copybook = await files.read(sourcePath);
62
- }
63
- catch (error) {
64
- return { errors: [`Reading copybook for ${options.logicalName} (${sourcePath}): ${error instanceof Error ? error.message : String(error)}`] };
65
- }
66
- const ast = (0, copybook_1.parseCopybook)(copybook);
67
- if ('errors' in ast)
68
- return ast;
69
- const projected = (0, default_projection_typescript_1.createDefaultProjection)(ast.value);
70
- if ('errors' in projected)
71
- return projected;
72
- const model = projected.value;
73
- const framing = definition.options?.framing;
74
- // Runtime's ProjectionDefinition<T> encodes the same tree. Here the
75
- // generated-interface type is intentionally not part of the display pipeline.
76
- const runtimeProjection = (0, cursor_projection_1.canonicalProjection)(model);
77
- const filename = resolvedFile.value;
26
+ const opened = await (0, configured_file_1.openConfiguredCobolFile)(options, files);
27
+ if ('errors' in opened)
28
+ return opened;
29
+ const source = opened.value;
78
30
  const count = options.all ? undefined : (options.count ?? 10);
79
31
  const skip = options.skip ?? 0;
80
32
  async function* lines() {
81
33
  let visited = 0;
82
34
  let emitted = 0;
83
- for await (const record of (0, cobol_file_node_1.readCobolFile)({
84
- filename, copybook: sourcePath, projection: runtimeProjection,
85
- ...(framing ? { framing } : {}),
86
- ...(options.bufferSize ? { bufferSize: options.bufferSize } : {})
35
+ for await (const record of (0, cursor_loader_cobol_1.readCobolFile)({
36
+ filename: source.filename, copybook: source.copybook,
37
+ projection: source.runtimeProjection,
38
+ ...(source.framing ? { framing: source.framing } : {}),
39
+ ...(source.bufferSize ? { bufferSize: source.bufferSize } : {})
87
40
  })) {
88
41
  try {
89
42
  visited++;
@@ -91,7 +44,7 @@ async function openFileDisplay(options, files = files_1.nodeTextFiles) {
91
44
  continue;
92
45
  let json;
93
46
  try {
94
- json = JSON.stringify((0, projection_json_1.projectionToJson)(model, record.result));
47
+ json = JSON.stringify((0, projection_json_1.projectionToJson)(source.projection, record.result));
95
48
  }
96
49
  catch (error) {
97
50
  throw new Error(`Displaying ${options.logicalName}, record ${visited}: ${error instanceof Error ? error.message : String(error)}`);
@@ -106,22 +59,6 @@ async function openFileDisplay(options, files = files_1.nodeTextFiles) {
106
59
  return;
107
60
  }
108
61
  }
109
- return (0, errors_1.value)({ filename, lines: lines() });
110
- }
111
- async function readDataPath(files, options, catalogue, directory) {
112
- if (options.input !== undefined) {
113
- if (!options.input.trim())
114
- return { errors: ['Display input filename must not be empty'] };
115
- return (0, errors_1.value)((0, node_path_1.resolve)(options.input));
116
- }
117
- const dataFilename = (0, node_path_1.resolve)(directory, options.data ?? 'data.yaml');
118
- const data = await (0, file_catalogue_1.readDataFileConfiguration)(files, dataFilename);
119
- if ('errors' in data)
120
- return data;
121
- const resolved = (0, file_catalogue_1.resolveDataFiles)(catalogue, data.value, directory);
122
- if ('errors' in resolved)
123
- return resolved;
124
- const found = resolved.value.find(entry => entry.logicalName === options.logicalName);
125
- return found ? (0, errors_1.value)(found.filename) : { errors: [`No data file configured for ${JSON.stringify(options.logicalName)} in ${dataFilename}`] };
62
+ return (0, errors_1.value)({ filename: source.filename, lines: lines() });
126
63
  }
127
64
  //# sourceMappingURL=file.display.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.display.js","sourceRoot":"","sources":["../../src/file.display.ts"],"names":[],"mappings":";;AAsDA,0CAuEC;AA7HD,yCAA8D;AAE9D,2CAA6C;AAC7C,iDAAgD;AAChD,2FAA+E;AAC/E,mEAA+D;AAG/D,uFAA+E;AAC/E,6CAAqD;AACrD,6DAGiC;AACjC,uDAAkD;AAuBlD,SAAS,eAAe,CAAC,OAAuB;IAC5C,MAAM,WAAW,GAAa,EAAE,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,WAAW,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAA;IAC3F,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7F,WAAW,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAA;IAChE,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1F,WAAW,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAA;IAClE,CAAC;IACD,IA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CAAC,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAE,MAAM,CAAC,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC,EAAE,CAAC;YACD,IAAI,CAAC;gBACD,OAAO,EAAE,CAAA;gBACT,IAAI,OAAO,IAAI,IAAI;oBAAE,SAAQ;gBAC7B,IAAI,IAAY,CAAA;gBAChB,IAAI,CAAC;oBAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,kCAAgB,EAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;gBAAC,CAAC;gBACjF,OAAO,KAAK,EAAE,CAAC;oBACX,MAAM,IAAI,KAAK,CAAC,cAAc,OAAO,CAAC,WAAW,YAAY,OAAO,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;gBACtI,CAAC;gBACD,OAAO,EAAE,CAAA;gBACT,MAAM,IAAI,CAAA;YACd,CAAC;oBAAS,CAAC;gBAAC,MAAM,CAAC,KAAK,EAAE,CAAA;YAAC,CAAC;YAC5B,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK;gBAAE,OAAM;QACvD,CAAC;IACL,CAAC;IACD,OAAO,IAAA,cAAK,EAAC,EAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC,CAAC,CAAA;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cobol-ts/file-display",
3
3
  "description": "Stream JSONL from configured COBOL data files using an in-memory default projection",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index",
7
7
  "browserslist": {
@@ -17,14 +17,16 @@
17
17
  ]
18
18
  },
19
19
  "dependencies": {
20
- "@cobol-ts/files": "0.0.6",
21
- "@cobol-ts/errors": "0.0.6",
22
- "@cobol-ts/file-catalogue": "0.0.6",
23
- "@cobol-ts/copybook": "0.0.6",
24
- "@cobol-ts/default-projection-typescript": "0.0.6",
25
- "@cobol-ts/cursor-loader-types": "0.0.6",
26
- "@cobol-ts/cursor-loader-cobol": "0.0.6",
27
- "@cobol-ts/cursor-projection": "0.0.6"
20
+ "@cobol-ts/files": "0.0.8",
21
+ "@cobol-ts/errors": "0.0.8",
22
+ "@cobol-ts/file-catalogue": "0.0.8",
23
+ "@cobol-ts/copybook": "0.0.8",
24
+ "@cobol-ts/default-projection-typescript": "0.0.8",
25
+ "@cobol-ts/cursor-loader-types": "0.0.8",
26
+ "@cobol-ts/cursor-loader-cobol": "0.0.8",
27
+ "@cobol-ts/cursor-projection": "0.0.8",
28
+ "@cobol-ts/yaml": "0.0.8",
29
+ "@cobol-ts/yaml-jsyaml": "0.0.8"
28
30
  },
29
31
  "devDependencies": {
30
32
  "typescript": "^5.2.2",