@slicemachine/manager 0.25.2-beta.11 → 0.25.2-beta.12
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/execa/index.cjs +8 -70
- package/dist/_node_modules/execa/index.cjs.map +1 -1
- package/dist/_node_modules/execa/index.js +2 -64
- package/dist/_node_modules/execa/index.js.map +1 -1
- package/dist/_node_modules/execa/lib/stream.cjs +0 -15
- package/dist/_node_modules/execa/lib/stream.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/stream.js +1 -16
- package/dist/_node_modules/execa/lib/stream.js.map +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client.cjs +0 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +0 -2
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/managers/SliceMachineManager.cjs +0 -3
- package/dist/managers/SliceMachineManager.cjs.map +1 -1
- package/dist/managers/SliceMachineManager.d.ts +0 -2
- package/dist/managers/SliceMachineManager.js +0 -3
- package/dist/managers/SliceMachineManager.js.map +1 -1
- package/dist/managers/telemetry/types.cjs.map +1 -1
- package/dist/managers/telemetry/types.d.ts +0 -1
- package/dist/managers/telemetry/types.js.map +1 -1
- package/package.json +2 -2
- package/src/client/index.ts +0 -2
- package/src/index.ts +0 -2
- package/src/managers/SliceMachineManager.ts +0 -4
- package/src/managers/telemetry/types.ts +0 -1
- package/dist/constants/GIT_PROVIDER.cjs +0 -7
- package/dist/constants/GIT_PROVIDER.cjs.map +0 -1
- package/dist/constants/GIT_PROVIDER.d.ts +0 -4
- package/dist/constants/GIT_PROVIDER.js +0 -7
- package/dist/constants/GIT_PROVIDER.js.map +0 -1
- package/dist/constants/GIT_PROVIDER_APP_SLUGS.cjs +0 -26
- package/dist/constants/GIT_PROVIDER_APP_SLUGS.cjs.map +0 -1
- package/dist/constants/GIT_PROVIDER_APP_SLUGS.d.ts +0 -3
- package/dist/constants/GIT_PROVIDER_APP_SLUGS.js +0 -26
- package/dist/constants/GIT_PROVIDER_APP_SLUGS.js.map +0 -1
- package/dist/managers/git/GitManager.cjs +0 -334
- package/dist/managers/git/GitManager.cjs.map +0 -1
- package/dist/managers/git/GitManager.d.ts +0 -89
- package/dist/managers/git/GitManager.js +0 -316
- package/dist/managers/git/GitManager.js.map +0 -1
- package/dist/managers/git/buildGitRepoSpecifier.cjs +0 -7
- package/dist/managers/git/buildGitRepoSpecifier.cjs.map +0 -1
- package/dist/managers/git/buildGitRepoSpecifier.d.ts +0 -19
- package/dist/managers/git/buildGitRepoSpecifier.js +0 -7
- package/dist/managers/git/buildGitRepoSpecifier.js.map +0 -1
- package/dist/managers/git/types.d.ts +0 -20
- package/src/constants/GIT_PROVIDER.ts +0 -5
- package/src/constants/GIT_PROVIDER_APP_SLUGS.ts +0 -28
- package/src/managers/git/GitManager.ts +0 -502
- package/src/managers/git/buildGitRepoSpecifier.ts +0 -24
- package/src/managers/git/types.ts +0 -26
@@ -4,10 +4,10 @@ const node_buffer = require("node:buffer");
|
|
4
4
|
const path = require("node:path");
|
5
5
|
const childProcess = require("node:child_process");
|
6
6
|
const process = require("node:process");
|
7
|
-
const index = require("../cross-spawn/index.cjs");
|
8
|
-
const index$
|
9
|
-
const index$
|
10
|
-
const index
|
7
|
+
const index$1 = require("../cross-spawn/index.cjs");
|
8
|
+
const index$3 = require("../strip-final-newline/index.cjs");
|
9
|
+
const index$2 = require("../npm-run-path/index.cjs");
|
10
|
+
const index = require("../onetime/index.cjs");
|
11
11
|
const error = require("./lib/error.cjs");
|
12
12
|
const stdio = require("./lib/stdio.cjs");
|
13
13
|
const kill = require("./lib/kill.cjs");
|
@@ -20,12 +20,12 @@ const DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
20
20
|
const getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
21
21
|
const env = extendEnv ? { ...process.env, ...envOption } : envOption;
|
22
22
|
if (preferLocal) {
|
23
|
-
return index$
|
23
|
+
return index$2.npmRunPathEnv({ env, cwd: localDir, execPath });
|
24
24
|
}
|
25
25
|
return env;
|
26
26
|
};
|
27
27
|
const handleArguments = (file, args, options = {}) => {
|
28
|
-
const parsed = index._parse(file, args, options);
|
28
|
+
const parsed = index$1._parse(file, args, options);
|
29
29
|
file = parsed.command;
|
30
30
|
args = parsed.args;
|
31
31
|
options = parsed.options;
|
@@ -57,7 +57,7 @@ const handleOutput = (options, value, error2) => {
|
|
57
57
|
return error2 === void 0 ? void 0 : "";
|
58
58
|
}
|
59
59
|
if (options.stripFinalNewline) {
|
60
|
-
return index$
|
60
|
+
return index$3(value);
|
61
61
|
}
|
62
62
|
return value;
|
63
63
|
};
|
@@ -131,79 +131,17 @@ function execa(file, args, options) {
|
|
131
131
|
killed: false
|
132
132
|
};
|
133
133
|
};
|
134
|
-
const handlePromiseOnce = index
|
134
|
+
const handlePromiseOnce = index(handlePromise);
|
135
135
|
stream.handleInput(spawned, parsed.options);
|
136
136
|
spawned.all = stream.makeAllStream(spawned, parsed.options);
|
137
137
|
pipe.addPipeMethods(spawned);
|
138
138
|
promise.mergePromise(spawned, handlePromiseOnce);
|
139
139
|
return spawned;
|
140
140
|
}
|
141
|
-
function execaSync(file, args, options) {
|
142
|
-
const parsed = handleArguments(file, args, options);
|
143
|
-
const command$1 = command.joinCommand(file, args);
|
144
|
-
const escapedCommand = command.getEscapedCommand(file, args);
|
145
|
-
verbose.logCommand(escapedCommand, parsed.options);
|
146
|
-
const input = stream.handleInputSync(parsed.options);
|
147
|
-
let result;
|
148
|
-
try {
|
149
|
-
result = childProcess.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
|
150
|
-
} catch (error$1) {
|
151
|
-
throw error.makeError({
|
152
|
-
error: error$1,
|
153
|
-
stdout: "",
|
154
|
-
stderr: "",
|
155
|
-
all: "",
|
156
|
-
command: command$1,
|
157
|
-
escapedCommand,
|
158
|
-
parsed,
|
159
|
-
timedOut: false,
|
160
|
-
isCanceled: false,
|
161
|
-
killed: false
|
162
|
-
});
|
163
|
-
}
|
164
|
-
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
165
|
-
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
166
|
-
if (result.error || result.status !== 0 || result.signal !== null) {
|
167
|
-
const error$1 = error.makeError({
|
168
|
-
stdout,
|
169
|
-
stderr,
|
170
|
-
error: result.error,
|
171
|
-
signal: result.signal,
|
172
|
-
exitCode: result.status,
|
173
|
-
command: command$1,
|
174
|
-
escapedCommand,
|
175
|
-
parsed,
|
176
|
-
timedOut: result.error && result.error.code === "ETIMEDOUT",
|
177
|
-
isCanceled: false,
|
178
|
-
killed: result.signal !== null
|
179
|
-
});
|
180
|
-
if (!parsed.options.reject) {
|
181
|
-
return error$1;
|
182
|
-
}
|
183
|
-
throw error$1;
|
184
|
-
}
|
185
|
-
return {
|
186
|
-
command: command$1,
|
187
|
-
escapedCommand,
|
188
|
-
exitCode: 0,
|
189
|
-
stdout,
|
190
|
-
stderr,
|
191
|
-
failed: false,
|
192
|
-
timedOut: false,
|
193
|
-
isCanceled: false,
|
194
|
-
killed: false
|
195
|
-
};
|
196
|
-
}
|
197
141
|
function execaCommand(command$1, options) {
|
198
142
|
const [file, ...args] = command.parseCommand(command$1);
|
199
143
|
return execa(file, args, options);
|
200
144
|
}
|
201
|
-
function execaCommandSync(command$1, options) {
|
202
|
-
const [file, ...args] = command.parseCommand(command$1);
|
203
|
-
return execaSync(file, args, options);
|
204
|
-
}
|
205
145
|
exports.execa = execa;
|
206
146
|
exports.execaCommand = execaCommand;
|
207
|
-
exports.execaCommandSync = execaCommandSync;
|
208
|
-
exports.execaSync = execaSync;
|
209
147
|
//# sourceMappingURL=index.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../../node_modules/execa/index.js"],"sourcesContent":["import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t\t\tstdin: undefined,\n\t\t\tstdout: undefined,\n\t\t\tstderr: undefined,\n\t\t\tstdio,\n\t\t\tshell: false,\n\t\t},\n\t);\n}\n"],"names":["npmRunPathEnv","crossSpawn","verboseDefault","normalizeStdio","error","Buffer","stripFinalNewline","command","joinCommand","getEscapedCommand","logCommand","validateTimeout","makeError","mergePromise","getSpawnedPromise","setupTimeout","setExitHandler","spawnedKill","spawnedCancel","getSpawnedResult","onetime","handleInput","makeAllStream","addPipeMethods","handleInputSync","parseCommand"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,MAAO,MAAO;AAEzC,MAAM,SAAS,CAAC,EAAC,KAAK,WAAW,WAAW,aAAa,UAAU,SAAQ,MAAM;AAChF,QAAM,MAAM,YAAY,EAAC,GAAG,QAAQ,KAAK,GAAG,UAAS,IAAI;AAEzD,MAAI,aAAa;AAChB,WAAOA,QAAAA,cAAc,EAAC,KAAK,KAAK,UAAU,SAAQ,CAAC;AAAA,EACnD;AAED,SAAO;AACR;AAEA,MAAM,kBAAkB,CAAC,MAAM,MAAM,UAAU,CAAA,MAAO;AACrD,QAAM,SAASC,MAAW,OAAO,MAAM,MAAM,OAAO;AACpD,SAAO,OAAO;AACd,SAAO,OAAO;AACd,YAAU,OAAO;AAEjB,YAAU;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,aAAa;A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,OAAO,SAAS,OAAO,MAAM,SAAS;AAAA,MAChD,YAAY;AAAA,MACZ,QAAQ,OAAO,WAAW;AAAA,IAC7B,CAAG;AAED,QAAI,CAAC,OAAO,QAAQ,QAAQ;AAC3B,aAAOH;AAAAA,IACP;AAED,UAAMA;AAAAA,EACN;AAED,SAAO;AAAA,IACR,SAAEG;AAAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AACA;AAoCO,SAAS,aAAaA,WAAS,SAAS;AAC9C,QAAM,CAAC,MAAM,GAAG,IAAI,IAAIkB,QAAY,aAAClB,SAAO;AAC5C,SAAO,MAAM,MAAM,MAAM,OAAO;AACjC;AAEO,SAAS,iBAAiBA,WAAS,SAAS;AAClD,QAAM,CAAC,MAAM,GAAG,IAAI,IAAIkB,QAAY,aAAClB,SAAO;AAC5C,SAAO,UAAU,MAAM,MAAM,OAAO;AACrC;;;;;","x_google_ignoreList":[0]}
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../node_modules/execa/index.js"],"sourcesContent":["import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t\t\tstdin: undefined,\n\t\t\tstdout: undefined,\n\t\t\tstderr: undefined,\n\t\t\tstdio,\n\t\t\tshell: false,\n\t\t},\n\t);\n}\n"],"names":["npmRunPathEnv","crossSpawn","verboseDefault","normalizeStdio","error","Buffer","stripFinalNewline","command","joinCommand","getEscapedCommand","logCommand","validateTimeout","makeError","mergePromise","getSpawnedPromise","setupTimeout","setExitHandler","spawnedKill","spawnedCancel","getSpawnedResult","onetime","handleInput","makeAllStream","addPipeMethods","parseCommand"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,MAAO,MAAO;AAEzC,MAAM,SAAS,CAAC,EAAC,KAAK,WAAW,WAAW,aAAa,UAAU,SAAQ,MAAM;AAChF,QAAM,MAAM,YAAY,EAAC,GAAG,QAAQ,KAAK,GAAG,UAAS,IAAI;AAEzD,MAAI,aAAa;AAChB,WAAOA,QAAAA,cAAc,EAAC,KAAK,KAAK,UAAU,SAAQ,CAAC;AAAA,EACnD;AAED,SAAO;AACR;AAEA,MAAM,kBAAkB,CAAC,MAAM,MAAM,UAAU,CAAA,MAAO;AACrD,QAAM,SAASC,QAAW,OAAO,MAAM,MAAM,OAAO;AACpD,SAAO,OAAO;AACd,SAAO,OAAO;AACd,YAAU,OAAO;AAEjB,YAAU;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,aAAa;AAAA,IACb,UAAU,QAAQ,OAAO,QAAQ,IAAK;AAAA,IACtC,UAAU,QAAQ;AAAA,IAClB,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAASC,QAAc;AAAA,IACvB,GAAG;AAAA,EACL;AAEC,UAAQ,MAAM,OAAO,OAAO;AAE5B,UAAQ,QAAQC,qBAAe,OAAO;AAEtC,MAAI,QAAQ,aAAa,WAAW,KAAK,SAAS,MAAM,MAAM,MAAM,OAAO;AAE1E,SAAK,QAAQ,IAAI;AAAA,EACjB;AAED,SAAO,EAAC,MAAM,MAAM,SAAS,OAAM;AACpC;AA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@@ import { makeError } from "./lib/error.js";
|
|
10
10
|
import { normalizeStdio } from "./lib/stdio.js";
|
11
11
|
import { validateTimeout, setupTimeout, setExitHandler, spawnedKill, spawnedCancel } from "./lib/kill.js";
|
12
12
|
import { addPipeMethods } from "./lib/pipe.js";
|
13
|
-
import {
|
13
|
+
import { handleInput, makeAllStream, getSpawnedResult } from "./lib/stream.js";
|
14
14
|
import { mergePromise, getSpawnedPromise } from "./lib/promise.js";
|
15
15
|
import { parseCommand, joinCommand, getEscapedCommand } from "./lib/command.js";
|
16
16
|
import { logCommand, verboseDefault } from "./lib/verbose.js";
|
@@ -136,74 +136,12 @@ function execa(file, args, options) {
|
|
136
136
|
mergePromise(spawned, handlePromiseOnce);
|
137
137
|
return spawned;
|
138
138
|
}
|
139
|
-
function execaSync(file, args, options) {
|
140
|
-
const parsed = handleArguments(file, args, options);
|
141
|
-
const command = joinCommand(file, args);
|
142
|
-
const escapedCommand = getEscapedCommand(file, args);
|
143
|
-
logCommand(escapedCommand, parsed.options);
|
144
|
-
const input = handleInputSync(parsed.options);
|
145
|
-
let result;
|
146
|
-
try {
|
147
|
-
result = childProcess.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
|
148
|
-
} catch (error) {
|
149
|
-
throw makeError({
|
150
|
-
error,
|
151
|
-
stdout: "",
|
152
|
-
stderr: "",
|
153
|
-
all: "",
|
154
|
-
command,
|
155
|
-
escapedCommand,
|
156
|
-
parsed,
|
157
|
-
timedOut: false,
|
158
|
-
isCanceled: false,
|
159
|
-
killed: false
|
160
|
-
});
|
161
|
-
}
|
162
|
-
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
163
|
-
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
164
|
-
if (result.error || result.status !== 0 || result.signal !== null) {
|
165
|
-
const error = makeError({
|
166
|
-
stdout,
|
167
|
-
stderr,
|
168
|
-
error: result.error,
|
169
|
-
signal: result.signal,
|
170
|
-
exitCode: result.status,
|
171
|
-
command,
|
172
|
-
escapedCommand,
|
173
|
-
parsed,
|
174
|
-
timedOut: result.error && result.error.code === "ETIMEDOUT",
|
175
|
-
isCanceled: false,
|
176
|
-
killed: result.signal !== null
|
177
|
-
});
|
178
|
-
if (!parsed.options.reject) {
|
179
|
-
return error;
|
180
|
-
}
|
181
|
-
throw error;
|
182
|
-
}
|
183
|
-
return {
|
184
|
-
command,
|
185
|
-
escapedCommand,
|
186
|
-
exitCode: 0,
|
187
|
-
stdout,
|
188
|
-
stderr,
|
189
|
-
failed: false,
|
190
|
-
timedOut: false,
|
191
|
-
isCanceled: false,
|
192
|
-
killed: false
|
193
|
-
};
|
194
|
-
}
|
195
139
|
function execaCommand(command, options) {
|
196
140
|
const [file, ...args] = parseCommand(command);
|
197
141
|
return execa(file, args, options);
|
198
142
|
}
|
199
|
-
function execaCommandSync(command, options) {
|
200
|
-
const [file, ...args] = parseCommand(command);
|
201
|
-
return execaSync(file, args, options);
|
202
|
-
}
|
203
143
|
export {
|
204
144
|
execa,
|
205
|
-
execaCommand
|
206
|
-
execaCommandSync,
|
207
|
-
execaSync
|
145
|
+
execaCommand
|
208
146
|
};
|
209
147
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../node_modules/execa/index.js"],"sourcesContent":["import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t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ACA;AAAA,MACA,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACX,CAAG;AAAA,EACD;AAED,QAAM,SAAS,aAAa,OAAO,SAAS,OAAO,QAAQ,OAAO,KAAK;AACvE,QAAM,SAAS,aAAa,OAAO,SAAS,OAAO,QAAQ,OAAO,KAAK;AAEvE,MAAI,OAAO,SAAS,OAAO,WAAW,KAAK,OAAO,WAAW,MAAM;AAClE,UAAM,QAAQ,UAAU;AAAA,MACvB;AAAA,MACA;AAAA,MACA,OAAO,OAAO;AAAA,MACd,QAAQ,OAAO;AAAA,MACf,UAAU,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,OAAO,SAAS,OAAO,MAAM,SAAS;AAAA,MAChD,YAAY;AAAA,MACZ,QAAQ,OAAO,WAAW;AAAA,IAC7B,CAAG;AAED,QAAI,CAAC,OAAO,QAAQ,QAAQ;AAC3B,aAAO;AAAA,IACP;AAED,UAAM;AAAA,EACN;AAED,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AACA;AAoCO,SAAS,aAAa,SAAS,SAAS;AAC9C,QAAM,CAAC,MAAM,GAAG,IAAI,IAAI,aAAa,OAAO;AAC5C,SAAO,MAAM,MAAM,MAAM,OAAO;AACjC;AAEO,SAAS,iBAAiB,SAAS,SAAS;AAClD,QAAM,CAAC,MAAM,GAAG,IAAI,IAAI,aAAa,OAAO;AAC5C,SAAO,UAAU,MAAM,MAAM,OAAO;AACrC;","x_google_ignoreList":[0]}
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/execa/index.js"],"sourcesContent":["import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t\t\tstdin: undefined,\n\t\t\tstdout: undefined,\n\t\t\tstderr: undefined,\n\t\t\tstdio,\n\t\t\tshell: false,\n\t\t},\n\t);\n}\n"],"names":["path"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,MAAO,MAAO;AAEzC,MAAM,SAAS,CAAC,EAAC,KAAK,WAAW,WAAW,aAAa,UAAU,SAAQ,MAAM;AAChF,QAAM,MAAM,YAAY,EAAC,GAAG,QAAQ,KAAK,GAAG,UAAS,IAAI;AAEzD,MAAI,aAAa;AAChB,WAAO,cAAc,EAAC,KAAK,KAAK,UAAU,SAAQ,CAAC;AAAA,EACnD;AAED,SAAO;AACR;AAEA,MAAM,kBAAkB,CAAC,MAAM,MAAM,UAAU,CAAA,MAAO;AACrD,QAAM,SAAS,WAAW,OAAO,MAAM,MAAM,OAAO;AACpD,SAAO,OAAO;AACd,SAAO,OAAO;AACd,YAAU,OAAO;AAEjB,YAAU;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,aAAa;AAAA,IACb,UAAU,QAAQ,OAAO,QAAQ,IAAK;AAAA,IACtC,UAAU,QAAQ;AAAA,IAClB,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEC,UAAQ,MAAM,OAAO,OAAO;AAE5B,UAAQ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,6 @@ const validateInputOptions = (input) => {
|
|
9
9
|
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
10
10
|
}
|
11
11
|
};
|
12
|
-
const getInputSync = ({ input, inputFile }) => {
|
13
|
-
if (typeof inputFile !== "string") {
|
14
|
-
return input;
|
15
|
-
}
|
16
|
-
validateInputOptions(input);
|
17
|
-
return node_fs.readFileSync(inputFile);
|
18
|
-
};
|
19
|
-
const handleInputSync = (options) => {
|
20
|
-
const input = getInputSync(options);
|
21
|
-
if (index.isStream(input)) {
|
22
|
-
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
23
|
-
}
|
24
|
-
return input;
|
25
|
-
};
|
26
12
|
const getInput = ({ input, inputFile }) => {
|
27
13
|
if (typeof inputFile !== "string") {
|
28
14
|
return input;
|
@@ -91,6 +77,5 @@ const getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, max
|
|
91
77
|
};
|
92
78
|
exports.getSpawnedResult = getSpawnedResult;
|
93
79
|
exports.handleInput = handleInput;
|
94
|
-
exports.handleInputSync = handleInputSync;
|
95
80
|
exports.makeAllStream = makeAllStream;
|
96
81
|
//# sourceMappingURL=stream.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream.cjs","sources":["../../../../../../node_modules/execa/lib/stream.js"],"sourcesContent":["import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n"],"names":["
|
1
|
+
{"version":3,"file":"stream.cjs","sources":["../../../../../../node_modules/execa/lib/stream.js"],"sourcesContent":["import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n"],"names":["createReadStream","isStream","mergeStream","getStream"],"mappings":";;;;;;AAKA,MAAM,uBAAuB,WAAS;AACrC,MAAI,UAAU,QAAW;AACxB,UAAM,IAAI,UAAU,yDAAyD;AAAA,EAC7E;AACF;AAsBA,MAAM,WAAW,CAAC,EAAC,OAAO,UAAS,MAAM;AACxC,MAAI,OAAO,cAAc,U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AC,UAAU,QAAQ,UAAS,CAAC;AAC5E,QAAM,gBAAgB,iBAAiB,QAAQ,EAAC,UAAU,QAAQ,UAAS,CAAC;AAC5E,QAAM,aAAa,iBAAiB,KAAK,EAAC,UAAU,QAAQ,WAAW,YAAY,EAAC,CAAC;AAErF,MAAI;AACH,WAAO,MAAM,QAAQ,IAAI,CAAC,aAAa,eAAe,eAAe,UAAU,CAAC;AAAA,EAChF,SAAQ,OAAO;AACf,WAAO,QAAQ,IAAI;AAAA,MAClB,EAAC,OAAO,QAAQ,MAAM,QAAQ,UAAU,MAAM,SAAQ;AAAA,MACtD,gBAAgB,QAAQ,aAAa;AAAA,MACrC,gBAAgB,QAAQ,aAAa;AAAA,MACrC,gBAAgB,KAAK,UAAU;AAAA,IAClC,CAAG;AAAA,EACD;AACF;;;;","x_google_ignoreList":[0]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { createReadStream } from "node:fs";
|
2
2
|
import { isStream } from './../_node_modules/is-stream/index.js';
|
3
3
|
import getStream from "../../get-stream/index.js";
|
4
4
|
import mergeStream from "../../merge-stream/index.js";
|
@@ -7,20 +7,6 @@ const validateInputOptions = (input) => {
|
|
7
7
|
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
8
8
|
}
|
9
9
|
};
|
10
|
-
const getInputSync = ({ input, inputFile }) => {
|
11
|
-
if (typeof inputFile !== "string") {
|
12
|
-
return input;
|
13
|
-
}
|
14
|
-
validateInputOptions(input);
|
15
|
-
return readFileSync(inputFile);
|
16
|
-
};
|
17
|
-
const handleInputSync = (options) => {
|
18
|
-
const input = getInputSync(options);
|
19
|
-
if (isStream(input)) {
|
20
|
-
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
21
|
-
}
|
22
|
-
return input;
|
23
|
-
};
|
24
10
|
const getInput = ({ input, inputFile }) => {
|
25
11
|
if (typeof inputFile !== "string") {
|
26
12
|
return input;
|
@@ -90,7 +76,6 @@ const getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, max
|
|
90
76
|
export {
|
91
77
|
getSpawnedResult,
|
92
78
|
handleInput,
|
93
|
-
handleInputSync,
|
94
79
|
makeAllStream
|
95
80
|
};
|
96
81
|
//# sourceMappingURL=stream.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream.js","sources":["../../../../../../node_modules/execa/lib/stream.js"],"sourcesContent":["import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n"],"names":[],"mappings":";;;;AAKA,MAAM,uBAAuB,WAAS;AACrC,MAAI,UAAU,QAAW;AACxB,UAAM,IAAI,UAAU,yDAAyD;AAAA,EAC7E;AACF;
|
1
|
+
{"version":3,"file":"stream.js","sources":["../../../../../../node_modules/execa/lib/stream.js"],"sourcesContent":["import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n"],"names":[],"mappings":";;;;AAKA,MAAM,uBAAuB,WAAS;AACrC,MAAI,UAAU,QAAW;AACxB,UAAM,IAAI,UAAU,yDAAyD;AAAA,EAC7E;AACF;AAsBA,MAAM,WAAW,CAAC,EAAC,OAAO,UAAS,MAAM;AACxC,MAAI,OAAO,cAAc,UAAU;AAClC,WAAO;AAAA,EACP;AAED,uBAAqB,KAAK;AAC1B,SAAO,iBAAiB,SAAS;AAClC;AAGY,MAAC,cAAc,CAAC,SAAS,YAAY;AAChD,QAAM,QAAQ,SAAS,OAAO;AAE9B,MAAI,UAAU,QAAW;AACxB;AAAA,EACA;AAED,MAAI,SAAS,KAAK,GAAG;AACpB,UAAM,KAAK,QAAQ,KAAK;AAAA,EAC1B,OAAQ;AACN,YAAQ,MAAM,IAAI,KAAK;AAAA,EACvB;AACF;AAGY,MAAC,gBAAgB,CAAC,SAAS,EAAC,IAAG,MAAM;AAChD,MAAI,CAAC,OAAQ,CAAC,QAAQ,UAAU,CAAC,QAAQ,QAAS;AACjD;AAAA,EACA;AAED,QAAM,QAAQ;AAEd,MAAI,QAAQ,QA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oreList":[0]}
|
package/dist/client/index.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
export { createSliceMachineManagerClient } from "../managers/createSliceMachineManagerClient";
|
2
2
|
export type { CreateSliceMachineManagerClientArgs, SliceMachineManagerClient, } from "../managers/createSliceMachineManagerClient";
|
3
|
-
export { GIT_PROVIDER, type GitProvider } from "../constants/GIT_PROVIDER";
|
4
3
|
export type { Environment } from "../managers/prismicRepository/types";
|
5
4
|
export type { SliceMachineManagerPushSliceReturnType } from "../managers/slices/SlicesManager";
|
6
5
|
export { InternalError, NotFoundError, SliceMachineError, UnauthenticatedError, UnauthorizedError, UnexpectedDataError, isInternalError, isNotFoundError, isPluginError, isSliceMachineError, isUnauthenticatedError, isUnauthorizedError, isUnexpectedDataError, isInvalidActiveEnvironmentError, isUnsupportedError, } from "../errors";
|
package/dist/client.cjs
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const createSliceMachineManagerClient = require("./managers/createSliceMachineManagerClient.cjs");
|
4
|
-
const GIT_PROVIDER = require("./constants/GIT_PROVIDER.cjs");
|
5
4
|
const errors = require("./errors.cjs");
|
6
5
|
const DecodeError = require("./lib/DecodeError.cjs");
|
7
6
|
exports.createSliceMachineManagerClient = createSliceMachineManagerClient.createSliceMachineManagerClient;
|
8
|
-
exports.GIT_PROVIDER = GIT_PROVIDER.GIT_PROVIDER;
|
9
7
|
exports.InternalError = errors.InternalError;
|
10
8
|
exports.NotFoundError = errors.NotFoundError;
|
11
9
|
exports.SliceMachineError = errors.SliceMachineError;
|
package/dist/client.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"client.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/client.js
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
import { createSliceMachineManagerClient } from "./managers/createSliceMachineManagerClient.js";
|
2
|
-
import { GIT_PROVIDER } from "./constants/GIT_PROVIDER.js";
|
3
2
|
import { InternalError, NotFoundError, SliceMachineError, UnauthenticatedError, UnauthorizedError, UnexpectedDataError, isInternalError, isInvalidActiveEnvironmentError, isNotFoundError, isPluginError, isSliceMachineError, isUnauthenticatedError, isUnauthorizedError, isUnexpectedDataError, isUnsupportedError } from "./errors.js";
|
4
3
|
import { DecodeError } from "./lib/DecodeError.js";
|
5
4
|
export {
|
6
5
|
DecodeError,
|
7
|
-
GIT_PROVIDER,
|
8
6
|
InternalError,
|
9
7
|
NotFoundError,
|
10
8
|
SliceMachineError,
|
package/dist/client.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/index.d.ts
CHANGED
@@ -4,7 +4,6 @@ export type { SliceMachineManager } from "./managers/SliceMachineManager";
|
|
4
4
|
export { createSliceMachineManager } from "./managers/createSliceMachineManager";
|
5
5
|
export { createSliceMachineManagerMiddleware } from "./managers/createSliceMachineManagerMiddleware";
|
6
6
|
export type { CreateSliceMachineManagerMiddlewareArgs } from "./managers/createSliceMachineManagerMiddleware";
|
7
|
-
export type { GitOwner, GitRepo, GitRepoSpecifier } from "./managers/git/types";
|
8
7
|
export type { Environment, PushChangesLimit, } from "./managers/prismicRepository/types";
|
9
8
|
export type { PrismicAuthManager, PrismicUserProfile, PrismicAuthState, } from "./auth/PrismicAuthManager";
|
10
9
|
export { createPrismicAuthManager } from "./auth/createPrismicAuthManager";
|
@@ -25,7 +25,6 @@ const TelemetryManager = require("./telemetry/TelemetryManager.cjs");
|
|
25
25
|
const buildPrismicRepositoryAPIEndpoint = require("../lib/buildPrismicRepositoryAPIEndpoint.cjs");
|
26
26
|
const DocumentationManager = require("./documentation/DocumentationManager.cjs");
|
27
27
|
const SliceTemplateLibraryManager = require("./sliceTemplateLibrary/SliceTemplateLibraryManager.cjs");
|
28
|
-
const GitManager = require("./git/GitManager.cjs");
|
29
28
|
function _interopNamespaceDefault(e) {
|
30
29
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
31
30
|
if (e) {
|
@@ -61,7 +60,6 @@ class SliceMachineManager {
|
|
61
60
|
__publicField(this, "telemetry");
|
62
61
|
__publicField(this, "user");
|
63
62
|
__publicField(this, "versions");
|
64
|
-
__publicField(this, "git");
|
65
63
|
this._prismicAuthManager = createPrismicAuthManager.createPrismicAuthManager();
|
66
64
|
this.user = new UserManager.UserManager(this);
|
67
65
|
this.prismicRepository = new PrismicRepositoryManager.PrismicRepositoryManager(this);
|
@@ -78,7 +76,6 @@ class SliceMachineManager {
|
|
78
76
|
this.sliceTemplateLibrary = new SliceTemplateLibraryManager.SliceTemplateLibraryManager(this);
|
79
77
|
this.versions = new VersionsManager.VersionsManager(this);
|
80
78
|
this.telemetry = new TelemetryManager.TelemetryManager(this);
|
81
|
-
this.git = new GitManager.GitManager(this);
|
82
79
|
this.cwd = (args == null ? void 0 : args.cwd) ?? process.cwd();
|
83
80
|
}
|
84
81
|
// The `_sliceMachinePluginRunner` property is hidden behind a function to
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SliceMachineManager.cjs","sources":["../../../src/managers/SliceMachineManager.ts"],"sourcesContent":["import {\n\tSharedSlice,\n\tCustomType,\n} from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\nimport * as prismicCustomTypesClient from \"@prismicio/custom-types-client\";\nimport {\n\tSliceMachinePlugin,\n\tSliceMachinePluginRunner,\n} from \"@slicemachine/plugin-kit\";\n\nimport { createContentDigest } from \"../lib/createContentDigest\";\n\nimport { PackageManager, SliceMachineConfig } from \"../types\";\nimport {\n\tPrismicAuthManager,\n\tPrismicUserProfile,\n} from \"../auth/PrismicAuthManager\";\nimport { createPrismicAuthManager } from \"../auth/createPrismicAuthManager\";\nimport { UnauthenticatedError } from \"../errors\";\n\nimport { API_ENDPOINTS, APIEndpoints } from \"../constants/API_ENDPOINTS\";\n\nimport { UserManager } from \"./user/UserManager\";\nimport { PrismicRepositoryManager } from \"./prismicRepository/PrismicRepositoryManager\";\n\nimport { PluginsManager } from \"./plugins/PluginsManager\";\n\nimport { ProjectManager } from \"./project/ProjectManager\";\nimport { CustomTypesManager } from \"./customTypes/CustomTypesManager\";\nimport { SlicesManager } from \"./slices/SlicesManager\";\nimport { SnippetsManager } from \"./snippets/SnippetsManager\";\nimport { ScreenshotsManager } from \"./screenshots/ScreenshotsManager\";\nimport { SimulatorManager } from \"./simulator/SimulatorManager\";\n\nimport { VersionsManager } from \"./versions/VersionsManager\";\n\nimport { TelemetryManager } from \"./telemetry/TelemetryManager\";\nimport { buildPrismicRepositoryAPIEndpoint } from \"../lib/buildPrismicRepositoryAPIEndpoint\";\nimport { DocumentationManager } from \"./documentation/DocumentationManager\";\nimport { SliceTemplateLibraryManager } from \"./sliceTemplateLibrary/SliceTemplateLibraryManager\";\nimport { GitManager } from \"./git/GitManager\";\n\ntype SliceMachineManagerGetStateReturnType = {\n\tenv: {\n\t\tshortId?: string;\n\t\tintercomHash?: string;\n\t\tmanifest: {\n\t\t\tapiEndpoint: string;\n\t\t\tlocalSliceSimulatorURL?: string;\n\t\t};\n\t\trepo: string;\n\t\tpackageManager: PackageManager;\n\t\tendpoints: APIEndpoints;\n\t};\n\tlibraries: {\n\t\tname: string;\n\t\tpath: string;\n\t\tisLocal: boolean;\n\t\tcomponents: {\n\t\t\tfrom: string;\n\t\t\thref: string;\n\t\t\tpathToSlice: string;\n\t\t\tfileName: string | null;\n\t\t\textension: string | null;\n\t\t\tmodel: SharedSlice;\n\t\t\tscreenshots: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\thash: string;\n\t\t\t\t\tdata: Buffer;\n\t\t\t\t}\n\t\t\t>;\n\t\t\tmocks?: SharedSliceContent[];\n\t\t}[];\n\t\tmeta: {\n\t\t\tname?: string;\n\t\t\tversion?: string;\n\t\t\tisNodeModule: boolean;\n\t\t\tisDownloaded: boolean;\n\t\t\tisManual: boolean;\n\t\t};\n\t}[];\n\tcustomTypes: CustomType[];\n\tremoteCustomTypes: CustomType[];\n\tremoteSlices: SharedSlice[];\n\tclientError?: {\n\t\tname: string;\n\t\tmessage: string;\n\t\tstatus: number;\n\t\treason: string;\n\t};\n};\n\ntype SliceMachineManagerConstructorArgs = {\n\tcwd?: string;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\nexport class SliceMachineManager {\n\tprivate _sliceMachinePluginRunner: SliceMachinePluginRunner | undefined =\n\t\tundefined;\n\tprivate _prismicAuthManager: PrismicAuthManager;\n\n\tcwd: string;\n\n\tcustomTypes: CustomTypesManager;\n\tplugins: PluginsManager;\n\tprismicRepository: PrismicRepositoryManager;\n\tproject: ProjectManager;\n\tscreenshots: ScreenshotsManager;\n\tsimulator: SimulatorManager;\n\tslices: SlicesManager;\n\tsnippets: SnippetsManager;\n\tdocumentation: DocumentationManager;\n\tsliceTemplateLibrary: SliceTemplateLibraryManager;\n\ttelemetry: TelemetryManager;\n\tuser: UserManager;\n\tversions: VersionsManager;\n\tgit: GitManager;\n\n\tconstructor(args?: SliceMachineManagerConstructorArgs) {\n\t\t// _prismicAuthManager must be set at least before UserManager\n\t\t// is instantiated. It depends on the PrismicAuthManager for\n\t\t// authentication-related methods.\n\t\tthis._prismicAuthManager = createPrismicAuthManager();\n\n\t\tthis.user = new UserManager(this);\n\t\tthis.prismicRepository = new PrismicRepositoryManager(this);\n\n\t\tthis.plugins = new PluginsManager(this, {\n\t\t\tnativePlugins: args?.nativePlugins,\n\t\t});\n\n\t\tthis.project = new ProjectManager(this);\n\t\tthis.customTypes = new CustomTypesManager(this);\n\t\tthis.slices = new SlicesManager(this);\n\t\tthis.snippets = new SnippetsManager(this);\n\t\tthis.screenshots = new ScreenshotsManager(this);\n\t\tthis.simulator = new SimulatorManager(this);\n\t\tthis.documentation = new DocumentationManager(this);\n\t\tthis.sliceTemplateLibrary = new SliceTemplateLibraryManager(this);\n\n\t\tthis.versions = new VersionsManager(this);\n\n\t\tthis.telemetry = new TelemetryManager(this);\n\n\t\tthis.git = new GitManager(this);\n\n\t\tthis.cwd = args?.cwd ?? process.cwd();\n\t}\n\n\t// The `_sliceMachinePluginRunner` property is hidden behind a function to\n\t// discourage access. Using a function deliberatly breaks the pattern\n\t// of other child managers that are accessible as properties, like\n\t// `project`, `plugins`, etc. We do not treat SliceMachinePluginRunner\n\t// as a child manager.\n\tgetSliceMachinePluginRunner(): SliceMachinePluginRunner | undefined {\n\t\treturn this._sliceMachinePluginRunner;\n\t}\n\n\t// The `_prismicAuthManager` property is hidden behind a function to\n\t// discourage access. Using a function deliberatly breaks the pattern\n\t// of other child managers that are accessible as properties, like\n\t// `project`, `plugins`, etc. We do not treat PrismicAuthManager as a\n\t// child manager.\n\tgetPrismicAuthManager(): PrismicAuthManager {\n\t\treturn this._prismicAuthManager;\n\t}\n\n\tgetAPIEndpoints(): APIEndpoints {\n\t\treturn API_ENDPOINTS;\n\t}\n\n\t// TODO: Remove this global-state method. It is expensive and a\n\t// potential source of bugs due to data inconsistency. SM UI relies on\n\t// it heavily, so removal will require significant effort.\n\tasync getState(): Promise<SliceMachineManagerGetStateReturnType> {\n\t\tconst [\n\t\t\t{ sliceMachineConfig, libraries },\n\t\t\t{ profile, remoteCustomTypes, remoteSlices, authError },\n\t\t\tcustomTypes,\n\t\t\tpackageManager,\n\t\t] = await Promise.all([\n\t\t\tthis.project.getSliceMachineConfig().then(async (sliceMachineConfig) => {\n\t\t\t\tconst libraries = await this._getLibraries(sliceMachineConfig);\n\n\t\t\t\treturn { sliceMachineConfig, libraries };\n\t\t\t}),\n\t\t\tthis._getProfile().then(async (profile) => {\n\t\t\t\tlet authError;\n\t\t\t\tif (profile) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst [remoteCustomTypes, remoteSlices] = await Promise.all([\n\t\t\t\t\t\t\tthis.customTypes.fetchRemoteCustomTypes(),\n\t\t\t\t\t\t\tthis.slices.fetchRemoteSlices(),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tprofile,\n\t\t\t\t\t\t\tremoteCustomTypes,\n\t\t\t\t\t\t\tremoteSlices,\n\t\t\t\t\t\t\tauthError,\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error instanceof prismicCustomTypesClient.ForbiddenError) {\n\t\t\t\t\t\t\tauthError = {\n\t\t\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\t\t\tstatus: 403,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\terror instanceof UnauthenticatedError ||\n\t\t\t\t\t\t\terror instanceof prismicCustomTypesClient.UnauthorizedError\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tauthError = {\n\t\t\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\t\t\tstatus: 401,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tprofile,\n\t\t\t\t\tremoteCustomTypes: [],\n\t\t\t\t\tremoteSlices: [],\n\t\t\t\t\tauthError,\n\t\t\t\t};\n\t\t\t}),\n\t\t\tthis._getCustomTypes(),\n\t\t\tthis.project.detectPackageManager(),\n\t\t]);\n\n\t\t// SM UI detects if a user is logged out by looking at\n\t\t// `clientError`. Here, we simulate what the old core does by\n\t\t// returning an `ErrorWithStatus`-like object if the user does\n\t\t// not have access to the repository or is not logged in.\n\t\tconst clientError: SliceMachineManagerGetStateReturnType[\"clientError\"] =\n\t\t\tauthError ||\n\t\t\t(profile\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\tstatus: 401, // Needed to trigger the unauthorized flow.\n\t\t\t\t });\n\n\t\treturn {\n\t\t\tenv: {\n\t\t\t\tmanifest: {\n\t\t\t\t\tapiEndpoint:\n\t\t\t\t\t\tsliceMachineConfig.apiEndpoint ||\n\t\t\t\t\t\tbuildPrismicRepositoryAPIEndpoint(\n\t\t\t\t\t\t\tsliceMachineConfig.repositoryName,\n\t\t\t\t\t\t),\n\t\t\t\t\tlocalSliceSimulatorURL: sliceMachineConfig.localSliceSimulatorURL,\n\t\t\t\t},\n\t\t\t\tpackageManager,\n\t\t\t\trepo: sliceMachineConfig.repositoryName,\n\t\t\t\tintercomHash: profile?.intercomHash,\n\t\t\t\tshortId: profile?.shortId,\n\t\t\t\tendpoints: this.getAPIEndpoints(),\n\t\t\t},\n\t\t\tlibraries,\n\t\t\tcustomTypes,\n\t\t\tremoteCustomTypes,\n\t\t\tremoteSlices,\n\t\t\tclientError,\n\t\t};\n\t}\n\n\tprivate async _getProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tlet profile: PrismicUserProfile | undefined;\n\n\t\tconst isLoggedIn = await this.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\tprofile = await this.user.getProfile();\n\t\t\tawait this.user.refreshAuthenticationToken();\n\t\t}\n\n\t\treturn profile;\n\t}\n\n\tprivate async _getLibraries(\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t): Promise<SliceMachineManagerGetStateReturnType[\"libraries\"]> {\n\t\tconst libraries: SliceMachineManagerGetStateReturnType[\"libraries\"] = [];\n\n\t\tif (sliceMachineConfig.libraries) {\n\t\t\tawait Promise.all(\n\t\t\t\tsliceMachineConfig.libraries.map(async (libraryID) => {\n\t\t\t\t\tconst { sliceIDs } = await this.slices.readSliceLibrary({\n\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (sliceIDs) {\n\t\t\t\t\t\tconst components: SliceMachineManagerGetStateReturnType[\"libraries\"][number][\"components\"] =\n\t\t\t\t\t\t\t[];\n\n\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\tsliceIDs.map(async (sliceID) => {\n\t\t\t\t\t\t\t\tconst [{ model }, { mocks }] = await Promise.all([\n\t\t\t\t\t\t\t\t\tthis.slices.readSlice({ libraryID, sliceID }),\n\t\t\t\t\t\t\t\t\tthis.slices.readSliceMocks({ libraryID, sliceID }),\n\t\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\t\tif (model) {\n\t\t\t\t\t\t\t\t\tconst screenshots: (typeof components)[number][\"screenshots\"] =\n\t\t\t\t\t\t\t\t\t\t{};\n\t\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\t\tmodel.variations.map(async (variation) => {\n\t\t\t\t\t\t\t\t\t\t\tconst screenshot = await this.slices.readSliceScreenshot({\n\t\t\t\t\t\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t\t\t\t\t\t\tsliceID,\n\t\t\t\t\t\t\t\t\t\t\t\tvariationID: variation.id,\n\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\tif (screenshot.data) {\n\t\t\t\t\t\t\t\t\t\t\t\tscreenshots[variation.id] = {\n\t\t\t\t\t\t\t\t\t\t\t\t\thash: createContentDigest(screenshot.data),\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata: screenshot.data,\n\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tcomponents.push({\n\t\t\t\t\t\t\t\t\t\tfrom: libraryID,\n\t\t\t\t\t\t\t\t\t\thref: libraryID.replace(/\\//g, \"--\"),\n\t\t\t\t\t\t\t\t\t\tpathToSlice: \"pathToSlice\",\n\t\t\t\t\t\t\t\t\t\tfileName: \"fileName\",\n\t\t\t\t\t\t\t\t\t\textension: \"extension\",\n\t\t\t\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\t\t\t\tscreenshots,\n\t\t\t\t\t\t\t\t\t\tmocks,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tlibraries.push({\n\t\t\t\t\t\t\tname: libraryID,\n\t\t\t\t\t\t\tpath: libraryID,\n\t\t\t\t\t\t\tisLocal: true, // TODO: Do we still support node_modules-based libraries?\n\t\t\t\t\t\t\tcomponents,\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t// TODO: Do we still support node_modules-based libraries?\n\t\t\t\t\t\t\t\tisNodeModule: false,\n\t\t\t\t\t\t\t\tisDownloaded: false,\n\t\t\t\t\t\t\t\tisManual: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\t// Preserve library order from config file\n\t\treturn libraries.sort((library1, library2) => {\n\t\t\tconst libraryIndex1 =\n\t\t\t\tsliceMachineConfig.libraries?.indexOf(library1.name) || 0;\n\t\t\tconst libraryIndex2 =\n\t\t\t\tsliceMachineConfig.libraries?.indexOf(library2.name) || 0;\n\n\t\t\treturn Math.sign(libraryIndex1 - libraryIndex2);\n\t\t});\n\t}\n\n\tprivate async _getCustomTypes(): Promise<\n\t\tSliceMachineManagerGetStateReturnType[\"customTypes\"]\n\t> {\n\t\tconst customTypes: SliceMachineManagerGetStateReturnType[\"customTypes\"] =\n\t\t\t[];\n\n\t\tconst { ids: customTypeIDs } =\n\t\t\tawait this.customTypes.readCustomTypeLibrary();\n\n\t\tif (customTypeIDs) {\n\t\t\tawait Promise.all(\n\t\t\t\tcustomTypeIDs.map(async (customTypeID) => {\n\t\t\t\t\tconst { model } = await this.customTypes.readCustomType({\n\t\t\t\t\t\tid: customTypeID,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (model) {\n\t\t\t\t\t\tcustomTypes.push(model);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn customTypes;\n\t}\n}\n"],"names":["createPrismicAuthManager","UserManager","PrismicRepositoryManager","PluginsManager","ProjectManager","CustomTypesManager","SlicesManager","SnippetsManager","ScreenshotsManager","SimulatorManager","DocumentationManager","SliceTemplateLibraryManager","VersionsManager","TelemetryManager","GitManager","API_ENDPOINTS","sliceMachineConfig","libraries","profile","authError","remoteCustomTypes","remoteSlices","prismicCustomTypesClient","UnauthenticatedError","buildPrismicRepositoryAPIEndpoint","createContentDigest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmGa,oBAAmB;AAAA,EAsB/B,YAAY,MAAyC;AArB7C;AAEA;AAER;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMC,SAAK,sBAAsBA,yBAAAA;AAEtB,SAAA,OAAO,IAAIC,YAAA,YAAY,IAAI;AAC3B,SAAA,oBAAoB,IAAIC,yBAAA,yBAAyB,IAAI;AAErD,SAAA,UAAU,IAAIC,eAAA,eAAe,MAAM;AAAA,MACvC,eAAe,6BAAM;AAAA,IAAA,CACrB;AAEI,SAAA,UAAU,IAAIC,eAAA,eAAe,IAAI;AACjC,SAAA,cAAc,IAAIC,mBAAA,mBAAmB,IAAI;AACzC,SAAA,SAAS,IAAIC,cAAA,cAAc,IAAI;AAC/B,SAAA,WAAW,IAAIC,gBAAA,gBAAgB,IAAI;AACnC,S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,MAAM;AAAA;AAAA,cAEL,cAAc;AAAA,cACd,cAAc;AAAA,cACd,UAAU;AAAA,YACV;AAAA,UAAA,CACD;AAAA,QACF;AAAA,MACA,CAAA,CAAC;AAAA,IAEJ;AAGA,WAAO,UAAU,KAAK,CAAC,UAAU,aAAY;;AAC5C,YAAM,kBACL,wBAAmB,cAAnB,mBAA8B,QAAQ,SAAS,UAAS;AACzD,YAAM,kBACL,wBAAmB,cAAnB,mBAA8B,QAAQ,SAAS,UAAS;AAElD,aAAA,KAAK,KAAK,gBAAgB,aAAa;AAAA,IAAA,CAC9C;AAAA,EACF;AAAA,EAEQ,MAAM,kBAAe;AAG5B,UAAM,cACL,CAAA;AAED,UAAM,EAAE,KAAK,kBACZ,MAAM,KAAK,YAAY;AAExB,QAAI,eAAe;AAClB,YAAM,QAAQ,IACb,cAAc,IAAI,OAAO,iBAAgB;AACxC,cAAM,EAAE,MAAK,IAAK,MAAM,KAAK,YAAY,eAAe;AAAA,UACvD,IAAI;AAAA,QAAA,CACJ;AAED,YAAI,OAAO;AACV,sBAAY,KAAK,KAAK;AAAA,QACvB;AAAA,MACA,CAAA,CAAC;AAAA,IAEJ;AAEO,WAAA;AAAA,EACR;AACA;;"}
|
1
|
+
{"version":3,"file":"SliceMachineManager.cjs","sources":["../../../src/managers/SliceMachineManager.ts"],"sourcesContent":["import {\n\tSharedSlice,\n\tCustomType,\n} from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\nimport * as prismicCustomTypesClient from \"@prismicio/custom-types-client\";\nimport {\n\tSliceMachinePlugin,\n\tSliceMachinePluginRunner,\n} from \"@slicemachine/plugin-kit\";\n\nimport { createContentDigest } from \"../lib/createContentDigest\";\n\nimport { PackageManager, SliceMachineConfig } from \"../types\";\nimport {\n\tPrismicAuthManager,\n\tPrismicUserProfile,\n} from \"../auth/PrismicAuthManager\";\nimport { createPrismicAuthManager } from \"../auth/createPrismicAuthManager\";\nimport { UnauthenticatedError } from \"../errors\";\n\nimport { API_ENDPOINTS, APIEndpoints } from \"../constants/API_ENDPOINTS\";\n\nimport { UserManager } from \"./user/UserManager\";\nimport { PrismicRepositoryManager } from \"./prismicRepository/PrismicRepositoryManager\";\n\nimport { PluginsManager } from \"./plugins/PluginsManager\";\n\nimport { ProjectManager } from \"./project/ProjectManager\";\nimport { CustomTypesManager } from \"./customTypes/CustomTypesManager\";\nimport { SlicesManager } from \"./slices/SlicesManager\";\nimport { SnippetsManager } from \"./snippets/SnippetsManager\";\nimport { ScreenshotsManager } from \"./screenshots/ScreenshotsManager\";\nimport { SimulatorManager } from \"./simulator/SimulatorManager\";\n\nimport { VersionsManager } from \"./versions/VersionsManager\";\n\nimport { TelemetryManager } from \"./telemetry/TelemetryManager\";\nimport { buildPrismicRepositoryAPIEndpoint } from \"../lib/buildPrismicRepositoryAPIEndpoint\";\nimport { DocumentationManager } from \"./documentation/DocumentationManager\";\nimport { SliceTemplateLibraryManager } from \"./sliceTemplateLibrary/SliceTemplateLibraryManager\";\n\ntype SliceMachineManagerGetStateReturnType = {\n\tenv: {\n\t\tshortId?: string;\n\t\tintercomHash?: string;\n\t\tmanifest: {\n\t\t\tapiEndpoint: string;\n\t\t\tlocalSliceSimulatorURL?: string;\n\t\t};\n\t\trepo: string;\n\t\tpackageManager: PackageManager;\n\t\tendpoints: APIEndpoints;\n\t};\n\tlibraries: {\n\t\tname: string;\n\t\tpath: string;\n\t\tisLocal: boolean;\n\t\tcomponents: {\n\t\t\tfrom: string;\n\t\t\thref: string;\n\t\t\tpathToSlice: string;\n\t\t\tfileName: string | null;\n\t\t\textension: string | null;\n\t\t\tmodel: SharedSlice;\n\t\t\tscreenshots: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\thash: string;\n\t\t\t\t\tdata: Buffer;\n\t\t\t\t}\n\t\t\t>;\n\t\t\tmocks?: SharedSliceContent[];\n\t\t}[];\n\t\tmeta: {\n\t\t\tname?: string;\n\t\t\tversion?: string;\n\t\t\tisNodeModule: boolean;\n\t\t\tisDownloaded: boolean;\n\t\t\tisManual: boolean;\n\t\t};\n\t}[];\n\tcustomTypes: CustomType[];\n\tremoteCustomTypes: CustomType[];\n\tremoteSlices: SharedSlice[];\n\tclientError?: {\n\t\tname: string;\n\t\tmessage: string;\n\t\tstatus: number;\n\t\treason: string;\n\t};\n};\n\ntype SliceMachineManagerConstructorArgs = {\n\tcwd?: string;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\nexport class SliceMachineManager {\n\tprivate _sliceMachinePluginRunner: SliceMachinePluginRunner | undefined =\n\t\tundefined;\n\tprivate _prismicAuthManager: PrismicAuthManager;\n\n\tcwd: string;\n\n\tcustomTypes: CustomTypesManager;\n\tplugins: PluginsManager;\n\tprismicRepository: PrismicRepositoryManager;\n\tproject: ProjectManager;\n\tscreenshots: ScreenshotsManager;\n\tsimulator: SimulatorManager;\n\tslices: SlicesManager;\n\tsnippets: SnippetsManager;\n\tdocumentation: DocumentationManager;\n\tsliceTemplateLibrary: SliceTemplateLibraryManager;\n\ttelemetry: TelemetryManager;\n\tuser: UserManager;\n\tversions: VersionsManager;\n\n\tconstructor(args?: SliceMachineManagerConstructorArgs) {\n\t\t// _prismicAuthManager must be set at least before UserManager\n\t\t// is instantiated. It depends on the PrismicAuthManager for\n\t\t// authentication-related methods.\n\t\tthis._prismicAuthManager = createPrismicAuthManager();\n\n\t\tthis.user = new UserManager(this);\n\t\tthis.prismicRepository = new PrismicRepositoryManager(this);\n\n\t\tthis.plugins = new PluginsManager(this, {\n\t\t\tnativePlugins: args?.nativePlugins,\n\t\t});\n\n\t\tthis.project = new ProjectManager(this);\n\t\tthis.customTypes = new CustomTypesManager(this);\n\t\tthis.slices = new SlicesManager(this);\n\t\tthis.snippets = new SnippetsManager(this);\n\t\tthis.screenshots = new ScreenshotsManager(this);\n\t\tthis.simulator = new SimulatorManager(this);\n\t\tthis.documentation = new DocumentationManager(this);\n\t\tthis.sliceTemplateLibrary = new SliceTemplateLibraryManager(this);\n\n\t\tthis.versions = new VersionsManager(this);\n\n\t\tthis.telemetry = new TelemetryManager(this);\n\n\t\tthis.cwd = args?.cwd ?? process.cwd();\n\t}\n\n\t// The `_sliceMachinePluginRunner` property is hidden behind a function to\n\t// discourage access. Using a function deliberatly breaks the pattern\n\t// of other child managers that are accessible as properties, like\n\t// `project`, `plugins`, etc. We do not treat SliceMachinePluginRunner\n\t// as a child manager.\n\tgetSliceMachinePluginRunner(): SliceMachinePluginRunner | undefined {\n\t\treturn this._sliceMachinePluginRunner;\n\t}\n\n\t// The `_prismicAuthManager` property is hidden behind a function to\n\t// discourage access. Using a function deliberatly breaks the pattern\n\t// of other child managers that are accessible as properties, like\n\t// `project`, `plugins`, etc. We do not treat PrismicAuthManager as a\n\t// child manager.\n\tgetPrismicAuthManager(): PrismicAuthManager {\n\t\treturn this._prismicAuthManager;\n\t}\n\n\tgetAPIEndpoints(): APIEndpoints {\n\t\treturn API_ENDPOINTS;\n\t}\n\n\t// TODO: Remove this global-state method. It is expensive and a\n\t// potential source of bugs due to data inconsistency. SM UI relies on\n\t// it heavily, so removal will require significant effort.\n\tasync getState(): Promise<SliceMachineManagerGetStateReturnType> {\n\t\tconst [\n\t\t\t{ sliceMachineConfig, libraries },\n\t\t\t{ profile, remoteCustomTypes, remoteSlices, authError },\n\t\t\tcustomTypes,\n\t\t\tpackageManager,\n\t\t] = await Promise.all([\n\t\t\tthis.project.getSliceMachineConfig().then(async (sliceMachineConfig) => {\n\t\t\t\tconst libraries = await this._getLibraries(sliceMachineConfig);\n\n\t\t\t\treturn { sliceMachineConfig, libraries };\n\t\t\t}),\n\t\t\tthis._getProfile().then(async (profile) => {\n\t\t\t\tlet authError;\n\t\t\t\tif (profile) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst [remoteCustomTypes, remoteSlices] = await Promise.all([\n\t\t\t\t\t\t\tthis.customTypes.fetchRemoteCustomTypes(),\n\t\t\t\t\t\t\tthis.slices.fetchRemoteSlices(),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tprofile,\n\t\t\t\t\t\t\tremoteCustomTypes,\n\t\t\t\t\t\t\tremoteSlices,\n\t\t\t\t\t\t\tauthError,\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error instanceof prismicCustomTypesClient.ForbiddenError) {\n\t\t\t\t\t\t\tauthError = {\n\t\t\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\t\t\tstatus: 403,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\terror instanceof UnauthenticatedError ||\n\t\t\t\t\t\t\terror instanceof prismicCustomTypesClient.UnauthorizedError\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tauthError = {\n\t\t\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\t\t\tstatus: 401,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tprofile,\n\t\t\t\t\tremoteCustomTypes: [],\n\t\t\t\t\tremoteSlices: [],\n\t\t\t\t\tauthError,\n\t\t\t\t};\n\t\t\t}),\n\t\t\tthis._getCustomTypes(),\n\t\t\tthis.project.detectPackageManager(),\n\t\t]);\n\n\t\t// SM UI detects if a user is logged out by looking at\n\t\t// `clientError`. Here, we simulate what the old core does by\n\t\t// returning an `ErrorWithStatus`-like object if the user does\n\t\t// not have access to the repository or is not logged in.\n\t\tconst clientError: SliceMachineManagerGetStateReturnType[\"clientError\"] =\n\t\t\tauthError ||\n\t\t\t(profile\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tname: \"__stub__\",\n\t\t\t\t\t\tmessage: \"__stub__\",\n\t\t\t\t\t\treason: \"__stub__\",\n\t\t\t\t\t\tstatus: 401, // Needed to trigger the unauthorized flow.\n\t\t\t\t });\n\n\t\treturn {\n\t\t\tenv: {\n\t\t\t\tmanifest: {\n\t\t\t\t\tapiEndpoint:\n\t\t\t\t\t\tsliceMachineConfig.apiEndpoint ||\n\t\t\t\t\t\tbuildPrismicRepositoryAPIEndpoint(\n\t\t\t\t\t\t\tsliceMachineConfig.repositoryName,\n\t\t\t\t\t\t),\n\t\t\t\t\tlocalSliceSimulatorURL: sliceMachineConfig.localSliceSimulatorURL,\n\t\t\t\t},\n\t\t\t\tpackageManager,\n\t\t\t\trepo: sliceMachineConfig.repositoryName,\n\t\t\t\tintercomHash: profile?.intercomHash,\n\t\t\t\tshortId: profile?.shortId,\n\t\t\t\tendpoints: this.getAPIEndpoints(),\n\t\t\t},\n\t\t\tlibraries,\n\t\t\tcustomTypes,\n\t\t\tremoteCustomTypes,\n\t\t\tremoteSlices,\n\t\t\tclientError,\n\t\t};\n\t}\n\n\tprivate async _getProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tlet profile: PrismicUserProfile | undefined;\n\n\t\tconst isLoggedIn = await this.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\tprofile = await this.user.getProfile();\n\t\t\tawait this.user.refreshAuthenticationToken();\n\t\t}\n\n\t\treturn profile;\n\t}\n\n\tprivate async _getLibraries(\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t): Promise<SliceMachineManagerGetStateReturnType[\"libraries\"]> {\n\t\tconst libraries: SliceMachineManagerGetStateReturnType[\"libraries\"] = [];\n\n\t\tif (sliceMachineConfig.libraries) {\n\t\t\tawait Promise.all(\n\t\t\t\tsliceMachineConfig.libraries.map(async (libraryID) => {\n\t\t\t\t\tconst { sliceIDs } = await this.slices.readSliceLibrary({\n\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (sliceIDs) {\n\t\t\t\t\t\tconst components: SliceMachineManagerGetStateReturnType[\"libraries\"][number][\"components\"] =\n\t\t\t\t\t\t\t[];\n\n\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\tsliceIDs.map(async (sliceID) => {\n\t\t\t\t\t\t\t\tconst [{ model }, { mocks }] = await Promise.all([\n\t\t\t\t\t\t\t\t\tthis.slices.readSlice({ libraryID, sliceID }),\n\t\t\t\t\t\t\t\t\tthis.slices.readSliceMocks({ libraryID, sliceID }),\n\t\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\t\tif (model) {\n\t\t\t\t\t\t\t\t\tconst screenshots: (typeof components)[number][\"screenshots\"] =\n\t\t\t\t\t\t\t\t\t\t{};\n\t\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\t\tmodel.variations.map(async (variation) => {\n\t\t\t\t\t\t\t\t\t\t\tconst screenshot = await this.slices.readSliceScreenshot({\n\t\t\t\t\t\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t\t\t\t\t\t\tsliceID,\n\t\t\t\t\t\t\t\t\t\t\t\tvariationID: variation.id,\n\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\tif (screenshot.data) {\n\t\t\t\t\t\t\t\t\t\t\t\tscreenshots[variation.id] = {\n\t\t\t\t\t\t\t\t\t\t\t\t\thash: createContentDigest(screenshot.data),\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata: screenshot.data,\n\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tcomponents.push({\n\t\t\t\t\t\t\t\t\t\tfrom: libraryID,\n\t\t\t\t\t\t\t\t\t\thref: libraryID.replace(/\\//g, \"--\"),\n\t\t\t\t\t\t\t\t\t\tpathToSlice: \"pathToSlice\",\n\t\t\t\t\t\t\t\t\t\tfileName: \"fileName\",\n\t\t\t\t\t\t\t\t\t\textension: \"extension\",\n\t\t\t\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\t\t\t\tscreenshots,\n\t\t\t\t\t\t\t\t\t\tmocks,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tlibraries.push({\n\t\t\t\t\t\t\tname: libraryID,\n\t\t\t\t\t\t\tpath: libraryID,\n\t\t\t\t\t\t\tisLocal: true, // TODO: Do we still support node_modules-based libraries?\n\t\t\t\t\t\t\tcomponents,\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t// TODO: Do we still support node_modules-based libraries?\n\t\t\t\t\t\t\t\tisNodeModule: false,\n\t\t\t\t\t\t\t\tisDownloaded: false,\n\t\t\t\t\t\t\t\tisManual: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\t// Preserve library order from config file\n\t\treturn libraries.sort((library1, library2) => {\n\t\t\tconst libraryIndex1 =\n\t\t\t\tsliceMachineConfig.libraries?.indexOf(library1.name) || 0;\n\t\t\tconst libraryIndex2 =\n\t\t\t\tsliceMachineConfig.libraries?.indexOf(library2.name) || 0;\n\n\t\t\treturn Math.sign(libraryIndex1 - libraryIndex2);\n\t\t});\n\t}\n\n\tprivate async _getCustomTypes(): Promise<\n\t\tSliceMachineManagerGetStateReturnType[\"customTypes\"]\n\t> {\n\t\tconst customTypes: SliceMachineManagerGetStateReturnType[\"customTypes\"] =\n\t\t\t[];\n\n\t\tconst { ids: customTypeIDs } =\n\t\t\tawait this.customTypes.readCustomTypeLibrary();\n\n\t\tif (customTypeIDs) {\n\t\t\tawait Promise.all(\n\t\t\t\tcustomTypeIDs.map(async (customTypeID) => {\n\t\t\t\t\tconst { model } = await this.customTypes.readCustomType({\n\t\t\t\t\t\tid: customTypeID,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (model) {\n\t\t\t\t\t\tcustomTypes.push(model);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn customTypes;\n\t}\n}\n"],"names":["createPrismicAuthManager","UserManager","PrismicRepositoryManager","PluginsManager","ProjectManager","CustomTypesManager","SlicesManager","SnippetsManager","ScreenshotsManager","SimulatorManager","DocumentationManager","SliceTemplateLibraryManager","VersionsManager","TelemetryManager","API_ENDPOINTS","sliceMachineConfig","libraries","profile","authError","remoteCustomTypes","remoteSlices","prismicCustomTypesClient","UnauthenticatedError","buildPrismicRepositoryAPIEndpoint","createContentDigest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkGa,oBAAmB;AAAA,EAqB/B,YAAY,MAAyC;AApB7C;AAEA;AAER;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMC,SAAK,sBAAsBA,yBAAAA;AAEtB,SAAA,OAAO,IAAIC,YAAA,YAAY,IAAI;AAC3B,SAAA,oBAAoB,IAAIC,yBAAA,yBAAyB,IAAI;AAErD,SAAA,UAAU,IAAIC,eAAA,eAAe,MAAM;AAAA,MACvC,eAAe,6BAAM;AAAA,IAAA,CACrB;AAEI,SAAA,UAAU,IAAIC,eAAA,eAAe,IAAI;AACjC,SAAA,cAAc,IAAIC,mBAAA,mBAAmB,IAAI;AACzC,SAAA,SAAS,IAAIC,cAAA,cAAc,IAAI;AAC/B,SAAA,WAAW,IAAIC,gBAAA,gBAAgB,IAAI;AACnC,SAAA,cAAc,IAAIC,mBAAA,mBAAmB,IAAI;AACzC,SAAA,YAAY,IAAIC,iBAAA,iBAAiB,IAAI;AACrC,SAAA,gBAAgB,IAAIC,qBAAA,qBAAqB,IAAI;AAC7C,SAAA,uBAAuB,IAAIC,4B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