planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

3
node_modules/resolve-protobuf-schema/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.10"

21
node_modules/resolve-protobuf-schema/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Mathias Buus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

49
node_modules/resolve-protobuf-schema/README.md generated vendored Normal file
View File

@@ -0,0 +1,49 @@
# resolve-protobuf-schema
Read a protobuf schema from the disk, parse it and resolve all imports
```
npm install resolve-protobuf-schema
```
[![build status](http://img.shields.io/travis/mafintosh/resolve-protobuf-schema.svg?style=flat)](http://travis-ci.org/mafintosh/resolve-protobuf-schema)
## Usage
Store the following example protobuf schema in `test.proto`
```
message Test {
optional string test = 1;
}
```
Then run
``` js
var resolve = require('resolve-protobuf-schema')
console.log(resolve.sync('test.proto')) // prints the parsed schema
```
Schema imports will resolved as well
```
import "./test.proto"
message AnotherTest {
optional string test = 1;
}
```
``` js
console.log(resolve.sync('./another-test.proto')) // will print a combined parsed schema
```
## API
* `resolve(path, cb)` read and resolve a schema
* `resolve.sync(path)` sync version of `resolve`
## License
MIT

50
node_modules/resolve-protobuf-schema/index.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
var schema = require('protocol-buffers-schema')
var fs = require('fs')
var path = require('path')
var merge = function(a, b) {
a.messages = a.messages.concat(b.messages)
a.enums = a.enums.concat(b.enums)
return a
}
var readSync = function(filename) {
if (!/\.proto$/i.test(filename) && !fs.existsSync(filename)) filename += '.proto'
var sch = schema(fs.readFileSync(filename, 'utf-8'))
var imports = [].concat(sch.imports || [])
imports.forEach(function(i) {
sch = merge(sch, readSync(path.resolve(path.dirname(filename), i)))
})
return sch
}
var read = function(filename, cb) {
fs.exists(filename, function(exists) {
if (!exists && !/\.proto$/i.test(filename)) filename += '.proto'
fs.readFile(filename, 'utf-8', function(err, proto) {
if (err) return cb(err)
var sch = schema(proto)
var imports = [].concat(sch.imports || [])
var loop = function() {
if (!imports.length) return cb(null, sch)
read(path.resolve(path.dirname(filename), imports.shift()), function(err, ch) {
if (err) return cb(err)
sch = merge(sch, ch)
loop()
})
}
loop()
})
})
}
module.exports = read
module.exports.sync = readSync

25
node_modules/resolve-protobuf-schema/package.json generated vendored Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "resolve-protobuf-schema",
"version": "2.1.0",
"description": "Read a protobuf schema from the disk, parse it and resolve all imports",
"main": "index.js",
"dependencies": {
"protocol-buffers-schema": "^3.3.1"
},
"devDependencies": {
"tape": "^3.0.0"
},
"scripts": {
"test": "tape test/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/mafintosh/resolve-protobuf-schema.git"
},
"author": "Mathias Buus (@mafintosh)",
"license": "MIT",
"bugs": {
"url": "https://github.com/mafintosh/resolve-protobuf-schema/issues"
},
"homepage": "https://github.com/mafintosh/resolve-protobuf-schema"
}

5
node_modules/resolve-protobuf-schema/test/a.proto generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import "./b.proto";
message A {
optional string a = 1;
}

5
node_modules/resolve-protobuf-schema/test/b.proto generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import "./c.proto";
message B {
optional string b = 1;
}

3
node_modules/resolve-protobuf-schema/test/c.proto generated vendored Normal file
View File

@@ -0,0 +1,3 @@
message C {
optional string c = 1;
}

49
node_modules/resolve-protobuf-schema/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
var tape = require('tape')
var schema = require('../')
var test = function(name, fn) {
tape(name, function(t) {
fn(t, schema)
})
tape(name+' sync', function(t) {
fn(t, function(name, cb) {
cb(null, schema.sync(name))
})
})
}
test('c', function(t, schema) {
schema(__dirname+'/c.proto', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 1)
schema(__dirname+'/c', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 1)
t.end()
})
})
})
test('b imports c', function(t, schema) {
schema(__dirname+'/b.proto', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 2)
schema(__dirname+'/b', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 2)
t.end()
})
})
})
test('a imports b imports c', function(t, schema) {
schema(__dirname+'/a.proto', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 3)
schema(__dirname+'/a', function(err, sch) {
t.notOk(err, 'no err')
t.same(sch.messages.length, 3)
t.end()
})
})
})