keycloakify 6.10.1 → 6.11.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 +6 -0
- package/bin/keycloakify/BuildOptions.d.ts +5 -0
- package/bin/keycloakify/BuildOptions.js +47 -8
- package/bin/keycloakify/BuildOptions.js.map +1 -1
- package/bin/keycloakify/generateJavaStackFiles.d.ts +2 -1
- package/bin/keycloakify/generateJavaStackFiles.js +4 -5
- package/bin/keycloakify/generateJavaStackFiles.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +39 -8
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/bin/tools/crc32.d.ts +9 -0
- package/bin/tools/crc32.js +63 -0
- package/bin/tools/crc32.js.map +1 -0
- package/bin/tools/deflate.d.ts +24 -0
- package/bin/tools/deflate.js +155 -0
- package/bin/tools/deflate.js.map +1 -0
- package/bin/tools/jar.d.ts +14 -0
- package/bin/tools/jar.js +124 -0
- package/bin/tools/jar.js.map +1 -0
- package/bin/tools/tee.d.ts +3 -0
- package/bin/tools/tee.js +36 -0
- package/bin/tools/tee.js.map +1 -0
- package/bin/tools/walk.d.ts +8 -0
- package/bin/tools/walk.js +125 -0
- package/bin/tools/walk.js.map +1 -0
- package/bin/tools/zip.d.ts +29 -0
- package/bin/tools/zip.js +329 -0
- package/bin/tools/zip.js.map +1 -0
- package/bin/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -1
- package/src/bin/keycloakify/BuildOptions.ts +31 -4
- package/src/bin/keycloakify/generateJavaStackFiles.ts +6 -8
- package/src/bin/keycloakify/keycloakify.ts +25 -5
- package/src/bin/tools/crc32.ts +54 -0
- package/src/bin/tools/deflate.ts +61 -0
- package/src/bin/tools/downloadAndUnzip.ts +1 -1
- package/src/bin/tools/jar.ts +100 -0
- package/src/bin/tools/tee.ts +37 -0
- package/src/bin/tools/walk.ts +19 -0
- package/src/bin/tools/zip.ts +245 -0
package/bin/tools/jar.js
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (_) try {
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
|
+
};
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
42
|
+
var stream_1 = require("stream");
|
43
|
+
var promises_1 = require("stream/promises");
|
44
|
+
var path_1 = require("path");
|
45
|
+
var fs_1 = require("fs");
|
46
|
+
var walk_1 = __importDefault(require("./walk"));
|
47
|
+
var zip_1 = __importDefault(require("./zip"));
|
48
|
+
/** Trim leading whitespace from every line */
|
49
|
+
var trimIndent = function (s) { return s.replace(/(\n)\s+/g, "$1"); };
|
50
|
+
/**
|
51
|
+
* Create a jar archive, using the resources found at `rootPath` (a directory) and write the
|
52
|
+
* archive to `targetPath` (a file). Use `groupId`, `artifactId` and `version` to define
|
53
|
+
* the contents of the pom.properties file which is going to be added to the archive.
|
54
|
+
*/
|
55
|
+
function jar(_a) {
|
56
|
+
var groupId = _a.groupId, artifactId = _a.artifactId, version = _a.version, rootPath = _a.rootPath, targetPath = _a.targetPath;
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
58
|
+
var manifest, pomProps, pathToRecord;
|
59
|
+
return __generator(this, function (_b) {
|
60
|
+
switch (_b.label) {
|
61
|
+
case 0:
|
62
|
+
manifest = {
|
63
|
+
path: "META-INF/MANIFEST.MF",
|
64
|
+
data: Buffer.from(trimIndent("Manifest-Version: 1.0\n Archiver-Version: Plexus Archiver\n Created-By: Keycloakify\n Built-By: unknown\n Build-Jdk: 19.0.0"))
|
65
|
+
};
|
66
|
+
pomProps = {
|
67
|
+
path: "META-INF/maven/".concat(groupId, "/").concat(artifactId, "/pom.properties"),
|
68
|
+
data: Buffer.from(trimIndent("# Generated by keycloakify\n # ".concat(new Date(), "\n artifactId=").concat(artifactId, "\n groupId=").concat(groupId, "\n version=").concat(version)))
|
69
|
+
};
|
70
|
+
pathToRecord = function () {
|
71
|
+
return new stream_1.Transform({
|
72
|
+
objectMode: true,
|
73
|
+
transform: function (path, _, cb) {
|
74
|
+
var filename = (0, path_1.relative)(rootPath, path).split(path_1.sep).join("/");
|
75
|
+
this.push({ filename: filename, path: path });
|
76
|
+
cb();
|
77
|
+
},
|
78
|
+
final: function () {
|
79
|
+
this.push(manifest);
|
80
|
+
this.push(pomProps);
|
81
|
+
this.push(null);
|
82
|
+
}
|
83
|
+
});
|
84
|
+
};
|
85
|
+
/**
|
86
|
+
* Create an async pipeline, wait until everything is fully processed
|
87
|
+
*/
|
88
|
+
return [4 /*yield*/, (0, promises_1.pipeline)(
|
89
|
+
// walk all files in `rootPath` recursively
|
90
|
+
stream_1.Readable.from((0, walk_1.default)(rootPath)),
|
91
|
+
// transform every path into a ZipSource object
|
92
|
+
pathToRecord(),
|
93
|
+
// let the zip lib convert all ZipSource objects into a byte stream
|
94
|
+
(0, zip_1.default)(),
|
95
|
+
// write that byte stream to targetPath
|
96
|
+
(0, fs_1.createWriteStream)(targetPath, { encoding: "binary" }))];
|
97
|
+
case 1:
|
98
|
+
/**
|
99
|
+
* Create an async pipeline, wait until everything is fully processed
|
100
|
+
*/
|
101
|
+
_b.sent();
|
102
|
+
return [2 /*return*/];
|
103
|
+
}
|
104
|
+
});
|
105
|
+
});
|
106
|
+
}
|
107
|
+
exports.default = jar;
|
108
|
+
/**
|
109
|
+
* Standalone usage, call e.g. `ts-node jar.ts dirWithSources some-jar.jar`
|
110
|
+
*/
|
111
|
+
if (require.main === module) {
|
112
|
+
var main = function () {
|
113
|
+
var _a, _b, _c;
|
114
|
+
return jar({
|
115
|
+
rootPath: process.argv[2],
|
116
|
+
targetPath: process.argv[3],
|
117
|
+
artifactId: (_a = process.env.ARTIFACT_ID) !== null && _a !== void 0 ? _a : "artifact",
|
118
|
+
groupId: (_b = process.env.GROUP_ID) !== null && _b !== void 0 ? _b : "group",
|
119
|
+
version: (_c = process.env.VERSION) !== null && _c !== void 0 ? _c : "1.0.0"
|
120
|
+
});
|
121
|
+
};
|
122
|
+
main().catch(function (e) { return console.error(e); });
|
123
|
+
}
|
124
|
+
//# sourceMappingURL=jar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jar.js","sourceRoot":"","sources":["../../src/bin/tools/jar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA6C;AAC7C,4CAA2C;AAC3C,6BAAqC;AACrC,yBAAuC;AAEvC,gDAA0B;AAE1B,8CAAwB;AAExB,8CAA8C;AAC9C,IAAM,UAAU,GAAG,UAAC,CAAS,IAAK,OAAA,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,EAA3B,CAA2B,CAAC;AAU9D;;;;GAIG;AACH,SAA8B,GAAG,CAAC,EAA+D;QAA7D,OAAO,aAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,UAAU,gBAAA;;;;;;oBAC5E,QAAQ,GAAc;wBACxB,IAAI,EAAE,sBAAsB;wBAC5B,IAAI,EAAE,MAAM,CAAC,IAAI,CACb,UAAU,CACN,6LAImB,CACtB,CACJ;qBACJ,CAAC;oBAEI,QAAQ,GAAc;wBACxB,IAAI,EAAE,yBAAkB,OAAO,cAAI,UAAU,oBAAiB;wBAC9D,IAAI,EAAE,MAAM,CAAC,IAAI,CACb,UAAU,CACN,yDACK,IAAI,IAAI,EAAE,2CACD,UAAU,wCACb,OAAO,wCACP,OAAO,CAAE,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,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,WAAW,mCAAI,UAAU;YACjD,OAAO,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,OAAO;YACxC,OAAO,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,OAAO;SAC1C,CAAC,CAAA;KAAA,CAAC;IACP,IAAI,EAAE,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAhB,CAAgB,CAAC,CAAC;CACvC"}
|
package/bin/tools/tee.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var stream_1 = require("stream");
|
4
|
+
function tee(input) {
|
5
|
+
var a = new stream_1.PassThrough();
|
6
|
+
var b = new stream_1.PassThrough();
|
7
|
+
var aFull = false;
|
8
|
+
var bFull = false;
|
9
|
+
a.on("drain", function () {
|
10
|
+
aFull = false;
|
11
|
+
if (!aFull && !bFull)
|
12
|
+
input.resume();
|
13
|
+
});
|
14
|
+
b.on("drain", function () {
|
15
|
+
bFull = false;
|
16
|
+
if (!aFull && !bFull)
|
17
|
+
input.resume();
|
18
|
+
});
|
19
|
+
input.on("error", function (e) {
|
20
|
+
a.emit("error", e);
|
21
|
+
b.emit("error", e);
|
22
|
+
});
|
23
|
+
input.on("data", function (chunk) {
|
24
|
+
aFull = !a.write(chunk);
|
25
|
+
bFull = !b.write(chunk);
|
26
|
+
if (aFull || bFull)
|
27
|
+
input.pause();
|
28
|
+
});
|
29
|
+
input.on("end", function () {
|
30
|
+
a.end();
|
31
|
+
b.end();
|
32
|
+
});
|
33
|
+
return [a, b];
|
34
|
+
}
|
35
|
+
exports.default = tee;
|
36
|
+
//# sourceMappingURL=tee.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tee.js","sourceRoot":"","sources":["../../src/bin/tools/tee.ts"],"names":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;AAC3B,CAAC;AAlCD,sBAkCC"}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
3
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
4
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
5
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
6
|
+
function step(op) {
|
7
|
+
if (f) throw new TypeError("Generator is already executing.");
|
8
|
+
while (_) try {
|
9
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
10
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
11
|
+
switch (op[0]) {
|
12
|
+
case 0: case 1: t = op; break;
|
13
|
+
case 4: _.label++; return { value: op[1], done: false };
|
14
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
15
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
16
|
+
default:
|
17
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
18
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
19
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
20
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
21
|
+
if (t[2]) _.ops.pop();
|
22
|
+
_.trys.pop(); continue;
|
23
|
+
}
|
24
|
+
op = body.call(thisArg, _);
|
25
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
26
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
27
|
+
}
|
28
|
+
};
|
29
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
30
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
31
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
32
|
+
var m = o[Symbol.asyncIterator], i;
|
33
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
34
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
35
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
36
|
+
};
|
37
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
38
|
+
var i, p;
|
39
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
40
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
41
|
+
};
|
42
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
43
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
44
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
45
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
46
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
47
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
48
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
49
|
+
function fulfill(value) { resume("next", value); }
|
50
|
+
function reject(value) { resume("throw", value); }
|
51
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
52
|
+
};
|
53
|
+
var __values = (this && this.__values) || function(o) {
|
54
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
55
|
+
if (m) return m.call(o);
|
56
|
+
if (o && typeof o.length === "number") return {
|
57
|
+
next: function () {
|
58
|
+
if (o && i >= o.length) o = void 0;
|
59
|
+
return { value: o && o[i++], done: !o };
|
60
|
+
}
|
61
|
+
};
|
62
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
63
|
+
};
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
65
|
+
var promises_1 = require("fs/promises");
|
66
|
+
var path_1 = require("path");
|
67
|
+
/**
|
68
|
+
* Asynchronously and recursively walk a directory tree, yielding every file and directory
|
69
|
+
* found
|
70
|
+
*
|
71
|
+
* @param root the starting directory
|
72
|
+
* @returns AsyncGenerator
|
73
|
+
*/
|
74
|
+
function walk(root) {
|
75
|
+
return __asyncGenerator(this, arguments, function walk_1() {
|
76
|
+
var _a, _b, entry, absolutePath, e_1_1;
|
77
|
+
var e_1, _c;
|
78
|
+
return __generator(this, function (_d) {
|
79
|
+
switch (_d.label) {
|
80
|
+
case 0:
|
81
|
+
_d.trys.push([0, 12, 13, 14]);
|
82
|
+
return [4 /*yield*/, __await((0, promises_1.readdir)(root, { withFileTypes: true }))];
|
83
|
+
case 1:
|
84
|
+
_a = __values.apply(void 0, [_d.sent()]), _b = _a.next();
|
85
|
+
_d.label = 2;
|
86
|
+
case 2:
|
87
|
+
if (!!_b.done) return [3 /*break*/, 11];
|
88
|
+
entry = _b.value;
|
89
|
+
absolutePath = (0, path_1.resolve)(root, entry.name);
|
90
|
+
if (!entry.isDirectory()) return [3 /*break*/, 7];
|
91
|
+
return [4 /*yield*/, __await(absolutePath)];
|
92
|
+
case 3: return [4 /*yield*/, _d.sent()];
|
93
|
+
case 4:
|
94
|
+
_d.sent();
|
95
|
+
return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(walk(absolutePath))))];
|
96
|
+
case 5: return [4 /*yield*/, __await.apply(void 0, [_d.sent()])];
|
97
|
+
case 6:
|
98
|
+
_d.sent();
|
99
|
+
return [3 /*break*/, 10];
|
100
|
+
case 7: return [4 /*yield*/, __await(absolutePath)];
|
101
|
+
case 8: return [4 /*yield*/, _d.sent()];
|
102
|
+
case 9:
|
103
|
+
_d.sent();
|
104
|
+
_d.label = 10;
|
105
|
+
case 10:
|
106
|
+
_b = _a.next();
|
107
|
+
return [3 /*break*/, 2];
|
108
|
+
case 11: return [3 /*break*/, 14];
|
109
|
+
case 12:
|
110
|
+
e_1_1 = _d.sent();
|
111
|
+
e_1 = { error: e_1_1 };
|
112
|
+
return [3 /*break*/, 14];
|
113
|
+
case 13:
|
114
|
+
try {
|
115
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
116
|
+
}
|
117
|
+
finally { if (e_1) throw e_1.error; }
|
118
|
+
return [7 /*endfinally*/];
|
119
|
+
case 14: return [2 /*return*/];
|
120
|
+
}
|
121
|
+
});
|
122
|
+
});
|
123
|
+
}
|
124
|
+
exports.default = walk;
|
125
|
+
//# sourceMappingURL=walk.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/bin/tools/walk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAsC;AACtC,6BAA+B;AAE/B;;;;;;GAMG;AACH,SAA+B,IAAI,CAAC,IAAY;;;;;;;;oBACxB,6BAAM,IAAA,kBAAO,EAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,GAAA;;oBAA5C,KAAA,wBAAA,SAA4C,EAAA;;;;oBAArD,KAAK;oBACN,YAAY,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;yBAC3C,KAAK,CAAC,WAAW,EAAE,EAAnB,wBAAmB;iDACb,YAAY;wBAAlB,gCAAkB;;oBAAlB,SAAkB,CAAC;oBACnB,sBAAA,SAAO,iBAAA,cAAA,IAAI,CAAC,YAAY,CAAC,CAAA,CAAA,CAAA,EAAA;wBAAzB,4CAAA,SAAyB,IAAA;;oBAAzB,SAAyB,CAAC;;qDACjB,YAAY;wBAAlB,gCAAkB;;oBAAlB,SAAkB,CAAC;;;;;;;;;;;;;;;;;;;;CAEjC;AARD,uBAQC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { Transform } from "stream";
|
4
|
+
/**
|
5
|
+
* Zip source
|
6
|
+
* @property filename the name of the entry in the archie
|
7
|
+
* @property path of the source file, if the source is an actual file
|
8
|
+
* @property data the actual data buffer, if the source is constructed in-memory
|
9
|
+
*/
|
10
|
+
export declare type ZipSource = {
|
11
|
+
path: string;
|
12
|
+
} & ({
|
13
|
+
fsPath: string;
|
14
|
+
} | {
|
15
|
+
data: Buffer;
|
16
|
+
});
|
17
|
+
export declare type ZipRecord = {
|
18
|
+
path: string;
|
19
|
+
compression: "deflate" | undefined;
|
20
|
+
uncompressedSize: number;
|
21
|
+
compressedSize?: number;
|
22
|
+
crc32?: number;
|
23
|
+
offset?: number;
|
24
|
+
};
|
25
|
+
/**
|
26
|
+
* @returns a stream Transform, which reads a stream of ZipRecords and
|
27
|
+
* writes a bytestream
|
28
|
+
*/
|
29
|
+
export default function zip(): Transform;
|