@mochabug/adaptkit 1.0.0-rc.1 → 1.0.0-rc.2
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 +13 -71
- package/bin/index.js.map +3 -3
- package/package.json +2 -3
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.2" };
|
|
5
5
|
|
|
6
6
|
// node_modules/@bufbuild/protobuf/dist/esm/is-message.js
|
|
7
7
|
function isMessage(arg, schema) {
|
|
@@ -5399,18 +5399,16 @@ async function waitForConsent(issuerUrl, errorUrl, clientId) {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
|
|
5401
5401
|
// src/publish.ts
|
|
5402
|
+
import { parse } from "@babel/parser";
|
|
5403
|
+
import babelTraverse from "@babel/traverse";
|
|
5404
|
+
import * as t from "@babel/types";
|
|
5402
5405
|
import { ConnectError, createClient } from "@connectrpc/connect";
|
|
5403
5406
|
import { createGrpcTransport } from "@connectrpc/connect-node";
|
|
5404
|
-
import archiver from "archiver";
|
|
5405
5407
|
import chalk5 from "chalk";
|
|
5406
5408
|
import fg2 from "fast-glob";
|
|
5407
5409
|
import fs5 from "fs";
|
|
5408
5410
|
import path4 from "path";
|
|
5409
5411
|
import sharp from "sharp";
|
|
5410
|
-
import { parse } from "@babel/parser";
|
|
5411
|
-
import babelTraverse from "@babel/traverse";
|
|
5412
|
-
import * as t from "@babel/types";
|
|
5413
|
-
import { PassThrough } from "stream";
|
|
5414
5412
|
|
|
5415
5413
|
// src/genproto/google/api/http_pb.ts
|
|
5416
5414
|
var file_google_api_http = /* @__PURE__ */ fileDesc("ChVnb29nbGUvYXBpL2h0dHAucHJvdG8SCmdvb2dsZS5hcGkiVAoESHR0cBIjCgVydWxlcxgBIAMoCzIULmdvb2dsZS5hcGkuSHR0cFJ1bGUSJwofZnVsbHlfZGVjb2RlX3Jlc2VydmVkX2V4cGFuc2lvbhgCIAEoCCKBAgoISHR0cFJ1bGUSEAoIc2VsZWN0b3IYASABKAkSDQoDZ2V0GAIgASgJSAASDQoDcHV0GAMgASgJSAASDgoEcG9zdBgEIAEoCUgAEhAKBmRlbGV0ZRgFIAEoCUgAEg8KBXBhdGNoGAYgASgJSAASLwoGY3VzdG9tGAggASgLMh0uZ29vZ2xlLmFwaS5DdXN0b21IdHRwUGF0dGVybkgAEgwKBGJvZHkYByABKAkSFQoNcmVzcG9uc2VfYm9keRgMIAEoCRIxChNhZGRpdGlvbmFsX2JpbmRpbmdzGAsgAygLMhQuZ29vZ2xlLmFwaS5IdHRwUnVsZUIJCgdwYXR0ZXJuIi8KEUN1c3RvbUh0dHBQYXR0ZXJuEgwKBGtpbmQYASABKAkSDAoEcGF0aBgCIAEoCUJqCg5jb20uZ29vZ2xlLmFwaUIJSHR0cFByb3RvUAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvYXBpL2Fubm90YXRpb25zO2Fubm90YXRpb25z+AEBogIER0FQSWIGcHJvdG8z");
|
|
@@ -5458,54 +5456,6 @@ function isPathSafe(filePath) {
|
|
|
5458
5456
|
const absoluteFilePath = path4.resolve(filePath);
|
|
5459
5457
|
return absoluteFilePath.startsWith(currentWorkingDir);
|
|
5460
5458
|
}
|
|
5461
|
-
function folderExists(folderPath) {
|
|
5462
|
-
try {
|
|
5463
|
-
const absolutePath = path4.resolve(folderPath);
|
|
5464
|
-
if (fs5.existsSync(absolutePath)) {
|
|
5465
|
-
const stats = fs5.statSync(absolutePath);
|
|
5466
|
-
return stats.isDirectory();
|
|
5467
|
-
} else {
|
|
5468
|
-
return false;
|
|
5469
|
-
}
|
|
5470
|
-
} catch (err) {
|
|
5471
|
-
console.error("Error checking if folder exists:", err);
|
|
5472
|
-
return false;
|
|
5473
|
-
}
|
|
5474
|
-
}
|
|
5475
|
-
function createArchive(folder) {
|
|
5476
|
-
return new Promise((resolve, reject) => {
|
|
5477
|
-
if (!folderExists(folder)) {
|
|
5478
|
-
reject(`The folder ${folder} does not exist`);
|
|
5479
|
-
}
|
|
5480
|
-
const archive = archiver("tar", {
|
|
5481
|
-
gzip: true,
|
|
5482
|
-
// Use gzip compression
|
|
5483
|
-
zlib: { level: 9 }
|
|
5484
|
-
// Sets the compression level.
|
|
5485
|
-
});
|
|
5486
|
-
archive.on("error", (err) => {
|
|
5487
|
-
reject(err);
|
|
5488
|
-
});
|
|
5489
|
-
const buffers = [];
|
|
5490
|
-
const bufferStream = new PassThrough();
|
|
5491
|
-
bufferStream.on("data", (data) => buffers.push(data));
|
|
5492
|
-
bufferStream.on("end", () => {
|
|
5493
|
-
const res = Buffer.concat(buffers);
|
|
5494
|
-
console.log(`${folder} have been compressed successfully into a buffer.`);
|
|
5495
|
-
resolve(res);
|
|
5496
|
-
});
|
|
5497
|
-
archive.pipe(bufferStream);
|
|
5498
|
-
fg2(path4.join(folder, "**", "*")).then((paths) => {
|
|
5499
|
-
for (let filepath of paths) {
|
|
5500
|
-
if (fs5.statSync(filepath).isFile()) {
|
|
5501
|
-
const relativePath = path4.relative(folder, filepath);
|
|
5502
|
-
archive.file(filepath, { name: relativePath });
|
|
5503
|
-
}
|
|
5504
|
-
}
|
|
5505
|
-
archive.finalize();
|
|
5506
|
-
}).catch((err) => reject(err));
|
|
5507
|
-
});
|
|
5508
|
-
}
|
|
5509
5459
|
function resolveBindingValue(node, scope, depth = 0) {
|
|
5510
5460
|
if (!node) return null;
|
|
5511
5461
|
if (depth > 20) return node;
|
|
@@ -5655,7 +5605,7 @@ async function validateEsmModules(manifest) {
|
|
|
5655
5605
|
async function sendPlugin(manifest, client, reqHeaders) {
|
|
5656
5606
|
await validateEsmModules(manifest);
|
|
5657
5607
|
const lookup = {};
|
|
5658
|
-
async function createFileRequest(filePath, imgOpts
|
|
5608
|
+
async function createFileRequest(filePath, imgOpts) {
|
|
5659
5609
|
if (!filePath || lookup[filePath]) {
|
|
5660
5610
|
return;
|
|
5661
5611
|
}
|
|
@@ -5675,8 +5625,6 @@ async function sendPlugin(manifest, client, reqHeaders) {
|
|
|
5675
5625
|
console.log(
|
|
5676
5626
|
`Compressed: ${filePath} to ${imgOpts[0]}x${imgOpts[1]} size`
|
|
5677
5627
|
);
|
|
5678
|
-
} else if (fileContent) {
|
|
5679
|
-
buffer = fileContent;
|
|
5680
5628
|
} else {
|
|
5681
5629
|
buffer = fs5.readFileSync(filePath);
|
|
5682
5630
|
}
|
|
@@ -5709,22 +5657,16 @@ async function sendPlugin(manifest, client, reqHeaders) {
|
|
|
5709
5657
|
createFileRequest(manifest.logo, [80, 80])
|
|
5710
5658
|
];
|
|
5711
5659
|
if (manifest.assets && fs5.existsSync(manifest.assets)) {
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
await createArchive(manifest.assets)
|
|
5717
|
-
)
|
|
5718
|
-
);
|
|
5660
|
+
const assetFiles = await fg2(path4.join(manifest.assets, "**", "*"));
|
|
5661
|
+
assetFiles.forEach((file) => {
|
|
5662
|
+
files.push(createFileRequest(file));
|
|
5663
|
+
});
|
|
5719
5664
|
}
|
|
5720
5665
|
if (manifest.cdn && fs5.existsSync(manifest.cdn)) {
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
await createArchive(manifest.cdn)
|
|
5726
|
-
)
|
|
5727
|
-
);
|
|
5666
|
+
const cdnFiles = await fg2(path4.join(manifest.cdn, "**", "*"));
|
|
5667
|
+
cdnFiles.forEach((file) => {
|
|
5668
|
+
files.push(createFileRequest(file));
|
|
5669
|
+
});
|
|
5728
5670
|
}
|
|
5729
5671
|
for (let vertex of manifest.vertices) {
|
|
5730
5672
|
files.push(createFileRequest(vertex.logo, [40, 40]));
|