@shopify/cli-kit 4.8.5 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/private/node/analytics.js +5 -3
- package/dist/private/node/analytics.js.map +1 -1
- package/dist/private/node/api/status-checks.d.ts +7 -0
- package/dist/private/node/api/status-checks.js +11 -0
- package/dist/private/node/api/status-checks.js.map +1 -0
- package/dist/private/node/api.d.ts +15 -0
- package/dist/private/node/api.js +28 -0
- package/dist/private/node/api.js.map +1 -1
- package/dist/private/node/command-event-context.d.ts +29 -0
- package/dist/private/node/command-event-context.js +43 -0
- package/dist/private/node/command-event-context.js.map +1 -0
- package/dist/private/node/command-event-output.d.ts +7 -0
- package/dist/private/node/command-event-output.js +16 -0
- package/dist/private/node/command-event-output.js.map +1 -0
- package/dist/private/node/command-json-schema.d.ts +10 -0
- package/dist/private/node/command-json-schema.js +38 -0
- package/dist/private/node/command-json-schema.js.map +1 -0
- package/dist/private/node/context/agent.d.ts +1 -0
- package/dist/private/node/context/agent.js +44 -0
- package/dist/private/node/context/agent.js.map +1 -0
- package/dist/private/node/json-error.d.ts +23 -0
- package/dist/private/node/json-error.js +123 -0
- package/dist/private/node/json-error.js.map +1 -0
- package/dist/private/node/output.js +3 -1
- package/dist/private/node/output.js.map +1 -1
- package/dist/private/node/output.test.d.ts +1 -0
- package/dist/private/node/output.test.js +74 -0
- package/dist/private/node/output.test.js.map +1 -0
- package/dist/private/node/session/device-authorization.js +49 -15
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/validate.js +9 -22
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/ui/alert.d.ts +1 -1
- package/dist/private/node/ui/alert.js +29 -3
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +8 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +54 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js +3 -3
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js +16 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.js +3 -2
- package/dist/private/node/ui/components/Prompts/PromptLayout.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js +20 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +2 -9
- package/dist/private/node/ui/components/Tasks.js +5 -44
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.js +3 -3
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +15 -1
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/token-item.d.ts +2 -0
- package/dist/private/node/ui/components/token-item.js +26 -0
- package/dist/private/node/ui/components/token-item.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +3 -3
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +2 -2
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -1
- package/dist/private/node/ui/tasks.d.ts +10 -0
- package/dist/private/node/ui/tasks.js +68 -0
- package/dist/private/node/ui/tasks.js.map +1 -0
- package/dist/public/common/command-events.d.ts +125 -0
- package/dist/public/common/command-events.js +54 -0
- package/dist/public/common/command-events.js.map +1 -0
- package/dist/public/common/json-output-schema.d.ts +10 -0
- package/dist/public/common/json-output-schema.js +17 -0
- package/dist/public/common/json-output-schema.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/api/admin.js +18 -1
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/app-management.d.ts +1 -0
- package/dist/public/node/api/app-management.js +4 -0
- package/dist/public/node/api/app-management.js.map +1 -1
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.d.ts +3 -3
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.js +5 -3
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.js.map +1 -1
- package/dist/public/node/base-command.d.ts +6 -0
- package/dist/public/node/base-command.js +34 -5
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli-launcher.js +20 -2
- package/dist/public/node/cli-launcher.js.map +1 -1
- package/dist/public/node/cli.d.ts +1 -0
- package/dist/public/node/cli.js +2 -0
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/command-events.d.ts +65 -0
- package/dist/public/node/command-events.js +71 -0
- package/dist/public/node/command-events.js.map +1 -0
- package/dist/public/node/context/local.d.ts +6 -0
- package/dist/public/node/context/local.js +10 -1
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/custom-oclif-loader.d.ts +6 -0
- package/dist/public/node/custom-oclif-loader.js +45 -19
- package/dist/public/node/custom-oclif-loader.js.map +1 -1
- package/dist/public/node/environment.d.ts +2 -1
- package/dist/public/node/environment.js +3 -2
- package/dist/public/node/environment.js.map +1 -1
- package/dist/public/node/error/index.d.ts +91 -0
- package/dist/public/node/error/index.js +266 -0
- package/dist/public/node/error/index.js.map +1 -0
- package/dist/public/node/error/schema.d.ts +472 -0
- package/dist/public/node/error/schema.js +54 -0
- package/dist/public/node/error/schema.js.map +1 -0
- package/dist/public/node/error/types.d.ts +9 -0
- package/dist/public/node/error/types.js +2 -0
- package/dist/public/node/error/types.js.map +1 -0
- package/dist/public/node/error.d.ts +1 -87
- package/dist/public/node/error.js +1 -252
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.d.ts +17 -3
- package/dist/public/node/fs.js +7 -5
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/json-output-schema.d.ts +26 -0
- package/dist/public/node/json-output-schema.js +30 -0
- package/dist/public/node/json-output-schema.js.map +1 -0
- package/dist/public/node/local-storage.d.ts +1 -0
- package/dist/public/node/local-storage.js +54 -21
- package/dist/public/node/local-storage.js.map +1 -1
- package/dist/public/node/monorail.d.ts +3 -1
- package/dist/public/node/monorail.js +1 -1
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/multiple-installation-warning.d.ts +1 -1
- package/dist/public/node/multiple-installation-warning.js +2 -3
- package/dist/public/node/multiple-installation-warning.js.map +1 -1
- package/dist/public/node/no-input.d.ts +11 -0
- package/dist/public/node/no-input.js +19 -0
- package/dist/public/node/no-input.js.map +1 -0
- package/dist/public/node/output.d.ts +6 -0
- package/dist/public/node/output.js +40 -0
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/path.js +3 -1
- package/dist/public/node/path.js.map +1 -1
- package/dist/public/node/system.d.ts +2 -2
- package/dist/public/node/system.js +8 -4
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/testing/output.d.ts +30 -0
- package/dist/public/node/testing/output.js +83 -0
- package/dist/public/node/testing/output.js.map +1 -1
- package/dist/public/node/ui.d.ts +5 -1
- package/dist/public/node/ui.js +89 -5
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/upgrade.js +17 -2
- package/dist/public/node/upgrade.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -1,253 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { stringifyMessage, TokenizedString } from './output.js';
|
|
3
|
-
import { tokenItemToString } from '../../private/node/ui/components/token-item.js';
|
|
4
|
-
import { hasRateLimitCode } from '../../private/node/analytics/graphql-error-codes.js';
|
|
5
|
-
import { Errors } from '@oclif/core';
|
|
6
|
-
export var FatalErrorType;
|
|
7
|
-
(function (FatalErrorType) {
|
|
8
|
-
FatalErrorType[FatalErrorType["Abort"] = 0] = "Abort";
|
|
9
|
-
FatalErrorType[FatalErrorType["AbortSilent"] = 1] = "AbortSilent";
|
|
10
|
-
FatalErrorType[FatalErrorType["Bug"] = 2] = "Bug";
|
|
11
|
-
})(FatalErrorType || (FatalErrorType = {}));
|
|
12
|
-
export class CancelExecution extends Error {
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.
|
|
16
|
-
* There shouldn't be code that catches fatal errors.
|
|
17
|
-
*/
|
|
18
|
-
export class FatalError extends Error {
|
|
19
|
-
tryMessage;
|
|
20
|
-
type;
|
|
21
|
-
nextSteps;
|
|
22
|
-
formattedMessage;
|
|
23
|
-
customSections;
|
|
24
|
-
skipOclifErrorHandling;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a new FatalError error.
|
|
27
|
-
*
|
|
28
|
-
* @param message - The error message.
|
|
29
|
-
* @param type - The type of fatal error.
|
|
30
|
-
* @param tryMessage - The message that recommends next steps to the user.
|
|
31
|
-
* You can pass a string a {@link TokenizedString} or a {@link TokenItem}
|
|
32
|
-
* if you need to style the message inside the error Banner component.
|
|
33
|
-
* @param nextSteps - Message to show as "next steps" with suggestions to solve the issue.
|
|
34
|
-
* @param customSections - Custom sections to show in the error banner. To be used if nextSteps is not enough.
|
|
35
|
-
*/
|
|
36
|
-
constructor(message, type, tryMessage = null, nextSteps, customSections) {
|
|
37
|
-
const messageIsOutputMessage = typeof message === 'string' || 'value' in message;
|
|
38
|
-
super(messageIsOutputMessage ? stringifyMessage(message) : tokenItemToString(message));
|
|
39
|
-
if (tryMessage) {
|
|
40
|
-
if (tryMessage instanceof TokenizedString) {
|
|
41
|
-
this.tryMessage = stringifyMessage(tryMessage);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.tryMessage = tryMessage;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.tryMessage = null;
|
|
49
|
-
}
|
|
50
|
-
this.type = type;
|
|
51
|
-
this.nextSteps = nextSteps;
|
|
52
|
-
this.customSections = customSections;
|
|
53
|
-
this.skipOclifErrorHandling = true;
|
|
54
|
-
if (!messageIsOutputMessage) {
|
|
55
|
-
this.formattedMessage = message;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* An abort error is a fatal error that shouldn't be reported as a bug.
|
|
61
|
-
* Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer.
|
|
62
|
-
*/
|
|
63
|
-
export class AbortError extends FatalError {
|
|
64
|
-
constructor(message, tryMessage = null, nextSteps, customSections) {
|
|
65
|
-
super(message, FatalErrorType.Abort, tryMessage, nextSteps, customSections);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* An external error is similar to Abort but has extra command and args attributes.
|
|
70
|
-
* This is useful to represent errors coming from external commands, usually executed by execa.
|
|
71
|
-
*/
|
|
72
|
-
export class ExternalError extends FatalError {
|
|
73
|
-
command;
|
|
74
|
-
args;
|
|
75
|
-
constructor(message, command, args, tryMessage = null) {
|
|
76
|
-
super(message, FatalErrorType.Abort, tryMessage);
|
|
77
|
-
this.command = command;
|
|
78
|
-
this.args = args;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export class AbortSilentError extends FatalError {
|
|
82
|
-
constructor() {
|
|
83
|
-
super('', FatalErrorType.AbortSilent);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* A bug error is an error that represents a bug and therefore should be reported.
|
|
88
|
-
*/
|
|
89
|
-
export class BugError extends FatalError {
|
|
90
|
-
constructor(message, tryMessage = null) {
|
|
91
|
-
super(message, FatalErrorType.Bug, tryMessage);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* A function that handles errors that blow up in the CLI.
|
|
96
|
-
*
|
|
97
|
-
* @param error - Error to be handled.
|
|
98
|
-
* @returns A promise that resolves with the error passed.
|
|
99
|
-
*/
|
|
100
|
-
export async function handler(error) {
|
|
101
|
-
let fatal;
|
|
102
|
-
if (isFatal(error)) {
|
|
103
|
-
fatal = error;
|
|
104
|
-
}
|
|
105
|
-
else if (typeof error === 'string') {
|
|
106
|
-
fatal = new BugError(error);
|
|
107
|
-
}
|
|
108
|
-
else if (error instanceof Error) {
|
|
109
|
-
fatal = new BugError(error.message);
|
|
110
|
-
fatal.stack = error.stack;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
// errors can come in all shapes and sizes...
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
|
-
const maybeError = error;
|
|
116
|
-
fatal = new BugError(maybeError?.message ?? 'Unknown error');
|
|
117
|
-
if (maybeError?.stack) {
|
|
118
|
-
fatal.stack = maybeError?.stack;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const { renderFatalError } = await import('./ui.js');
|
|
122
|
-
renderFatalError(fatal);
|
|
123
|
-
return Promise.resolve(error);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* A function that maps an error to an Abort with the stack trace when coming from the CLI.
|
|
127
|
-
*
|
|
128
|
-
* @param error - Error to be mapped.
|
|
129
|
-
* @returns A promise that resolves with the new error object.
|
|
130
|
-
*/
|
|
131
|
-
export function errorMapper(error) {
|
|
132
|
-
if (error instanceof Errors.CLIError) {
|
|
133
|
-
const mappedError = new AbortError(error.message);
|
|
134
|
-
mappedError.stack = error.stack;
|
|
135
|
-
return Promise.resolve(mappedError);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
return Promise.resolve(error);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* A function that checks if an error is a fatal one.
|
|
143
|
-
*
|
|
144
|
-
* @param error - Error to be checked.
|
|
145
|
-
* @returns A boolean indicating if the error is a fatal one.
|
|
146
|
-
*/
|
|
147
|
-
function isFatal(error) {
|
|
148
|
-
try {
|
|
149
|
-
return Object.prototype.hasOwnProperty.call(error, 'type');
|
|
150
|
-
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* A function that checks if an error should be reported as unexpected.
|
|
158
|
-
*
|
|
159
|
-
* @param error - Error to be checked.
|
|
160
|
-
* @returns A boolean indicating if the error should be reported as unexpected.
|
|
161
|
-
*/
|
|
162
|
-
export function shouldReportErrorAsUnexpected(error) {
|
|
163
|
-
if (!isFatal(error)) {
|
|
164
|
-
// this means its not one of the CLI wrapped errors
|
|
165
|
-
if (error instanceof Error) {
|
|
166
|
-
// Raw API errors that slip through unwrapped (e.g. the handleErrors:false path) are expected
|
|
167
|
-
// environmental conditions, not CLI bugs. Treat them as expected so they don't pollute crash
|
|
168
|
-
// reporting.
|
|
169
|
-
if (isExpectedApiError(error)) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
const message = error.message;
|
|
173
|
-
return !errorMessageImpliesEnvironmentIssue(message);
|
|
174
|
-
}
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
if (error.type === FatalErrorType.Bug) {
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Detects raw graphql-request `ClientError`s that are expected environmental conditions rather than
|
|
184
|
-
* CLI bugs. These reach the reporter as plain `Error`s (not `FatalError`s) and would otherwise be
|
|
185
|
-
* reported as unexpected.
|
|
186
|
-
*
|
|
187
|
-
* HTTP 401 (unauthenticated) is not "transient" in the retry sense — it means the user's session
|
|
188
|
-
* token is expired or invalid, a credential/environment condition (see issue #7891). Rate limiting
|
|
189
|
-
* (HTTP 429, or a `THROTTLED`/`429` GraphQL code on any error in the response) matches the shape
|
|
190
|
-
* detected by `errorsIncludeStatus429` in `private/node/api.ts`. Gateway errors (502/503/504) are
|
|
191
|
-
* also expected infrastructure failures.
|
|
192
|
-
*
|
|
193
|
-
* Scoped to the external `ClientError` shape only — importing the cli-kit `GraphQLClientError`
|
|
194
|
-
* wrapper here would create an `error.ts → headers.ts → error.ts` import cycle.
|
|
195
|
-
*
|
|
196
|
-
* Matched structurally rather than with `instanceof ClientError`, because importing the class
|
|
197
|
-
* pulls `graphql-request` — and through it `graphql`, `tr46` and `whatwg-url` — into the module
|
|
198
|
-
* graph of every command, for one type check on an error path. `ClientError` is the only error
|
|
199
|
-
* reaching here that carries both `response` and `request`; the cli-kit wrapper carries
|
|
200
|
-
* `statusCode` instead (see `private/node/api/headers.ts`).
|
|
201
|
-
*
|
|
202
|
-
* @param error - Error to be checked.
|
|
203
|
-
* @returns A boolean indicating if the error is a known expected API error.
|
|
204
|
-
*/
|
|
205
|
-
function isExpectedApiError(error) {
|
|
206
|
-
const candidate = error;
|
|
207
|
-
if (typeof candidate.response !== 'object' || candidate.response === null || candidate.request === undefined) {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
const status = candidate.response.status;
|
|
211
|
-
if (status === 401 || status === 429 || status === 502 || status === 503 || status === 504) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
return hasRateLimitCode(candidate.response.errors);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Stack traces usually have file:// - we strip that and also remove the Windows drive designation.
|
|
218
|
-
*
|
|
219
|
-
* @param filePath - Path to be cleaned.
|
|
220
|
-
* @returns The cleaned path.
|
|
221
|
-
*/
|
|
222
|
-
export function cleanSingleStackTracePath(filePath) {
|
|
223
|
-
return normalizePath(filePath)
|
|
224
|
-
.replace('file:/', '/')
|
|
225
|
-
.replace(/^\/?[A-Z]:/, '');
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* There are certain errors that we know are not due to a CLI bug, but are environmental/user error.
|
|
229
|
-
*
|
|
230
|
-
* @param message - The error message to check.
|
|
231
|
-
* @returns A boolean indicating if the error message implies an environment issue.
|
|
232
|
-
*/
|
|
233
|
-
function errorMessageImpliesEnvironmentIssue(message) {
|
|
234
|
-
const environmentIssueMessages = [
|
|
235
|
-
'EPERM: operation not permitted, scandir',
|
|
236
|
-
'EPERM: operation not permitted, rename',
|
|
237
|
-
'EACCES: permission denied',
|
|
238
|
-
'EPERM: operation not permitted, symlink',
|
|
239
|
-
'This version of npm supports the following node versions',
|
|
240
|
-
'EBUSY: resource busy or locked',
|
|
241
|
-
'ENOTEMPTY: directory not empty',
|
|
242
|
-
'getaddrinfo ENOTFOUND',
|
|
243
|
-
'Client network socket disconnected before secure TLS connection was established',
|
|
244
|
-
'spawn EPERM',
|
|
245
|
-
'socket hang up',
|
|
246
|
-
'The user aborted a request.',
|
|
247
|
-
'write EPIPE',
|
|
248
|
-
'Unsupported platform',
|
|
249
|
-
];
|
|
250
|
-
const anyMatches = environmentIssueMessages.some((issueMessage) => message.includes(issueMessage));
|
|
251
|
-
return anyMatches;
|
|
252
|
-
}
|
|
1
|
+
export * from './error/index.js';
|
|
253
2
|
//# sourceMappingURL=error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/public/node/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAC,MAAM,aAAa,CAAA;AAC5E,OAAO,EAAC,iBAAiB,EAAmC,MAAM,gDAAgD,CAAA;AAClH,OAAO,EAAC,gBAAgB,EAAC,MAAM,qDAAqD,CAAA;AAEpF,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAIlC,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qDAAK,CAAA;IACL,iEAAW,CAAA;IACX,iDAAG,CAAA;AACL,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;GAGG;AACH,MAAM,OAAgB,UAAW,SAAQ,KAAK;IAC5C,UA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AgC;QAChC,gCAAgC;QAChC,uBAAuB;QACvB,iFAAiF;QACjF,aAAa;QACb,gBAAgB;QAChB,6BAA6B;QAC7B,aAAa;QACb,sBAAsB;KACvB,CAAA;IACD,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAA;IAClG,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import {normalizePath} from './path.js'\nimport {OutputMessage, stringifyMessage, TokenizedString} from './output.js'\nimport {tokenItemToString, type InlineToken, type TokenItem} from '../../private/node/ui/components/token-item.js'\nimport {hasRateLimitCode} from '../../private/node/analytics/graphql-error-codes.js'\n\nimport {Errors} from '@oclif/core'\n\nimport type {AlertCustomSection} from './ui.js'\n\nexport enum FatalErrorType {\n Abort,\n AbortSilent,\n Bug,\n}\n\nexport class CancelExecution extends Error {}\n\n/**\n * A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.\n * There shouldn't be code that catches fatal errors.\n */\nexport abstract class FatalError extends Error {\n tryMessage: TokenItem | null\n type: FatalErrorType\n nextSteps?: TokenItem<InlineToken>[]\n formattedMessage?: TokenItem\n customSections?: AlertCustomSection[]\n skipOclifErrorHandling: boolean\n /**\n * Creates a new FatalError error.\n *\n * @param message - The error message.\n * @param type - The type of fatal error.\n * @param tryMessage - The message that recommends next steps to the user.\n * You can pass a string a {@link TokenizedString} or a {@link TokenItem}\n * if you need to style the message inside the error Banner component.\n * @param nextSteps - Message to show as \"next steps\" with suggestions to solve the issue.\n * @param customSections - Custom sections to show in the error banner. To be used if nextSteps is not enough.\n */\n constructor(\n message: TokenItem | OutputMessage,\n type: FatalErrorType,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n const messageIsOutputMessage = typeof message === 'string' || 'value' in message\n super(messageIsOutputMessage ? stringifyMessage(message) : tokenItemToString(message))\n\n if (tryMessage) {\n if (tryMessage instanceof TokenizedString) {\n this.tryMessage = stringifyMessage(tryMessage)\n } else {\n this.tryMessage = tryMessage\n }\n } else {\n this.tryMessage = null\n }\n\n this.type = type\n this.nextSteps = nextSteps\n this.customSections = customSections\n this.skipOclifErrorHandling = true\n\n if (!messageIsOutputMessage) {\n this.formattedMessage = message\n }\n }\n}\n\n/**\n * An abort error is a fatal error that shouldn't be reported as a bug.\n * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer.\n */\nexport class AbortError extends FatalError {\n constructor(\n message: TokenItem | OutputMessage,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n super(message, FatalErrorType.Abort, tryMessage, nextSteps, customSections)\n }\n}\n\n/**\n * An external error is similar to Abort but has extra command and args attributes.\n * This is useful to represent errors coming from external commands, usually executed by execa.\n */\nexport class ExternalError extends FatalError {\n command: string\n args: string[]\n\n constructor(\n message: OutputMessage,\n command: string,\n args: string[],\n tryMessage: TokenItem | OutputMessage | null = null,\n ) {\n super(message, FatalErrorType.Abort, tryMessage)\n this.command = command\n this.args = args\n }\n}\n\nexport class AbortSilentError extends FatalError {\n constructor() {\n super('', FatalErrorType.AbortSilent)\n }\n}\n\n/**\n * A bug error is an error that represents a bug and therefore should be reported.\n */\nexport class BugError extends FatalError {\n constructor(message: TokenItem | OutputMessage, tryMessage: TokenItem | OutputMessage | null = null) {\n super(message, FatalErrorType.Bug, tryMessage)\n }\n}\n\n/**\n * A function that handles errors that blow up in the CLI.\n *\n * @param error - Error to be handled.\n * @returns A promise that resolves with the error passed.\n */\nexport async function handler(error: unknown): Promise<unknown> {\n let fatal: FatalError\n if (isFatal(error)) {\n fatal = error\n } else if (typeof error === 'string') {\n fatal = new BugError(error)\n } else if (error instanceof Error) {\n fatal = new BugError(error.message)\n fatal.stack = error.stack\n } else {\n // errors can come in all shapes and sizes...\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const maybeError = error as any\n fatal = new BugError(maybeError?.message ?? 'Unknown error')\n if (maybeError?.stack) {\n fatal.stack = maybeError?.stack\n }\n }\n\n const {renderFatalError} = await import('./ui.js')\n renderFatalError(fatal)\n return Promise.resolve(error)\n}\n\n/**\n * A function that maps an error to an Abort with the stack trace when coming from the CLI.\n *\n * @param error - Error to be mapped.\n * @returns A promise that resolves with the new error object.\n */\nexport function errorMapper(error: unknown): Promise<unknown> {\n if (error instanceof Errors.CLIError) {\n const mappedError = new AbortError(error.message)\n mappedError.stack = error.stack\n return Promise.resolve(mappedError)\n } else {\n return Promise.resolve(error)\n }\n}\n\n/**\n * A function that checks if an error is a fatal one.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a fatal one.\n */\nfunction isFatal(error: unknown): error is FatalError {\n try {\n return Object.prototype.hasOwnProperty.call(error, 'type')\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * A function that checks if an error should be reported as unexpected.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error should be reported as unexpected.\n */\nexport function shouldReportErrorAsUnexpected(error: unknown): boolean {\n if (!isFatal(error)) {\n // this means its not one of the CLI wrapped errors\n if (error instanceof Error) {\n // Raw API errors that slip through unwrapped (e.g. the handleErrors:false path) are expected\n // environmental conditions, not CLI bugs. Treat them as expected so they don't pollute crash\n // reporting.\n if (isExpectedApiError(error)) {\n return false\n }\n const message = error.message\n return !errorMessageImpliesEnvironmentIssue(message)\n }\n return true\n }\n if (error.type === FatalErrorType.Bug) {\n return true\n }\n return false\n}\n\n/**\n * Detects raw graphql-request `ClientError`s that are expected environmental conditions rather than\n * CLI bugs. These reach the reporter as plain `Error`s (not `FatalError`s) and would otherwise be\n * reported as unexpected.\n *\n * HTTP 401 (unauthenticated) is not \"transient\" in the retry sense — it means the user's session\n * token is expired or invalid, a credential/environment condition (see issue #7891). Rate limiting\n * (HTTP 429, or a `THROTTLED`/`429` GraphQL code on any error in the response) matches the shape\n * detected by `errorsIncludeStatus429` in `private/node/api.ts`. Gateway errors (502/503/504) are\n * also expected infrastructure failures.\n *\n * Scoped to the external `ClientError` shape only — importing the cli-kit `GraphQLClientError`\n * wrapper here would create an `error.ts → headers.ts → error.ts` import cycle.\n *\n * Matched structurally rather than with `instanceof ClientError`, because importing the class\n * pulls `graphql-request` — and through it `graphql`, `tr46` and `whatwg-url` — into the module\n * graph of every command, for one type check on an error path. `ClientError` is the only error\n * reaching here that carries both `response` and `request`; the cli-kit wrapper carries\n * `statusCode` instead (see `private/node/api/headers.ts`).\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a known expected API error.\n */\nfunction isExpectedApiError(error: Error): boolean {\n const candidate = error as Error & {\n response?: {status?: number; errors?: unknown}\n request?: unknown\n }\n if (typeof candidate.response !== 'object' || candidate.response === null || candidate.request === undefined) {\n return false\n }\n const status = candidate.response.status\n if (status === 401 || status === 429 || status === 502 || status === 503 || status === 504) {\n return true\n }\n return hasRateLimitCode(candidate.response.errors)\n}\n\n/**\n * Stack traces usually have file:// - we strip that and also remove the Windows drive designation.\n *\n * @param filePath - Path to be cleaned.\n * @returns The cleaned path.\n */\nexport function cleanSingleStackTracePath(filePath: string): string {\n return normalizePath(filePath)\n .replace('file:/', '/')\n .replace(/^\\/?[A-Z]:/, '')\n}\n\n/**\n * There are certain errors that we know are not due to a CLI bug, but are environmental/user error.\n *\n * @param message - The error message to check.\n * @returns A boolean indicating if the error message implies an environment issue.\n */\nfunction errorMessageImpliesEnvironmentIssue(message: string): boolean {\n const environmentIssueMessages = [\n 'EPERM: operation not permitted, scandir',\n 'EPERM: operation not permitted, rename',\n 'EACCES: permission denied',\n 'EPERM: operation not permitted, symlink',\n 'This version of npm supports the following node versions',\n 'EBUSY: resource busy or locked',\n 'ENOTEMPTY: directory not empty',\n 'getaddrinfo ENOTFOUND',\n 'Client network socket disconnected before secure TLS connection was established',\n 'spawn EPERM',\n 'socket hang up',\n 'The user aborted a request.',\n 'write EPIPE',\n 'Unsupported platform',\n ]\n const anyMatches = environmentIssueMessages.some((issueMessage) => message.includes(issueMessage))\n return anyMatches\n}\n"]}
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/public/node/error.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './error/index.js'\n"]}
|
package/dist/public/node/fs.d.ts
CHANGED
|
@@ -114,12 +114,26 @@ export declare function mkdir(path: string): Promise<void>;
|
|
|
114
114
|
* @param path - Path to the directory to be created.
|
|
115
115
|
*/
|
|
116
116
|
export declare function mkdirSync(path: string): void;
|
|
117
|
+
interface RemoveFileOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Number of times Node retries the removal when it hits a transient error
|
|
120
|
+
* (EBUSY, EMFILE, ENFILE, ENOTEMPTY or EPERM), waiting `retryDelay` milliseconds
|
|
121
|
+
* longer on each try. Defaults to 0 (no retries).
|
|
122
|
+
*/
|
|
123
|
+
maxRetries?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Milliseconds to wait between retries. Defaults to 100.
|
|
126
|
+
*/
|
|
127
|
+
retryDelay?: number;
|
|
128
|
+
}
|
|
117
129
|
/**
|
|
118
|
-
* Removes a file at the given path.
|
|
130
|
+
* Removes a file or directory (recursively) at the given path.
|
|
119
131
|
*
|
|
120
|
-
* @param path - Path to the file to be removed.
|
|
132
|
+
* @param path - Path to the file or directory to be removed.
|
|
133
|
+
* @param options - Retry behavior, passed through to Node's `fs.rm`. Useful when the removal can
|
|
134
|
+
* race with transient locks, such as an antivirus scanning freshly written files.
|
|
121
135
|
*/
|
|
122
|
-
export declare function removeFile(path: string): Promise<void>;
|
|
136
|
+
export declare function removeFile(path: string, options?: RemoveFileOptions): Promise<void>;
|
|
123
137
|
/**
|
|
124
138
|
* Renames a file.
|
|
125
139
|
* @param from - Path to the file to be renamed.
|
package/dist/public/node/fs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { outputContent, outputToken, outputDebug } from './output.js';
|
|
|
2
2
|
import { joinPath, normalizePath, resolvePath } from './path.js';
|
|
3
3
|
import { getRandomName } from '../common/string.js';
|
|
4
4
|
import { systemTempDir } from '../../private/node/temp-dir.js';
|
|
5
|
-
import { copy as fsCopy, ensureFile as fsEnsureFile, ensureFileSync as fsEnsureFileSync,
|
|
5
|
+
import { copy as fsCopy, ensureFile as fsEnsureFile, ensureFileSync as fsEnsureFileSync, removeSync as fsRemoveSync, move as fsMove,
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
} from 'fs-extra/esm';
|
|
@@ -175,13 +175,15 @@ export function mkdirSync(path) {
|
|
|
175
175
|
fsMkdirSync(path, { recursive: true });
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
* Removes a file at the given path.
|
|
178
|
+
* Removes a file or directory (recursively) at the given path.
|
|
179
179
|
*
|
|
180
|
-
* @param path - Path to the file to be removed.
|
|
180
|
+
* @param path - Path to the file or directory to be removed.
|
|
181
|
+
* @param options - Retry behavior, passed through to Node's `fs.rm`. Useful when the removal can
|
|
182
|
+
* race with transient locks, such as an antivirus scanning freshly written files.
|
|
181
183
|
*/
|
|
182
|
-
export async function removeFile(path) {
|
|
184
|
+
export async function removeFile(path, options = {}) {
|
|
183
185
|
outputDebug(outputContent `Removing file at ${outputToken.path(path)}...`);
|
|
184
|
-
await
|
|
186
|
+
await fsRm(path, { recursive: true, force: true, ...options });
|
|
185
187
|
}
|
|
186
188
|
/**
|
|
187
189
|
* Renames a file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,WAAW,CAAA;AAE9D,OAAO,EAAC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ath, normalizePath, resolvePath} from './path.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {systemTempDir} from '../../private/node/temp-dir.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {sep, join} from 'pathe'\nimport {findUp as internalFindUp, findUpSync as internalFindUpSync} from 'find-up'\nimport {minimatch} from 'minimatch'\nimport fastGlobLib from 'fast-glob'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n createWriteStream as fsCreateWriteStream,\n constants as fsConstants,\n existsSync as fsFileExistsSync,\n unlinkSync as fsUnlinkSync,\n mkdtempSync as fsMkdtempSync,\n accessSync,\n ReadStream,\n WriteStream,\n statSync,\n} from 'fs'\n\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n rename as fsRename,\n unlink as fsUnlink,\n rm as fsRm,\n readdir as fsReaddir,\n symlink as fsSymlink,\n} from 'fs/promises'\nimport {pathToFileURL as pathToFile} from 'url'\nimport * as os from 'os'\n\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n *\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n const tmpDir = await fsMkdtemp(join(systemTempDir, 'tmp-'))\n try {\n return await callback(tmpDir)\n } finally {\n await fsRm(tmpDir, {recursive: true, force: true, maxRetries: 2})\n }\n}\n\n/**\n * Return a temporary directory\n * @returns - The path to the temporary directory.\n */\nexport function tempDirectory(): string {\n return fsMkdtempSync(join(systemTempDir, 'tmp-'))\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding.\n *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n if (resolvePath(from) === resolvePath(to)) {\n outputDebug(\n outputContent`Skipping copy file step because source and destination is the same: ${outputToken.path(from)}`,\n )\n return\n }\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\nexport interface WriteOptions {\n encoding: BufferEncoding\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n * @param options - Options to write the file with (defaults to utf-8 encoding).\n */\nexport async function writeFile(\n path: string,\n data: string | Buffer,\n options: WriteOptions = {encoding: 'utf8'},\n): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, options)\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\n/**\n * Removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport async function removeFile(path: string): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRemove(path)\n}\n\n/**\n * Renames a file.\n * @param from - Path to the file to be renamed.\n * @param to - New path for the file.\n */\nexport async function renameFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsRename(from, to)\n}\n\n/**\n * Creates a symbolic link.\n *\n * @param target - Path that the symlink points to.\n * @param path - Path where the symlink will be created.\n */\nexport async function symlink(target: string, path: string): Promise<void> {\n outputDebug(outputContent`Creating symbolic link from ${outputToken.path(path)} to ${outputToken.path(target)}...`)\n\n // On Windows, we need to specify the type of symlink (file or dir)\n let type: 'file' | 'dir' | 'junction' = 'file'\n\n try {\n const stats = await fsLstat(target)\n if (stats.isDirectory()) {\n type = 'junction'\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n // If we can't stat the target, assume it's a file\n }\n\n await fsSymlink(target, path, type)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await fsRm(path, {recursive: true, force: options.force ?? true})\n}\n\n/**\n * Create a temporary directory within the OS provided location for temp directories\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp(joinPath(os.tmpdir(), 'tmp-'))\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport function isDirectorySync(path: string): boolean {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return fsStatSync(path).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Synchronously unlink a file at the given path.\n *\n * @param path - Path to the file.\n */\nexport function unlinkFileSync(path: string): void {\n fsUnlinkSync(path)\n}\n\n/**\n * Unlink a file at the given path.\n *\n * @param path - Path to the file.\n * @returns A promise that resolves when the file is unlinked.\n */\nexport function unlinkFile(path: string): Promise<void> {\n return fsUnlink(path)\n}\n\n/**\n * Create a read stream for a file with optional options.\n *\n * @param path - Path to the file.\n * @param options - Options for the read stream.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(\n path: string,\n options?: {encoding?: BufferEncoding; start?: number; end?: number},\n): ReadStream {\n return fsCreateReadStream(path, options)\n}\n\n/**\n * Create a write stream for a file.\n *\n * @param path - Path to the file.\n * @returns A write stream for the file.\n */\nexport function createFileWriteStream(path: string): WriteStream {\n return fsCreateWriteStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileHasWritePermissions(path: string): boolean {\n try {\n accessSync(path, fsConstants.W_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function unixFileIsOwnedByCurrentUser(path: string): boolean | undefined {\n // process.getuid() is only available on Unix-like systems\n if (process.platform === 'win32' || typeof process.getuid !== 'function') return undefined\n if (!fileExistsSync(path)) return false\n\n try {\n const stats = statSync(path)\n const currentUid = process.getuid()\n\n return stats.uid === currentUid\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists.\n *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileExistsSync(path: string): boolean {\n return fsFileExistsSync(path)\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\n\n/**\n * Synchronously traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns An array of pathnames that match the given pattern.\n */\nexport function globSync(pattern: Pattern | Pattern[], options?: GlobOptions): string[] {\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlobLib.sync(pattern, overridenOptions)\n}\n\n/**\n * Convert a path to a File URL.\n *\n * @param path - Path to convert.\n * @returns The File URL.\n */\nexport function pathToFileURL(path: string): URL {\n return pathToFile(path)\n}\n\n/**\n * The operating system-specific end-of-line marker:\n * - `\\n` on POSIX\n * - `\\r\\n` on Windows\n */\nexport type EOL = '\\r\\n' | '\\n'\n\n/**\n * Detects the end-of-line marker used in a string.\n *\n * @param content - file contents to analyze\n *\n * @returns The detected end-of-line marker\n */\nexport function detectEOL(content: string): EOL {\n const match = content.match(/\\r\\n|\\n/g)\n\n if (!match) {\n return defaultEOL()\n }\n\n // Optimization: Use a single loop to count occurrences instead of multiple .filter() calls.\n // This reduces iterations from 2 to 1 and avoids creating intermediate arrays.\n // For large files, this can be ~35-40% faster.\n let crlf = 0\n for (const eol of match) {\n if (eol === '\\r\\n') crlf++\n }\n const lf = match.length - crlf\n\n return crlf > lf ? '\\r\\n' : '\\n'\n}\n\n/**\n * Returns the operating system's end-of-line marker.\n *\n * @returns The OS-specific end-of-line marker\n */\nexport function defaultEOL(): EOL {\n return os.EOL as EOL\n}\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport function findPathUpSync(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUpSync> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = internalFindUpSync(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\nexport interface MatchGlobOptions {\n matchBase: boolean\n noglobstar: boolean\n}\n\n/**\n * Matches a key against a glob pattern.\n * @param key - The key to match.\n * @param pattern - The glob pattern to match against.\n * @param options - The options to refine the matching approach.\n * @returns true if the key matches the pattern, false otherwise.\n */\nexport function matchGlob(key: string, pattern: string, options?: MatchGlobOptions): boolean {\n return minimatch(key, pattern, options)\n}\n\n/**\n * Read a directory.\n * @param path - The path to read.\n * @returns A promise that resolves to an array of file names.\n */\nexport function readdir(path: string): Promise<string[]> {\n return fsReaddir(path)\n}\n\n/**\n * Copies the contents of a directory to another directory.\n *\n * @param srcDir - Source directory path.\n * @param destDir - Destination directory path.\n */\nexport async function copyDirectoryContents(srcDir: string, destDir: string): Promise<void> {\n if (!(await fileExists(srcDir))) {\n throw new Error(`Source directory ${srcDir} does not exist`)\n }\n\n await fsCopy(srcDir, destDir)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,WAAW,CAAA;AAE9D,OAAO,EAAC,aAAa,EAAmB,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,YAAY,EAC1B,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AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAqD,EACrD,OAAqD;IAErD,wBAAwB;IACxB,8DAA8D;IAC9D,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,OAAc,EAAE,OAAO,CAAC,CAAA;IACzD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAqD,EACrD,OAAqD;IAErD,wBAAwB;IACxB,8DAA8D;IAC9D,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAc,EAAE,OAAO,CAAC,CAAA;IACvD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7C,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAe,EAAE,OAA0B;IAChF,OAAO,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAc,EAAE,OAAe;IACzE,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,iBAAiB,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC/B,CAAC","sourcesContent":["import {outputContent, outputToken, outputDebug} from './output.js'\nimport {joinPath, normalizePath, resolvePath} from './path.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {systemTempDir} from '../../private/node/temp-dir.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {sep, join} from 'pathe'\nimport {findUp as internalFindUp, findUpSync as internalFindUpSync} from 'find-up'\nimport {minimatch} from 'minimatch'\nimport fastGlobLib from 'fast-glob'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n createWriteStream as fsCreateWriteStream,\n constants as fsConstants,\n existsSync as fsFileExistsSync,\n unlinkSync as fsUnlinkSync,\n mkdtempSync as fsMkdtempSync,\n accessSync,\n ReadStream,\n WriteStream,\n statSync,\n} from 'fs'\n\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n rename as fsRename,\n unlink as fsUnlink,\n rm as fsRm,\n readdir as fsReaddir,\n symlink as fsSymlink,\n} from 'fs/promises'\nimport {pathToFileURL as pathToFile} from 'url'\nimport * as os from 'os'\n\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n *\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n const tmpDir = await fsMkdtemp(join(systemTempDir, 'tmp-'))\n try {\n return await callback(tmpDir)\n } finally {\n await fsRm(tmpDir, {recursive: true, force: true, maxRetries: 2})\n }\n}\n\n/**\n * Return a temporary directory\n * @returns - The path to the temporary directory.\n */\nexport function tempDirectory(): string {\n return fsMkdtempSync(join(systemTempDir, 'tmp-'))\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding.\n *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n if (resolvePath(from) === resolvePath(to)) {\n outputDebug(\n outputContent`Skipping copy file step because source and destination is the same: ${outputToken.path(from)}`,\n )\n return\n }\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\nexport interface WriteOptions {\n encoding: BufferEncoding\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n * @param options - Options to write the file with (defaults to utf-8 encoding).\n */\nexport async function writeFile(\n path: string,\n data: string | Buffer,\n options: WriteOptions = {encoding: 'utf8'},\n): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, options)\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\ninterface RemoveFileOptions {\n /**\n * Number of times Node retries the removal when it hits a transient error\n * (EBUSY, EMFILE, ENFILE, ENOTEMPTY or EPERM), waiting `retryDelay` milliseconds\n * longer on each try. Defaults to 0 (no retries).\n */\n maxRetries?: number\n /**\n * Milliseconds to wait between retries. Defaults to 100.\n */\n retryDelay?: number\n}\n\n/**\n * Removes a file or directory (recursively) at the given path.\n *\n * @param path - Path to the file or directory to be removed.\n * @param options - Retry behavior, passed through to Node's `fs.rm`. Useful when the removal can\n * race with transient locks, such as an antivirus scanning freshly written files.\n */\nexport async function removeFile(path: string, options: RemoveFileOptions = {}): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRm(path, {recursive: true, force: true, ...options})\n}\n\n/**\n * Renames a file.\n * @param from - Path to the file to be renamed.\n * @param to - New path for the file.\n */\nexport async function renameFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsRename(from, to)\n}\n\n/**\n * Creates a symbolic link.\n *\n * @param target - Path that the symlink points to.\n * @param path - Path where the symlink will be created.\n */\nexport async function symlink(target: string, path: string): Promise<void> {\n outputDebug(outputContent`Creating symbolic link from ${outputToken.path(path)} to ${outputToken.path(target)}...`)\n\n // On Windows, we need to specify the type of symlink (file or dir)\n let type: 'file' | 'dir' | 'junction' = 'file'\n\n try {\n const stats = await fsLstat(target)\n if (stats.isDirectory()) {\n type = 'junction'\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n // If we can't stat the target, assume it's a file\n }\n\n await fsSymlink(target, path, type)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await fsRm(path, {recursive: true, force: options.force ?? true})\n}\n\n/**\n * Create a temporary directory within the OS provided location for temp directories\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp(joinPath(os.tmpdir(), 'tmp-'))\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport function isDirectorySync(path: string): boolean {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return fsStatSync(path).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Synchronously unlink a file at the given path.\n *\n * @param path - Path to the file.\n */\nexport function unlinkFileSync(path: string): void {\n fsUnlinkSync(path)\n}\n\n/**\n * Unlink a file at the given path.\n *\n * @param path - Path to the file.\n * @returns A promise that resolves when the file is unlinked.\n */\nexport function unlinkFile(path: string): Promise<void> {\n return fsUnlink(path)\n}\n\n/**\n * Create a read stream for a file with optional options.\n *\n * @param path - Path to the file.\n * @param options - Options for the read stream.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(\n path: string,\n options?: {encoding?: BufferEncoding; start?: number; end?: number},\n): ReadStream {\n return fsCreateReadStream(path, options)\n}\n\n/**\n * Create a write stream for a file.\n *\n * @param path - Path to the file.\n * @returns A write stream for the file.\n */\nexport function createFileWriteStream(path: string): WriteStream {\n return fsCreateWriteStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileHasWritePermissions(path: string): boolean {\n try {\n accessSync(path, fsConstants.W_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function unixFileIsOwnedByCurrentUser(path: string): boolean | undefined {\n // process.getuid() is only available on Unix-like systems\n if (process.platform === 'win32' || typeof process.getuid !== 'function') return undefined\n if (!fileExistsSync(path)) return false\n\n try {\n const stats = statSync(path)\n const currentUid = process.getuid()\n\n return stats.uid === currentUid\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists.\n *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileExistsSync(path: string): boolean {\n return fsFileExistsSync(path)\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\n\n/**\n * Synchronously traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns An array of pathnames that match the given pattern.\n */\nexport function globSync(pattern: Pattern | Pattern[], options?: GlobOptions): string[] {\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlobLib.sync(pattern, overridenOptions)\n}\n\n/**\n * Convert a path to a File URL.\n *\n * @param path - Path to convert.\n * @returns The File URL.\n */\nexport function pathToFileURL(path: string): URL {\n return pathToFile(path)\n}\n\n/**\n * The operating system-specific end-of-line marker:\n * - `\\n` on POSIX\n * - `\\r\\n` on Windows\n */\nexport type EOL = '\\r\\n' | '\\n'\n\n/**\n * Detects the end-of-line marker used in a string.\n *\n * @param content - file contents to analyze\n *\n * @returns The detected end-of-line marker\n */\nexport function detectEOL(content: string): EOL {\n const match = content.match(/\\r\\n|\\n/g)\n\n if (!match) {\n return defaultEOL()\n }\n\n // Optimization: Use a single loop to count occurrences instead of multiple .filter() calls.\n // This reduces iterations from 2 to 1 and avoids creating intermediate arrays.\n // For large files, this can be ~35-40% faster.\n let crlf = 0\n for (const eol of match) {\n if (eol === '\\r\\n') crlf++\n }\n const lf = match.length - crlf\n\n return crlf > lf ? '\\r\\n' : '\\n'\n}\n\n/**\n * Returns the operating system's end-of-line marker.\n *\n * @returns The OS-specific end-of-line marker\n */\nexport function defaultEOL(): EOL {\n return os.EOL as EOL\n}\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport function findPathUpSync(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUpSync> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = internalFindUpSync(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\nexport interface MatchGlobOptions {\n matchBase: boolean\n noglobstar: boolean\n}\n\n/**\n * Matches a key against a glob pattern.\n * @param key - The key to match.\n * @param pattern - The glob pattern to match against.\n * @param options - The options to refine the matching approach.\n * @returns true if the key matches the pattern, false otherwise.\n */\nexport function matchGlob(key: string, pattern: string, options?: MatchGlobOptions): boolean {\n return minimatch(key, pattern, options)\n}\n\n/**\n * Read a directory.\n * @param path - The path to read.\n * @returns A promise that resolves to an array of file names.\n */\nexport function readdir(path: string): Promise<string[]> {\n return fsReaddir(path)\n}\n\n/**\n * Copies the contents of a directory to another directory.\n *\n * @param srcDir - Source directory path.\n * @param destDir - Destination directory path.\n */\nexport async function copyDirectoryContents(srcDir: string, destDir: string): Promise<void> {\n if (!(await fileExists(srcDir))) {\n throw new Error(`Source directory ${srcDir} does not exist`)\n }\n\n await fsCopy(srcDir, destDir)\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
2
|
+
import type { ZodTypeAny, z } from 'zod';
|
|
3
|
+
export { formatJsonOutputTimestamp, jsonOutputTimestampSchema } from '../common/json-output-schema.js';
|
|
4
|
+
interface JsonOutputSchemaDefinition<TSchema extends ZodTypeAny = ZodTypeAny> {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly schema: TSchema;
|
|
7
|
+
readonly definitions: Readonly<Record<string, ZodTypeAny>>;
|
|
8
|
+
}
|
|
9
|
+
export interface JsonOutputSchema<TSchema extends ZodTypeAny = ZodTypeAny> extends JsonOutputSchemaDefinition<TSchema> {
|
|
10
|
+
readonly jsonSchema: ReturnType<typeof zodToJsonSchema>;
|
|
11
|
+
validate(value: unknown): z.output<TSchema>;
|
|
12
|
+
encode(value: z.input<TSchema>): string;
|
|
13
|
+
}
|
|
14
|
+
export type InferJsonOutputSchema<TOutputSchema extends JsonOutputSchema> = z.output<TOutputSchema['schema']>;
|
|
15
|
+
interface DefineJsonOutputSchemaOptions<TSchema extends ZodTypeAny> {
|
|
16
|
+
name: string;
|
|
17
|
+
schema: TSchema;
|
|
18
|
+
definitions?: Readonly<Record<string, ZodTypeAny>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Defines the runtime validator, encoder, and JSON Schema for a command's JSON output.
|
|
22
|
+
*
|
|
23
|
+
* @param options - The root schema name, its Zod schema, and any named nested schemas.
|
|
24
|
+
* @returns The complete JSON output contract.
|
|
25
|
+
*/
|
|
26
|
+
export declare function defineJsonOutputSchema<TSchema extends ZodTypeAny>(options: DefineJsonOutputSchemaOptions<TSchema>): JsonOutputSchema<TSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
2
|
+
export { formatJsonOutputTimestamp, jsonOutputTimestampSchema } from '../common/json-output-schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the runtime validator, encoder, and JSON Schema for a command's JSON output.
|
|
5
|
+
*
|
|
6
|
+
* @param options - The root schema name, its Zod schema, and any named nested schemas.
|
|
7
|
+
* @returns The complete JSON output contract.
|
|
8
|
+
*/
|
|
9
|
+
export function defineJsonOutputSchema(options) {
|
|
10
|
+
return {
|
|
11
|
+
name: options.name,
|
|
12
|
+
schema: options.schema,
|
|
13
|
+
definitions: options.definitions ?? {},
|
|
14
|
+
jsonSchema: zodToJsonSchema(options.schema, {
|
|
15
|
+
name: options.name,
|
|
16
|
+
nameStrategy: 'title',
|
|
17
|
+
...(options.definitions ? { definitions: options.definitions } : {}),
|
|
18
|
+
target: 'jsonSchema7',
|
|
19
|
+
}),
|
|
20
|
+
validate: (value) => options.schema.parse(value),
|
|
21
|
+
encode: (value) => encodeJsonOutput(options.schema.parse(value)),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function encodeJsonOutput(value) {
|
|
25
|
+
const encoded = JSON.stringify(value, null, 2);
|
|
26
|
+
if (encoded === undefined)
|
|
27
|
+
throw new TypeError('JSON output must be serializable.');
|
|
28
|
+
return encoded;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=json-output-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-output-schema.js","sourceRoot":"","sources":["../../../src/public/node/json-output-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAA;AAGlD,OAAO,EAAC,yBAAyB,EAAE,yBAAyB,EAAC,MAAM,iCAAiC,CAAA;AAsBpG;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA+C;IAE/C,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;QACtC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE;YAC1C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,YAAY,EAAE,OAAO;YACrB,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,MAAM,EAAE,aAAa;SACtB,CAAC;QACF,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAChD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACjE,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9C,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAA;IACnF,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import {zodToJsonSchema} from 'zod-to-json-schema'\nimport type {ZodTypeAny, z} from 'zod'\n\nexport {formatJsonOutputTimestamp, jsonOutputTimestampSchema} from '../common/json-output-schema.js'\n\ninterface JsonOutputSchemaDefinition<TSchema extends ZodTypeAny = ZodTypeAny> {\n readonly name: string\n readonly schema: TSchema\n readonly definitions: Readonly<Record<string, ZodTypeAny>>\n}\n\nexport interface JsonOutputSchema<TSchema extends ZodTypeAny = ZodTypeAny> extends JsonOutputSchemaDefinition<TSchema> {\n readonly jsonSchema: ReturnType<typeof zodToJsonSchema>\n validate(value: unknown): z.output<TSchema>\n encode(value: z.input<TSchema>): string\n}\n\nexport type InferJsonOutputSchema<TOutputSchema extends JsonOutputSchema> = z.output<TOutputSchema['schema']>\n\ninterface DefineJsonOutputSchemaOptions<TSchema extends ZodTypeAny> {\n name: string\n schema: TSchema\n definitions?: Readonly<Record<string, ZodTypeAny>>\n}\n\n/**\n * Defines the runtime validator, encoder, and JSON Schema for a command's JSON output.\n *\n * @param options - The root schema name, its Zod schema, and any named nested schemas.\n * @returns The complete JSON output contract.\n */\nexport function defineJsonOutputSchema<TSchema extends ZodTypeAny>(\n options: DefineJsonOutputSchemaOptions<TSchema>,\n): JsonOutputSchema<TSchema> {\n return {\n name: options.name,\n schema: options.schema,\n definitions: options.definitions ?? {},\n jsonSchema: zodToJsonSchema(options.schema, {\n name: options.name,\n nameStrategy: 'title',\n ...(options.definitions ? {definitions: options.definitions} : {}),\n target: 'jsonSchema7',\n }),\n validate: (value) => options.schema.parse(value),\n encode: (value) => encodeJsonOutput(options.schema.parse(value)),\n }\n}\n\nfunction encodeJsonOutput(value: unknown): string {\n const encoded = JSON.stringify(value, null, 2)\n if (encoded === undefined) throw new TypeError('JSON output must be serializable.')\n return encoded\n}\n"]}
|
|
@@ -48,6 +48,7 @@ export declare class LocalStorage<T extends Record<string, any>> {
|
|
|
48
48
|
*
|
|
49
49
|
* @param error - The error that occurred.
|
|
50
50
|
* @param operation - The operation that failed.
|
|
51
|
+
* @param configPath - The local storage configuration file path.
|
|
51
52
|
* @throws AbortError if the error is permission-related.
|
|
52
53
|
* @throws BugError if the error is not permission-related.
|
|
53
54
|
*/
|