44// ...
55"use strict" ;
66
7+ var protobuf = require ( ".." ) ;
8+
79/**
810 * Descriptor extension.
911 * @namespace
12+ * @property {Type } FileDescriptorSet Descriptor set describing a root
13+ * @property {Type } DescriptorProto Descriptor describing a type
14+ * @property {Type } FieldDescriptorProto Descriptor describing a field
1015 */
11- var descriptor = exports ;
12-
13- var protobuf = require ( ".." ) ;
16+ var descriptor = module . exports = protobuf . Root . fromJSON ( require ( "../google/protobuf/descriptor.json" ) ) . lookup ( ".google.protobuf" ) ;
1417
15- var root = protobuf . Root . fromJSON ( require ( "../google/protobuf/descriptor.json" ) ) . resolveAll ( ) ,
16- Root = protobuf . Root ,
18+ var Root = protobuf . Root ,
1719 Type = protobuf . Type ,
1820 Field = protobuf . Field ;
1921
20- // Root
22+ var FileDescriptorSet = descriptor . FileDescriptorSet ,
23+ DescriptorProto = descriptor . DescriptorProto ,
24+ FieldDescriptorProto = descriptor . FieldDescriptorProto ;
2125
22- /**
23- * FileDescriptorSet describing a root.
24- * @type {Type }
25- */
26- descriptor . FileDescriptorSet = root . lookupType ( ".google.protobuf.FileDescriptorSet" ) ;
26+ // Root
2727
2828/**
2929 * Creates a root from a descriptor set.
@@ -44,12 +44,6 @@ protobuf.Root.prototype.toDescriptor = function toDescriptorSet() {
4444
4545// Type
4646
47- /**
48- * DescriptorProto describing a type.
49- * @type {Type }
50- */
51- descriptor . DescriptorProto = root . lookupType ( ".google.protobuf.DescriptorProto" ) ;
52-
5347/**
5448 * Creates a type from a descriptor.
5549 * @param {DescriptorProto|Reader|Uint8Array } descriptor Descriptor
@@ -82,12 +76,6 @@ protobuf.Type.prototype.toDescriptor = function toDescriptor() {
8276
8377// Field
8478
85- /**
86- * FieldDescriptorProto describing a field.
87- * @type {Type }
88- */
89- descriptor . FieldDescriptorProto = root . lookupType ( ".google.protobuf.FieldDescriptorProto" ) ;
90-
9179/**
9280 * Creates a field from a descriptor.
9381 * @param {FieldDescriptorProto|Reader|Uint8Array } descriptor Descriptor
@@ -104,5 +92,3 @@ protobuf.Field.fromDescriptor = function fromDescriptor(descriptor) {
10492protobuf . Field . prototype . toDescriptor = function toDescriptor ( ) {
10593 throw Error ( "not implemented" ) ;
10694} ;
107-
108- // etc.
0 commit comments