@nocobase/plugin-multi-portal 2.2.0-alpha.10
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/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/client-v2/354.ead3e96143164cd5.js +10 -0
- package/dist/client-v2/499.ef2ff0c022687485.js +10 -0
- package/dist/client-v2/778.23ba409a924ee34a.js +10 -0
- package/dist/client-v2/845.f2b0ce44ae4be707.js +10 -0
- package/dist/client-v2/entryActions/PortalEntryActionModel.d.ts +52 -0
- package/dist/client-v2/entryActions/portalEntryActionStore.d.ts +36 -0
- package/dist/client-v2/entryActions/registerPortalEntryActions.d.ts +10 -0
- package/dist/client-v2/entryActions/types.d.ts +41 -0
- package/dist/client-v2/entryActions/url.d.ts +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/layoutRegistration.d.ts +38 -0
- package/dist/client-v2/locale.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalBlockModel.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +34 -0
- package/dist/client-v2/pages/MultiPortalsPage.d.ts +80 -0
- package/dist/client-v2/permissions/MultiPortalPermissionsTab.d.ts +21 -0
- package/dist/client-v2/permissions/multiPortalPermissions.d.ts +12 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/client-v2/routeRepositoryScope.d.ts +11 -0
- package/dist/client-v2/routeUrl.d.ts +18 -0
- package/dist/externalVersion.js +25 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +82 -0
- package/dist/locale/zh-CN.json +82 -0
- package/dist/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/dist/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/commonjs/header.js +312 -0
- package/dist/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
- package/dist/node_modules/tar/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/dist/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/list.js +145 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/dist/node_modules/tar/dist/commonjs/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
- package/dist/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/commonjs/pack.js +545 -0
- package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/dist/commonjs/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/commonjs/parse.js +610 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/dist/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/dist/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/dist/node_modules/tar/dist/commonjs/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/dist/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/dist/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/create.js +76 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/dist/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/extract.js +49 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/dist/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/esm/header.js +275 -0
- package/dist/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/esm/index.js +20 -0
- package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/dist/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/list.js +105 -0
- package/dist/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
- package/dist/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/dist/node_modules/tar/dist/esm/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/esm/options.js +54 -0
- package/dist/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/esm/pack.js +503 -0
- package/dist/node_modules/tar/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/dist/esm/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/esm/parse.js +606 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/dist/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/esm/pax.js +154 -0
- package/dist/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/dist/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/dist/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/replace.js +221 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/dist/node_modules/tar/dist/esm/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/types.js +45 -0
- package/dist/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
- package/dist/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/update.js +30 -0
- package/dist/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/dist/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
- package/dist/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.js +85 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/package.json +69 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.js +1018 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/package.json +82 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.js +363 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/package.json +80 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/dist/node_modules/tar/package.json +1 -0
- package/dist/server/collections/desktopRoutes.d.ts +14 -0
- package/dist/server/collections/desktopRoutes.js +48 -0
- package/dist/server/collections/extendRoleField.d.ts +14 -0
- package/dist/server/collections/extendRoleField.js +51 -0
- package/dist/server/collections/multiPortals.d.ts +10 -0
- package/dist/server/collections/multiPortals.js +128 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.js +76 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.js +73 -0
- package/dist/server/collections/rolesMultiPortals.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortals.js +68 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.d.ts +11 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.js +70 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.d.ts +13 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.js +104 -0
- package/dist/server/plugin.d.ts +63 -0
- package/dist/server/plugin.js +2130 -0
- package/package.json +34 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.create = void 0;
|
|
7
|
+
const fs_minipass_1 = require("@isaacs/fs-minipass");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const list_js_1 = require("./list.js");
|
|
10
|
+
const make_command_js_1 = require("./make-command.js");
|
|
11
|
+
const pack_js_1 = require("./pack.js");
|
|
12
|
+
const createFileSync = (opt, files) => {
|
|
13
|
+
const p = new pack_js_1.PackSync(opt);
|
|
14
|
+
const stream = new fs_minipass_1.WriteStreamSync(opt.file, {
|
|
15
|
+
mode: opt.mode || 0o666,
|
|
16
|
+
});
|
|
17
|
+
p.pipe(stream);
|
|
18
|
+
addFilesSync(p, files);
|
|
19
|
+
};
|
|
20
|
+
const createFile = (opt, files) => {
|
|
21
|
+
const p = new pack_js_1.Pack(opt);
|
|
22
|
+
const stream = new fs_minipass_1.WriteStream(opt.file, {
|
|
23
|
+
mode: opt.mode || 0o666,
|
|
24
|
+
});
|
|
25
|
+
p.pipe(stream);
|
|
26
|
+
const promise = new Promise((res, rej) => {
|
|
27
|
+
stream.on('error', rej);
|
|
28
|
+
stream.on('close', res);
|
|
29
|
+
p.on('error', rej);
|
|
30
|
+
});
|
|
31
|
+
addFilesAsync(p, files).catch(er => p.emit('error', er));
|
|
32
|
+
return promise;
|
|
33
|
+
};
|
|
34
|
+
const addFilesSync = (p, files) => {
|
|
35
|
+
files.forEach(file => {
|
|
36
|
+
if (file.charAt(0) === '@') {
|
|
37
|
+
(0, list_js_1.list)({
|
|
38
|
+
file: node_path_1.default.resolve(p.cwd, file.slice(1)),
|
|
39
|
+
sync: true,
|
|
40
|
+
noResume: true,
|
|
41
|
+
onReadEntry: entry => p.add(entry),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
p.add(file);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
p.end();
|
|
49
|
+
};
|
|
50
|
+
const addFilesAsync = async (p, files) => {
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
if (file.charAt(0) === '@') {
|
|
53
|
+
await (0, list_js_1.list)({
|
|
54
|
+
file: node_path_1.default.resolve(String(p.cwd), file.slice(1)),
|
|
55
|
+
noResume: true,
|
|
56
|
+
onReadEntry: entry => {
|
|
57
|
+
p.add(entry);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
p.add(file);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
p.end();
|
|
66
|
+
};
|
|
67
|
+
const createSync = (opt, files) => {
|
|
68
|
+
const p = new pack_js_1.PackSync(opt);
|
|
69
|
+
addFilesSync(p, files);
|
|
70
|
+
return p;
|
|
71
|
+
};
|
|
72
|
+
const createAsync = (opt, files) => {
|
|
73
|
+
const p = new pack_js_1.Pack(opt);
|
|
74
|
+
addFilesAsync(p, files).catch(er => p.emit('error', er));
|
|
75
|
+
return p;
|
|
76
|
+
};
|
|
77
|
+
exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => {
|
|
78
|
+
if (!files?.length) {
|
|
79
|
+
throw new TypeError('no paths specified to add to archive');
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CwdError = void 0;
|
|
4
|
+
class CwdError extends Error {
|
|
5
|
+
path;
|
|
6
|
+
code;
|
|
7
|
+
syscall = 'chdir';
|
|
8
|
+
constructor(path, code) {
|
|
9
|
+
super(`${code}: Cannot cd into '${path}'`);
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
get name() {
|
|
14
|
+
return 'CwdError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CwdError = CwdError;
|
|
18
|
+
//# sourceMappingURL=cwd-error.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.extract = void 0;
|
|
40
|
+
// tar -x
|
|
41
|
+
const fsm = __importStar(require("@isaacs/fs-minipass"));
|
|
42
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
43
|
+
const list_js_1 = require("./list.js");
|
|
44
|
+
const make_command_js_1 = require("./make-command.js");
|
|
45
|
+
const unpack_js_1 = require("./unpack.js");
|
|
46
|
+
const extractFileSync = (opt) => {
|
|
47
|
+
const u = new unpack_js_1.UnpackSync(opt);
|
|
48
|
+
const file = opt.file;
|
|
49
|
+
const stat = node_fs_1.default.statSync(file);
|
|
50
|
+
// This trades a zero-byte read() syscall for a stat
|
|
51
|
+
// However, it will usually result in less memory allocation
|
|
52
|
+
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
53
|
+
const stream = new fsm.ReadStreamSync(file, {
|
|
54
|
+
readSize: readSize,
|
|
55
|
+
size: stat.size,
|
|
56
|
+
});
|
|
57
|
+
stream.pipe(u);
|
|
58
|
+
};
|
|
59
|
+
const extractFile = (opt, _) => {
|
|
60
|
+
const u = new unpack_js_1.Unpack(opt);
|
|
61
|
+
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
62
|
+
const file = opt.file;
|
|
63
|
+
const p = new Promise((resolve, reject) => {
|
|
64
|
+
u.on('error', reject);
|
|
65
|
+
u.on('close', resolve);
|
|
66
|
+
// This trades a zero-byte read() syscall for a stat
|
|
67
|
+
// However, it will usually result in less memory allocation
|
|
68
|
+
node_fs_1.default.stat(file, (er, stat) => {
|
|
69
|
+
if (er) {
|
|
70
|
+
reject(er);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const stream = new fsm.ReadStream(file, {
|
|
74
|
+
readSize: readSize,
|
|
75
|
+
size: stat.size,
|
|
76
|
+
});
|
|
77
|
+
stream.on('error', reject);
|
|
78
|
+
stream.pipe(u);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
return p;
|
|
83
|
+
};
|
|
84
|
+
exports.extract = (0, make_command_js_1.makeCommand)(extractFileSync, extractFile, opt => new unpack_js_1.UnpackSync(opt), opt => new unpack_js_1.Unpack(opt), (opt, files) => {
|
|
85
|
+
if (files?.length)
|
|
86
|
+
(0, list_js_1.filesFilter)(opt, files);
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Get the appropriate flag to use for creating files
|
|
3
|
+
// We use fmap on Windows platforms for files less than
|
|
4
|
+
// 512kb. This is a fairly low limit, but avoids making
|
|
5
|
+
// things slower in some cases. Since most of what this
|
|
6
|
+
// library is used for is extracting tarballs of many
|
|
7
|
+
// relatively small files in npm packages and the like,
|
|
8
|
+
// it can be a big boost on Windows platforms.
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getWriteFlag = void 0;
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const platform = process.env.__FAKE_PLATFORM__ || process.platform;
|
|
16
|
+
const isWindows = platform === 'win32';
|
|
17
|
+
/* c8 ignore start */
|
|
18
|
+
const { O_CREAT, O_NOFOLLOW, O_TRUNC, O_WRONLY } = fs_1.default.constants;
|
|
19
|
+
const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) ||
|
|
20
|
+
fs_1.default.constants.UV_FS_O_FILEMAP ||
|
|
21
|
+
0;
|
|
22
|
+
/* c8 ignore stop */
|
|
23
|
+
const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP;
|
|
24
|
+
const fMapLimit = 512 * 1024;
|
|
25
|
+
const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY;
|
|
26
|
+
const noFollowFlag = !isWindows && typeof O_NOFOLLOW === 'number' ?
|
|
27
|
+
O_NOFOLLOW | O_TRUNC | O_CREAT | O_WRONLY
|
|
28
|
+
: null;
|
|
29
|
+
exports.getWriteFlag = noFollowFlag !== null ? () => noFollowFlag
|
|
30
|
+
: !fMapEnabled ? () => 'w'
|
|
31
|
+
: (size) => (size < fMapLimit ? fMapFlag : 'w');
|
|
32
|
+
//# sourceMappingURL=get-write-flag.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { EntryTypeCode, EntryTypeName } from './types.js';
|
|
2
|
+
export type HeaderData = {
|
|
3
|
+
path?: string;
|
|
4
|
+
mode?: number;
|
|
5
|
+
uid?: number;
|
|
6
|
+
gid?: number;
|
|
7
|
+
size?: number;
|
|
8
|
+
cksum?: number;
|
|
9
|
+
type?: EntryTypeName | 'Unsupported';
|
|
10
|
+
linkpath?: string;
|
|
11
|
+
uname?: string;
|
|
12
|
+
gname?: string;
|
|
13
|
+
devmaj?: number;
|
|
14
|
+
devmin?: number;
|
|
15
|
+
atime?: Date;
|
|
16
|
+
ctime?: Date;
|
|
17
|
+
mtime?: Date;
|
|
18
|
+
charset?: string;
|
|
19
|
+
comment?: string;
|
|
20
|
+
dev?: number;
|
|
21
|
+
ino?: number;
|
|
22
|
+
nlink?: number;
|
|
23
|
+
};
|
|
24
|
+
export declare class Header implements HeaderData {
|
|
25
|
+
#private;
|
|
26
|
+
cksumValid: boolean;
|
|
27
|
+
needPax: boolean;
|
|
28
|
+
nullBlock: boolean;
|
|
29
|
+
block?: Buffer;
|
|
30
|
+
path?: string;
|
|
31
|
+
mode?: number;
|
|
32
|
+
uid?: number;
|
|
33
|
+
gid?: number;
|
|
34
|
+
size?: number;
|
|
35
|
+
cksum?: number;
|
|
36
|
+
linkpath?: string;
|
|
37
|
+
uname?: string;
|
|
38
|
+
gname?: string;
|
|
39
|
+
devmaj: number;
|
|
40
|
+
devmin: number;
|
|
41
|
+
atime?: Date;
|
|
42
|
+
ctime?: Date;
|
|
43
|
+
mtime?: Date;
|
|
44
|
+
charset?: string;
|
|
45
|
+
comment?: string;
|
|
46
|
+
constructor(data?: Buffer | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData);
|
|
47
|
+
decode(buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData): void;
|
|
48
|
+
encode(buf?: Buffer, off?: number): boolean;
|
|
49
|
+
get type(): EntryTypeName;
|
|
50
|
+
get typeKey(): EntryTypeCode | 'Unsupported';
|
|
51
|
+
set type(type: EntryTypeCode | EntryTypeName | 'Unsupported');
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// parse a 512-byte header block to a data object, or vice-versa
|
|
3
|
+
// encode returns `true` if a pax extended header is needed, because
|
|
4
|
+
// the data could not be faithfully encoded in a simple header.
|
|
5
|
+
// (Also, check header.needPax to see if it needs a pax header.)
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.Header = void 0;
|
|
41
|
+
const node_path_1 = require("node:path");
|
|
42
|
+
const large = __importStar(require("./large-numbers.js"));
|
|
43
|
+
const types = __importStar(require("./types.js"));
|
|
44
|
+
class Header {
|
|
45
|
+
cksumValid = false;
|
|
46
|
+
needPax = false;
|
|
47
|
+
nullBlock = false;
|
|
48
|
+
block;
|
|
49
|
+
path;
|
|
50
|
+
mode;
|
|
51
|
+
uid;
|
|
52
|
+
gid;
|
|
53
|
+
size;
|
|
54
|
+
cksum;
|
|
55
|
+
#type = 'Unsupported';
|
|
56
|
+
linkpath;
|
|
57
|
+
uname;
|
|
58
|
+
gname;
|
|
59
|
+
devmaj = 0;
|
|
60
|
+
devmin = 0;
|
|
61
|
+
atime;
|
|
62
|
+
ctime;
|
|
63
|
+
mtime;
|
|
64
|
+
charset;
|
|
65
|
+
comment;
|
|
66
|
+
constructor(data, off = 0, ex, gex) {
|
|
67
|
+
if (Buffer.isBuffer(data)) {
|
|
68
|
+
this.decode(data, off || 0, ex, gex);
|
|
69
|
+
}
|
|
70
|
+
else if (data) {
|
|
71
|
+
this.#slurp(data);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
decode(buf, off, ex, gex) {
|
|
75
|
+
if (!off) {
|
|
76
|
+
off = 0;
|
|
77
|
+
}
|
|
78
|
+
if (!buf || !(buf.length >= off + 512)) {
|
|
79
|
+
throw new Error('need 512 bytes for header');
|
|
80
|
+
}
|
|
81
|
+
this.path = ex?.path ?? decString(buf, off, 100);
|
|
82
|
+
this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
|
|
83
|
+
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
|
|
84
|
+
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
|
|
85
|
+
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
|
|
86
|
+
this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
|
|
87
|
+
this.cksum = decNumber(buf, off + 148, 12);
|
|
88
|
+
// if we have extended or global extended headers, apply them now
|
|
89
|
+
// See https://github.com/npm/node-tar/pull/187
|
|
90
|
+
// Apply global before local, so it overrides
|
|
91
|
+
if (gex)
|
|
92
|
+
this.#slurp(gex, true);
|
|
93
|
+
if (ex)
|
|
94
|
+
this.#slurp(ex);
|
|
95
|
+
// old tar versions marked dirs as a file with a trailing /
|
|
96
|
+
const t = decString(buf, off + 156, 1);
|
|
97
|
+
if (types.isCode(t)) {
|
|
98
|
+
this.#type = t || '0';
|
|
99
|
+
}
|
|
100
|
+
if (this.#type === '0' && this.path.slice(-1) === '/') {
|
|
101
|
+
this.#type = '5';
|
|
102
|
+
}
|
|
103
|
+
// tar implementations sometimes incorrectly put the stat(dir).size
|
|
104
|
+
// as the size in the tarball, even though Directory entries are
|
|
105
|
+
// not able to have any body at all. In the very rare chance that
|
|
106
|
+
// it actually DOES have a body, we weren't going to do anything with
|
|
107
|
+
// it anyway, and it'll just be a warning about an invalid header.
|
|
108
|
+
if (this.#type === '5') {
|
|
109
|
+
this.size = 0;
|
|
110
|
+
}
|
|
111
|
+
this.linkpath = decString(buf, off + 157, 100);
|
|
112
|
+
if (buf.subarray(off + 257, off + 265).toString() === 'ustar\u000000') {
|
|
113
|
+
/* c8 ignore start */
|
|
114
|
+
this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
|
|
115
|
+
this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
|
|
116
|
+
this.devmaj =
|
|
117
|
+
ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
|
|
118
|
+
this.devmin =
|
|
119
|
+
ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
|
|
120
|
+
/* c8 ignore stop */
|
|
121
|
+
if (buf[off + 475] !== 0) {
|
|
122
|
+
// definitely a prefix, definitely >130 chars.
|
|
123
|
+
const prefix = decString(buf, off + 345, 155);
|
|
124
|
+
this.path = prefix + '/' + this.path;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const prefix = decString(buf, off + 345, 130);
|
|
128
|
+
if (prefix) {
|
|
129
|
+
this.path = prefix + '/' + this.path;
|
|
130
|
+
}
|
|
131
|
+
/* c8 ignore start */
|
|
132
|
+
this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
|
|
133
|
+
this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
|
|
134
|
+
/* c8 ignore stop */
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
let sum = 8 * 0x20;
|
|
138
|
+
for (let i = off; i < off + 148; i++) {
|
|
139
|
+
sum += buf[i];
|
|
140
|
+
}
|
|
141
|
+
for (let i = off + 156; i < off + 512; i++) {
|
|
142
|
+
sum += buf[i];
|
|
143
|
+
}
|
|
144
|
+
this.cksumValid = sum === this.cksum;
|
|
145
|
+
if (this.cksum === undefined && sum === 8 * 0x20) {
|
|
146
|
+
this.nullBlock = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
#slurp(ex, gex = false) {
|
|
150
|
+
Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
|
|
151
|
+
// we slurp in everything except for the path attribute in
|
|
152
|
+
// a global extended header, because that's weird. Also, any
|
|
153
|
+
// null/undefined values are ignored.
|
|
154
|
+
return !(v === null ||
|
|
155
|
+
v === undefined ||
|
|
156
|
+
(k === 'path' && gex) ||
|
|
157
|
+
(k === 'linkpath' && gex) ||
|
|
158
|
+
k === 'global');
|
|
159
|
+
})));
|
|
160
|
+
}
|
|
161
|
+
encode(buf, off = 0) {
|
|
162
|
+
if (!buf) {
|
|
163
|
+
buf = this.block = Buffer.alloc(512);
|
|
164
|
+
}
|
|
165
|
+
if (this.#type === 'Unsupported') {
|
|
166
|
+
this.#type = '0';
|
|
167
|
+
}
|
|
168
|
+
if (!(buf.length >= off + 512)) {
|
|
169
|
+
throw new Error('need 512 bytes for header');
|
|
170
|
+
}
|
|
171
|
+
const prefixSize = this.ctime || this.atime ? 130 : 155;
|
|
172
|
+
const split = splitPrefix(this.path || '', prefixSize);
|
|
173
|
+
const path = split[0];
|
|
174
|
+
const prefix = split[1];
|
|
175
|
+
this.needPax = !!split[2];
|
|
176
|
+
this.needPax = encString(buf, off, 100, path) || this.needPax;
|
|
177
|
+
this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax;
|
|
178
|
+
this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax;
|
|
179
|
+
this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax;
|
|
180
|
+
this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax;
|
|
181
|
+
this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax;
|
|
182
|
+
buf[off + 156] = Number(this.#type.codePointAt(0));
|
|
183
|
+
this.needPax =
|
|
184
|
+
encString(buf, off + 157, 100, this.linkpath) || this.needPax;
|
|
185
|
+
buf.write('ustar\u000000', off + 257, 8);
|
|
186
|
+
this.needPax =
|
|
187
|
+
encString(buf, off + 265, 32, this.uname) || this.needPax;
|
|
188
|
+
this.needPax =
|
|
189
|
+
encString(buf, off + 297, 32, this.gname) || this.needPax;
|
|
190
|
+
this.needPax =
|
|
191
|
+
encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
|
|
192
|
+
this.needPax =
|
|
193
|
+
encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
|
|
194
|
+
this.needPax =
|
|
195
|
+
encString(buf, off + 345, prefixSize, prefix) || this.needPax;
|
|
196
|
+
if (buf[off + 475] !== 0) {
|
|
197
|
+
this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax;
|
|
201
|
+
this.needPax =
|
|
202
|
+
encDate(buf, off + 476, 12, this.atime) || this.needPax;
|
|
203
|
+
this.needPax =
|
|
204
|
+
encDate(buf, off + 488, 12, this.ctime) || this.needPax;
|
|
205
|
+
}
|
|
206
|
+
let sum = 8 * 0x20;
|
|
207
|
+
for (let i = off; i < off + 148; i++) {
|
|
208
|
+
sum += buf[i];
|
|
209
|
+
}
|
|
210
|
+
for (let i = off + 156; i < off + 512; i++) {
|
|
211
|
+
sum += buf[i];
|
|
212
|
+
}
|
|
213
|
+
this.cksum = sum;
|
|
214
|
+
encNumber(buf, off + 148, 8, this.cksum);
|
|
215
|
+
this.cksumValid = true;
|
|
216
|
+
return this.needPax;
|
|
217
|
+
}
|
|
218
|
+
get type() {
|
|
219
|
+
return (this.#type === 'Unsupported' ?
|
|
220
|
+
this.#type
|
|
221
|
+
: types.name.get(this.#type));
|
|
222
|
+
}
|
|
223
|
+
get typeKey() {
|
|
224
|
+
return this.#type;
|
|
225
|
+
}
|
|
226
|
+
set type(type) {
|
|
227
|
+
const c = String(types.code.get(type));
|
|
228
|
+
if (types.isCode(c) || c === 'Unsupported') {
|
|
229
|
+
this.#type = c;
|
|
230
|
+
}
|
|
231
|
+
else if (types.isCode(type)) {
|
|
232
|
+
this.#type = type;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
throw new TypeError('invalid entry type: ' + type);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
exports.Header = Header;
|
|
240
|
+
const splitPrefix = (p, prefixSize) => {
|
|
241
|
+
const pathSize = 100;
|
|
242
|
+
let pp = p;
|
|
243
|
+
let prefix = '';
|
|
244
|
+
let ret = undefined;
|
|
245
|
+
const root = node_path_1.posix.parse(p).root || '.';
|
|
246
|
+
if (Buffer.byteLength(pp) < pathSize) {
|
|
247
|
+
ret = [pp, prefix, false];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
// first set prefix to the dir, and path to the base
|
|
251
|
+
prefix = node_path_1.posix.dirname(pp);
|
|
252
|
+
pp = node_path_1.posix.basename(pp);
|
|
253
|
+
do {
|
|
254
|
+
if (Buffer.byteLength(pp) <= pathSize &&
|
|
255
|
+
Buffer.byteLength(prefix) <= prefixSize) {
|
|
256
|
+
// both fit!
|
|
257
|
+
ret = [pp, prefix, false];
|
|
258
|
+
}
|
|
259
|
+
else if (Buffer.byteLength(pp) > pathSize &&
|
|
260
|
+
Buffer.byteLength(prefix) <= prefixSize) {
|
|
261
|
+
// prefix fits in prefix, but path doesn't fit in path
|
|
262
|
+
ret = [pp.slice(0, pathSize - 1), prefix, true];
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
// make path take a bit from prefix
|
|
266
|
+
pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp);
|
|
267
|
+
prefix = node_path_1.posix.dirname(prefix);
|
|
268
|
+
}
|
|
269
|
+
} while (prefix !== root && ret === undefined);
|
|
270
|
+
// at this point, found no resolution, just truncate
|
|
271
|
+
if (!ret) {
|
|
272
|
+
ret = [p.slice(0, pathSize - 1), '', true];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return ret;
|
|
276
|
+
};
|
|
277
|
+
const decString = (buf, off, size) => buf
|
|
278
|
+
.subarray(off, off + size)
|
|
279
|
+
.toString('utf8')
|
|
280
|
+
.replace(/\0.*/, '');
|
|
281
|
+
const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
|
|
282
|
+
const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000);
|
|
283
|
+
const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ?
|
|
284
|
+
large.parse(buf.subarray(off, off + size))
|
|
285
|
+
: decSmallNumber(buf, off, size);
|
|
286
|
+
const nanUndef = (value) => (isNaN(value) ? undefined : value);
|
|
287
|
+
const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf
|
|
288
|
+
.subarray(off, off + size)
|
|
289
|
+
.toString('utf8')
|
|
290
|
+
.replace(/\0.*$/, '')
|
|
291
|
+
.trim(), 8));
|
|
292
|
+
// the maximum encodable as a null-terminated octal, by field size
|
|
293
|
+
const MAXNUM = {
|
|
294
|
+
12: 0o77777777777,
|
|
295
|
+
8: 0o7777777,
|
|
296
|
+
};
|
|
297
|
+
const encNumber = (buf, off, size, num) => num === undefined ? false
|
|
298
|
+
: num > MAXNUM[size] || num < 0 ?
|
|
299
|
+
(large.encode(num, buf.subarray(off, off + size)), true)
|
|
300
|
+
: (encSmallNumber(buf, off, size, num), false);
|
|
301
|
+
const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii');
|
|
302
|
+
const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
|
|
303
|
+
const padOctal = (str, size) => (str.length === size - 1 ?
|
|
304
|
+
str
|
|
305
|
+
: new Array(size - str.length - 1).join('0') + str + ' ') + '\0';
|
|
306
|
+
const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000));
|
|
307
|
+
// enough to fill the longest string we've got
|
|
308
|
+
const NULLS = new Array(156).join('\0');
|
|
309
|
+
// pad with nulls, return true if it's longer or non-ascii
|
|
310
|
+
const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'),
|
|
311
|
+
str.length !== Buffer.byteLength(str) || str.length > size));
|
|
312
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { type TarOptionsWithAliasesAsync, type TarOptionsWithAliasesAsyncFile, type TarOptionsWithAliasesAsyncNoFile, type TarOptionsWithAliasesSyncNoFile, type TarOptionsWithAliases, type TarOptionsWithAliasesFile, type TarOptionsWithAliasesSync, type TarOptionsWithAliasesSyncFile, } from './options.js';
|
|
2
|
+
export * from './create.js';
|
|
3
|
+
export { create as c } from './create.js';
|
|
4
|
+
export * from './extract.js';
|
|
5
|
+
export { extract as x } from './extract.js';
|
|
6
|
+
export * from './header.js';
|
|
7
|
+
export * from './list.js';
|
|
8
|
+
export { list as t } from './list.js';
|
|
9
|
+
export * from './pack.js';
|
|
10
|
+
export * from './parse.js';
|
|
11
|
+
export * from './pax.js';
|
|
12
|
+
export * from './read-entry.js';
|
|
13
|
+
export * from './replace.js';
|
|
14
|
+
export { replace as r } from './replace.js';
|
|
15
|
+
export * as types from './types.js';
|
|
16
|
+
export * from './unpack.js';
|
|
17
|
+
export * from './update.js';
|
|
18
|
+
export { update as u } from './update.js';
|
|
19
|
+
export * from './write-entry.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|