Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add rollup config #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions cjs/google.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

var protobuf = require('./google/protobuf.cjs');

/// autogenerated by protoc-plugin-js

exports.protobuf = protobuf;
13 changes: 13 additions & 0 deletions cjs/google/protobuf.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

var NullValue = require('./protobuf/NullValue.cjs');
var Struct = require('./protobuf/Struct.cjs');
var Value = require('./protobuf/Value.cjs');
var ListValue = require('./protobuf/ListValue.cjs');

/// autogenerated by protoc-plugin-js

exports.NullValue = NullValue;
exports.Struct = Struct;
exports.Value = Value;
exports.ListValue = ListValue;
9 changes: 9 additions & 0 deletions cjs/google/protobuf/ListValue.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var encode = require('./ListValue/encode.cjs');
var decode = require('./ListValue/decode.cjs');

/// autogenerated by protoc-plugin-js

exports.encode = encode.encode;
exports.decode = decode.decode;
20 changes: 20 additions & 0 deletions cjs/google/protobuf/ListValue/decode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var reader = require('protobuf-codec/decode/reader');
var decode$1 = require('../Value/decode.cjs');

/// autogenerated by protoc-plugin-js

function decode(buf, byteOffset = 0, byteLength = buf.byteLength) {
const field$values = [];
for (const [field, { data }] of reader(buf, byteOffset, byteLength)) {
switch (field) {
case 1:
field$values.push(decode$1.decode(data));
break
}
}
return { values: field$values }
}

exports.decode = decode;
21 changes: 21 additions & 0 deletions cjs/google/protobuf/ListValue/encode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var Writer = require('protobuf-codec/encode/writer');
var encode$1 = require('../Value/encode.cjs');

/// autogenerated by protoc-plugin-js

function encode(obj = {}, buf, byteOffset = 0) {
const writer = new Writer();

if (obj.values?.length)
obj.values.forEach((v) => writer.bytes(1, encode$1.encode(v)));

return writer.concat(buf, byteOffset)
}

// export function encodingLength (obj) {
// throw new Error('Unimplemented')
// }

exports.encode = encode;
58 changes: 58 additions & 0 deletions cjs/google/protobuf/NullValue.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

var assert = require('nanoassert');
var types = require('protobuf-codec/encode/types');
var types$1 = require('protobuf-codec/decode/types');

/// autogenerated by protoc-plugin-js

const NULL_VALUE = 0;

const enumValues = new Map([[0, 'NULL_VALUE']]);
const enumNames = new Map([['NULL_VALUE', 0]]);

function encode(value, buf, byteOffset = 0) {
if (typeof value === 'string') return encode(parse(value), buf, byteOffset)
if (value == null) throw new Error('Invalid NullValue value (' + value + ')')

return types.enumerable.encode(value, buf, byteOffset)
}

function decode(varint) {
const int = types$1.enumerable(varint);

return stringify(int) ?? int
}

function encodingLength(value) {
if (typeof value === 'string') return encodingLength(parse(value))
assert(value != null, 'Invalid NullValue value (' + value + ')');

if (0 <= value && value <= 0) return 1

// enumerable max value in case of unknown value
return 5
}

/**
* Convert an enum value to it's human readable name.
* Returns undefined on an unknown value.
*/
function stringify(int) {
return enumValues.get(int)
}

/**
* Convert an enum string names to it's machine integer value.
* Returns undefined on an unknown name.
*/
function parse(str) {
return enumNames.get(str)
}

exports.NULL_VALUE = NULL_VALUE;
exports.decode = decode;
exports.encode = encode;
exports.encodingLength = encodingLength;
exports.parse = parse;
exports.stringify = stringify;
11 changes: 11 additions & 0 deletions cjs/google/protobuf/Struct.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

var encode = require('./Struct/encode.cjs');
var decode = require('./Struct/decode.cjs');
var FieldsEntry = require('./Struct/FieldsEntry.cjs');

/// autogenerated by protoc-plugin-js

exports.encode = encode.encode;
exports.decode = decode.decode;
exports.FieldsEntry = FieldsEntry;
9 changes: 9 additions & 0 deletions cjs/google/protobuf/Struct/FieldsEntry.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var encode = require('./FieldsEntry/encode.cjs');
var decode = require('./FieldsEntry/decode.cjs');

/// autogenerated by protoc-plugin-js

exports.encode = encode.encode;
exports.decode = decode.decode;
26 changes: 26 additions & 0 deletions cjs/google/protobuf/Struct/FieldsEntry/decode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

var reader = require('protobuf-codec/decode/reader');
var types = require('protobuf-codec/decode/types');
var decode$1 = require('../../Value/decode.cjs');

/// autogenerated by protoc-plugin-js

function decode(buf, byteOffset = 0, byteLength = buf.byteLength) {
let field$key = '';
let field$value = {};
for (const [field, { data }] of reader(buf, byteOffset, byteLength)) {
switch (field) {
case 1:
field$key = types.string(data);
break

case 2:
field$value = decode$1.decode(data);
break
}
}
return { key: field$key, value: field$value }
}

