@pnpm/exe 11.0.0-beta.2 → 11.0.0-beta.3
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/dist/node_modules/@gar/promise-retry/LICENSE +1 -0
- package/dist/node_modules/@gar/promise-retry/lib/index.js +43 -9
- package/dist/node_modules/@gar/promise-retry/lib/retry.js +109 -0
- package/dist/node_modules/@gar/promise-retry/package.json +1 -4
- package/dist/node_modules/@npmcli/redact/LICENSE +21 -0
- package/dist/node_modules/@npmcli/redact/lib/deep-map.js +71 -0
- package/dist/node_modules/@npmcli/redact/lib/error.js +28 -0
- package/dist/node_modules/@npmcli/redact/lib/index.js +44 -0
- package/dist/node_modules/@npmcli/redact/lib/matchers.js +88 -0
- package/dist/node_modules/@npmcli/redact/lib/server.js +59 -0
- package/dist/node_modules/@npmcli/redact/lib/utils.js +202 -0
- package/dist/node_modules/{unique-slug → @npmcli/redact}/package.json +21 -18
- package/dist/node_modules/brace-expansion/dist/commonjs/index.js +3 -1
- package/dist/node_modules/brace-expansion/dist/esm/index.js +3 -1
- package/dist/node_modules/brace-expansion/package.json +1 -1
- package/dist/node_modules/cacache/lib/content/write.js +2 -2
- package/dist/node_modules/cacache/lib/entry-index.js +2 -2
- package/dist/node_modules/cacache/lib/util/tmp.js +6 -0
- package/dist/node_modules/cacache/package.json +4 -5
- package/dist/node_modules/make-fetch-happen/lib/remote.js +4 -2
- package/dist/node_modules/make-fetch-happen/package.json +2 -1
- package/dist/node_modules/picomatch/lib/constants.js +4 -0
- package/dist/node_modules/picomatch/lib/parse.js +301 -0
- package/dist/node_modules/picomatch/lib/picomatch.js +11 -3
- package/dist/node_modules/picomatch/package.json +2 -3
- package/dist/node_modules/tar/dist/commonjs/create.js +3 -4
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +7 -4
- package/dist/node_modules/tar/dist/commonjs/header.js +14 -27
- package/dist/node_modules/tar/dist/commonjs/index.min.js +3 -3
- package/dist/node_modules/tar/dist/commonjs/list.js +2 -7
- package/dist/node_modules/tar/dist/commonjs/make-command.js +3 -12
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +5 -6
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +1 -1
- package/dist/node_modules/tar/dist/commonjs/pack.js +3 -8
- package/dist/node_modules/tar/dist/commonjs/parse.js +12 -22
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +2 -2
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +2 -6
- package/dist/node_modules/tar/dist/commonjs/replace.js +5 -10
- package/dist/node_modules/tar/dist/commonjs/unpack.js +38 -63
- package/dist/node_modules/tar/dist/commonjs/winchars.js +1 -1
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +12 -13
- package/dist/node_modules/tar/dist/esm/create.js +3 -4
- package/dist/node_modules/tar/dist/esm/get-write-flag.js +7 -4
- package/dist/node_modules/tar/dist/esm/header.js +14 -27
- package/dist/node_modules/tar/dist/esm/index.min.js +3 -3
- package/dist/node_modules/tar/dist/esm/list.js +2 -7
- package/dist/node_modules/tar/dist/esm/make-command.js +3 -12
- package/dist/node_modules/tar/dist/esm/mkdir.js +5 -6
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +1 -1
- package/dist/node_modules/tar/dist/esm/pack.js +4 -9
- package/dist/node_modules/tar/dist/esm/parse.js +13 -23
- package/dist/node_modules/tar/dist/esm/path-reservations.js +2 -2
- package/dist/node_modules/tar/dist/esm/read-entry.js +2 -6
- package/dist/node_modules/tar/dist/esm/replace.js +6 -11
- package/dist/node_modules/tar/dist/esm/unpack.js +38 -63
- package/dist/node_modules/tar/dist/esm/winchars.js +1 -1
- package/dist/node_modules/tar/dist/esm/write-entry.js +14 -15
- package/dist/node_modules/tar/package.json +9 -4
- package/dist/pnpm.mjs +7586 -6579
- package/dist/worker.js +140 -50
- package/package.json +12 -9
- package/pn +1 -0
- package/pnpx +1 -0
- package/pnx +1 -0
- package/prepare.js +12 -3
- package/setup.js +28 -1
- package/dist/node_modules/imurmurhash/imurmurhash.js +0 -138
- package/dist/node_modules/imurmurhash/imurmurhash.min.js +0 -12
- package/dist/node_modules/imurmurhash/package.json +0 -40
- package/dist/node_modules/retry/License +0 -21
- package/dist/node_modules/retry/index.js +0 -1
- package/dist/node_modules/retry/lib/retry.js +0 -100
- package/dist/node_modules/retry/lib/retry_operation.js +0 -162
- package/dist/node_modules/retry/package.json +0 -36
- package/dist/node_modules/unique-filename/LICENSE +0 -5
- package/dist/node_modules/unique-filename/lib/index.js +0 -7
- package/dist/node_modules/unique-filename/package.json +0 -53
- package/dist/node_modules/unique-slug/LICENSE +0 -15
- package/dist/node_modules/unique-slug/lib/index.js +0 -11
|
@@ -45,6 +45,277 @@ const syntaxError = (type, char) => {
|
|
|
45
45
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
const splitTopLevel = input => {
|
|
49
|
+
const parts = [];
|
|
50
|
+
let bracket = 0;
|
|
51
|
+
let paren = 0;
|
|
52
|
+
let quote = 0;
|
|
53
|
+
let value = '';
|
|
54
|
+
let escaped = false;
|
|
55
|
+
|
|
56
|
+
for (const ch of input) {
|
|
57
|
+
if (escaped === true) {
|
|
58
|
+
value += ch;
|
|
59
|
+
escaped = false;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (ch === '\\') {
|
|
64
|
+
value += ch;
|
|
65
|
+
escaped = true;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (ch === '"') {
|
|
70
|
+
quote = quote === 1 ? 0 : 1;
|
|
71
|
+
value += ch;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (quote === 0) {
|
|
76
|
+
if (ch === '[') {
|
|
77
|
+
bracket++;
|
|
78
|
+
} else if (ch === ']' && bracket > 0) {
|
|
79
|
+
bracket--;
|
|
80
|
+
} else if (bracket === 0) {
|
|
81
|
+
if (ch === '(') {
|
|
82
|
+
paren++;
|
|
83
|
+
} else if (ch === ')' && paren > 0) {
|
|
84
|
+
paren--;
|
|
85
|
+
} else if (ch === '|' && paren === 0) {
|
|
86
|
+
parts.push(value);
|
|
87
|
+
value = '';
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
value += ch;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
parts.push(value);
|
|
97
|
+
return parts;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const isPlainBranch = branch => {
|
|
101
|
+
let escaped = false;
|
|
102
|
+
|
|
103
|
+
for (const ch of branch) {
|
|
104
|
+
if (escaped === true) {
|
|
105
|
+
escaped = false;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (ch === '\\') {
|
|
110
|
+
escaped = true;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return true;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const normalizeSimpleBranch = branch => {
|
|
123
|
+
let value = branch.trim();
|
|
124
|
+
let changed = true;
|
|
125
|
+
|
|
126
|
+
while (changed === true) {
|
|
127
|
+
changed = false;
|
|
128
|
+
|
|
129
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
130
|
+
value = value.slice(2, -1);
|
|
131
|
+
changed = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!isPlainBranch(value)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return value.replace(/\\(.)/g, '$1');
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const hasRepeatedCharPrefixOverlap = branches => {
|
|
143
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
144
|
+
|
|
145
|
+
for (let i = 0; i < values.length; i++) {
|
|
146
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
147
|
+
const a = values[i];
|
|
148
|
+
const b = values[j];
|
|
149
|
+
const char = a[0];
|
|
150
|
+
|
|
151
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return false;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
165
|
+
if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let bracket = 0;
|
|
170
|
+
let paren = 0;
|
|
171
|
+
let quote = 0;
|
|
172
|
+
let escaped = false;
|
|
173
|
+
|
|
174
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
175
|
+
const ch = pattern[i];
|
|
176
|
+
|
|
177
|
+
if (escaped === true) {
|
|
178
|
+
escaped = false;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (ch === '\\') {
|
|
183
|
+
escaped = true;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (ch === '"') {
|
|
188
|
+
quote = quote === 1 ? 0 : 1;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (quote === 1) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (ch === '[') {
|
|
197
|
+
bracket++;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (ch === ']' && bracket > 0) {
|
|
202
|
+
bracket--;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (bracket > 0) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (ch === '(') {
|
|
211
|
+
paren++;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (ch === ')') {
|
|
216
|
+
paren--;
|
|
217
|
+
|
|
218
|
+
if (paren === 0) {
|
|
219
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
type: pattern[0],
|
|
225
|
+
body: pattern.slice(2, i),
|
|
226
|
+
end: i
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const getStarExtglobSequenceOutput = pattern => {
|
|
234
|
+
let index = 0;
|
|
235
|
+
const chars = [];
|
|
236
|
+
|
|
237
|
+
while (index < pattern.length) {
|
|
238
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
239
|
+
|
|
240
|
+
if (!match || match.type !== '*') {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const branches = splitTopLevel(match.body).map(branch => branch.trim());
|
|
245
|
+
if (branches.length !== 1) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
250
|
+
if (!branch || branch.length !== 1) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
chars.push(branch);
|
|
255
|
+
index += match.end + 1;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (chars.length < 1) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const source = chars.length === 1
|
|
263
|
+
? utils.escapeRegex(chars[0])
|
|
264
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
265
|
+
|
|
266
|
+
return `${source}*`;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const repeatedExtglobRecursion = pattern => {
|
|
270
|
+
let depth = 0;
|
|
271
|
+
let value = pattern.trim();
|
|
272
|
+
let match = parseRepeatedExtglob(value);
|
|
273
|
+
|
|
274
|
+
while (match) {
|
|
275
|
+
depth++;
|
|
276
|
+
value = match.body.trim();
|
|
277
|
+
match = parseRepeatedExtglob(value);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return depth;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
284
|
+
if (options.maxExtglobRecursion === false) {
|
|
285
|
+
return { risky: false };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const max =
|
|
289
|
+
typeof options.maxExtglobRecursion === 'number'
|
|
290
|
+
? options.maxExtglobRecursion
|
|
291
|
+
: constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
292
|
+
|
|
293
|
+
const branches = splitTopLevel(body).map(branch => branch.trim());
|
|
294
|
+
|
|
295
|
+
if (branches.length > 1) {
|
|
296
|
+
if (
|
|
297
|
+
branches.some(branch => branch === '') ||
|
|
298
|
+
branches.some(branch => /^[*?]+$/.test(branch)) ||
|
|
299
|
+
hasRepeatedCharPrefixOverlap(branches)
|
|
300
|
+
) {
|
|
301
|
+
return { risky: true };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
for (const branch of branches) {
|
|
306
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
307
|
+
if (safeOutput) {
|
|
308
|
+
return { risky: true, safeOutput };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
312
|
+
return { risky: true };
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return { risky: false };
|
|
317
|
+
};
|
|
318
|
+
|
|
48
319
|
/**
|
|
49
320
|
* Parse the given input string.
|
|
50
321
|
* @param {String} input
|
|
@@ -225,6 +496,8 @@ const parse = (input, options) => {
|
|
|
225
496
|
token.prev = prev;
|
|
226
497
|
token.parens = state.parens;
|
|
227
498
|
token.output = state.output;
|
|
499
|
+
token.startIndex = state.index;
|
|
500
|
+
token.tokensIndex = tokens.length;
|
|
228
501
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
229
502
|
|
|
230
503
|
increment('parens');
|
|
@@ -234,6 +507,34 @@ const parse = (input, options) => {
|
|
|
234
507
|
};
|
|
235
508
|
|
|
236
509
|
const extglobClose = token => {
|
|
510
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
511
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
512
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
513
|
+
|
|
514
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
515
|
+
const safeOutput = analysis.safeOutput
|
|
516
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
517
|
+
: undefined;
|
|
518
|
+
const open = tokens[token.tokensIndex];
|
|
519
|
+
|
|
520
|
+
open.type = 'text';
|
|
521
|
+
open.value = literal;
|
|
522
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
523
|
+
|
|
524
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
525
|
+
tokens[i].value = '';
|
|
526
|
+
tokens[i].output = '';
|
|
527
|
+
delete tokens[i].suffix;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
state.output = token.output + open.output;
|
|
531
|
+
state.backtrack = true;
|
|
532
|
+
|
|
533
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
534
|
+
decrement('parens');
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
237
538
|
let output = token.close + (opts.capture ? ')' : '');
|
|
238
539
|
let rest;
|
|
239
540
|
|
|
@@ -233,6 +233,14 @@ picomatch.scan = (input, options) => scan(input, options);
|
|
|
233
233
|
* Compile a regular expression from the `state` object returned by the
|
|
234
234
|
* [parse()](#parse) method.
|
|
235
235
|
*
|
|
236
|
+
* ```js
|
|
237
|
+
* const picomatch = require('picomatch');
|
|
238
|
+
* const state = picomatch.parse('*.js');
|
|
239
|
+
* // picomatch.compileRe(state[, options]);
|
|
240
|
+
*
|
|
241
|
+
* console.log(picomatch.compileRe(state));
|
|
242
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
243
|
+
* ```
|
|
236
244
|
* @param {Object} `state`
|
|
237
245
|
* @param {Object} `options`
|
|
238
246
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -268,10 +276,10 @@ picomatch.compileRe = (state, options, returnOutput = false, returnState = false
|
|
|
268
276
|
*
|
|
269
277
|
* ```js
|
|
270
278
|
* const picomatch = require('picomatch');
|
|
271
|
-
*
|
|
272
|
-
* // picomatch.compileRe(state[, options]);
|
|
279
|
+
* // picomatch.makeRe(state[, options]);
|
|
273
280
|
*
|
|
274
|
-
*
|
|
281
|
+
* const result = picomatch.makeRe('*.js');
|
|
282
|
+
* console.log(result);
|
|
275
283
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
276
284
|
* ```
|
|
277
285
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picomatch",
|
|
3
3
|
"description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.4",
|
|
5
5
|
"homepage": "https://github.com/micromatch/picomatch",
|
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
|
7
7
|
"funding": "https://github.com/sponsors/jonschlinkert",
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"fill-range": "^7.0.1",
|
|
33
33
|
"gulp-format-md": "^2.0.0",
|
|
34
34
|
"mocha": "^10.4.0",
|
|
35
|
-
"nyc": "^15.1.0"
|
|
36
|
-
"time-require": "github:jonschlinkert/time-require"
|
|
35
|
+
"nyc": "^15.1.0"
|
|
37
36
|
},
|
|
38
37
|
"keywords": [
|
|
39
38
|
"glob",
|
|
@@ -28,7 +28,7 @@ const createFile = (opt, files) => {
|
|
|
28
28
|
stream.on('close', res);
|
|
29
29
|
p.on('error', rej);
|
|
30
30
|
});
|
|
31
|
-
addFilesAsync(p, files);
|
|
31
|
+
addFilesAsync(p, files).catch(er => p.emit('error', er));
|
|
32
32
|
return promise;
|
|
33
33
|
};
|
|
34
34
|
const addFilesSync = (p, files) => {
|
|
@@ -48,8 +48,7 @@ const addFilesSync = (p, files) => {
|
|
|
48
48
|
p.end();
|
|
49
49
|
};
|
|
50
50
|
const addFilesAsync = async (p, files) => {
|
|
51
|
-
for (
|
|
52
|
-
const file = String(files[i]);
|
|
51
|
+
for (const file of files) {
|
|
53
52
|
if (file.charAt(0) === '@') {
|
|
54
53
|
await (0, list_js_1.list)({
|
|
55
54
|
file: node_path_1.default.resolve(String(p.cwd), file.slice(1)),
|
|
@@ -72,7 +71,7 @@ const createSync = (opt, files) => {
|
|
|
72
71
|
};
|
|
73
72
|
const createAsync = (opt, files) => {
|
|
74
73
|
const p = new pack_js_1.Pack(opt);
|
|
75
|
-
addFilesAsync(p, files);
|
|
74
|
+
addFilesAsync(p, files).catch(er => p.emit('error', er));
|
|
76
75
|
return p;
|
|
77
76
|
};
|
|
78
77
|
exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => {
|
|
@@ -15,7 +15,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
15
15
|
const platform = process.env.__FAKE_PLATFORM__ || process.platform;
|
|
16
16
|
const isWindows = platform === 'win32';
|
|
17
17
|
/* c8 ignore start */
|
|
18
|
-
const { O_CREAT, O_TRUNC, O_WRONLY } = fs_1.default.constants;
|
|
18
|
+
const { O_CREAT, O_NOFOLLOW, O_TRUNC, O_WRONLY } = fs_1.default.constants;
|
|
19
19
|
const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) ||
|
|
20
20
|
fs_1.default.constants.UV_FS_O_FILEMAP ||
|
|
21
21
|
0;
|
|
@@ -23,7 +23,10 @@ const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) ||
|
|
|
23
23
|
const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP;
|
|
24
24
|
const fMapLimit = 512 * 1024;
|
|
25
25
|
const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:
|
|
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');
|
|
29
32
|
//# sourceMappingURL=get-write-flag.js.map
|
|
@@ -83,8 +83,7 @@ class Header {
|
|
|
83
83
|
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
|
|
84
84
|
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
|
|
85
85
|
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
|
|
86
|
-
this.mtime =
|
|
87
|
-
ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
|
|
86
|
+
this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
|
|
88
87
|
this.cksum = decNumber(buf, off + 148, 12);
|
|
89
88
|
// if we have extended or global extended headers, apply them now
|
|
90
89
|
// See https://github.com/npm/node-tar/pull/187
|
|
@@ -110,13 +109,10 @@ class Header {
|
|
|
110
109
|
this.size = 0;
|
|
111
110
|
}
|
|
112
111
|
this.linkpath = decString(buf, off + 157, 100);
|
|
113
|
-
if (buf.subarray(off + 257, off + 265).toString() ===
|
|
114
|
-
'ustar\u000000') {
|
|
112
|
+
if (buf.subarray(off + 257, off + 265).toString() === 'ustar\u000000') {
|
|
115
113
|
/* c8 ignore start */
|
|
116
|
-
this.uname =
|
|
117
|
-
|
|
118
|
-
this.gname =
|
|
119
|
-
ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
|
|
114
|
+
this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
|
|
115
|
+
this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
|
|
120
116
|
this.devmaj =
|
|
121
117
|
ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
|
|
122
118
|
this.devmin =
|
|
@@ -133,10 +129,8 @@ class Header {
|
|
|
133
129
|
this.path = prefix + '/' + this.path;
|
|
134
130
|
}
|
|
135
131
|
/* c8 ignore start */
|
|
136
|
-
this.atime =
|
|
137
|
-
|
|
138
|
-
this.ctime =
|
|
139
|
-
ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
|
|
132
|
+
this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
|
|
133
|
+
this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
|
|
140
134
|
/* c8 ignore stop */
|
|
141
135
|
}
|
|
142
136
|
}
|
|
@@ -180,17 +174,12 @@ class Header {
|
|
|
180
174
|
const prefix = split[1];
|
|
181
175
|
this.needPax = !!split[2];
|
|
182
176
|
this.needPax = encString(buf, off, 100, path) || this.needPax;
|
|
183
|
-
this.needPax =
|
|
184
|
-
|
|
185
|
-
this.needPax =
|
|
186
|
-
|
|
187
|
-
this.needPax =
|
|
188
|
-
|
|
189
|
-
this.needPax =
|
|
190
|
-
encNumber(buf, off + 124, 12, this.size) || this.needPax;
|
|
191
|
-
this.needPax =
|
|
192
|
-
encDate(buf, off + 136, 12, this.mtime) || this.needPax;
|
|
193
|
-
buf[off + 156] = this.#type.charCodeAt(0);
|
|
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));
|
|
194
183
|
this.needPax =
|
|
195
184
|
encString(buf, off + 157, 100, this.linkpath) || this.needPax;
|
|
196
185
|
buf.write('ustar\u000000', off + 257, 8);
|
|
@@ -205,12 +194,10 @@ class Header {
|
|
|
205
194
|
this.needPax =
|
|
206
195
|
encString(buf, off + 345, prefixSize, prefix) || this.needPax;
|
|
207
196
|
if (buf[off + 475] !== 0) {
|
|
208
|
-
this.needPax =
|
|
209
|
-
encString(buf, off + 345, 155, prefix) || this.needPax;
|
|
197
|
+
this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax;
|
|
210
198
|
}
|
|
211
199
|
else {
|
|
212
|
-
this.needPax =
|
|
213
|
-
encString(buf, off + 345, 130, prefix) || this.needPax;
|
|
200
|
+
this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax;
|
|
214
201
|
this.needPax =
|
|
215
202
|
encDate(buf, off + 476, 12, this.atime) || this.needPax;
|
|
216
203
|
this.needPax =
|