@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,179 @@
|
|
|
1
|
+
import { chownr, chownrSync } from 'chownr';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import fsp from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { CwdError } from './cwd-error.js';
|
|
6
|
+
import { normalizeWindowsPath } from './normalize-windows-path.js';
|
|
7
|
+
import { SymlinkError } from './symlink-error.js';
|
|
8
|
+
const checkCwd = (dir, cb) => {
|
|
9
|
+
fs.stat(dir, (er, st) => {
|
|
10
|
+
if (er || !st.isDirectory()) {
|
|
11
|
+
er = new CwdError(dir, er?.code || 'ENOTDIR');
|
|
12
|
+
}
|
|
13
|
+
cb(er);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Wrapper around fs/promises.mkdir for tar's needs.
|
|
18
|
+
*
|
|
19
|
+
* The main purpose is to avoid creating directories if we know that
|
|
20
|
+
* they already exist (and track which ones exist for this purpose),
|
|
21
|
+
* and prevent entries from being extracted into symlinked folders,
|
|
22
|
+
* if `preservePaths` is not set.
|
|
23
|
+
*/
|
|
24
|
+
export const mkdir = (dir, opt, cb) => {
|
|
25
|
+
dir = normalizeWindowsPath(dir);
|
|
26
|
+
// if there's any overlap between mask and mode,
|
|
27
|
+
// then we'll need an explicit chmod
|
|
28
|
+
/* c8 ignore next */
|
|
29
|
+
const umask = opt.umask ?? 0o22;
|
|
30
|
+
const mode = opt.mode | 0o0700;
|
|
31
|
+
const needChmod = (mode & umask) !== 0;
|
|
32
|
+
const uid = opt.uid;
|
|
33
|
+
const gid = opt.gid;
|
|
34
|
+
const doChown = typeof uid === 'number' &&
|
|
35
|
+
typeof gid === 'number' &&
|
|
36
|
+
(uid !== opt.processUid || gid !== opt.processGid);
|
|
37
|
+
const preserve = opt.preserve;
|
|
38
|
+
const unlink = opt.unlink;
|
|
39
|
+
const cwd = normalizeWindowsPath(opt.cwd);
|
|
40
|
+
const done = (er, created) => {
|
|
41
|
+
if (er) {
|
|
42
|
+
cb(er);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (created && doChown) {
|
|
46
|
+
chownr(created, uid, gid, er => done(er));
|
|
47
|
+
}
|
|
48
|
+
else if (needChmod) {
|
|
49
|
+
fs.chmod(dir, mode, cb);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
cb();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
if (dir === cwd) {
|
|
57
|
+
return checkCwd(dir, done);
|
|
58
|
+
}
|
|
59
|
+
if (preserve) {
|
|
60
|
+
return fsp.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts
|
|
61
|
+
done);
|
|
62
|
+
}
|
|
63
|
+
const sub = normalizeWindowsPath(path.relative(cwd, dir));
|
|
64
|
+
const parts = sub.split('/');
|
|
65
|
+
mkdir_(cwd, parts, mode, unlink, cwd, undefined, done);
|
|
66
|
+
};
|
|
67
|
+
const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => {
|
|
68
|
+
if (parts.length === 0) {
|
|
69
|
+
return cb(null, created);
|
|
70
|
+
}
|
|
71
|
+
const p = parts.shift();
|
|
72
|
+
const part = normalizeWindowsPath(path.resolve(base + '/' + p));
|
|
73
|
+
fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
|
|
74
|
+
};
|
|
75
|
+
const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => {
|
|
76
|
+
if (er) {
|
|
77
|
+
fs.lstat(part, (statEr, st) => {
|
|
78
|
+
if (statEr) {
|
|
79
|
+
statEr.path = statEr.path && normalizeWindowsPath(statEr.path);
|
|
80
|
+
cb(statEr);
|
|
81
|
+
}
|
|
82
|
+
else if (st.isDirectory()) {
|
|
83
|
+
mkdir_(part, parts, mode, unlink, cwd, created, cb);
|
|
84
|
+
}
|
|
85
|
+
else if (unlink) {
|
|
86
|
+
fs.unlink(part, er => {
|
|
87
|
+
if (er) {
|
|
88
|
+
return cb(er);
|
|
89
|
+
}
|
|
90
|
+
fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else if (st.isSymbolicLink()) {
|
|
94
|
+
return cb(new SymlinkError(part, part + '/' + parts.join('/')));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
cb(er);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
created = created || part;
|
|
103
|
+
mkdir_(part, parts, mode, unlink, cwd, created, cb);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const checkCwdSync = (dir) => {
|
|
107
|
+
let ok = false;
|
|
108
|
+
let code;
|
|
109
|
+
try {
|
|
110
|
+
ok = fs.statSync(dir).isDirectory();
|
|
111
|
+
}
|
|
112
|
+
catch (er) {
|
|
113
|
+
code = er?.code;
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
if (!ok) {
|
|
117
|
+
throw new CwdError(dir, code ?? 'ENOTDIR');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export const mkdirSync = (dir, opt) => {
|
|
122
|
+
dir = normalizeWindowsPath(dir);
|
|
123
|
+
// if there's any overlap between mask and mode,
|
|
124
|
+
// then we'll need an explicit chmod
|
|
125
|
+
/* c8 ignore next */
|
|
126
|
+
const umask = opt.umask ?? 0o22;
|
|
127
|
+
const mode = opt.mode | 0o700;
|
|
128
|
+
const needChmod = (mode & umask) !== 0;
|
|
129
|
+
const uid = opt.uid;
|
|
130
|
+
const gid = opt.gid;
|
|
131
|
+
const doChown = typeof uid === 'number' &&
|
|
132
|
+
typeof gid === 'number' &&
|
|
133
|
+
(uid !== opt.processUid || gid !== opt.processGid);
|
|
134
|
+
const preserve = opt.preserve;
|
|
135
|
+
const unlink = opt.unlink;
|
|
136
|
+
const cwd = normalizeWindowsPath(opt.cwd);
|
|
137
|
+
const done = (created) => {
|
|
138
|
+
if (created && doChown) {
|
|
139
|
+
chownrSync(created, uid, gid);
|
|
140
|
+
}
|
|
141
|
+
if (needChmod) {
|
|
142
|
+
fs.chmodSync(dir, mode);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
if (dir === cwd) {
|
|
146
|
+
checkCwdSync(cwd);
|
|
147
|
+
return done();
|
|
148
|
+
}
|
|
149
|
+
if (preserve) {
|
|
150
|
+
return done(fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined);
|
|
151
|
+
}
|
|
152
|
+
const sub = normalizeWindowsPath(path.relative(cwd, dir));
|
|
153
|
+
const parts = sub.split('/');
|
|
154
|
+
let created;
|
|
155
|
+
for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) {
|
|
156
|
+
part = normalizeWindowsPath(path.resolve(part));
|
|
157
|
+
try {
|
|
158
|
+
fs.mkdirSync(part, mode);
|
|
159
|
+
created = created || part;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
const st = fs.lstatSync(part);
|
|
163
|
+
if (st.isDirectory()) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
else if (unlink) {
|
|
167
|
+
fs.unlinkSync(part);
|
|
168
|
+
fs.mkdirSync(part, mode);
|
|
169
|
+
created = created || part;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
else if (st.isSymbolicLink()) {
|
|
173
|
+
return new SymlinkError(part, part + '/' + parts.join('/'));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return done(created);
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=mkdir.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const modeFix = (mode, isDir, portable) => {
|
|
2
|
+
mode &= 0o7777;
|
|
3
|
+
// in portable mode, use the minimum reasonable umask
|
|
4
|
+
// if this system creates files with 0o664 by default
|
|
5
|
+
// (as some linux distros do), then we'll write the
|
|
6
|
+
// archive with 0o644 instead. Also, don't ever create
|
|
7
|
+
// a file that is not readable/writable by the owner.
|
|
8
|
+
if (portable) {
|
|
9
|
+
mode = (mode | 0o600) & ~0o22;
|
|
10
|
+
}
|
|
11
|
+
// if dirs are readable, then they should be listable
|
|
12
|
+
if (isDir) {
|
|
13
|
+
if (mode & 0o400) {
|
|
14
|
+
mode |= 0o100;
|
|
15
|
+
}
|
|
16
|
+
if (mode & 0o40) {
|
|
17
|
+
mode |= 0o10;
|
|
18
|
+
}
|
|
19
|
+
if (mode & 0o4) {
|
|
20
|
+
mode |= 0o1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return mode;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=mode-fix.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// warning: extremely hot code path.
|
|
2
|
+
// This has been meticulously optimized for use
|
|
3
|
+
// within npm install on large package trees.
|
|
4
|
+
// Do not edit without careful benchmarking.
|
|
5
|
+
const normalizeCache = Object.create(null);
|
|
6
|
+
// Limit the size of this. Very low-sophistication LRU cache
|
|
7
|
+
const MAX = 10000;
|
|
8
|
+
const cache = new Set();
|
|
9
|
+
export const normalizeUnicode = (s) => {
|
|
10
|
+
if (!cache.has(s)) {
|
|
11
|
+
// shake out identical accents and ligatures
|
|
12
|
+
normalizeCache[s] = s
|
|
13
|
+
.normalize('NFD')
|
|
14
|
+
.toLocaleLowerCase('en')
|
|
15
|
+
.toLocaleUpperCase('en');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
cache.delete(s);
|
|
19
|
+
}
|
|
20
|
+
cache.add(s);
|
|
21
|
+
const ret = normalizeCache[s];
|
|
22
|
+
let i = cache.size - MAX;
|
|
23
|
+
// only prune when we're 10% over the max
|
|
24
|
+
if (i > MAX / 10) {
|
|
25
|
+
for (const s of cache) {
|
|
26
|
+
cache.delete(s);
|
|
27
|
+
delete normalizeCache[s];
|
|
28
|
+
if (--i <= 0)
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return ret;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=normalize-unicode.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// on windows, either \ or / are valid directory separators.
|
|
2
|
+
// on unix, \ is a valid character in filenames.
|
|
3
|
+
// so, on windows, and only on windows, we replace all \ chars with /,
|
|
4
|
+
// so that we can use / as our one and only directory separator char.
|
|
5
|
+
const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
|
|
6
|
+
export const normalizeWindowsPath = platform !== 'win32' ?
|
|
7
|
+
(p) => p
|
|
8
|
+
: (p) => p && p.replaceAll(/\\/g, '/');
|
|
9
|
+
//# sourceMappingURL=normalize-windows-path.js.map
|