exports.decode = decode;
22 changes: 22 additions & 0 deletions cjs/google/protobuf/Struct/FieldsEntry/encode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

var Writer = require('protobuf-codec/encode/writer');
var types = require('protobuf-codec/encode/types');
var encode$1 = require('../../Value/encode.cjs');

/// autogenerated by protoc-plugin-js

function encode(obj = {}, buf, byteOffset = 0) {
const writer = new Writer();

if (obj.key) writer.bytes(1, obj.key, types.string);
if (obj.value) writer.bytes(2, encode$1.encode(obj.value));

return writer.concat(buf, byteOffset)
}

// export function encodingLength (obj) {
// throw new Error('Unimplemented')
// }

exports.encode = encode;
20 changes: 20 additions & 0 deletions cjs/google/protobuf/Struct/decode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var reader = require('protobuf-codec/decode/reader');
var decode$1 = require('./FieldsEntry/decode.cjs');

/// autogenerated by protoc-plugin-js

function decode(buf, byteOffset = 0, byteLength = buf.byteLength) {
const field$fields = [];
for (const [field, { data }] of reader(buf, byteOffset, byteLength)) {
switch (field) {
case 1:
field$fields.push(decode$1.decode(data));
break
}
}
return { fields: field$fields }
}

exports.decode = decode;
23 changes: 23 additions & 0 deletions cjs/google/protobuf/Struct/encode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

var Writer = require('protobuf-codec/encode/writer');
var encode$1 = require('./FieldsEntry/encode.cjs');

/// autogenerated by protoc-plugin-js

function encode(obj = {}, buf, byteOffset = 0) {
const writer = new Writer();

if (obj.fields?.length)
obj.fields.forEach((v) =>
writer.bytes(1, encode$1.encode(v))
);

return writer.concat(buf, byteOffset)
}

// export function encodingLength (obj) {
// throw new Error('Unimplemented')
// }

exports.encode = encode;
9 changes: 9 additions & 0 deletions cjs/google/protobuf/Value.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var encode = require('./Value/encode.cjs');
var decode = require('./Value/decode.cjs');

/// autogenerated by protoc-plugin-js

exports.encode = encode.encode;
exports.decode = decode.decode;
43 changes: 43 additions & 0 deletions cjs/google/protobuf/Value/decode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

var reader = require('protobuf-codec/decode/reader');
var types = require('protobuf-codec/decode/types');
var NullValue = require('../NullValue.cjs');
var decode$2 = require('../Struct/decode.cjs');
var decode$1 = require('../ListValue/decode.cjs');

/// autogenerated by protoc-plugin-js

function decode(buf, byteOffset = 0, byteLength = buf.byteLength) {
let field$kind = null;
for (const [field, { data }] of reader(buf, byteOffset, byteLength)) {
switch (field) {
case 1:
field$kind = { nullValue: NullValue.decode(data) };
break

case 2:
field$kind = { numberValue: types.double(data) };
break

case 3:
field$kind = { stringValue: types.string(data) };
break

case 4:
field$kind = { boolValue: types.bool(data) };
break

case 5:
field$kind = { structValue: decode$2.decode(data) };
break

case 6:
field$kind = { listValue: decode$1.decode(data) };
break
}
}
return { kind: field$kind }
}

exports.decode = decode;
44 changes: 44 additions & 0 deletions cjs/google/protobuf/Value/encode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use strict';

var Writer = require('protobuf-codec/encode/writer');
var types = require('protobuf-codec/encode/types');
var NullValue = require('../NullValue.cjs');
var encode$1 = require('../Struct/encode.cjs');
var encode$2 = require('../ListValue/encode.cjs');

/// autogenerated by protoc-plugin-js

function encode(obj = {}, buf, byteOffset = 0) {
const writer = new Writer();

if (obj.kind?.nullValue ?? obj.nullValue)
writer.varint(
1,
obj.kind?.nullValue ?? obj.nullValue,
NullValue
);
if (obj.kind?.numberValue ?? obj.numberValue)
writer.fixed64(2, obj.kind?.numberValue ?? obj.numberValue, types.double);
if (obj.kind?.stringValue ?? obj.stringValue)
writer.bytes(3, obj.kind?.stringValue ?? obj.stringValue, types.string);
if (obj.kind?.boolValue ?? obj.boolValue)
writer.varint(4, obj.kind?.boolValue ?? obj.boolValue, types.bool);
if (obj.kind?.structValue ?? obj.structValue)
writer.bytes(
5,
encode$1.encode(obj.kind?.structValue ?? obj.structValue)
);
if (obj.kind?.listValue ?? obj.listValue)
writer.bytes(
6,
encode$2.encode(obj.kind?.listValue ?? obj.listValue)
);

return writer.concat(buf, byteOffset)
}

// export function encodingLength (obj) {
// throw new Error('Unimplemented')
// }

exports.encode = encode;
9 changes: 9 additions & 0 deletions cjs/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var vega = require('./vega.cjs');
var google = require('./google.cjs');



exports.vega = vega;
exports.google = google;
Loading