@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.
Files changed (217) hide show
  1. package/LICENSE.txt +107 -0
  2. package/README.md +14 -0
  3. package/client-v2.d.ts +2 -0
  4. package/client-v2.js +1 -0
  5. package/client.d.ts +2 -0
  6. package/client.js +1 -0
  7. package/dist/client/index.d.ts +9 -0
  8. package/dist/client/index.js +10 -0
  9. package/dist/client/locale.d.ts +10 -0
  10. package/dist/client/models/index.d.ts +11 -0
  11. package/dist/client/plugin.d.ts +13 -0
  12. package/dist/client-v2/354.ead3e96143164cd5.js +10 -0
  13. package/dist/client-v2/499.ef2ff0c022687485.js +10 -0
  14. package/dist/client-v2/778.23ba409a924ee34a.js +10 -0
  15. package/dist/client-v2/845.f2b0ce44ae4be707.js +10 -0
  16. package/dist/client-v2/entryActions/PortalEntryActionModel.d.ts +52 -0
  17. package/dist/client-v2/entryActions/portalEntryActionStore.d.ts +36 -0
  18. package/dist/client-v2/entryActions/registerPortalEntryActions.d.ts +10 -0
  19. package/dist/client-v2/entryActions/types.d.ts +41 -0
  20. package/dist/client-v2/entryActions/url.d.ts +10 -0
  21. package/dist/client-v2/index.d.ts +9 -0
  22. package/dist/client-v2/index.js +10 -0
  23. package/dist/client-v2/layoutRegistration.d.ts +38 -0
  24. package/dist/client-v2/locale.d.ts +13 -0
  25. package/dist/client-v2/models/MultiPortalBlockModel.d.ts +13 -0
  26. package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +34 -0
  27. package/dist/client-v2/pages/MultiPortalsPage.d.ts +80 -0
  28. package/dist/client-v2/permissions/MultiPortalPermissionsTab.d.ts +21 -0
  29. package/dist/client-v2/permissions/multiPortalPermissions.d.ts +12 -0
  30. package/dist/client-v2/plugin.d.ts +13 -0
  31. package/dist/client-v2/routeRepositoryScope.d.ts +11 -0
  32. package/dist/client-v2/routeUrl.d.ts +18 -0
  33. package/dist/externalVersion.js +25 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +48 -0
  36. package/dist/locale/en-US.json +82 -0
  37. package/dist/locale/zh-CN.json +82 -0
  38. package/dist/node_modules/tar/dist/commonjs/create.d.ts +3 -0
  39. package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
  40. package/dist/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
  41. package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
  42. package/dist/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
  43. package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
  44. package/dist/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
  45. package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
  46. package/dist/node_modules/tar/dist/commonjs/header.d.ts +53 -0
  47. package/dist/node_modules/tar/dist/commonjs/header.js +312 -0
  48. package/dist/node_modules/tar/dist/commonjs/index.d.ts +20 -0
  49. package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
  50. package/dist/node_modules/tar/dist/commonjs/index.min.js +1 -0
  51. package/dist/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
  52. package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
  53. package/dist/node_modules/tar/dist/commonjs/list.d.ts +7 -0
  54. package/dist/node_modules/tar/dist/commonjs/list.js +145 -0
  55. package/dist/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
  56. package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
  57. package/dist/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
  58. package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
  59. package/dist/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
  60. package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
  61. package/dist/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
  62. package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
  63. package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
  64. package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
  65. package/dist/node_modules/tar/dist/commonjs/options.d.ts +596 -0
  66. package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
  67. package/dist/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
  68. package/dist/node_modules/tar/dist/commonjs/pack.js +545 -0
  69. package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
  70. package/dist/node_modules/tar/dist/commonjs/parse.d.ts +85 -0
  71. package/dist/node_modules/tar/dist/commonjs/parse.js +610 -0
  72. package/dist/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
  73. package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
  74. package/dist/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
  75. package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
  76. package/dist/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
  77. package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
  78. package/dist/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
  79. package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
  80. package/dist/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
  81. package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
  82. package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
  83. package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
  84. package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
  85. package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
  86. package/dist/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
  87. package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
  88. package/dist/node_modules/tar/dist/commonjs/types.d.ts +7 -0
  89. package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
  90. package/dist/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
  91. package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
  92. package/dist/node_modules/tar/dist/commonjs/update.d.ts +2 -0
  93. package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
  94. package/dist/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
  95. package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
  96. package/dist/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
  97. package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
  98. package/dist/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
  99. package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
  100. package/dist/node_modules/tar/dist/esm/create.d.ts +3 -0
  101. package/dist/node_modules/tar/dist/esm/create.js +76 -0
  102. package/dist/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
  103. package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
  104. package/dist/node_modules/tar/dist/esm/extract.d.ts +3 -0
  105. package/dist/node_modules/tar/dist/esm/extract.js +49 -0
  106. package/dist/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
  107. package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
  108. package/dist/node_modules/tar/dist/esm/header.d.ts +53 -0
  109. package/dist/node_modules/tar/dist/esm/header.js +275 -0
  110. package/dist/node_modules/tar/dist/esm/index.d.ts +20 -0
  111. package/dist/node_modules/tar/dist/esm/index.js +20 -0
  112. package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
  113. package/dist/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
  114. package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
  115. package/dist/node_modules/tar/dist/esm/list.d.ts +7 -0
  116. package/dist/node_modules/tar/dist/esm/list.js +105 -0
  117. package/dist/node_modules/tar/dist/esm/make-command.d.ts +49 -0
  118. package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
  119. package/dist/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
  120. package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
  121. package/dist/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
  122. package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
  123. package/dist/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
  124. package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
  125. package/dist/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
  126. package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
  127. package/dist/node_modules/tar/dist/esm/options.d.ts +596 -0
  128. package/dist/node_modules/tar/dist/esm/options.js +54 -0
  129. package/dist/node_modules/tar/dist/esm/pack.d.ts +105 -0
  130. package/dist/node_modules/tar/dist/esm/pack.js +503 -0
  131. package/dist/node_modules/tar/dist/esm/package.json +3 -0
  132. package/dist/node_modules/tar/dist/esm/parse.d.ts +85 -0
  133. package/dist/node_modules/tar/dist/esm/parse.js +606 -0
  134. package/dist/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
  135. package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
  136. package/dist/node_modules/tar/dist/esm/pax.d.ts +26 -0
  137. package/dist/node_modules/tar/dist/esm/pax.js +154 -0
  138. package/dist/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
  139. package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
  140. package/dist/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
  141. package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
  142. package/dist/node_modules/tar/dist/esm/replace.d.ts +2 -0
  143. package/dist/node_modules/tar/dist/esm/replace.js +221 -0
  144. package/dist/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
  145. package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
  146. package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
  147. package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
  148. package/dist/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
  149. package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
  150. package/dist/node_modules/tar/dist/esm/types.d.ts +7 -0
  151. package/dist/node_modules/tar/dist/esm/types.js +45 -0
  152. package/dist/node_modules/tar/dist/esm/unpack.d.ts +101 -0
  153. package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
  154. package/dist/node_modules/tar/dist/esm/update.d.ts +2 -0
  155. package/dist/node_modules/tar/dist/esm/update.js +30 -0
  156. package/dist/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
  157. package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
  158. package/dist/node_modules/tar/dist/esm/winchars.d.ts +3 -0
  159. package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
  160. package/dist/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
  161. package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
  162. package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
  163. package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.js +93 -0
  164. package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/package.json +3 -0
  165. package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.d.ts +3 -0
  166. package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.js +85 -0
  167. package/dist/node_modules/tar/node_modules/chownr/dist/esm/package.json +3 -0
  168. package/dist/node_modules/tar/node_modules/chownr/package.json +69 -0
  169. package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
  170. package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.js +1028 -0
  171. package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/package.json +3 -0
  172. package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.d.ts +549 -0
  173. package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.js +1018 -0
  174. package/dist/node_modules/tar/node_modules/minipass/dist/esm/package.json +3 -0
  175. package/dist/node_modules/tar/node_modules/minipass/package.json +82 -0
  176. package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
  177. package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.js +123 -0
  178. package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
  179. package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.js +416 -0
  180. package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/package.json +3 -0
  181. package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
  182. package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.js +117 -0
  183. package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.d.ts +99 -0
  184. package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.js +363 -0
  185. package/dist/node_modules/tar/node_modules/minizlib/dist/esm/package.json +3 -0
  186. package/dist/node_modules/tar/node_modules/minizlib/package.json +80 -0
  187. package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
  188. package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
  189. package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
  190. package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
  191. package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
  192. package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
  193. package/dist/node_modules/tar/node_modules/yallist/package.json +68 -0
  194. package/dist/node_modules/tar/package.json +1 -0
  195. package/dist/server/collections/desktopRoutes.d.ts +14 -0
  196. package/dist/server/collections/desktopRoutes.js +48 -0
  197. package/dist/server/collections/extendRoleField.d.ts +14 -0
  198. package/dist/server/collections/extendRoleField.js +51 -0
  199. package/dist/server/collections/multiPortals.d.ts +10 -0
  200. package/dist/server/collections/multiPortals.js +128 -0
  201. package/dist/server/collections/rolesMultiPortalDesktopRoutes.d.ts +10 -0
  202. package/dist/server/collections/rolesMultiPortalDesktopRoutes.js +76 -0
  203. package/dist/server/collections/rolesMultiPortalRoutePolicies.d.ts +10 -0
  204. package/dist/server/collections/rolesMultiPortalRoutePolicies.js +73 -0
  205. package/dist/server/collections/rolesMultiPortals.d.ts +10 -0
  206. package/dist/server/collections/rolesMultiPortals.js +68 -0
  207. package/dist/server/ensureDefaultRoleMultiPortalAccess.d.ts +11 -0
  208. package/dist/server/ensureDefaultRoleMultiPortalAccess.js +70 -0
  209. package/dist/server/index.d.ts +9 -0
  210. package/dist/server/index.js +42 -0
  211. package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.d.ts +13 -0
  212. package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.js +104 -0
  213. package/dist/server/plugin.d.ts +63 -0
  214. package/dist/server/plugin.js +2130 -0
  215. package/package.json +34 -0
  216. package/server.d.ts +2 -0
  217. package/server.js +1 -0
