@tabnas/proto 0.6.3 → 0.6.4
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/proto-grammar.json +15781 -0
- package/dist/proto.d.ts +2 -5
- package/dist/proto.js +23 -27
- package/dist/proto.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/proto-grammar.json +15781 -0
- package/src/proto.ts +24 -30
package/dist/proto.d.ts
CHANGED
|
@@ -5,16 +5,13 @@ export interface ProtoOptions {
|
|
|
5
5
|
version: null | ProtoVersion;
|
|
6
6
|
reconcile: boolean;
|
|
7
7
|
}
|
|
8
|
-
type AnyTabnas = Tabnas & {
|
|
9
|
-
abnf?: Function;
|
|
10
|
-
};
|
|
11
8
|
declare const Proto: {
|
|
12
|
-
(tn:
|
|
9
|
+
(tn: Tabnas, options?: Partial<ProtoOptions>): void;
|
|
13
10
|
defaults: ProtoOptions;
|
|
14
11
|
};
|
|
15
12
|
declare function toDescriptor(cst: any, options?: Partial<ProtoOptions>): FileDescriptorProto;
|
|
16
13
|
declare function parse(src: string, options?: Partial<ProtoOptions>): FileDescriptorProto;
|
|
17
|
-
declare const VERSION = "0.6.
|
|
14
|
+
declare const VERSION = "0.6.4";
|
|
18
15
|
export { Proto, parse, toDescriptor, VERSION };
|
|
19
16
|
export type { ProtoVersion };
|
|
20
17
|
export * from './descriptor';
|
package/dist/proto.js
CHANGED
|
@@ -14,6 +14,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
14
14
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
17
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
21
|
exports.VERSION = exports.Proto = void 0;
|
|
19
22
|
exports.parse = parse;
|
|
@@ -23,39 +26,32 @@ exports.toDescriptor = toDescriptor;
|
|
|
23
26
|
// JSON. The version is auto-detected from the file's `syntax`/`edition`
|
|
24
27
|
// declaration and/or supplied via the `version` option.
|
|
25
28
|
const parser_1 = require("@tabnas/parser");
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
// The grammar, compiled at build time from proto-grammar/*.abnf by `npm
|
|
30
|
+
// run gen-grammar` (gen-grammar.js). Generated: never edit it.
|
|
31
|
+
const proto_grammar_json_1 = __importDefault(require("./proto-grammar.json"));
|
|
28
32
|
const build_descriptor_1 = require("./build-descriptor");
|
|
29
33
|
const aggregate_1 = require("./aggregate");
|
|
30
34
|
const detect_version_1 = require("./detect-version");
|
|
35
|
+
// The engine's GrammarSpec type describes a match token as a RegExp; the
|
|
36
|
+
// serialized form carries it as an `@~/…/` string, which `tn.grammar()`
|
|
37
|
+
// resolves on install. Hence the cast.
|
|
38
|
+
const COMPILED = proto_grammar_json_1.default;
|
|
31
39
|
// The Tabnas plugin: installs the union proto grammar so the engine can
|
|
32
40
|
// parse `.proto` source into a `{rule, src, kids}` CST. Use the exported
|
|
33
41
|
// `parse()` / `toDescriptor()` to turn that CST into a FileDescriptorProto.
|
|
34
42
|
const Proto = ((tn, _options) => {
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
// `wordKeywords` makes a keyword match as a whole word; `tokenClasses`
|
|
49
|
-
// compiles `ident` (an identifier or any keyword) to one engine token
|
|
50
|
-
// set, so a lookahead position peeks it as one token rather than one
|
|
51
|
-
// alternate per keyword. Both are required: see AGENTS.md.
|
|
52
|
-
;
|
|
53
|
-
tn.abnf(grammar_1.grammarText, {
|
|
54
|
-
tag: 'proto',
|
|
55
|
-
start: 'proto',
|
|
56
|
-
wordKeywords: true,
|
|
57
|
-
tokenClasses: true,
|
|
58
|
-
});
|
|
43
|
+
// The union grammar, compiled. gen-grammar.js ran @tabnas/abnf over the
|
|
44
|
+
// union text (src/grammar.ts) at build time, with the options this
|
|
45
|
+
// plugin used to pass at every install: `wordKeywords` makes a keyword
|
|
46
|
+
// match as a whole word, and `tokenClasses` compiles `ident` (an
|
|
47
|
+
// identifier or any keyword) to one engine token set, so a lookahead
|
|
48
|
+
// position peeks it as one token rather than one alternate per keyword;
|
|
49
|
+
// both are required (see AGENTS.md). The compiler wrote the CST
|
|
50
|
+
// builders as the engine's own `@node$` / `@capture$` / `@bubble$`
|
|
51
|
+
// builtins, so the file is pure data and installing it loads no
|
|
52
|
+
// compiler. The engine installs a copy: the imported object is shared,
|
|
53
|
+
// and nothing writes to it.
|
|
54
|
+
tn.grammar(COMPILED);
|
|
59
55
|
// An aggregate value (`option (f) = { a: 1 };`) is recorded as the text
|
|
60
56
|
// between its braces, which the CST's `src` does not keep: the lexer
|
|
61
57
|
// drops whitespace and comments. This action reads it from the source
|
|
@@ -85,7 +81,7 @@ function parse(src, options) {
|
|
|
85
81
|
// VERSION is this package's version. It MUST equal package.json "version":
|
|
86
82
|
// the release orchestrator rewrites both, and test/version.test.ts fails the
|
|
87
83
|
// build if they drift. Mirrors `const VERSION` in go/proto.go.
|
|
88
|
-
const VERSION = '0.6.
|
|
84
|
+
const VERSION = '0.6.4';
|
|
89
85
|
exports.VERSION = VERSION;
|
|
90
86
|
__exportStar(require("./descriptor"), exports);
|
|
91
87
|
//# sourceMappingURL=proto.js.map
|
package/dist/proto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proto.js","sourceRoot":"","sources":["../src/proto.ts"],"names":[],"mappings":";AAAA,2EAA2E
|
|
1
|
+
{"version":3,"file":"proto.js","sourceRoot":"","sources":["../src/proto.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C,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;IACpD,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAClB,OAAO,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC;AAED,2EAA2E;AAC3E,6EAA6E;AAC7E,+DAA+D;AAC/D,MAAM,OAAO,GAAG,OAAO,CAAA;QAEc,OAAO;AAE5C,+CAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"7.0.2","root":["../src/aggregate.ts","../src/build-descriptor.ts","../src/descriptor.ts","../src/detect-version.ts","../src/grammar.ts","../src/proto.ts"],"packageJsons":["../node_modules/@tabnas/
|
|
1
|
+
{"version":"7.0.2","root":["../src/aggregate.ts","../src/build-descriptor.ts","../src/descriptor.ts","../src/detect-version.ts","../src/grammar.ts","../src/proto.ts"],"packageJsons":["../node_modules/@tabnas/parser/package.json","../package.json"],"missingPackageJsons":["../node_modules/@tabnas/parser/dist/package.json"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tabnas/proto",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
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
5
|
"main": "dist/proto.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"pretest-watch": "npm run build",
|
|
33
33
|
"test-watch": "node --test --watch dist-test/proto.test.js",
|
|
34
34
|
"embed": "node embed-grammar.js",
|
|
35
|
+
"gen-grammar": "node gen-grammar.js",
|
|
35
36
|
"example": "node examples/wire-poc/demo.js",
|
|
36
37
|
"preexample-test": "npm run build",
|
|
37
38
|
"example-test": "node --test examples/wire-poc/codec.test.js",
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
"LICENSE"
|
|
55
56
|
],
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"@tabnas/abnf": ">=0.4.16",
|
|
58
58
|
"@tabnas/parser": ">=0.12.8"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|