@tabnas/proto 0.1.0

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.
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /* Copyright (c) 2026 Richard Rodger and other contributors, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.declaredVersion = declaredVersion;
5
+ exports.resolveVersion = resolveVersion;
6
+ exports.isEdition = isEdition;
7
+ exports.editionEnum = editionEnum;
8
+ const SYNTAX_VERSIONS = new Set(['proto2', 'proto3']);
9
+ const EDITION_VERSIONS = new Set(['2023', '2024']);
10
+ // Pull the declared version out of a `syntaxOrEdition` CST node, or null
11
+ // if the file has no leading `syntax`/`edition` declaration. The node's
12
+ // `src` is whitespace-stripped, e.g. `syntax="proto3";` or `edition="2023";`.
13
+ function declaredVersion(syntaxNode) {
14
+ if (!syntaxNode || 'string' !== typeof syntaxNode.src)
15
+ return null;
16
+ const m = syntaxNode.src.match(/^(syntax|edition)=["']([^"']+)["']/);
17
+ if (!m)
18
+ return null;
19
+ const value = m[2];
20
+ if (SYNTAX_VERSIONS.has(value) || EDITION_VERSIONS.has(value)) {
21
+ return value;
22
+ }
23
+ throw new Error(`proto: unknown ${m[1]} version "${value}"`);
24
+ }
25
+ // Reconcile the version declared in the source with the version supplied
26
+ // via the plugin option. With `reconcile` true (the default) a mismatch is
27
+ // an error; otherwise the declaration wins when present. Falls back to
28
+ // proto2 (protoc's default for a file with no declaration and no option).
29
+ function resolveVersion(declared, option, reconcile) {
30
+ if (null != declared && null != option && declared !== option) {
31
+ if (reconcile) {
32
+ throw new Error(`proto: version mismatch — option "${option}" but the file ` +
33
+ `declares "${declared}". Set reconcile:false to let the file win.`);
34
+ }
35
+ return declared;
36
+ }
37
+ return declared ?? option ?? 'proto2';
38
+ }
39
+ function isEdition(v) {
40
+ return EDITION_VERSIONS.has(v);
41
+ }
42
+ // FileDescriptorProto records syntax files via `syntax` and edition files
43
+ // via `edition` (as `EDITION_2023` / `EDITION_2024`).
44
+ function editionEnum(v) {
45
+ return 'EDITION_' + v;
46
+ }
47
+ //# sourceMappingURL=detect-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-version.js","sourceRoot":"","sources":["../src/detect-version.ts"],"names":[],"mappings":";AAAA,2EAA2E;;AAY3E,0CASC;AAMD,wCAeC;AAED,8BAEC;AAID,kCAEC;AA9CD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;AACrD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAElD,yEAAyE;AACzE,wEAAwE;AACxE,8EAA8E;AAC9E,SAAgB,eAAe,CAAC,UAAe;IAC7C,IAAI,CAAC,UAAU,IAAI,QAAQ,KAAK,OAAO,UAAU,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IAClE,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACpE,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACnB,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAClB,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9D,OAAO,KAAqB,CAAA;IAC9B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,GAAG,CAAC,CAAA;AAC9D,CAAC;AAED,yEAAyE;AACzE,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,SAAgB,cAAc,CAC5B,QAA6B,EAC7B,MAA2B,EAC3B,SAAkB;IAElB,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,MAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC9D,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,qCAAqC,MAAM,iBAAiB;gBAC5D,aAAa,QAAQ,6CAA6C,CACnE,CAAA;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,OAAO,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAA;AACvC,CAAC;AAED,SAAgB,SAAS,CAAC,CAAe;IACvC,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC;AAED,0EAA0E;AAC1E,sDAAsD;AACtD,SAAgB,WAAW,CAAC,CAAe;IACzC,OAAO,UAAU,GAAG,CAAC,CAAA;AACvB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const grammarText = "\n; ===== common.abnf =====\n; @tabnas/proto \u2014 Protocol Buffers .proto IDL, common (union base).\n; Structure only; lexical atoms are the engine's whole-word tokens:\n; TX = identifier NR = number ST = string VL = true/false/null\n; Whitespace and // and /* */ comments are ignored by the lexer.\n; The grammar is a permissive superset of proto2 / proto3 / editions;\n; version-specific legality is enforced in the descriptor walk.\n\nproto = [ syntaxOrEdition ] *topLevelDef\n\nsyntaxOrEdition = \"syntax\" \"=\" strLit \";\"\n\ntopLevelDef = importStmt / packageStmt / optionStmt / message / enumDef\n / service / extendStmt / emptyStmt\n\nimportStmt = \"import\" [ \"weak\" / \"public\" ] strLit \";\"\npackageStmt = \"package\" fullIdent \";\"\n\noptionStmt = \"option\" optionName \"=\" constant \";\"\noptionName = optionNamePart *( \".\" optionNamePart )\noptionNamePart = ident / \"(\" [ \".\" ] fullIdent \")\"\n\nmessage = \"message\" ident messageBody\nmessageBody = \"{\" *messageElement \"}\"\nmessageElement = field / enumDef / message / optionStmt / oneof / mapField\n / extendStmt / extensions / reserved / emptyStmt\n\nfield = [ label ] fieldType ident \"=\" fieldNumber [ fieldOptions ] \";\"\nlabel = \"required\" / \"optional\" / \"repeated\"\nfieldType = messageType\nfieldNumber = NR\nfieldOptions = \"[\" fieldOption *( \",\" fieldOption ) \"]\"\nfieldOption = optionName \"=\" constant\n\noneof = \"oneof\" ident \"{\" *oneofElement \"}\"\noneofElement = optionStmt / oneofField / emptyStmt\noneofField = fieldType ident \"=\" fieldNumber [ fieldOptions ] \";\"\n\nmapField = \"map\" \"<\" fieldType \",\" fieldType \">\" ident \"=\" fieldNumber\n [ fieldOptions ] \";\"\n\nenumDef = \"enum\" ident \"{\" *enumElement \"}\"\nenumElement = optionStmt / enumField / reserved / emptyStmt\nenumField = ident \"=\" [ \"-\" ] fieldNumber [ fieldOptions ] \";\"\n\nservice = \"service\" ident \"{\" *serviceElement \"}\"\nserviceElement = optionStmt / rpc / emptyStmt\nrpc = \"rpc\" ident \"(\" [ \"stream\" ] messageType \")\"\n \"returns\" \"(\" [ \"stream\" ] messageType \")\"\n ( \";\" / \"{\" *( optionStmt / emptyStmt ) \"}\" )\n\nextendStmt = \"extend\" messageType \"{\" *( field / emptyStmt ) \"}\"\nextensions = \"extensions\" ranges [ fieldOptions ] \";\"\nreserved = \"reserved\" ( ranges / fieldNames ) \";\"\nranges = range *( \",\" range )\nrange = NR [ \"to\" ( NR / \"max\" ) ]\nfieldNames = strLit *( \",\" strLit )\n\nconstant = boolLit / fullIdent / signedNumber / strLit / messageValue\nsignedNumber = [ \"-\" / \"+\" ] NR\nboolLit = VL\nmessageValue = \"{\" *messageValueEntry \"}\"\nmessageValueEntry = ident [ \":\" ] constant [ \",\" / \";\" ]\n\nmessageType = [ \".\" ] fullIdent\nfullIdent = ident *( \".\" ident )\nident = TX\nstrLit = ST\nemptyStmt = \";\"\n\n; ===== proto2.abnf =====\n; proto2 deltas: groups are proto2-only (deprecated). Labels (required/\n; optional/repeated), extend, and extensions live in common (the permissive\n; union); the descriptor walk enforces what each version actually allows.\nmessageElement =/ groupField\ngroupField = [ label ] \"group\" ident \"=\" fieldNumber messageBody\n\n; ===== proto3.abnf =====\n; proto3 deltas: none. proto3's surface syntax is the common base\n; (implicit label via the optional [ label ], plus the \"optional\" keyword).\n; Version legality (no required, no group) is enforced in the walk.\n\n; ===== edition-2023.abnf =====\n; edition 2023 deltas: the file may open with an `edition = \"2023\";`\n; declaration instead of `syntax = ...`.\nsyntaxOrEdition =/ editionDecl\neditionDecl = \"edition\" \"=\" strLit \";\"\n\n; ===== edition-2024.abnf =====\n; edition 2024 deltas: `import option \"...\";` and symbol visibility\n; (export / local) on message and enum declarations.\nimportStmt =/ \"import\" \"option\" strLit \";\"\ntopLevelDef =/ symbolVisibility message / symbolVisibility enumDef\nmessageElement =/ symbolVisibility message / symbolVisibility enumDef\nsymbolVisibility = \"export\" / \"local\"\n";
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /* Copyright (c) 2026 Richard Rodger and other contributors, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.grammarText = void 0;
5
+ // GENERATED by embed-grammar.js from proto-grammar/*.abnf — do not edit.
6
+ // Run `npm run embed` after changing any .abnf file.
7
+ exports.grammarText = `
8
+ ; ===== common.abnf =====
9
+ ; @tabnas/proto — Protocol Buffers .proto IDL, common (union base).
10
+ ; Structure only; lexical atoms are the engine's whole-word tokens:
11
+ ; TX = identifier NR = number ST = string VL = true/false/null
12
+ ; Whitespace and // and /* */ comments are ignored by the lexer.
13
+ ; The grammar is a permissive superset of proto2 / proto3 / editions;
14
+ ; version-specific legality is enforced in the descriptor walk.
15
+
16
+ proto = [ syntaxOrEdition ] *topLevelDef
17
+
18
+ syntaxOrEdition = "syntax" "=" strLit ";"
19
+
20
+ topLevelDef = importStmt / packageStmt / optionStmt / message / enumDef
21
+ / service / extendStmt / emptyStmt
22
+
23
+ importStmt = "import" [ "weak" / "public" ] strLit ";"
24
+ packageStmt = "package" fullIdent ";"
25
+
26
+ optionStmt = "option" optionName "=" constant ";"
27
+ optionName = optionNamePart *( "." optionNamePart )
28
+ optionNamePart = ident / "(" [ "." ] fullIdent ")"
29
+
30
+ message = "message" ident messageBody
31
+ messageBody = "{" *messageElement "}"
32
+ messageElement = field / enumDef / message / optionStmt / oneof / mapField
33
+ / extendStmt / extensions / reserved / emptyStmt
34
+
35
+ field = [ label ] fieldType ident "=" fieldNumber [ fieldOptions ] ";"
36
+ label = "required" / "optional" / "repeated"
37
+ fieldType = messageType
38
+ fieldNumber = NR
39
+ fieldOptions = "[" fieldOption *( "," fieldOption ) "]"
40
+ fieldOption = optionName "=" constant
41
+
42
+ oneof = "oneof" ident "{" *oneofElement "}"
43
+ oneofElement = optionStmt / oneofField / emptyStmt
44
+ oneofField = fieldType ident "=" fieldNumber [ fieldOptions ] ";"
45
+
46
+ mapField = "map" "<" fieldType "," fieldType ">" ident "=" fieldNumber
47
+ [ fieldOptions ] ";"
48
+
49
+ enumDef = "enum" ident "{" *enumElement "}"
50
+ enumElement = optionStmt / enumField / reserved / emptyStmt
51
+ enumField = ident "=" [ "-" ] fieldNumber [ fieldOptions ] ";"
52
+
53
+ service = "service" ident "{" *serviceElement "}"
54
+ serviceElement = optionStmt / rpc / emptyStmt
55
+ rpc = "rpc" ident "(" [ "stream" ] messageType ")"
56
+ "returns" "(" [ "stream" ] messageType ")"
57
+ ( ";" / "{" *( optionStmt / emptyStmt ) "}" )
58
+
59
+ extendStmt = "extend" messageType "{" *( field / emptyStmt ) "}"
60
+ extensions = "extensions" ranges [ fieldOptions ] ";"
61
+ reserved = "reserved" ( ranges / fieldNames ) ";"
62
+ ranges = range *( "," range )
63
+ range = NR [ "to" ( NR / "max" ) ]
64
+ fieldNames = strLit *( "," strLit )
65
+
66
+ constant = boolLit / fullIdent / signedNumber / strLit / messageValue
67
+ signedNumber = [ "-" / "+" ] NR
68
+ boolLit = VL
69
+ messageValue = "{" *messageValueEntry "}"
70
+ messageValueEntry = ident [ ":" ] constant [ "," / ";" ]
71
+
72
+ messageType = [ "." ] fullIdent
73
+ fullIdent = ident *( "." ident )
74
+ ident = TX
75
+ strLit = ST
76
+ emptyStmt = ";"
77
+
78
+ ; ===== proto2.abnf =====
79
+ ; proto2 deltas: groups are proto2-only (deprecated). Labels (required/
80
+ ; optional/repeated), extend, and extensions live in common (the permissive
81
+ ; union); the descriptor walk enforces what each version actually allows.
82
+ messageElement =/ groupField
83
+ groupField = [ label ] "group" ident "=" fieldNumber messageBody
84
+
85
+ ; ===== proto3.abnf =====
86
+ ; proto3 deltas: none. proto3's surface syntax is the common base
87
+ ; (implicit label via the optional [ label ], plus the "optional" keyword).
88
+ ; Version legality (no required, no group) is enforced in the walk.
89
+
90
+ ; ===== edition-2023.abnf =====
91
+ ; edition 2023 deltas: the file may open with an \`edition = "2023";\`
92
+ ; declaration instead of \`syntax = ...\`.
93
+ syntaxOrEdition =/ editionDecl
94
+ editionDecl = "edition" "=" strLit ";"
95
+
96
+ ; ===== edition-2024.abnf =====
97
+ ; edition 2024 deltas: \`import option "...";\` and symbol visibility
98
+ ; (export / local) on message and enum declarations.
99
+ importStmt =/ "import" "option" strLit ";"
100
+ topLevelDef =/ symbolVisibility message / symbolVisibility enumDef
101
+ messageElement =/ symbolVisibility message / symbolVisibility enumDef
102
+ symbolVisibility = "export" / "local"
103
+ `;
104
+ //# sourceMappingURL=grammar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grammar.js","sourceRoot":"","sources":["../src/grammar.ts"],"names":[],"mappings":";AAAA,2EAA2E;;;AAE3E,yEAAyE;AACzE,qDAAqD;AAExC,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgG1B,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { Tabnas } from '@tabnas/parser';
2
+ import { ProtoVersion } from './detect-version';
3
+ import { FileDescriptorProto } from './descriptor';
4
+ export interface ProtoOptions {
5
+ version: null | ProtoVersion;
6
+ reconcile: boolean;
7
+ }
8
+ type AnyTabnas = Tabnas & {
9
+ abnf?: Function;
10
+ };
11
+ declare const Proto: {
12
+ (tn: AnyTabnas, options?: Partial<ProtoOptions>): void;
13
+ defaults: ProtoOptions;
14
+ };
15
+ declare function toDescriptor(cst: any, options?: Partial<ProtoOptions>): FileDescriptorProto;
16
+ declare function parse(src: string, options?: Partial<ProtoOptions>): FileDescriptorProto;
17
+ export { Proto, parse, toDescriptor };
18
+ export type { ProtoVersion };
19
+ export * from './descriptor';
package/dist/proto.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /* Copyright (c) 2026 Richard Rodger and other contributors, MIT License */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.Proto = void 0;
19
+ exports.parse = parse;
20
+ exports.toDescriptor = toDescriptor;
21
+ // @tabnas/proto — a Tabnas plugin that parses Protocol Buffers `.proto`
22
+ // IDL (proto2, proto3, edition 2023/2024) into FileDescriptorProto-shaped
23
+ // JSON. The version is auto-detected from the file's `syntax`/`edition`
24
+ // declaration and/or supplied via the `version` option.
25
+ const parser_1 = require("@tabnas/parser");
26
+ const abnf_1 = require("@tabnas/abnf");
27
+ const grammar_1 = require("./grammar");
28
+ const build_descriptor_1 = require("./build-descriptor");
29
+ const detect_version_1 = require("./detect-version");
30
+ // The Tabnas plugin: installs the union proto grammar so the engine can
31
+ // parse `.proto` source into a `{rule, src, kids}` CST. Use the exported
32
+ // `parse()` / `toDescriptor()` to turn that CST into a FileDescriptorProto.
33
+ const Proto = ((tn, _options) => {
34
+ // Proto drives parsing through @tabnas/abnf; ensure it is installed.
35
+ if ('function' !== typeof tn.abnf)
36
+ tn.use(abnf_1.abnf);
37
+ tn.abnf(grammar_1.grammarText, {
38
+ tag: 'proto',
39
+ start: 'proto',
40
+ wordKeywords: true,
41
+ });
42
+ });
43
+ exports.Proto = Proto;
44
+ Proto.defaults = { version: null, reconcile: true };
45
+ // Turn a parsed proto CST into a FileDescriptorProto, resolving the
46
+ // version from the file's declaration and the supplied options.
47
+ function toDescriptor(cst, options) {
48
+ const opts = { ...Proto.defaults, ...(options || {}) };
49
+ const first = (cst && cst.kids ? cst.kids : []).find((k) => k && k.rule);
50
+ const declared = first && 'syntaxOrEdition' === first.rule ? (0, detect_version_1.declaredVersion)(first) : null;
51
+ const version = (0, detect_version_1.resolveVersion)(declared, opts.version, opts.reconcile);
52
+ return (0, build_descriptor_1.buildFile)(cst, version);
53
+ }
54
+ // Convenience: parse a `.proto` source string to a FileDescriptorProto in
55
+ // one call. Builds a fresh engine each time; for repeated parsing reuse an
56
+ // engine via `const j = new Tabnas().use(Proto)` and call
57
+ // `toDescriptor(j.parse(src), opts)`.
58
+ function parse(src, options) {
59
+ const tn = new parser_1.Tabnas({ rewind: { history: 8192 } });
60
+ Proto(tn, options);
61
+ return toDescriptor(tn.parse(src), options);
62
+ }
63
+ __exportStar(require("./descriptor"), exports);
64
+ //# sourceMappingURL=proto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto.js","sourceRoot":"","sources":["../src/proto.ts"],"names":[],"mappings":";AAAA,2EAA2E;;;;;;;;;;;;;;;;;AAmE3D,sBAAK;AAAE,oCAAY;AAjEnC,wEAAwE;AACxE,0EAA0E;AAC1E,wEAAwE;AACxE,wDAAwD;AAExD,2CAAuC;AACvC,uCAAmC;AAEnC,uCAAuC;AACvC,yDAA8C;AAC9C,qDAEyB;AAczB,wEAAwE;AACxE,yEAAyE;AACzE,4EAA4E;AAC5E,MAAM,KAAK,GAAG,CAAC,CAAC,EAAa,EAAE,QAAgC,EAAE,EAAE;IACjE,qEAAqE;IACrE,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC,IAAI;QAAE,EAAE,CAAC,GAAG,CAAC,WAAI,CAAC,CAC9C;IAAC,EAAE,CAAC,IAAiB,CAAC,qBAAW,EAAE;QAClC,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,OAAO;QACd,YAAY,EAAE,IAAI;KACnB,CAAC,CAAA;AACJ,CAAC,CAGA,CAAA;AAyBQ,sBAAK;AAvBd,KAAK,CAAC,QAAQ,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAEnD,oEAAoE;AACpE,gEAAgE;AAChE,SAAS,YAAY,CAAC,GAAQ,EAAE,OAA+B;IAC7D,MAAM,IAAI,GAAiB,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAA;IACpE,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7E,MAAM,QAAQ,GACZ,KAAK,IAAI,iBAAiB,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,gCAAe,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3E,MAAM,OAAO,GAAG,IAAA,+BAAc,EAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACtE,OAAO,IAAA,4BAAS,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAChC,CAAC;AAED,0EAA0E;AAC1E,2EAA2E;AAC3E,0DAA0D;AAC1D,sCAAsC;AACtC,SAAS,KAAK,CAAC,GAAW,EAAE,OAA+B;IACzD,MAAM,EAAE,GAAG,IAAI,eAAM,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAc,CAAA;IACjE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAClB,OAAO,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC;AAID,+CAA4B"}
@@ -0,0 +1 @@
1
+ {"root":["../src/build-descriptor.ts","../src/descriptor.ts","../src/detect-version.ts","../src/grammar.ts","../src/proto.ts"],"version":"6.0.3"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@tabnas/proto",
3
+ "version": "0.1.0",
4
+ "description": "Parse Protocol Buffers .proto IDL (proto2, proto3, edition 2023/2024) into FileDescriptorProto-shaped JSON, using the Tabnas parser and an ABNF grammar.",
5
+ "main": "dist/proto.js",
6
+ "type": "commonjs",
7
+ "types": "dist/proto.d.ts",
8
+ "homepage": "https://github.com/tabnas/proto",
9
+ "keywords": [
10
+ "protobuf",
11
+ "protocol-buffers",
12
+ "proto",
13
+ "proto2",
14
+ "proto3",
15
+ "editions",
16
+ "tabnas",
17
+ "parser",
18
+ "abnf",
19
+ "descriptor"
20
+ ],
21
+ "author": "Richard Rodger (http://richardrodger.com)",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git://github.com/tabnas/proto.git"
25
+ },
26
+ "scripts": {
27
+ "test": "node --enable-source-maps --test \"dist-test/*.test.js\"",
28
+ "test-some": "node --enable-source-maps --test-name-pattern=\"$npm_config_pattern\" --test \"dist-test/*.test.js\"",
29
+ "test-watch": "node --test --watch dist-test/proto.test.js",
30
+ "embed": "node embed-grammar.js",
31
+ "example": "node examples/wire-poc/demo.js",
32
+ "example-test": "node --test examples/wire-poc/codec.test.js",
33
+ "watch": "tsc --build src test -w",
34
+ "build": "node embed-grammar.js && tsc --build src test",
35
+ "clean": "rm -rf node_modules dist dist-test yarn.lock package-lock.json",
36
+ "reset": "npm run clean && npm i && npm run build && npm test",
37
+ "repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;",
38
+ "repo-publish": "npm run clean && npm i && npm run repo-publish-quick",
39
+ "repo-publish-quick": "npm run build && npm run test && npm run repo-tag && npm publish --access public --registry https://registry.npmjs.org "
40
+ },
41
+ "license": "MIT",
42
+ "files": [
43
+ "src",
44
+ "dist",
45
+ "LICENSE"
46
+ ],
47
+ "peerDependencies": {
48
+ "@tabnas/abnf": "^0.2.0",
49
+ "@tabnas/parser": "^0.2.0"
50
+ },
51
+ "devDependencies": {
52
+ "@tabnas/abnf": "file:../../abnf/ts",
53
+ "@tabnas/parser": "^0.2.0",
54
+ "@types/node": "25.6.0",
55
+ "typescript": "6.0.3"
56
+ },
57
+ "engines": {
58
+ "node": ">=24"
59
+ }
60
+ }