@@ -0,0 +1,105 @@
1
+ import { type Stats } from 'fs';
2
+ import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js';
3
+ export declare class PackJob {
4
+ path: string;
5
+ absolute: string;
6
+ entry?: WriteEntry | WriteEntryTar;
7
+ stat?: Stats;
8
+ readdir?: string[];
9
+ pending: boolean;
10
+ pendingLink: boolean;
11
+ ignore: boolean;
12
+ piped: boolean;
13
+ constructor(path: string, absolute: string);
14
+ }
15
+ import { Minipass } from 'minipass';
16
+ import * as zlib from 'minizlib';
17
+ import { Yallist } from 'yallist';
18
+ import { ReadEntry } from './read-entry.js';
19
+ import type { WarnEvent } from './warn-method.js';
20
+ import { type WarnData, type Warner } from './warn-method.js';
21
+ declare const ONSTAT: unique symbol;
22
+ declare const ENDED: unique symbol;
23
+ declare const QUEUE: unique symbol;
24
+ declare const PENDINGLINKS: unique symbol;
25
+ declare const CURRENT: unique symbol;
26
+ declare const PROCESS: unique symbol;
27
+ declare const PROCESSING: unique symbol;
28
+ declare const PROCESSJOB: unique symbol;
29
+ declare const JOBS: unique symbol;
30
+ declare const JOBDONE: unique symbol;
31
+ declare const ADDFSENTRY: unique symbol;
32
+ declare const ADDTARENTRY: unique symbol;
33
+ declare const STAT: unique symbol;
34
+ declare const READDIR: unique symbol;
35
+ declare const ONREADDIR: unique symbol;
36
+ declare const PIPE: unique symbol;
37
+ declare const ENTRY: unique symbol;
38
+ declare const ENTRYOPT: unique symbol;
39
+ declare const WRITEENTRYCLASS: unique symbol;
40
+ declare const WRITE: unique symbol;
41
+ declare const ONDRAIN: unique symbol;
42
+ import type { TarOptions } from './options.js';
43
+ export declare class Pack extends Minipass<Buffer, ReadEntry | string, WarnEvent<Buffer>> implements Warner {
44
+ sync: boolean;
45
+ opt: TarOptions;
46
+ cwd: string;
47
+ maxReadSize?: number;
48
+ preservePaths: boolean;
49
+ strict: boolean;
50
+ noPax: boolean;
51
+ prefix: string;
52
+ linkCache: Exclude<TarOptions['linkCache'], undefined>;
53
+ statCache: Exclude<TarOptions['statCache'], undefined>;
54
+ file: string;
55
+ portable: boolean;
56
+ zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress;
57
+ readdirCache: Exclude<TarOptions['readdirCache'], undefined>;
58
+ noDirRecurse: boolean;
59
+ follow: boolean;
60
+ noMtime: boolean;
61
+ mtime?: Date;
62
+ filter: Exclude<TarOptions['filter'], undefined>;
63
+ jobs: number;
64
+ [WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync;
65
+ onWriteEntry?: (entry: WriteEntry) => void;
66
+ [QUEUE]: Yallist<PackJob>;
67
+ [PENDINGLINKS]: Map<`${number}:${number}`, PackJob[]>;
68
+ [JOBS]: number;
69
+ [PROCESSING]: boolean;
70
+ [ENDED]: boolean;
71
+ constructor(opt?: TarOptions);
72
+ [WRITE](chunk: Buffer): boolean;
73
+ add(path: string | ReadEntry): this;
74
+ end(cb?: () => void): this;
75
+ end(path: string | ReadEntry, cb?: () => void): this;
76
+ end(path: string | ReadEntry, encoding?: Minipass.Encoding, cb?: () => void): this;
77
+ write(path: string | ReadEntry): boolean;
78
+ [ADDTARENTRY](p: ReadEntry): void;
79
+ [ADDFSENTRY](p: string): void;
80
+ [STAT](job: PackJob): void;
81
+ [ONSTAT](job: PackJob, stat: Stats): void;
82
+ [READDIR](job: PackJob): void;
83
+ [ONREADDIR](job: PackJob, entries: string[]): void;
84
+ [PROCESS](): void;
85
+ get [CURRENT](): PackJob | undefined;
86
+ [JOBDONE](job: PackJob): void;
87
+ [PROCESSJOB](job: PackJob): void;
88
+ [ENTRYOPT](job: PackJob): TarOptions;
89
+ [ENTRY](job: PackJob): WriteEntry | undefined;
90
+ [ONDRAIN](): void;
91
+ [PIPE](job: PackJob): void;
92
+ pause(): void;
93
+ warn(code: string, message: string | Error, data?: WarnData): void;
94
+ }
95
+ export declare class PackSync extends Pack {
96
+ sync: true;
97
+ constructor(opt: TarOptions);
98
+ pause(): void;
99
+ resume(): void;
100
+ [STAT](job: PackJob): void;
101
+ [READDIR](job: PackJob): void;
102
+ [PIPE](job: PackJob): void;
103
+ }
104
+ export {};
105
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1,545 @@
1
+ "use strict";
2
+ // A readable tar stream creator
3
+ // Technically, this is a transform stream that you write paths into,
4
+ // and tar format comes out of.
5
+ // The `add()` method is like `write()` but returns this,
6
+ // and end() return `this` as well, so you can
7
+ // do `new Pack(opt).add('files').add('dir').end().pipe(output)
8
+ // You could also do something like:
9
+ // streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.PackSync = exports.Pack = exports.PackJob = void 0;
48
+ const fs_1 = __importDefault(require("fs"));
49
+ const write_entry_js_1 = require("./write-entry.js");
50
+ class PackJob {
51
+ path;
52
+ absolute;
53
+ entry;
54
+ stat;
55
+ readdir;
56
+ pending = false;
57
+ pendingLink = false;
58
+ ignore = false;
59
+ piped = false;
60
+ constructor(path, absolute) {
61
+ this.path = path || './';
62
+ this.absolute = absolute;
63
+ }
64
+ }
65
+ exports.PackJob = PackJob;
66
+ const minipass_1 = require("minipass");
67
+ const zlib = __importStar(require("minizlib"));
68
+ const yallist_1 = require("yallist");
69
+ const read_entry_js_1 = require("./read-entry.js");
70
+ const warn_method_js_1 = require("./warn-method.js");
71
+ const EOF = Buffer.alloc(1024);
72
+ const ONSTAT = Symbol('onStat');
73
+ const ENDED = Symbol('ended');
74
+ const QUEUE = Symbol('queue');
75
+ const PENDINGLINKS = Symbol('queue');
76
+ const CURRENT = Symbol('current');
77
+ const PROCESS = Symbol('process');
78
+ const PROCESSING = Symbol('processing');
79
+ const PROCESSJOB = Symbol('processJob');
80
+ const JOBS = Symbol('jobs');
81
+ const JOBDONE = Symbol('jobDone');
82
+ const ADDFSENTRY = Symbol('addFSEntry');
83
+ const ADDTARENTRY = Symbol('addTarEntry');
84
+ const STAT = Symbol('stat');
85
+ const READDIR = Symbol('readdir');
86
+ const ONREADDIR = Symbol('onreaddir');
87
+ const PIPE = Symbol('pipe');
88
+ const ENTRY = Symbol('entry');
89
+ const ENTRYOPT = Symbol('entryOpt');
90
+ const WRITEENTRYCLASS = Symbol('writeEntryClass');
91
+ const WRITE = Symbol('write');
92
+ const ONDRAIN = Symbol('ondrain');
93
+ const path_1 = __importDefault(require("path"));
94
+ const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
95
+ class Pack extends minipass_1.Minipass {
96
+ sync = false;
97
+ opt;
98
+ cwd;
99
+ maxReadSize;
100
+ preservePaths;
101
+ strict;
102
+ noPax;
103
+ prefix;
104
+ linkCache;
105
+ statCache;
106
+ file;
107
+ portable;
108
+ zip;
109
+ readdirCache;
110
+ noDirRecurse;
111
+ follow;
112
+ noMtime;
113
+ mtime;
114
+ filter;
115
+ jobs;
116
+ [WRITEENTRYCLASS];
117
+ onWriteEntry;
118
+ // Note: we actually DO need a linked list here, because we
119
+ // shift() to update the head of the list where we start, but still
120
+ // while that happens, need to know what the next item in the queue
121
+ // will be. Since we do multiple jobs in parallel, it's not as simple
122
+ // as just an Array.shift(), since that would lose the information about
123
+ // the next job in the list. We could add a .next field on the PackJob
124
+ // class, but then we'd have to be tracking the tail of the queue the
125
+ // whole time, and Yallist just does that for us anyway.
126
+ [QUEUE];
127
+ [PENDINGLINKS] = new Map();
128
+ [JOBS] = 0;
129
+ [PROCESSING] = false;
130
+ [ENDED] = false;
131
+ constructor(opt = {}) {
132
+ super();
133
+ this.opt = opt;
134
+ this.file = opt.file || '';
135
+ this.cwd = opt.cwd || process.cwd();
136
+ this.maxReadSize = opt.maxReadSize;
137
+ this.preservePaths = !!opt.preservePaths;
138
+ this.strict = !!opt.strict;
139
+ this.noPax = !!opt.noPax;
140
+ this.prefix = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix || '');
141
+ this.linkCache = opt.linkCache || new Map();
142
+ this.statCache = opt.statCache || new Map();
143
+ this.readdirCache = opt.readdirCache || new Map();
144
+ this.onWriteEntry = opt.onWriteEntry;
145
+ this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntry;
146
+ if (typeof opt.onwarn === 'function') {
147
+ this.on('warn', opt.onwarn);
148
+ }
149
+ this.portable = !!opt.portable;
150
+ if (opt.gzip || opt.brotli || opt.zstd) {
151
+ if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) >
152
+ 1) {
153
+ throw new TypeError('gzip, brotli, zstd are mutually exclusive');
154
+ }
155
+ if (opt.gzip) {
156
+ if (typeof opt.gzip !== 'object') {
157
+ opt.gzip = {};
158
+ }
159
+ if (this.portable) {
160
+ opt.gzip.portable = true;
161
+ }
162
+ this.zip = new zlib.Gzip(opt.gzip);
163
+ }
164
+ if (opt.brotli) {
165
+ if (typeof opt.brotli !== 'object') {
166
+ opt.brotli = {};
167
+ }
168
+ this.zip = new zlib.BrotliCompress(opt.brotli);
169
+ }
170
+ if (opt.zstd) {
171
+ if (typeof opt.zstd !== 'object') {
172
+ opt.zstd = {};
173
+ }
174
+ this.zip = new zlib.ZstdCompress(opt.zstd);
175
+ }
176
+ /* c8 ignore next */
177
+ if (!this.zip)
178
+ throw new Error('impossible');
179
+ const zip = this.zip;
180
+ zip.on('data', chunk => super.write(chunk));
181
+ zip.on('end', () => super.end());
182
+ zip.on('drain', () => this[ONDRAIN]());
183
+ this.on('resume', () => zip.resume());
184
+ }
185
+ else {
186
+ this.on('drain', this[ONDRAIN]);
187
+ }
188
+ this.noDirRecurse = !!opt.noDirRecurse;
189
+ this.follow = !!opt.follow;
190
+ this.noMtime = !!opt.noMtime;
191
+ if (opt.mtime)
192
+ this.mtime = opt.mtime;
193
+ this.filter =
194
+ typeof opt.filter === 'function' ? opt.filter : () => true;
195
+ this[QUEUE] = new yallist_1.Yallist();
196
+ this[JOBS] = 0;
197
+ this.jobs = Number(opt.jobs) || 4;
198
+ this[PROCESSING] = false;
199
+ this[ENDED] = false;
200
+ }
201
+ [WRITE](chunk) {
202
+ return super.write(chunk);
203
+ }
204
+ add(path) {
205
+ this.write(path);
206
+ return this;
207
+ }
208
+ end(path, encoding, cb) {
209
+ /* c8 ignore start */
210
+ if (typeof path === 'function') {
211
+ cb = path;
212
+ path = undefined;
213
+ }
214
+ if (typeof encoding === 'function') {
215
+ cb = encoding;
216
+ encoding = undefined;
217
+ }
218
+ /* c8 ignore stop */
219
+ if (path) {
220
+ this.add(path);
221
+ }
222
+ this[ENDED] = true;
223
+ this[PROCESS]();
224
+ /* c8 ignore next */
225
+ if (cb)
226
+ cb();
227
+ return this;
228
+ }
229
+ write(path) {
230
+ if (this[ENDED]) {
231
+ throw new Error('write after end');
232
+ }
233
+ if (path instanceof read_entry_js_1.ReadEntry) {
234
+ this[ADDTARENTRY](path);
235
+ }
236
+ else {
237
+ this[ADDFSENTRY](path);
238
+ }
239
+ return this.flowing;
240
+ }
241
+ [ADDTARENTRY](p) {
242
+ const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p.path));
243
+ // in this case, we don't have to wait for the stat
244
+ if (!this.filter(p.path, p)) {
245
+ p.resume();
246
+ }
247
+ else {
248
+ const job = new PackJob(p.path, absolute);
249
+ job.entry = new write_entry_js_1.WriteEntryTar(p, this[ENTRYOPT](job));
250
+ job.entry.on('end', () => this[JOBDONE](job));
251
+ this[JOBS] += 1;
252
+ this[QUEUE].push(job);
253
+ }
254
+ this[PROCESS]();
255
+ }
256
+ [ADDFSENTRY](p) {
257
+ const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p));
258
+ this[QUEUE].push(new PackJob(p, absolute));
259
+ this[PROCESS]();
260
+ }
261
+ [STAT](job) {
262
+ job.pending = true;
263
+ this[JOBS] += 1;
264
+ const stat = this.follow ? 'stat' : 'lstat';
265
+ fs_1.default[stat](job.absolute, (er, stat) => {
266
+ job.pending = false;
267
+ this[JOBS] -= 1;
268
+ if (er) {
269
+ this.emit('error', er);
270
+ }
271
+ else {
272
+ this[ONSTAT](job, stat);
273
+ }
274
+ });
275
+ }
276
+ [ONSTAT](job, stat) {
277
+ this.statCache.set(job.absolute, stat);
278
+ job.stat = stat;
279
+ // now we have the stat, we can filter it.
280
+ if (!this.filter(job.path, stat)) {
281
+ job.ignore = true;
282
+ }
283
+ else if (stat.isFile() &&
284
+ stat.nlink > 1 &&
285
+ !this.linkCache.get(`${stat.dev}:${stat.ino}`) &&
286
+ !this.sync) {
287
+ // if it's not filtered, and it's a new File entry, and next anyway
288
+ // process right away in case any pending Link entries are about
289
+ // to try to link to it.
290
+ if (job === this[CURRENT]) {
291
+ this[PROCESSJOB](job);
292
+ }
293
+ else {
294
+ // if it's NOT the current entry, it needs to be deferred,
295
+ // so that the link target can be built first.
296
+ const key = `${stat.dev}:${stat.ino}`;
297
+ const pending = this[PENDINGLINKS].get(key);
298
+ if (pending)
299
+ pending.push(job);
300
+ else
301
+ this[PENDINGLINKS].set(key, [job]);
302
+ job.pendingLink = true;
303
+ job.pending = true;
304
+ }
305
+ }
306
+ this[PROCESS]();
307
+ }
308
+ [READDIR](job) {
309
+ job.pending = true;
310
+ this[JOBS] += 1;
311
+ fs_1.default.readdir(job.absolute, (er, entries) => {
312
+ job.pending = false;
313
+ this[JOBS] -= 1;
314
+ if (er) {
315
+ return this.emit('error', er);
316
+ }
317
+ this[ONREADDIR](job, entries);
318
+ });
319
+ }
320
+ [ONREADDIR](job, entries) {
321
+ this.readdirCache.set(job.absolute, entries);
322
+ job.readdir = entries;
323
+ this[PROCESS]();
324
+ }
325
+ [PROCESS]() {
326
+ if (this[PROCESSING]) {
327
+ return;
328
+ }
329
+ this[PROCESSING] = true;
330
+ for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) {
331
+ this[PROCESSJOB](w.value);
332
+ if (w.value.ignore) {
333
+ const p = w.next;
334
+ this[QUEUE].removeNode(w);
335
+ w.next = p;
336
+ }
337
+ }
338
+ this[PROCESSING] = false;
339
+ if (this[ENDED] && this[QUEUE].length === 0 && this[JOBS] === 0) {
340
+ if (this.zip) {
341
+ this.zip.end(EOF);
342
+ }
343
+ else {
344
+ super.write(EOF);
345
+ super.end();
346
+ }
347
+ }
348
+ }
349
+ get [CURRENT]() {
350
+ return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value;
351
+ }
352
+ [JOBDONE](job) {
353
+ this[QUEUE].shift();
354
+ this[JOBS] -= 1;
355
+ const { stat } = job;
356
+ if (stat && stat.isFile() && stat.nlink > 1) {
357
+ // might be a file with pending links
358
+ const key = `${stat.dev}:${stat.ino}`;
359
+ const pending = this[PENDINGLINKS].get(key);
360
+ if (pending) {
361
+ this[PENDINGLINKS].delete(key);
362
+ for (const job of pending) {
363
+ job.pending = false;
364
+ this[PROCESSJOB](job);
365
+ }
366
+ }
367
+ }
368
+ this[PROCESS]();
369
+ }
370
+ [PROCESSJOB](job) {
371
+ if (job.pending && job.pendingLink && job === this[CURRENT]) {
372
+ // At least one of the links to this file are not being included
373
+ // in the tarball, so we need to just proceed.
374
+ job.pending = false;
375
+ job.pendingLink = false;
376
+ }
377
+ if (job.pending) {
378
+ return;
379
+ }
380
+ if (job.entry) {
381
+ if (job === this[CURRENT] && !job.piped) {
382
+ this[PIPE](job);
383
+ }
384
+ return;
385
+ }
386
+ if (!job.stat) {
387
+ const sc = this.statCache.get(job.absolute);
388
+ if (sc) {
389
+ this[ONSTAT](job, sc);
390
+ }
391
+ else {
392
+ this[STAT](job);
393
+ }
394
+ }
395
+ if (!job.stat) {
396
+ return;
397
+ }
398
+ // filtered out!
399
+ if (job.ignore) {
400
+ return;
401
+ }
402
+ if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {
403
+ const rc = this.readdirCache.get(job.absolute);
404
+ if (rc) {
405
+ this[ONREADDIR](job, rc);
406
+ }
407
+ else {
408
+ this[READDIR](job);
409
+ }
410
+ if (!job.readdir) {
411
+ return;
412
+ }
413
+ }
414
+ // we know it doesn't have an entry, because that got checked above
415
+ job.entry = this[ENTRY](job);
416
+ if (!job.entry) {
417
+ job.ignore = true;
418
+ return;
419
+ }
420
+ if (job === this[CURRENT] && !job.piped) {
421
+ this[PIPE](job);
422
+ }
423
+ }
424
+ [ENTRYOPT](job) {
425
+ return {
426
+ onwarn: (code, msg, data) => this.warn(code, msg, data),
427
+ noPax: this.noPax,
428
+ cwd: this.cwd,
429
+ absolute: job.absolute,
430
+ preservePaths: this.preservePaths,
431
+ maxReadSize: this.maxReadSize,
432
+ strict: this.strict,
433
+ portable: this.portable,
434
+ linkCache: this.linkCache,
435
+ statCache: this.statCache,
436
+ noMtime: this.noMtime,
437
+ mtime: this.mtime,
438
+ prefix: this.prefix,
439
+ onWriteEntry: this.onWriteEntry,
440
+ };
441
+ }
442
+ [ENTRY](job) {
443
+ this[JOBS] += 1;
444
+ try {
445
+ const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job));
446
+ return e
447
+ .on('end', () => this[JOBDONE](job))
448
+ .on('error', er => this.emit('error', er));
449
+ }
450
+ catch (er) {
451
+ this.emit('error', er);
452
+ }
453
+ }
454
+ [ONDRAIN]() {
455
+ if (this[CURRENT] && this[CURRENT].entry) {
456
+ this[CURRENT].entry.resume();
457
+ }
458
+ }
459
+ // like .pipe() but using super, because our write() is special
460
+ [PIPE](job) {
461
+ job.piped = true;
462
+ if (job.readdir) {
463
+ job.readdir.forEach(entry => {
464
+ const p = job.path;
465
+ const base = p === './' ? '' : p.replace(/\/*$/, '/');
466
+ this[ADDFSENTRY](base + entry);
467
+ });
468
+ }
469
+ const source = job.entry;
470
+ const zip = this.zip;
471
+ /* c8 ignore start */
472
+ if (!source)
473
+ throw new Error('cannot pipe without source');
474
+ /* c8 ignore stop */
475
+ if (zip) {
476
+ source.on('data', chunk => {
477
+ if (!zip.write(chunk)) {
478
+ source.pause();
479
+ }
480
+ });
481
+ }
482
+ else {
483
+ source.on('data', chunk => {
484
+ if (!super.write(chunk)) {
485
+ source.pause();
486
+ }
487
+ });
488
+ }
489
+ }
490
+ pause() {
491
+ if (this.zip) {
492
+ this.zip.pause();
493
+ }
494
+ return super.pause();
495
+ }
496
+ warn(code, message, data = {}) {
497
+ (0, warn_method_js_1.warnMethod)(this, code, message, data);
498
+ }
499
+ }
500
+ exports.Pack = Pack;
501
+ class PackSync extends Pack {
502
+ sync = true;
503
+ constructor(opt) {
504
+ super(opt);
505
+ this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntrySync;
506
+ }
507
+ // pause/resume are no-ops in sync streams.
508
+ pause() { }
509
+ resume() { }
510
+ [STAT](job) {
511
+ const stat = this.follow ? 'statSync' : 'lstatSync';
512
+ this[ONSTAT](job, fs_1.default[stat](job.absolute));
513
+ }
514
+ [READDIR](job) {
515
+ this[ONREADDIR](job, fs_1.default.readdirSync(job.absolute));
516
+ }
517
+ // gotta get it all in this tick
518
+ [PIPE](job) {
519
+ const source = job.entry;
520
+ const zip = this.zip;
521
+ if (job.readdir) {
522
+ job.readdir.forEach(entry => {
523
+ const p = job.path;
524
+ const base = p === './' ? '' : p.replace(/\/*$/, '/');
525
+ this[ADDFSENTRY](base + entry);
526
+ });
527
+ }
528
+ /* c8 ignore start */
529
+ if (!source)
530
+ throw new Error('Cannot pipe without source');
531
+ /* c8 ignore stop */
532
+ if (zip) {
533
+ source.on('data', chunk => {
534
+ zip.write(chunk);
535
+ });
536
+ }
537
+ else {
538
+ source.on('data', chunk => {
539
+ super[WRITE](chunk);
540
+ });
541
+ }
542
+ }
543
+ }
544
+ exports.PackSync = PackSync;
545
+ //# sourceMappingURL=pack.js.map
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }