zotero-plugin 6.4.4 → 7.0.1
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/README.md +1 -1
- package/dist/cjs/bin/branches.cjs +55 -0
- package/dist/cjs/bin/branches.cjs.map +1 -0
- package/dist/cjs/bin/branches.d.cts +1 -0
- package/dist/cjs/bin/continuous-integration.cjs +90 -0
- package/dist/cjs/bin/continuous-integration.cjs.map +1 -0
- package/dist/cjs/bin/continuous-integration.d.cts +14 -0
- package/dist/cjs/bin/copy-assets.cjs +91 -0
- package/dist/cjs/bin/copy-assets.cjs.map +1 -0
- package/dist/cjs/bin/copy-assets.d.cts +4 -0
- package/dist/cjs/bin/crypto.cjs +71 -0
- package/dist/cjs/bin/crypto.cjs.map +1 -0
- package/dist/cjs/bin/crypto.d.cts +13 -0
- package/dist/cjs/bin/fetch-log.cjs +159 -0
- package/dist/cjs/bin/fetch-log.cjs.map +1 -0
- package/dist/cjs/bin/fetch-log.d.cts +1 -0
- package/dist/cjs/bin/find-root.cjs +47 -0
- package/dist/cjs/bin/find-root.cjs.map +1 -0
- package/dist/cjs/bin/find-root.d.cts +4 -0
- package/dist/cjs/bin/keypair.cjs +122 -0
- package/dist/cjs/bin/keypair.cjs.map +1 -0
- package/dist/cjs/bin/keypair.d.cts +1 -0
- package/dist/cjs/bin/link.cjs +53 -0
- package/dist/cjs/bin/link.cjs.map +1 -0
- package/dist/cjs/bin/link.d.cts +1 -0
- package/dist/cjs/bin/make-dirs.cjs +43 -0
- package/dist/cjs/bin/make-dirs.cjs.map +1 -0
- package/dist/cjs/bin/make-dirs.d.cts +2 -0
- package/dist/cjs/bin/make-manifest.cjs +208 -0
- package/dist/cjs/bin/make-manifest.cjs.map +1 -0
- package/dist/cjs/bin/make-manifest.d.cts +2 -0
- package/dist/cjs/bin/release.cjs +292 -0
- package/dist/cjs/bin/release.cjs.map +1 -0
- package/dist/cjs/bin/release.d.cts +1 -0
- package/dist/cjs/bin/start.cjs +202 -0
- package/dist/cjs/bin/start.cjs.map +1 -0
- package/dist/cjs/bin/start.d.cts +1 -0
- package/dist/cjs/bin/version.cjs +120 -0
- package/dist/cjs/bin/version.cjs.map +1 -0
- package/dist/cjs/bin/version.d.cts +4 -0
- package/dist/cjs/bin/zipup.cjs +147 -0
- package/dist/cjs/bin/zipup.cjs.map +1 -0
- package/dist/cjs/bin/zipup.d.cts +1 -0
- package/dist/cjs/create-element.cjs +92 -0
- package/dist/cjs/create-element.cjs.map +1 -0
- package/dist/cjs/create-element.d.cts +18 -0
- package/dist/cjs/debug-log.cjs +375 -0
- package/dist/cjs/debug-log.cjs.map +1 -0
- package/dist/cjs/debug-log.d.cts +32 -0
- package/dist/cjs/loader/json.cjs +52 -0
- package/dist/cjs/loader/json.cjs.map +1 -0
- package/dist/cjs/loader/json.d.cts +8 -0
- package/dist/cjs/loader/peggy.cjs +42 -0
- package/dist/cjs/loader/peggy.cjs.map +1 -0
- package/dist/cjs/loader/peggy.d.cts +3 -0
- package/dist/cjs/loader/pem.cjs +51 -0
- package/dist/cjs/loader/pem.cjs.map +1 -0
- package/dist/cjs/loader/pem.d.cts +8 -0
- package/dist/cjs/logger.cjs +102 -0
- package/dist/cjs/logger.cjs.map +1 -0
- package/dist/cjs/logger.d.cts +15 -0
- package/dist/cjs/tsup.config.cjs +64464 -0
- package/dist/cjs/tsup.config.cjs.map +1 -0
- package/dist/cjs/tsup.config.d.cts +5 -0
- package/dist/esm/bin/branches.d.ts +1 -0
- package/{bin/branches.mjs → dist/esm/bin/branches.js} +8 -10
- package/dist/esm/bin/branches.js.map +1 -0
- package/{continuous-integration.d.ts → dist/esm/bin/continuous-integration.d.ts} +3 -2
- package/dist/esm/bin/continuous-integration.js +56 -0
- package/dist/esm/bin/continuous-integration.js.map +1 -0
- package/dist/esm/bin/copy-assets.d.ts +4 -0
- package/dist/esm/bin/copy-assets.js +58 -0
- package/dist/esm/bin/copy-assets.js.map +1 -0
- package/dist/esm/bin/crypto.d.ts +13 -0
- package/dist/esm/bin/crypto.js +36 -0
- package/dist/esm/bin/crypto.js.map +1 -0
- package/dist/esm/bin/fetch-log.d.ts +1 -0
- package/{bin/fetch-log.mjs → dist/esm/bin/fetch-log.js} +25 -20
- package/dist/esm/bin/fetch-log.js.map +1 -0
- package/dist/esm/bin/find-root.d.ts +4 -0
- package/dist/esm/bin/find-root.js +12 -0
- package/dist/esm/bin/find-root.js.map +1 -0
- package/dist/esm/bin/keypair.d.ts +1 -0
- package/{bin/keypair.mjs → dist/esm/bin/keypair.js} +1 -0
- package/dist/esm/bin/keypair.js.map +1 -0
- package/dist/esm/bin/link.d.ts +1 -0
- package/dist/esm/bin/link.js +31 -0
- package/dist/esm/bin/link.js.map +1 -0
- package/dist/esm/bin/make-dirs.d.ts +2 -0
- package/dist/esm/bin/make-dirs.js +20 -0
- package/dist/esm/bin/make-dirs.js.map +1 -0
- package/dist/esm/bin/make-manifest.d.ts +2 -0
- package/dist/esm/bin/make-manifest.js +185 -0
- package/dist/esm/bin/make-manifest.js.map +1 -0
- package/dist/esm/bin/release.d.ts +1 -0
- package/{bin/release.mjs → dist/esm/bin/release.js} +41 -44
- package/dist/esm/bin/release.js.map +1 -0
- package/dist/esm/bin/start.d.ts +1 -0
- package/{bin/start.mjs → dist/esm/bin/start.js} +1 -0
- package/dist/esm/bin/start.js.map +1 -0
- package/dist/esm/bin/version.d.ts +4 -0
- package/dist/esm/bin/version.js +87 -0
- package/dist/esm/bin/version.js.map +1 -0
- package/dist/esm/bin/zipup.d.ts +1 -0
- package/{bin/zipup.mjs → dist/esm/bin/zipup.js} +31 -31
- package/dist/esm/bin/zipup.js.map +1 -0
- package/{create-element.d.ts → dist/esm/create-element.d.ts} +4 -3
- package/dist/esm/create-element.js +67 -0
- package/dist/esm/create-element.js.map +1 -0
- package/{debug-log.d.ts → dist/esm/debug-log.d.ts} +4 -3
- package/dist/esm/debug-log.js +338 -0
- package/dist/esm/debug-log.js.map +1 -0
- package/dist/esm/loader/json.d.ts +8 -0
- package/dist/esm/loader/json.js +18 -0
- package/dist/esm/loader/json.js.map +1 -0
- package/dist/esm/loader/peggy.d.ts +3 -0
- package/dist/esm/loader/peggy.js +12 -0
- package/dist/esm/loader/peggy.js.map +1 -0
- package/dist/esm/loader/pem.d.ts +8 -0
- package/dist/esm/loader/pem.js +17 -0
- package/dist/esm/loader/pem.js.map +1 -0
- package/{logger.d.ts → dist/esm/logger.d.ts} +3 -1
- package/dist/esm/logger.js +78 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/tsup.config.d.ts +5 -0
- package/dist/esm/tsup.config.js +64468 -0
- package/dist/esm/tsup.config.js.map +1 -0
- package/package.json +37 -48
- package/bin/link.mjs +0 -32
- package/continuous-integration.js +0 -63
- package/copy-assets.d.ts +0 -1
- package/copy-assets.js +0 -46
- package/create-element.js +0 -74
- package/debug-log.js +0 -251
- package/error-report.pug +0 -12
- package/esbuild.d.ts +0 -4
- package/esbuild.js +0 -16
- package/loader/json.d.ts +0 -1
- package/loader/json.js +0 -29
- package/loader/peggy.d.ts +0 -1
- package/loader/peggy.js +0 -12
- package/loader/wrap.d.ts +0 -1
- package/loader/wrap.js +0 -35
- package/logger.js +0 -87
- package/make-dirs.d.ts +0 -1
- package/make-dirs.js +0 -13
- package/manifest.d.ts +0 -1
- package/manifest.js +0 -103
- package/root.d.ts +0 -2
- package/root.js +0 -3
- package/version.d.ts +0 -2
- package/version.js +0 -32
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ sent with the old keypair cannot be decrypted, so if you forget your passphrase,
|
|
|
153
153
|
add this to your esbuild script:
|
|
154
154
|
|
|
155
155
|
```
|
|
156
|
-
const { pem } = require('zotero-plugin/
|
|
156
|
+
const { pem } = require('zotero-plugin/loader/pem')
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
and add `pem` to your plugins in the esbuild config:
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// bin/branches.ts
|
|
26
|
+
var import_config = require("dotenv/config");
|
|
27
|
+
var import_rest = require("@octokit/rest");
|
|
28
|
+
|
|
29
|
+
// bin/find-root.ts
|
|
30
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
31
|
+
var import_path = __toESM(require("path"), 1);
|
|
32
|
+
var folders = process.cwd().split(import_path.default.sep);
|
|
33
|
+
var rootIndex = folders.findIndex((folder, i) => import_fs.default.existsSync(import_path.default.join(folders.slice(0, i + 1).join(import_path.default.sep), "package.json")));
|
|
34
|
+
var root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(import_path.default.sep);
|
|
35
|
+
var pkg = JSON.parse(import_fs.default.readFileSync(import_path.default.join(root, "package.json"), "utf-8"));
|
|
36
|
+
|
|
37
|
+
// bin/branches.ts
|
|
38
|
+
process.on("unhandledRejection", (up) => {
|
|
39
|
+
throw up;
|
|
40
|
+
});
|
|
41
|
+
var octokit = new import_rest.Octokit({ auth: `token ${process.env.GITHUB_TOKEN}` });
|
|
42
|
+
var [, owner, repo] = pkg.repository.url.match(/:\/\/github.com\/([^/]+)\/([^.]+)\.git$/);
|
|
43
|
+
async function main() {
|
|
44
|
+
const branches = await octokit.repos.listBranches({ owner, repo });
|
|
45
|
+
for (const branch of branches.data) {
|
|
46
|
+
if (/^[0-9]+$/.exec(branch.name)) {
|
|
47
|
+
const issue = await octokit.issues.get({ owner, repo, issue_number: parseInt(branch.name) });
|
|
48
|
+
if (issue.data.state !== "open") console.log(branch.name, issue.data.state);
|
|
49
|
+
} else if (!["master", "main", "gh-pages"].includes(branch.name)) {
|
|
50
|
+
console.log(branch.name);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
main().catch((err) => console.log(err));
|
|
55
|
+
//# sourceMappingURL=branches.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/branches.ts","../../../bin/find-root.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/* eslint-disable no-console, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */\n\nprocess.on('unhandledRejection', up => {\n throw up\n})\n\nimport 'dotenv/config'\nimport * as path from 'path'\n\nimport { Octokit } from '@octokit/rest'\nconst octokit = new Octokit({ auth: `token ${process.env.GITHUB_TOKEN}` })\n\n// @ts-expect-error TS2835\nimport { pkg, root } from './find-root'\n\nconst [, owner, repo] = pkg.repository.url.match(/:\\/\\/github.com\\/([^/]+)\\/([^.]+)\\.git$/)\n\nasync function main() {\n const branches = await octokit.repos.listBranches({ owner, repo })\n\n for (const branch of branches.data) {\n if (/^[0-9]+$/.exec(branch.name)) {\n const issue = await octokit.issues.get({ owner, repo, issue_number: parseInt(branch.name) })\n if (issue.data.state !== 'open') console.log(branch.name, issue.data.state) // eslint-disable-line no-console\n }\n else if (!['master', 'main', 'gh-pages'].includes(branch.name)) {\n console.log(branch.name)\n }\n }\n}\n\nmain().catch(err => console.log(err))\n","import fs from 'fs'\nimport path from 'path'\n\nconst folders = process.cwd().split(path.sep)\nconst rootIndex = folders.findIndex((folder: string, i: number) => fs.existsSync(path.join(folders.slice(0, i + 1).join(path.sep), 'package.json')))\nexport const root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(path.sep)\n\nexport const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,oBAAO;AAGP,kBAAwB;;;ACXxB,gBAAe;AACf,kBAAiB;AAEjB,IAAM,UAAU,QAAQ,IAAI,EAAE,MAAM,YAAAA,QAAK,GAAG;AAC5C,IAAM,YAAY,QAAQ,UAAU,CAAC,QAAgB,MAAc,UAAAC,QAAG,WAAW,YAAAD,QAAK,KAAK,QAAQ,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,YAAAA,QAAK,GAAG,GAAG,cAAc,CAAC,CAAC;AAC5I,IAAM,QAAQ,YAAY,IAAI,QAAQ,MAAM,GAAG,YAAY,CAAC,IAAI,SAAS,KAAK,YAAAA,QAAK,GAAG;AAEtF,IAAM,MAAM,KAAK,MAAM,UAAAC,QAAG,aAAa,YAAAD,QAAK,KAAK,MAAM,cAAc,GAAG,OAAO,CAAC;;;ADHvF,QAAQ,GAAG,sBAAsB,QAAM;AACrC,QAAM;AACR,CAAC;AAMD,IAAM,UAAU,IAAI,oBAAQ,EAAE,MAAM,SAAS,QAAQ,IAAI,YAAY,GAAG,CAAC;AAKzE,IAAM,CAAC,EAAE,OAAO,IAAI,IAAI,IAAI,WAAW,IAAI,MAAM,yCAAyC;AAE1F,eAAe,OAAO;AACpB,QAAM,WAAW,MAAM,QAAQ,MAAM,aAAa,EAAE,OAAO,KAAK,CAAC;AAEjE,aAAW,UAAU,SAAS,MAAM;AAClC,QAAI,WAAW,KAAK,OAAO,IAAI,GAAG;AAChC,YAAM,QAAQ,MAAM,QAAQ,OAAO,IAAI,EAAE,OAAO,MAAM,cAAc,SAAS,OAAO,IAAI,EAAE,CAAC;AAC3F,UAAI,MAAM,KAAK,UAAU,OAAQ,SAAQ,IAAI,OAAO,MAAM,MAAM,KAAK,KAAK;AAAA,IAC5E,WACS,CAAC,CAAC,UAAU,QAAQ,UAAU,EAAE,SAAS,OAAO,IAAI,GAAG;AAC9D,cAAQ,IAAI,OAAO,IAAI;AAAA,IACzB;AAAA,EACF;AACF;AAEA,KAAK,EAAE,MAAM,SAAO,QAAQ,IAAI,GAAG,CAAC;","names":["path","fs"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// bin/continuous-integration.ts
|
|
30
|
+
var continuous_integration_exports = {};
|
|
31
|
+
__export(continuous_integration_exports, {
|
|
32
|
+
ContinuousIntegration: () => ContinuousIntegration
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(continuous_integration_exports);
|
|
35
|
+
var child_process = __toESM(require("child_process"), 1);
|
|
36
|
+
var ContinuousIntegrationSingleton = class {
|
|
37
|
+
service = "";
|
|
38
|
+
build_number;
|
|
39
|
+
tag = "";
|
|
40
|
+
commit_message = "";
|
|
41
|
+
branch = "";
|
|
42
|
+
pull_request = false;
|
|
43
|
+
issue = "";
|
|
44
|
+
constructor() {
|
|
45
|
+
for (const [id, name] of Object.entries({ CIRCLECI: "Circle", TRAVIS: "Travis", SEMAPHORE: "Semaphore", GITHUB_ACTIONS: "GitHub" })) {
|
|
46
|
+
if (process.env[id] === "true") this.service = name;
|
|
47
|
+
}
|
|
48
|
+
switch (this.service) {
|
|
49
|
+
case "Circle":
|
|
50
|
+
this.build_number = this.parseInt(process.env.CIRCLE_BUILD_NUM);
|
|
51
|
+
try {
|
|
52
|
+
this.tag = child_process.execSync(`git describe --exact-match ${process.env.CIRCLE_SHA1}`, { stdio: "pipe" }).toString().trim();
|
|
53
|
+
} catch (err) {
|
|
54
|
+
this.tag = null;
|
|
55
|
+
}
|
|
56
|
+
this.commit_message = child_process.execSync(`git log --format=%B -n 1 ${process.env.CIRCLE_SHA1}`).toString().trim();
|
|
57
|
+
this.branch = process.env.CIRCLE_BRANCH;
|
|
58
|
+
this.pull_request = !!process.env.CIRCLE_PULL_REQUEST;
|
|
59
|
+
break;
|
|
60
|
+
case "GitHub":
|
|
61
|
+
this.build_number = this.parseInt(process.env.GITHUB_RUN_NUMBER);
|
|
62
|
+
this.commit_message = child_process.execSync(`git log --format=%B -n 1 ${process.env.GITHUB_SHA}`).toString().trim();
|
|
63
|
+
this.pull_request = process.env.GITHUB_EVENT_NAME.startsWith("pull-request");
|
|
64
|
+
if (process.env.GITHUB_HEAD_REF) {
|
|
65
|
+
this.branch = process.env.GITHUB_HEAD_REF.split("/").pop();
|
|
66
|
+
} else if (process.env.GITHUB_REF.startsWith("refs/tags/")) {
|
|
67
|
+
this.tag = process.env.GITHUB_REF.split("/").pop();
|
|
68
|
+
} else if (process.env.GITHUB_REF.startsWith("refs/heads/")) {
|
|
69
|
+
this.branch = process.env.GITHUB_REF.split("/").pop();
|
|
70
|
+
}
|
|
71
|
+
this.branch = this.branch || "";
|
|
72
|
+
this.issue = this.branch.match(/^gh-([0-9]+)$/)?.[1] || "";
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
if (process.env.CI === "true") throw new Error(`Unexpected CI service ${this.service}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
parseInt(n) {
|
|
79
|
+
if (typeof n === "number") return n;
|
|
80
|
+
const int = parseInt(n);
|
|
81
|
+
if (isNaN(int)) throw new Error(`${n} is not an integer`);
|
|
82
|
+
return int;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var ContinuousIntegration = new ContinuousIntegrationSingleton();
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
ContinuousIntegration
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=continuous-integration.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/continuous-integration.ts"],"sourcesContent":["import * as child_process from 'child_process'\n\nclass ContinuousIntegrationSingleton {\n public service = ''\n public build_number: number\n public tag = ''\n public commit_message = ''\n public branch = ''\n public pull_request = false\n public issue = ''\n\n constructor() {\n for (const [id, name] of Object.entries({ CIRCLECI: 'Circle', TRAVIS: 'Travis', SEMAPHORE: 'Semaphore', GITHUB_ACTIONS: 'GitHub' })) {\n if (process.env[id] === 'true') this.service = name\n }\n\n switch (this.service) {\n case 'Circle':\n this.build_number = this.parseInt(process.env.CIRCLE_BUILD_NUM)\n try {\n this.tag = child_process.execSync(`git describe --exact-match ${process.env.CIRCLE_SHA1}`, { stdio: 'pipe' }).toString().trim()\n }\n catch (err) {\n this.tag = null\n }\n this.commit_message = child_process.execSync(`git log --format=%B -n 1 ${process.env.CIRCLE_SHA1}`).toString().trim()\n this.branch = process.env.CIRCLE_BRANCH\n this.pull_request = !!process.env.CIRCLE_PULL_REQUEST\n break\n\n case 'GitHub':\n this.build_number = this.parseInt(process.env.GITHUB_RUN_NUMBER)\n this.commit_message = child_process.execSync(`git log --format=%B -n 1 ${process.env.GITHUB_SHA}`).toString().trim()\n this.pull_request = process.env.GITHUB_EVENT_NAME.startsWith('pull-request')\n\n if (process.env.GITHUB_HEAD_REF) {\n this.branch = process.env.GITHUB_HEAD_REF.split('/').pop()\n }\n else if (process.env.GITHUB_REF.startsWith('refs/tags/')) {\n // leave branch undefined when tagged... not great\n this.tag = process.env.GITHUB_REF.split('/').pop()\n }\n else if (process.env.GITHUB_REF.startsWith('refs/heads/')) {\n this.branch = process.env.GITHUB_REF.split('/').pop()\n }\n this.branch = this.branch || ''\n this.issue = this.branch.match(/^gh-([0-9]+)$/)?.[1] || ''\n break\n\n default:\n if (process.env.CI === 'true') throw new Error(`Unexpected CI service ${this.service}`)\n }\n }\n\n private parseInt(n: number | string): number {\n if (typeof n === 'number') return n\n const int = parseInt(n)\n if (isNaN(int)) throw new Error(`${n} is not an integer`)\n return int\n }\n}\n\nexport const ContinuousIntegration = new ContinuousIntegrationSingleton() // eslint-disable-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+B;AAE/B,IAAM,iCAAN,MAAqC;AAAA,EAC5B,UAAU;AAAA,EACV;AAAA,EACA,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,QAAQ;AAAA,EAEf,cAAc;AACZ,eAAW,CAAC,IAAI,IAAI,KAAK,OAAO,QAAQ,EAAE,UAAU,UAAU,QAAQ,UAAU,WAAW,aAAa,gBAAgB,SAAS,CAAC,GAAG;AACnI,UAAI,QAAQ,IAAI,EAAE,MAAM,OAAQ,MAAK,UAAU;AAAA,IACjD;AAEA,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,aAAK,eAAe,KAAK,SAAS,QAAQ,IAAI,gBAAgB;AAC9D,YAAI;AACF,eAAK,MAAoB,uBAAS,8BAA8B,QAAQ,IAAI,WAAW,IAAI,EAAE,OAAO,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK;AAAA,QAChI,SACO,KAAK;AACV,eAAK,MAAM;AAAA,QACb;AACA,aAAK,iBAA+B,uBAAS,4BAA4B,QAAQ,IAAI,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK;AACpH,aAAK,SAAS,QAAQ,IAAI;AAC1B,aAAK,eAAe,CAAC,CAAC,QAAQ,IAAI;AAClC;AAAA,MAEF,KAAK;AACH,aAAK,eAAe,KAAK,SAAS,QAAQ,IAAI,iBAAiB;AAC/D,aAAK,iBAA+B,uBAAS,4BAA4B,QAAQ,IAAI,UAAU,EAAE,EAAE,SAAS,EAAE,KAAK;AACnH,aAAK,eAAe,QAAQ,IAAI,kBAAkB,WAAW,cAAc;AAE3E,YAAI,QAAQ,IAAI,iBAAiB;AAC/B,eAAK,SAAS,QAAQ,IAAI,gBAAgB,MAAM,GAAG,EAAE,IAAI;AAAA,QAC3D,WACS,QAAQ,IAAI,WAAW,WAAW,YAAY,GAAG;AAExD,eAAK,MAAM,QAAQ,IAAI,WAAW,MAAM,GAAG,EAAE,IAAI;AAAA,QACnD,WACS,QAAQ,IAAI,WAAW,WAAW,aAAa,GAAG;AACzD,eAAK,SAAS,QAAQ,IAAI,WAAW,MAAM,GAAG,EAAE,IAAI;AAAA,QACtD;AACA,aAAK,SAAS,KAAK,UAAU;AAC7B,aAAK,QAAQ,KAAK,OAAO,MAAM,eAAe,IAAI,CAAC,KAAK;AACxD;AAAA,MAEF;AACE,YAAI,QAAQ,IAAI,OAAO,OAAQ,OAAM,IAAI,MAAM,yBAAyB,KAAK,OAAO,EAAE;AAAA,IAC1F;AAAA,EACF;AAAA,EAEQ,SAAS,GAA4B;AAC3C,QAAI,OAAO,MAAM,SAAU,QAAO;AAClC,UAAM,MAAM,SAAS,CAAC;AACtB,QAAI,MAAM,GAAG,EAAG,OAAM,IAAI,MAAM,GAAG,CAAC,oBAAoB;AACxD,WAAO;AAAA,EACT;AACF;AAEO,IAAM,wBAAwB,IAAI,+BAA+B;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class ContinuousIntegrationSingleton {
|
|
2
|
+
service: string;
|
|
3
|
+
build_number: number;
|
|
4
|
+
tag: string;
|
|
5
|
+
commit_message: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
pull_request: boolean;
|
|
8
|
+
issue: string;
|
|
9
|
+
constructor();
|
|
10
|
+
private parseInt;
|
|
11
|
+
}
|
|
12
|
+
declare const ContinuousIntegration: ContinuousIntegrationSingleton;
|
|
13
|
+
|
|
14
|
+
export { ContinuousIntegration };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// bin/copy-assets.ts
|
|
31
|
+
var copy_assets_exports = {};
|
|
32
|
+
__export(copy_assets_exports, {
|
|
33
|
+
copy: () => copy
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(copy_assets_exports);
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
37
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
38
|
+
|
|
39
|
+
// bin/find-root.ts
|
|
40
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
41
|
+
var import_path = __toESM(require("path"), 1);
|
|
42
|
+
var folders = process.cwd().split(import_path.default.sep);
|
|
43
|
+
var rootIndex = folders.findIndex((folder, i) => import_fs.default.existsSync(import_path.default.join(folders.slice(0, i + 1).join(import_path.default.sep), "package.json")));
|
|
44
|
+
var root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(import_path.default.sep);
|
|
45
|
+
var pkg = JSON.parse(import_fs.default.readFileSync(import_path.default.join(root, "package.json"), "utf-8"));
|
|
46
|
+
|
|
47
|
+
// bin/copy-assets.ts
|
|
48
|
+
function allow(file) {
|
|
49
|
+
switch (import_path2.default.basename(file)) {
|
|
50
|
+
case ".DS_Store":
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
switch (import_path2.default.extname(file).toLowerCase()) {
|
|
54
|
+
case ".json":
|
|
55
|
+
case ".ts":
|
|
56
|
+
case ".peggy":
|
|
57
|
+
case ".pug":
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
console.log("copying assets");
|
|
63
|
+
function shouldCopy(dir) {
|
|
64
|
+
return import_fs_extra.default.existsSync(dir) && !import_fs_extra.default.existsSync(import_path2.default.join(dir, ".nomedia"));
|
|
65
|
+
}
|
|
66
|
+
function copy() {
|
|
67
|
+
for (const dir of ["defaults", "content", "skin", "locale", "resource", "chrome.manifest", "chrome"].map((_) => import_path2.default.join(root, _))) {
|
|
68
|
+
if (!shouldCopy(dir)) continue;
|
|
69
|
+
import_fs_extra.default.copySync(dir, import_path2.default.join("build", dir), {
|
|
70
|
+
filter(src) {
|
|
71
|
+
if (dir !== "chrome.manifest" && dir !== "resource" && !allow(src)) return false;
|
|
72
|
+
if (import_fs_extra.default.lstatSync(src).isFile()) console.log(" ", src);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (shouldCopy("client")) {
|
|
78
|
+
import_fs_extra.default.copySync("client", "build", {
|
|
79
|
+
filter(src) {
|
|
80
|
+
if (import_fs_extra.default.lstatSync(src).isFile()) console.log(" ", src);
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
copy();
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
copy
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=copy-assets.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/copy-assets.ts","../../../bin/find-root.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from 'fs-extra'\nimport path from 'path'\n\n// @ts-expect-error TS2835\nimport { root } from './find-root'\n\nfunction allow(file) {\n switch (path.basename(file)) {\n case '.DS_Store':\n return false\n }\n\n switch (path.extname(file).toLowerCase()) {\n case '.json':\n case '.ts':\n case '.peggy':\n case '.pug':\n return false\n }\n\n return true\n}\n\nconsole.log('copying assets')\n\nfunction shouldCopy(dir) {\n return fs.existsSync(dir) && !fs.existsSync(path.join(dir, '.nomedia'))\n}\n\nexport function copy() {\n for (const dir of ['defaults', 'content', 'skin', 'locale', 'resource', 'chrome.manifest', 'chrome'].map(_ => path.join(root, _))) {\n if (!shouldCopy(dir)) continue\n\n fs.copySync(dir, path.join('build', dir), {\n filter(src) {\n if (dir !== 'chrome.manifest' && dir !== 'resource' && !allow(src)) return false\n if (fs.lstatSync(src).isFile()) console.log(' ', src)\n return true\n },\n })\n }\n\n if (shouldCopy('client')) {\n fs.copySync('client', 'build', {\n filter(src) {\n if (fs.lstatSync(src).isFile()) console.log(' ', src)\n return true\n },\n })\n }\n}\n\ncopy()\n","import fs from 'fs'\nimport path from 'path'\n\nconst folders = process.cwd().split(path.sep)\nconst rootIndex = folders.findIndex((folder: string, i: number) => fs.existsSync(path.join(folders.slice(0, i + 1).join(path.sep), 'package.json')))\nexport const root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(path.sep)\n\nexport const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAAe;AACf,IAAAA,eAAiB;;;ACHjB,gBAAe;AACf,kBAAiB;AAEjB,IAAM,UAAU,QAAQ,IAAI,EAAE,MAAM,YAAAC,QAAK,GAAG;AAC5C,IAAM,YAAY,QAAQ,UAAU,CAAC,QAAgB,MAAc,UAAAC,QAAG,WAAW,YAAAD,QAAK,KAAK,QAAQ,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,YAAAA,QAAK,GAAG,GAAG,cAAc,CAAC,CAAC;AAC5I,IAAM,QAAQ,YAAY,IAAI,QAAQ,MAAM,GAAG,YAAY,CAAC,IAAI,SAAS,KAAK,YAAAA,QAAK,GAAG;AAEtF,IAAM,MAAM,KAAK,MAAM,UAAAC,QAAG,aAAa,YAAAD,QAAK,KAAK,MAAM,cAAc,GAAG,OAAO,CAAC;;;ADCvF,SAAS,MAAM,MAAM;AACnB,UAAQ,aAAAE,QAAK,SAAS,IAAI,GAAG;AAAA,IAC3B,KAAK;AACH,aAAO;AAAA,EACX;AAEA,UAAQ,aAAAA,QAAK,QAAQ,IAAI,EAAE,YAAY,GAAG;AAAA,IACxC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,EACX;AAEA,SAAO;AACT;AAEA,QAAQ,IAAI,gBAAgB;AAE5B,SAAS,WAAW,KAAK;AACvB,SAAO,gBAAAC,QAAG,WAAW,GAAG,KAAK,CAAC,gBAAAA,QAAG,WAAW,aAAAD,QAAK,KAAK,KAAK,UAAU,CAAC;AACxE;AAEO,SAAS,OAAO;AACrB,aAAW,OAAO,CAAC,YAAY,WAAW,QAAQ,UAAU,YAAY,mBAAmB,QAAQ,EAAE,IAAI,OAAK,aAAAA,QAAK,KAAK,MAAM,CAAC,CAAC,GAAG;AACjI,QAAI,CAAC,WAAW,GAAG,EAAG;AAEtB,oBAAAC,QAAG,SAAS,KAAK,aAAAD,QAAK,KAAK,SAAS,GAAG,GAAG;AAAA,MACxC,OAAO,KAAK;AACV,YAAI,QAAQ,qBAAqB,QAAQ,cAAc,CAAC,MAAM,GAAG,EAAG,QAAO;AAC3E,YAAI,gBAAAC,QAAG,UAAU,GAAG,EAAE,OAAO,EAAG,SAAQ,IAAI,KAAK,GAAG;AACpD,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,WAAW,QAAQ,GAAG;AACxB,oBAAAA,QAAG,SAAS,UAAU,SAAS;AAAA,MAC7B,OAAO,KAAK;AACV,YAAI,gBAAAA,QAAG,UAAU,GAAG,EAAE,OAAO,EAAG,SAAQ,IAAI,KAAK,GAAG;AACpD,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEA,KAAK;","names":["import_path","path","fs","path","fs"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// bin/crypto.ts
|
|
30
|
+
var crypto_exports = {};
|
|
31
|
+
__export(crypto_exports, {
|
|
32
|
+
decrypt: () => decrypt,
|
|
33
|
+
encrypt: () => encrypt
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(crypto_exports);
|
|
36
|
+
var import_crypto = __toESM(require("crypto"), 1);
|
|
37
|
+
function encrypt(plaintext, passphrase) {
|
|
38
|
+
const salt = import_crypto.default.randomBytes(16);
|
|
39
|
+
const iterations = 1e5;
|
|
40
|
+
const keyLength = 32;
|
|
41
|
+
const algorithm = "aes-256-gcm";
|
|
42
|
+
const key = import_crypto.default.pbkdf2Sync(passphrase, salt, iterations, keyLength, "sha256");
|
|
43
|
+
const iv = import_crypto.default.randomBytes(12);
|
|
44
|
+
const cipher = import_crypto.default.createCipheriv(algorithm, key, iv);
|
|
45
|
+
let ciphertext = cipher.update(plaintext, "utf8", "base64");
|
|
46
|
+
ciphertext += cipher.final("base64");
|
|
47
|
+
const tag = cipher.getAuthTag();
|
|
48
|
+
return {
|
|
49
|
+
ciphertext,
|
|
50
|
+
iv: iv.toString("base64"),
|
|
51
|
+
tag: tag.toString("base64"),
|
|
52
|
+
salt: salt.toString("base64"),
|
|
53
|
+
iterations,
|
|
54
|
+
keyLength,
|
|
55
|
+
algorithm
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function decrypt({ ciphertext, iv, tag, salt, iterations, keyLength, algorithm }, passphrase) {
|
|
59
|
+
const key = import_crypto.default.pbkdf2Sync(passphrase, Buffer.from(salt, "base64"), iterations, keyLength, "sha256");
|
|
60
|
+
const decipher = import_crypto.default.createDecipheriv(algorithm, key, Buffer.from(iv, "base64"));
|
|
61
|
+
decipher.setAuthTag(Buffer.from(tag, "base64"));
|
|
62
|
+
let decrypted = decipher.update(ciphertext, "base64", "utf8");
|
|
63
|
+
decrypted += decipher.final("utf8");
|
|
64
|
+
return decrypted;
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
decrypt,
|
|
69
|
+
encrypt
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=crypto.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/crypto.ts"],"sourcesContent":["import crypto from 'crypto'\n\nexport type Encrypted = {\n ciphertext: string\n iv: string\n tag: string\n salt: string\n iterations: number\n keyLength: number\n algorithm: 'aes-256-gcm'\n}\n\nexport function encrypt(plaintext: string, passphrase: string): Encrypted {\n const salt = crypto.randomBytes(16)\n const iterations = 100000\n const keyLength = 32\n const algorithm = 'aes-256-gcm'\n\n const key = crypto.pbkdf2Sync(passphrase, salt, iterations, keyLength, 'sha256')\n const iv = crypto.randomBytes(12)\n\n const cipher = crypto.createCipheriv(algorithm, key, iv)\n\n let ciphertext = cipher.update(plaintext, 'utf8', 'base64')\n ciphertext += cipher.final('base64')\n\n const tag = cipher.getAuthTag()\n\n return {\n ciphertext,\n iv: iv.toString('base64'),\n tag: tag.toString('base64'),\n salt: salt.toString('base64'),\n iterations,\n keyLength,\n algorithm,\n }\n}\n\nexport function decrypt({ ciphertext, iv, tag, salt, iterations, keyLength, algorithm }: Encrypted, passphrase: string): string {\n const key = crypto.pbkdf2Sync(passphrase, Buffer.from(salt, 'base64'), iterations, keyLength, 'sha256')\n const decipher = crypto.createDecipheriv(algorithm, key, Buffer.from(iv, 'base64'))\n decipher.setAuthTag(Buffer.from(tag, 'base64'))\n let decrypted = decipher.update(ciphertext, 'base64', 'utf8')\n decrypted += decipher.final('utf8')\n return decrypted\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AAYZ,SAAS,QAAQ,WAAmB,YAA+B;AACxE,QAAM,OAAO,cAAAA,QAAO,YAAY,EAAE;AAClC,QAAM,aAAa;AACnB,QAAM,YAAY;AAClB,QAAM,YAAY;AAElB,QAAM,MAAM,cAAAA,QAAO,WAAW,YAAY,MAAM,YAAY,WAAW,QAAQ;AAC/E,QAAM,KAAK,cAAAA,QAAO,YAAY,EAAE;AAEhC,QAAM,SAAS,cAAAA,QAAO,eAAe,WAAW,KAAK,EAAE;AAEvD,MAAI,aAAa,OAAO,OAAO,WAAW,QAAQ,QAAQ;AAC1D,gBAAc,OAAO,MAAM,QAAQ;AAEnC,QAAM,MAAM,OAAO,WAAW;AAE9B,SAAO;AAAA,IACL;AAAA,IACA,IAAI,GAAG,SAAS,QAAQ;AAAA,IACxB,KAAK,IAAI,SAAS,QAAQ;AAAA,IAC1B,MAAM,KAAK,SAAS,QAAQ;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,QAAQ,EAAE,YAAY,IAAI,KAAK,MAAM,YAAY,WAAW,UAAU,GAAc,YAA4B;AAC9H,QAAM,MAAM,cAAAA,QAAO,WAAW,YAAY,OAAO,KAAK,MAAM,QAAQ,GAAG,YAAY,WAAW,QAAQ;AACtG,QAAM,WAAW,cAAAA,QAAO,iBAAiB,WAAW,KAAK,OAAO,KAAK,IAAI,QAAQ,CAAC;AAClF,WAAS,WAAW,OAAO,KAAK,KAAK,QAAQ,CAAC;AAC9C,MAAI,YAAY,SAAS,OAAO,YAAY,UAAU,MAAM;AAC5D,eAAa,SAAS,MAAM,MAAM;AAClC,SAAO;AACT;","names":["crypto"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Encrypted = {
|
|
2
|
+
ciphertext: string;
|
|
3
|
+
iv: string;
|
|
4
|
+
tag: string;
|
|
5
|
+
salt: string;
|
|
6
|
+
iterations: number;
|
|
7
|
+
keyLength: number;
|
|
8
|
+
algorithm: 'aes-256-gcm';
|
|
9
|
+
};
|
|
10
|
+
declare function encrypt(plaintext: string, passphrase: string): Encrypted;
|
|
11
|
+
declare function decrypt({ ciphertext, iv, tag, salt, iterations, keyLength, algorithm }: Encrypted, passphrase: string): string;
|
|
12
|
+
|
|
13
|
+
export { type Encrypted, decrypt, encrypt };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// bin/fetch-log.ts
|
|
26
|
+
var import_commander = require("commander");
|
|
27
|
+
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
28
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
29
|
+
var import_node_stream_zip = __toESM(require("node-stream-zip"), 1);
|
|
30
|
+
var import_node_stream = require("stream");
|
|
31
|
+
var import_promises = require("stream/promises");
|
|
32
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
33
|
+
var import_keyring = require("@napi-rs/keyring");
|
|
34
|
+
var import_prompts = __toESM(require("prompts"), 1);
|
|
35
|
+
|
|
36
|
+
// bin/find-root.ts
|
|
37
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
38
|
+
var import_path = __toESM(require("path"), 1);
|
|
39
|
+
var folders = process.cwd().split(import_path.default.sep);
|
|
40
|
+
var rootIndex = folders.findIndex((folder, i) => import_fs.default.existsSync(import_path.default.join(folders.slice(0, i + 1).join(import_path.default.sep), "package.json")));
|
|
41
|
+
var root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(import_path.default.sep);
|
|
42
|
+
var pkg = JSON.parse(import_fs.default.readFileSync(import_path.default.join(root, "package.json"), "utf-8"));
|
|
43
|
+
|
|
44
|
+
// bin/crypto.ts
|
|
45
|
+
var import_crypto = __toESM(require("crypto"), 1);
|
|
46
|
+
function decrypt({ ciphertext, iv, tag, salt, iterations, keyLength, algorithm }, passphrase) {
|
|
47
|
+
const key = import_crypto.default.pbkdf2Sync(passphrase, Buffer.from(salt, "base64"), iterations, keyLength, "sha256");
|
|
48
|
+
const decipher = import_crypto.default.createDecipheriv(algorithm, key, Buffer.from(iv, "base64"));
|
|
49
|
+
decipher.setAuthTag(Buffer.from(tag, "base64"));
|
|
50
|
+
let decrypted = decipher.update(ciphertext, "base64", "utf8");
|
|
51
|
+
decrypted += decipher.final("utf8");
|
|
52
|
+
return decrypted;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// bin/fetch-log.ts
|
|
56
|
+
async function getPassphrase(service, account) {
|
|
57
|
+
const entry = new import_keyring.Entry(service, account);
|
|
58
|
+
let passphrase = entry.getPassword();
|
|
59
|
+
if (!passphrase) {
|
|
60
|
+
const response = await (0, import_prompts.default)({
|
|
61
|
+
type: "password",
|
|
62
|
+
name: "passphrase",
|
|
63
|
+
message: `Enter a passphrase to decrypt your private key for ${service} ${account}:`
|
|
64
|
+
});
|
|
65
|
+
entry.setPassword(passphrase = response.passphrase);
|
|
66
|
+
}
|
|
67
|
+
return passphrase;
|
|
68
|
+
}
|
|
69
|
+
var oops = (...args2) => {
|
|
70
|
+
console.error(...args2);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
};
|
|
73
|
+
var program = new import_commander.Command();
|
|
74
|
+
program.description("A script to generate and store an RSA key pair in an encrypted file.").option("-p, --private <path>", "Path for the encrypted private key .pem.json file", "private.pem.json").argument("<debug log id>", "debug log ID to fetch").parse(process.argv);
|
|
75
|
+
var options = program.opts();
|
|
76
|
+
var args = program.args;
|
|
77
|
+
if (!args.length) oops("No log ID");
|
|
78
|
+
var m = args[0].match(/^(?<key>[a-z0-9]+)-(?<host>[^-]+)-(?<remote>[^.]+)(?<tags>.*)$/i);
|
|
79
|
+
if (!m) oops(args[0], "is not a valid log ID");
|
|
80
|
+
if (m.groups.host !== "0x0") oops("Unexpected debug log host", m.groups.host);
|
|
81
|
+
options.encrypted = m.groups.tags.split(".").includes("enc");
|
|
82
|
+
options.zip = import_path2.default.join("logs", `${m.groups.key}.zip`);
|
|
83
|
+
options.url = `https://0x0.st/${m.groups.remote}.zip`;
|
|
84
|
+
if (options.encrypted) {
|
|
85
|
+
if (!options.private) oops("No private key provided");
|
|
86
|
+
if (!import_fs2.default.existsSync(options.private)) oops("Private key", options.private, "does not exist");
|
|
87
|
+
if (!import_fs2.default.existsSync("package.json")) oops("package.json does not exist in the current directory");
|
|
88
|
+
}
|
|
89
|
+
var logs = import_path2.default.join("logs", m.groups.key);
|
|
90
|
+
console.log(options.url, "=>", logs);
|
|
91
|
+
if (!import_fs2.default.existsSync(logs)) {
|
|
92
|
+
import_fs2.default.mkdirSync(logs, { recursive: true });
|
|
93
|
+
}
|
|
94
|
+
async function main() {
|
|
95
|
+
try {
|
|
96
|
+
const response = await fetch(options.url, {
|
|
97
|
+
method: "GET",
|
|
98
|
+
headers: {
|
|
99
|
+
"User-Agent": `Zotero plugin log fetcher ${pkg.version}`,
|
|
100
|
+
Accept: "*/*"
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) oops(`Failed to download: ${response.statusText}`);
|
|
104
|
+
const readable = import_node_stream.Readable.fromWeb(response.body);
|
|
105
|
+
const download = import_fs2.default.createWriteStream(options.zip);
|
|
106
|
+
await (0, import_promises.finished)(readable.pipe(download));
|
|
107
|
+
let privateKey;
|
|
108
|
+
if (options.encrypted) {
|
|
109
|
+
const passphrase = await getPassphrase(`${pkg.name} Zotero plugin`, "debug-log");
|
|
110
|
+
privateKey = decrypt(JSON.parse(import_fs2.default.readFileSync(options.private, "utf-8")), passphrase);
|
|
111
|
+
}
|
|
112
|
+
const zipfile = new import_node_stream_zip.default.async({ file: options.zip });
|
|
113
|
+
let decryptionKey;
|
|
114
|
+
const fileEntries = {};
|
|
115
|
+
for (const entry of Object.values(await zipfile.entries())) {
|
|
116
|
+
if (entry.isDirectory) continue;
|
|
117
|
+
const m2 = entry.name.match(/(?<filename>.+)\.(?<type>key|enc|iv)$/i);
|
|
118
|
+
let filename = m2?.groups.filename || entry.name;
|
|
119
|
+
const type = (m2?.groups.type || "").toLowerCase();
|
|
120
|
+
if (type && !options.encrypted) oops("unexpected", type, "file in non-encrypted log");
|
|
121
|
+
if (type === "key") {
|
|
122
|
+
decryptionKey = import_crypto2.default.privateDecrypt({
|
|
123
|
+
key: privateKey,
|
|
124
|
+
padding: import_crypto2.default.constants.RSA_PKCS1_OAEP_PADDING,
|
|
125
|
+
oaepHash: "sha256"
|
|
126
|
+
}, await zipfile.entryData(entry.name));
|
|
127
|
+
} else {
|
|
128
|
+
const key = filename.toLowerCase();
|
|
129
|
+
const f = fileEntries[key] = fileEntries[key] || { filename };
|
|
130
|
+
f[type === "iv" ? "iv" : "contents"] = entry.name;
|
|
131
|
+
if (type) f.encrypted = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (options.encrypted && !decryptionKey) oops("no key file found");
|
|
135
|
+
for (const entry of Object.values(fileEntries)) {
|
|
136
|
+
if (!entry.contents) oops("no contents for", entry.filename);
|
|
137
|
+
if (entry.encrypted && !entry.iv) oops("no iv for", entry.filename);
|
|
138
|
+
const data = await zipfile.entryData(entry.contents);
|
|
139
|
+
const target = import_path2.default.join("logs", entry.filename);
|
|
140
|
+
if (entry.iv) {
|
|
141
|
+
const iv = await zipfile.entryData(entry.iv);
|
|
142
|
+
const tag = data.slice(-16);
|
|
143
|
+
const ciphertext = data.slice(0, -16);
|
|
144
|
+
const decipher = import_crypto2.default.createDecipheriv("aes-256-gcm", decryptionKey, iv);
|
|
145
|
+
decipher.setAuthTag(tag);
|
|
146
|
+
const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
147
|
+
import_fs2.default.writeFileSync(target, decrypted);
|
|
148
|
+
} else {
|
|
149
|
+
import_fs2.default.writeFileSync(target, data);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} finally {
|
|
153
|
+
if (import_fs2.default.existsSync(options.zip)) import_fs2.default.unlinkSync(options.zip);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
main().catch((err) => {
|
|
157
|
+
oops(err.message);
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=fetch-log.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/fetch-log.ts","../../../bin/find-root.ts","../../../bin/crypto.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander'\nimport crypto from 'crypto'\nimport fs from 'fs'\nimport StreamZip from 'node-stream-zip'\nimport { Readable } from 'node:stream'\nimport { finished } from 'node:stream/promises'\nimport path from 'path'\n\nimport { Entry as KeyRingEntry } from '@napi-rs/keyring'\nimport prompts from 'prompts'\n\n// @ts-expect-error TS2835\nimport { pkg } from './find-root'\n// @ts-expect-error TS2835\nimport { decrypt } from './crypto'\n\nasync function getPassphrase(service, account): Promise<string> {\n const entry = new KeyRingEntry(service, account)\n let passphrase = entry.getPassword()\n if (!passphrase) {\n const response = await prompts({\n type: 'password',\n name: 'passphrase',\n message: `Enter a passphrase to decrypt your private key for ${service} ${account}:`,\n })\n entry.setPassword(passphrase = response.passphrase)\n }\n return passphrase\n}\n\nconst oops = (...args) => {\n console.error(...args)\n process.exit(1)\n}\n\nconst program = new Command()\nprogram\n .description('A script to generate and store an RSA key pair in an encrypted file.')\n .option('-p, --private <path>', 'Path for the encrypted private key .pem.json file', 'private.pem.json')\n .argument('<debug log id>', 'debug log ID to fetch')\n .parse(process.argv)\nconst options = program.opts()\nconst args = program.args\n\nif (!args.length) oops('No log ID')\n\nlet m = args[0].match(/^(?<key>[a-z0-9]+)-(?<host>[^-]+)-(?<remote>[^.]+)(?<tags>.*)$/i)\nif (!m) oops(args[0], 'is not a valid log ID')\n\nif (m.groups.host !== '0x0') oops('Unexpected debug log host', m.groups.host)\n\noptions.encrypted = m.groups.tags.split('.').includes('enc')\noptions.zip = path.join('logs', `${m.groups.key}.zip`)\noptions.url = `https://0x0.st/${m.groups.remote}.zip`\n\nif (options.encrypted) {\n if (!options.private) oops('No private key provided')\n if (!fs.existsSync(options.private)) oops('Private key', options.private, 'does not exist')\n if (!fs.existsSync('package.json')) oops('package.json does not exist in the current directory')\n}\n\nconst logs = path.join('logs', m.groups!.key)\nconsole.log(options.url, '=>', logs)\nif (!fs.existsSync(logs)) {\n fs.mkdirSync(logs, { recursive: true })\n}\n\nasync function main() {\n try {\n const response = await fetch(options.url, {\n method: 'GET',\n headers: {\n 'User-Agent': `Zotero plugin log fetcher ${pkg.version}`,\n Accept: '*/*',\n },\n })\n if (!response.ok) oops(`Failed to download: ${response.statusText}`)\n\n const readable = Readable.fromWeb(response.body as any)\n const download = fs.createWriteStream(options.zip)\n await finished(readable.pipe(download))\n\n let privateKey\n if (options.encrypted) {\n const passphrase = await getPassphrase(`${pkg.name} Zotero plugin`, 'debug-log')\n privateKey = decrypt(JSON.parse(fs.readFileSync(options.private, 'utf-8')), passphrase)\n }\n\n const zipfile = new StreamZip.async({ file: options.zip })\n let decryptionKey: Buffer\n const fileEntries: Record<string, { filename: string; contents?: string; iv?: string; encrypted?: boolean }> = {}\n for (const entry of Object.values(await zipfile.entries())) {\n if (entry.isDirectory) continue\n\n const m = entry.name.match(/(?<filename>.+)\\.(?<type>key|enc|iv)$/i)\n let filename = m?.groups!.filename || entry.name\n const type = (m?.groups!.type || '').toLowerCase()\n\n if (type && !options.encrypted) oops('unexpected', type, 'file in non-encrypted log')\n\n if (type === 'key') {\n decryptionKey = crypto.privateDecrypt({\n key: privateKey,\n padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,\n oaepHash: 'sha256',\n }, await zipfile.entryData(entry.name))\n }\n else {\n const key = filename.toLowerCase()\n const f = fileEntries[key] = fileEntries[key] || { filename }\n f[type === 'iv' ? 'iv' : 'contents'] = entry.name\n if (type) f.encrypted = true\n }\n }\n\n if (options.encrypted && !decryptionKey) oops('no key file found')\n\n for (const entry of Object.values(fileEntries)) {\n if (!entry.contents) oops('no contents for', entry.filename)\n if (entry.encrypted && !entry.iv) oops('no iv for', entry.filename)\n\n const data = await zipfile.entryData(entry.contents)\n const target = path.join('logs', entry.filename)\n\n if (entry.iv) {\n const iv = await zipfile.entryData(entry.iv)\n const tag = data.slice(-16)\n const ciphertext = data.slice(0, -16)\n const decipher = crypto.createDecipheriv('aes-256-gcm', decryptionKey, iv)\n decipher.setAuthTag(tag)\n const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()])\n fs.writeFileSync(target, decrypted)\n }\n else {\n fs.writeFileSync(target, data)\n }\n }\n }\n finally {\n if (fs.existsSync(options.zip)) fs.unlinkSync(options.zip)\n }\n}\n\nmain().catch(err => {\n oops(err.message)\n})\n","import fs from 'fs'\nimport path from 'path'\n\nconst folders = process.cwd().split(path.sep)\nconst rootIndex = folders.findIndex((folder: string, i: number) => fs.existsSync(path.join(folders.slice(0, i + 1).join(path.sep), 'package.json')))\nexport const root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(path.sep)\n\nexport const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'))\n","import crypto from 'crypto'\n\nexport type Encrypted = {\n ciphertext: string\n iv: string\n tag: string\n salt: string\n iterations: number\n keyLength: number\n algorithm: 'aes-256-gcm'\n}\n\nexport function encrypt(plaintext: string, passphrase: string): Encrypted {\n const salt = crypto.randomBytes(16)\n const iterations = 100000\n const keyLength = 32\n const algorithm = 'aes-256-gcm'\n\n const key = crypto.pbkdf2Sync(passphrase, salt, iterations, keyLength, 'sha256')\n const iv = crypto.randomBytes(12)\n\n const cipher = crypto.createCipheriv(algorithm, key, iv)\n\n let ciphertext = cipher.update(plaintext, 'utf8', 'base64')\n ciphertext += cipher.final('base64')\n\n const tag = cipher.getAuthTag()\n\n return {\n ciphertext,\n iv: iv.toString('base64'),\n tag: tag.toString('base64'),\n salt: salt.toString('base64'),\n iterations,\n keyLength,\n algorithm,\n }\n}\n\nexport function decrypt({ ciphertext, iv, tag, salt, iterations, keyLength, algorithm }: Encrypted, passphrase: string): string {\n const key = crypto.pbkdf2Sync(passphrase, Buffer.from(salt, 'base64'), iterations, keyLength, 'sha256')\n const decipher = crypto.createDecipheriv(algorithm, key, Buffer.from(iv, 'base64'))\n decipher.setAuthTag(Buffer.from(tag, 'base64'))\n let decrypted = decipher.update(ciphertext, 'base64', 'utf8')\n decrypted += decipher.final('utf8')\n return decrypted\n}\n"],"mappings":"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","names":["import_crypto","import_fs","import_path","path","fs","crypto","KeyRingEntry","prompts","args","path","fs","StreamZip","m","crypto"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// bin/find-root.ts
|
|
30
|
+
var find_root_exports = {};
|
|
31
|
+
__export(find_root_exports, {
|
|
32
|
+
pkg: () => pkg,
|
|
33
|
+
root: () => root
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(find_root_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
37
|
+
var import_path = __toESM(require("path"), 1);
|
|
38
|
+
var folders = process.cwd().split(import_path.default.sep);
|
|
39
|
+
var rootIndex = folders.findIndex((folder, i) => import_fs.default.existsSync(import_path.default.join(folders.slice(0, i + 1).join(import_path.default.sep), "package.json")));
|
|
40
|
+
var root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(import_path.default.sep);
|
|
41
|
+
var pkg = JSON.parse(import_fs.default.readFileSync(import_path.default.join(root, "package.json"), "utf-8"));
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
pkg,
|
|
45
|
+
root
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=find-root.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../bin/find-root.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nconst folders = process.cwd().split(path.sep)\nconst rootIndex = folders.findIndex((folder: string, i: number) => fs.existsSync(path.join(folders.slice(0, i + 1).join(path.sep), 'package.json')))\nexport const root = (rootIndex > 0 ? folders.slice(0, rootIndex + 1) : folders).join(path.sep)\n\nexport const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAiB;AAEjB,IAAM,UAAU,QAAQ,IAAI,EAAE,MAAM,YAAAA,QAAK,GAAG;AAC5C,IAAM,YAAY,QAAQ,UAAU,CAAC,QAAgB,MAAc,UAAAC,QAAG,WAAW,YAAAD,QAAK,KAAK,QAAQ,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,YAAAA,QAAK,GAAG,GAAG,cAAc,CAAC,CAAC;AAC5I,IAAM,QAAQ,YAAY,IAAI,QAAQ,MAAM,GAAG,YAAY,CAAC,IAAI,SAAS,KAAK,YAAAA,QAAK,GAAG;AAEtF,IAAM,MAAM,KAAK,MAAM,UAAAC,QAAG,aAAa,YAAAD,QAAK,KAAK,MAAM,cAAc,GAAG,OAAO,CAAC;","names":["path","fs"]}
|