@mochabug/adaptkit 1.0.0-rc.5 → 1.0.0-rc.8
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/bin/index.js +31 -2
- package/bin/index.js.map +2 -2
- package/bin/publish.d.ts.map +1 -1
- package/package.json +4 -4
package/bin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// <define:__PACKAGE_JSON__>
|
|
4
|
-
var define_PACKAGE_JSON_default = { name: "@mochabug/adaptkit", version: "1.0.0-rc.
|
|
4
|
+
var define_PACKAGE_JSON_default = { name: "@mochabug/adaptkit", version: "1.0.0-rc.8" };
|
|
5
5
|
|
|
6
6
|
// node_modules/@bufbuild/protobuf/dist/esm/is-message.js
|
|
7
7
|
function isMessage(arg, schema) {
|
|
@@ -5417,6 +5417,35 @@ function isPathSafe(filePath) {
|
|
|
5417
5417
|
}
|
|
5418
5418
|
async function sendPlugin(opts) {
|
|
5419
5419
|
const lookup = {};
|
|
5420
|
+
async function createMetadataRequest(filePath) {
|
|
5421
|
+
if (!filePath || lookup[filePath]) {
|
|
5422
|
+
return;
|
|
5423
|
+
}
|
|
5424
|
+
if (!isPathSafe(filePath)) {
|
|
5425
|
+
throw new Error(
|
|
5426
|
+
`The file path is not safe: ${filePath}. It must be contained inside the manifest folder. Invalid manifest`
|
|
5427
|
+
);
|
|
5428
|
+
}
|
|
5429
|
+
if (!fs4.existsSync(filePath)) {
|
|
5430
|
+
throw new Error(
|
|
5431
|
+
`The path does not exists: ${filePath}. Invalid manifest`
|
|
5432
|
+
);
|
|
5433
|
+
}
|
|
5434
|
+
const buffer = fs4.readFileSync(filePath, "utf-8");
|
|
5435
|
+
lookup[filePath] = true;
|
|
5436
|
+
return create(UploadPluginRequestSchema, {
|
|
5437
|
+
data: {
|
|
5438
|
+
case: "file",
|
|
5439
|
+
value: {
|
|
5440
|
+
data: toBinary(
|
|
5441
|
+
VertexConfigMetadataSchema,
|
|
5442
|
+
fromJsonString(VertexConfigMetadataSchema, buffer)
|
|
5443
|
+
),
|
|
5444
|
+
name: filePath
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
});
|
|
5448
|
+
}
|
|
5420
5449
|
async function createFileRequest(filePath, imgOpts) {
|
|
5421
5450
|
if (!filePath || lookup[filePath]) {
|
|
5422
5451
|
return;
|
|
@@ -5488,7 +5517,7 @@ async function sendPlugin(opts) {
|
|
|
5488
5517
|
}
|
|
5489
5518
|
for (let vertex of opts.manifest.vertices) {
|
|
5490
5519
|
files.push(createFileRequest(vertex.logo, [40, 40]));
|
|
5491
|
-
files.push(
|
|
5520
|
+
files.push(createMetadataRequest(vertex.metadata));
|
|
5492
5521
|
if (vertex.config) {
|
|
5493
5522
|
files.push(createFileRequest(vertex.config));
|
|
5494
5523
|
}
|