@slicemachine/manager 0.25.1 → 0.25.2-alpha.dani-git-integration.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/_node_modules/execa/index.cjs +8 -70
  2. package/dist/_node_modules/execa/index.cjs.map +1 -1
  3. package/dist/_node_modules/execa/index.js +2 -64
  4. package/dist/_node_modules/execa/index.js.map +1 -1
  5. package/dist/_node_modules/execa/lib/stream.cjs +0 -15
  6. package/dist/_node_modules/execa/lib/stream.cjs.map +1 -1
  7. package/dist/_node_modules/execa/lib/stream.js +1 -16
  8. package/dist/_node_modules/execa/lib/stream.js.map +1 -1
  9. package/dist/auth/PrismicAuthManager.cjs +1 -1
  10. package/dist/auth/PrismicAuthManager.cjs.map +1 -1
  11. package/dist/auth/PrismicAuthManager.js +1 -1
  12. package/dist/auth/PrismicAuthManager.js.map +1 -1
  13. package/dist/client/index.d.ts +0 -1
  14. package/dist/client.cjs +0 -2
  15. package/dist/client.cjs.map +1 -1
  16. package/dist/client.js +0 -2
  17. package/dist/client.js.map +1 -1
  18. package/dist/index.d.ts +0 -1
  19. package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs +10 -6
  20. package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs.map +1 -1
  21. package/dist/lib/fetchGitHubReleaseBodyForRelease.js +10 -6
  22. package/dist/lib/fetchGitHubReleaseBodyForRelease.js.map +1 -1
  23. package/dist/managers/SliceMachineManager.cjs +4 -6
  24. package/dist/managers/SliceMachineManager.cjs.map +1 -1
  25. package/dist/managers/SliceMachineManager.d.ts +0 -2
  26. package/dist/managers/SliceMachineManager.js +4 -6
  27. package/dist/managers/SliceMachineManager.js.map +1 -1
  28. package/dist/managers/project/ProjectManager.cjs +6 -3
  29. package/dist/managers/project/ProjectManager.cjs.map +1 -1
  30. package/dist/managers/project/ProjectManager.d.ts +5 -0
  31. package/dist/managers/project/ProjectManager.js +6 -3
  32. package/dist/managers/project/ProjectManager.js.map +1 -1
  33. package/dist/managers/telemetry/TelemetryManager.cjs +6 -2
  34. package/dist/managers/telemetry/TelemetryManager.cjs.map +1 -1
  35. package/dist/managers/telemetry/TelemetryManager.js +6 -2
  36. package/dist/managers/telemetry/TelemetryManager.js.map +1 -1
  37. package/dist/managers/telemetry/types.cjs.map +1 -1
  38. package/dist/managers/telemetry/types.d.ts +0 -1
  39. package/dist/managers/telemetry/types.js.map +1 -1
  40. package/package.json +4 -3
  41. package/src/auth/PrismicAuthManager.ts +1 -1
  42. package/src/client/index.ts +0 -2
  43. package/src/index.ts +0 -2
  44. package/src/lib/fetchGitHubReleaseBodyForRelease.ts +11 -6
  45. package/src/managers/SliceMachineManager.ts +4 -6
  46. package/src/managers/project/ProjectManager.ts +9 -6
  47. package/src/managers/telemetry/TelemetryManager.ts +7 -2
  48. package/src/managers/telemetry/types.ts +0 -1
  49. package/dist/constants/GIT_PROVIDER.cjs +0 -7
  50. package/dist/constants/GIT_PROVIDER.cjs.map +0 -1
  51. package/dist/constants/GIT_PROVIDER.d.ts +0 -4
  52. package/dist/constants/GIT_PROVIDER.js +0 -7
  53. package/dist/constants/GIT_PROVIDER.js.map +0 -1
  54. package/dist/constants/GIT_PROVIDER_APP_SLUGS.cjs +0 -26
  55. package/dist/constants/GIT_PROVIDER_APP_SLUGS.cjs.map +0 -1
  56. package/dist/constants/GIT_PROVIDER_APP_SLUGS.d.ts +0 -3
  57. package/dist/constants/GIT_PROVIDER_APP_SLUGS.js +0 -26
  58. package/dist/constants/GIT_PROVIDER_APP_SLUGS.js.map +0 -1
  59. package/dist/managers/git/GitManager.cjs +0 -334
  60. package/dist/managers/git/GitManager.cjs.map +0 -1
  61. package/dist/managers/git/GitManager.d.ts +0 -89
  62. package/dist/managers/git/GitManager.js +0 -316
  63. package/dist/managers/git/GitManager.js.map +0 -1
  64. package/dist/managers/git/buildGitRepoSpecifier.cjs +0 -7
  65. package/dist/managers/git/buildGitRepoSpecifier.cjs.map +0 -1
  66. package/dist/managers/git/buildGitRepoSpecifier.d.ts +0 -19
  67. package/dist/managers/git/buildGitRepoSpecifier.js +0 -7
  68. package/dist/managers/git/buildGitRepoSpecifier.js.map +0 -1
  69. package/dist/managers/git/types.d.ts +0 -20
  70. package/src/constants/GIT_PROVIDER.ts +0 -5
  71. package/src/constants/GIT_PROVIDER_APP_SLUGS.ts +0 -28
  72. package/src/managers/git/GitManager.ts +0 -502
  73. package/src/managers/git/buildGitRepoSpecifier.ts +0 -24
  74. 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$1 = require("../strip-final-newline/index.cjs");
9
- const index$3 = require("../npm-run-path/index.cjs");
10
- const index$2 = require("../onetime/index.cjs");
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$3.npmRunPathEnv({ env, cwd: localDir, execPath });
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$1(value);
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$2(handlePromise);
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,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A;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,UAAMH,UAAQQ,MAAAA,UAAU;AAAA,MACvB;AAAA,MACA;AAAA,MACA,OAAO,OAAO;AAAA,MACd,QAAQ,OAAO;AAAA,MACf,UAAU,OAAO;AAAA,MACpB,SAAGL;AAAAA,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,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;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ACR,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACX;AAAA,EACA;AAEC,QAAM,oBAAoBa,MAAQ,aAAa;AAE/CC,SAAAA,YAAY,SAAS,OAAO,OAAO;AAEnC,UAAQ,MAAMC,OAAa,cAAC,SAAS,OAAO,OAAO;AAEnDC,OAAc,eAAC,OAAO;AACtBV,uBAAa,SAAS,iBAAiB;AACvC,SAAO;AACR;AAoGO,SAAS,aAAaN,WAAS,SAAS;AAC9C,QAAM,CAAC,MAAM,GAAG,IAAI,IAAIiB,QAAY,aAACjB,SAAO;AAC5C,SAAO,MAAM,MAAM,MAAM,OAAO;AACjC;;;","x_google_ignoreList":[0]}
@@ -10,7 +10,7 @@ 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 { handleInputSync, handleInput, makeAllStream, getSpawnedResult } from "./lib/stream.js";
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{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AAAA,MACA;AAAA,MACA;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;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@ -9,20 +9,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":["readFileSync","isStream","createReadStream","mergeStream","getStream"],"mappings":";;;;;;AAKA,MAAM,uBAAuB,WAAS;AACrC,MAAI,UAAU,QAAW;AACxB,UAAM,IAAI,UAAU,yDAAyD;AAAA,EAC7E;AACF;AAEA,MAAM,eAAe,CAAC,EAAC,OAAO,UAAS,MAAM;AAC5C,MAAI,OAAO,cAAc,UAAU;AAClC,WAAO;AAAA,EACP;AAED,uBAAqB,KAAK;AAC1B,SAAOA,QAAAA,aAAa,SAAS;AAC9B;AAGY,MAAC,kBAAkB,aAAW;AACzC,QAAM,QAAQ,aAAa,OAAO;AAElC,MAAIC,MAAAA,SAAS,KAAK,GAAG;AACpB,UAAM,IAAI,UAAU,oDAAoD;AAAA,EACxE;AAED,SAAO;AACR;AAEA,MAAM,WAAW,CAAC,EAAC,OAAO,UAAS,MAAM;AACxC,MAAI,OAAO,cAAc,UAAU;AAClC,WAAO;AAAA,EACP;AAED,uBAAqB,KAAK;AAC1B,SAAOC,QAAAA,iBAAiB,SAAS;AAClC;AAGY,MAAC,cAAc,CAAC,SAAS,YAAY;AAChD,QAAM,QAAQ,SAAS,OAAO;AAE9B,MAAI,UAAU,QAAW;AACxB;AAAA,EACA;AAED,MAAID,MAAAA,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,QAAQE;AAEd,MAAI,QAAQ,QAAQ;AACnB,UAAM,IAAI,QAAQ,MAAM;AAAA,EACxB;AAED,MAAI,QAA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a/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,UAAU;AAClC,WAAO;AAAA,EACP;AAED,uBAAqB,KAAK;AAC1B,SAAOA,QAAAA,iBAAiB,SAAS;AAClC;AAGY,MAAC,cAAc,CAAC,SAAS,YAAY;AAChD,QAAM,QAAQ,SAAS,OAAO;AAE9B,MAAI,UAAU,QAAW;AACxB;AAAA,EACA;AAED,MAAIC,MAAAA,SAAS,KAAK,GAAG;AACpB,UAAM,KAAK,QAAQ,KAAK;AAAA,EAC1B,OAAQ;AACN,YAAQ,MAAM,IAAI,KA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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 { readFileSync, createReadStream } from "node:fs";
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;AAEA,MAAM,eAAe,CAAC,EAAC,OAAO,UAAS,MAAM;AAC5C,MAAI,OAAO,cAAc,UAAU;AAClC,WAAO;AAAA,EACP;AAED,uBAAqB,KAAK;AAC1B,SAAO,aAAa,SAAS;AAC9B;AAGY,MAAC,kBAAkB,aAAW;AACzC,QAAM,QAAQ,aAAa,OAAO;AAElC,MAAI,SAAS,KAAK,GAAG;AACpB,UAAM,IAAI,UAAU,oDAAoD;AAAA,EACxE;AAED,SAAO;AACR;AAEA,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,IAA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B,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
+ {"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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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]}
@@ -142,7 +142,7 @@ class PrismicAuthManager {
142
142
  server.once("listening", () => {
143
143
  resolve2();
144
144
  });
145
- server.listen(args.port);
145
+ server.listen(args.port, "127.0.0.1");
146
146
  });
147
147
  if (args.onListenCallback) {
148
148
  args.onListenCallback();
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicAuthManager.cjs","sources":["../../../src/auth/PrismicAuthManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport * as http from \"node:http\";\n\nimport * as h3 from \"h3\";\nimport fetch from \"../lib/fetch\";\nimport cookie from \"cookie\";\nimport cors from \"cors\";\nimport getPort from \"get-port\";\n\nimport { decode } from \"../lib/decode\";\nimport { serializeCookies } from \"../lib/serializeCookies\";\n\nimport { API_ENDPOINTS } from \"../constants/API_ENDPOINTS\";\nimport { SLICE_MACHINE_USER_AGENT } from \"../constants/SLICE_MACHINE_USER_AGENT\";\nimport { createPrismicAuthManagerMiddleware } from \"./createPrismicAuthManagerMiddleware\";\nimport {\n\tInternalError,\n\tUnauthenticatedError,\n\tUnexpectedDataError,\n} from \"../errors\";\n\nconst COOKIE_SEPARATOR = \"; \";\nconst AUTH_COOKIE_KEY = \"prismic-auth\";\nconst SESSION_COOKIE_KEY = \"SESSION\";\n\nconst PERSISTED_AUTH_STATE_FILE_NAME = \".prismic\";\nconst DEFAULT_PERSISTED_AUTH_STATE: PrismicAuthState = {\n\tbase: \"https://prismic.io\",\n\tcookies: {},\n};\n\nconst PrismicAuthState = t.intersection([\n\tt.type({\n\t\tbase: t.string,\n\t\tcookies: t.intersection([\n\t\t\tt.partial({\n\t\t\t\t[AUTH_COOKIE_KEY]: t.string,\n\t\t\t\tSESSION: t.string,\n\t\t\t}),\n\t\t\tt.record(t.string, t.string),\n\t\t]),\n\t}),\n\tt.partial({\n\t\tshortId: t.string,\n\t\tintercomHash: t.string,\n\t\toauthAccessToken: t.string,\n\t\tauthUrl: t.string,\n\t}),\n]);\nexport type PrismicAuthState = t.TypeOf<typeof PrismicAuthState>;\n\nconst PrismicUserProfile = t.exact(\n\tt.type({\n\t\tuserId: t.string,\n\t\tshortId: t.string,\n\t\tintercomHash: t.string,\n\t\temail: t.string,\n\t\tfirstName: t.string,\n\t\tlastName: t.string,\n\t}),\n);\nexport type PrismicUserProfile = t.TypeOf<typeof PrismicUserProfile>;\n\ntype PrismicAuthManagerConstructorArgs = {\n\tscopedDirectory?: string;\n};\n\ntype PrismicAuthManagerLoginArgs = {\n\temail: string;\n\tcookies: string[];\n};\n\ntype PrismicAuthManagerGetLoginSessionInfoReturnType = {\n\tport: number;\n\turl: string;\n};\n\ntype PrismicAuthManagerNodeLoginSessionArgs = {\n\tport: number;\n\tonListenCallback?: () => void;\n};\n\ntype GetProfileForAuthenticationTokenArgs = {\n\tauthenticationToken: string;\n};\n\nconst checkHasAuthenticationToken = (\n\tauthState: PrismicAuthState,\n): authState is PrismicAuthState & {\n\tcookies: Required<\n\t\tPick<\n\t\t\tPrismicAuthState[\"cookies\"],\n\t\t\ttypeof AUTH_COOKIE_KEY | typeof SESSION_COOKIE_KEY\n\t\t>\n\t>;\n} => {\n\treturn Boolean(\n\t\tauthState.cookies[AUTH_COOKIE_KEY] && authState.cookies[SESSION_COOKIE_KEY],\n\t);\n};\n\nconst parseCookies = (cookies: string): Record<string, string> => {\n\treturn cookie.parse(cookies, {\n\t\t// Don't escape any values.\n\t\tdecode: (value) => value,\n\t});\n};\n\nexport class PrismicAuthManager {\n\t// TODO: Automatically scope the manager to the current Slice Machine\n\t// project? If not, this internal state can be removed.\n\tscopedDirectory: string;\n\n\tconstructor({\n\t\tscopedDirectory = os.homedir(),\n\t}: PrismicAuthManagerConstructorArgs = {}) {\n\t\tthis.scopedDirectory = scopedDirectory;\n\t}\n\n\t// TODO: Make the `cookies` argument more explicit. What are these\n\t// mysterious cookies?\n\tasync login(args: PrismicAuthManagerLoginArgs): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t// Set the auth's URL base to the current base at runtime.\n\t\tauthState.base = API_ENDPOINTS.PrismicWroom;\n\t\tauthState.cookies = {\n\t\t\t...authState.cookies,\n\t\t\t...parseCookies(args.cookies.join(COOKIE_SEPARATOR)),\n\t\t};\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst authenticationToken = authState.cookies[AUTH_COOKIE_KEY];\n\t\t\tconst profile = await this._getProfileForAuthenticationToken({\n\t\t\t\tauthenticationToken,\n\t\t\t});\n\n\t\t\tauthState.shortId = profile.shortId;\n\t\t\tauthState.intercomHash = profile.intercomHash;\n\t\t}\n\n\t\tawait this._writePersistedAuthState(authState);\n\t}\n\n\tasync getLoginSessionInfo(): Promise<PrismicAuthManagerGetLoginSessionInfoReturnType> {\n\t\t// Pick a random port, with a preference for historic `5555`\n\t\tconst port = await getPort({ port: 5555 });\n\n\t\tconst url = new URL(\n\t\t\t`./dashboard/cli/login?source=slice-machine&port=${port}`,\n\t\t\tAPI_ENDPOINTS.PrismicWroom,\n\t\t).toString();\n\n\t\treturn {\n\t\t\tport,\n\t\t\turl,\n\t\t};\n\t}\n\n\tasync nodeLoginSession(\n\t\targs: PrismicAuthManagerNodeLoginSessionArgs,\n\t): Promise<void> {\n\t\treturn new Promise<void>(async (resolve) => {\n\t\t\t// Timeout attempt after 3 minutes\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tserver.close();\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Login timeout, server did not receive a response within a 3-minute delay\",\n\t\t\t\t);\n\t\t\t}, 180_000);\n\n\t\t\tconst app = h3.createApp();\n\t\t\tapp.use(h3.fromNodeMiddleware(cors()));\n\t\t\tapp.use(\n\t\t\t\th3.fromNodeMiddleware(\n\t\t\t\t\tcreatePrismicAuthManagerMiddleware({\n\t\t\t\t\t\tprismicAuthManager: this,\n\t\t\t\t\t\tonLoginCallback() {\n\t\t\t\t\t\t\t// Cleanup process and resolve\n\t\t\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\t\t\tserver.close();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\t// Start server\n\t\t\tconst server = http.createServer(h3.toNodeListener(app));\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tserver.once(\"listening\", () => {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tserver.listen(args.port);\n\t\t\t});\n\n\t\t\tif (args.onListenCallback) {\n\t\t\t\targs.onListenCallback();\n\t\t\t}\n\t\t});\n\t}\n\n\tasync logout(): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t// Remove all Prismic cookies, short ID, and Intercom hash\n\t\t// associated with the currently logged in user.\n\t\tauthState.cookies = {};\n\t\tauthState.shortId = undefined;\n\t\tauthState.intercomHash = undefined;\n\n\t\tawait this._writePersistedAuthState(authState);\n\t}\n\n\tasync checkIsLoggedIn(): Promise<boolean> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst url = new URL(\"./validate\", API_ENDPOINTS.PrismicAuthentication);\n\t\t\turl.searchParams.set(\"token\", authState.cookies[AUTH_COOKIE_KEY]);\n\n\t\t\tlet res;\n\t\t\ttry {\n\t\t\t\tres = await fetch(url.toString(), {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t// Noop, we return if `res` is not defined.\n\t\t\t}\n\n\t\t\tif (!res || !res.ok) {\n\t\t\t\tawait this.logout();\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tasync getAuthenticationCookies(): Promise<\n\t\tPrismicAuthState[\"cookies\"] &\n\t\t\tRequired<\n\t\t\t\tPick<\n\t\t\t\t\tPrismicAuthState[\"cookies\"],\n\t\t\t\t\ttypeof AUTH_COOKIE_KEY | typeof SESSION_COOKIE_KEY\n\t\t\t\t>\n\t\t\t>\n\t> {\n\t\tconst isLoggedIn = await this.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\t\treturn authState.cookies;\n\t\t\t}\n\t\t}\n\n\t\tthrow new UnauthenticatedError();\n\t}\n\n\tasync getAuthenticationToken(): Promise<string> {\n\t\tconst cookies = await this.getAuthenticationCookies();\n\n\t\treturn cookies[AUTH_COOKIE_KEY];\n\t}\n\n\tasync refreshAuthenticationToken(): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst url = new URL(\n\t\t\t\t\"./refreshtoken\",\n\t\t\t\tAPI_ENDPOINTS.PrismicAuthentication,\n\t\t\t);\n\t\t\turl.searchParams.set(\"token\", authState.cookies[AUTH_COOKIE_KEY]);\n\n\t\t\tconst res = await fetch(url.toString(), {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst text = await res.text();\n\n\t\t\tif (res.ok) {\n\t\t\t\tauthState.cookies[AUTH_COOKIE_KEY] = text;\n\n\t\t\t\tawait this._writePersistedAuthState(authState);\n\t\t\t} else {\n\t\t\t\tthrow new InternalError(\"Failed to refresh authentication token.\", {\n\t\t\t\t\tcause: text,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new UnauthenticatedError();\n\t\t}\n\t}\n\n\tasync getProfile(): Promise<PrismicUserProfile> {\n\t\tconst authenticationToken = await this.getAuthenticationToken();\n\n\t\treturn await this._getProfileForAuthenticationToken({\n\t\t\tauthenticationToken,\n\t\t});\n\t}\n\n\tprivate async _getProfileForAuthenticationToken(\n\t\targs: GetProfileForAuthenticationTokenArgs,\n\t): Promise<PrismicUserProfile> {\n\t\tconst url = new URL(\"./profile\", API_ENDPOINTS.PrismicUser);\n\t\tconst res = await fetch(url.toString(), {\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${args.authenticationToken}`,\n\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t},\n\t\t});\n\n\t\tif (res.ok) {\n\t\t\tconst json = await res.json();\n\t\t\tconst { value: profile, error } = decode(PrismicUserProfile, json);\n\n\t\t\tif (error) {\n\t\t\t\tthrow new UnexpectedDataError(\n\t\t\t\t\t\"Received invalid data from the Prismic user service.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn profile;\n\t\t} else {\n\t\t\tconst text = await res.text();\n\t\t\tthrow new InternalError(\n\t\t\t\t\"Failed to retrieve profile from the Prismic user service.\",\n\t\t\t\t{\n\t\t\t\t\tcause: text,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate async _readPersistedAuthState(): Promise<PrismicAuthState> {\n\t\tconst authStateFilePath = this._getPersistedAuthStateFilePath();\n\n\t\tlet authStateFileContents: string = JSON.stringify({});\n\t\tlet rawAuthState: Record<string, unknown> = {};\n\n\t\ttry {\n\t\t\tauthStateFileContents = await fs.readFile(authStateFilePath, \"utf8\");\n\t\t\trawAuthState = JSON.parse(authStateFileContents);\n\t\t} catch {\n\t\t\t// Write a default persisted state if it doesn't already exist.\n\n\t\t\trawAuthState = {\n\t\t\t\t...DEFAULT_PERSISTED_AUTH_STATE,\n\t\t\t\tcookies: serializeCookies(DEFAULT_PERSISTED_AUTH_STATE.cookies),\n\t\t\t};\n\t\t\tauthStateFileContents = JSON.stringify(rawAuthState, null, \"\\t\");\n\n\t\t\tawait fs.mkdir(path.dirname(authStateFilePath), { recursive: true });\n\t\t\tawait fs.writeFile(authStateFilePath, authStateFileContents);\n\t\t}\n\n\t\t// Decode cookies into a record for convenience.\n\t\tif (typeof rawAuthState.cookies === \"string\") {\n\t\t\trawAuthState.cookies = parseCookies(rawAuthState.cookies);\n\t\t}\n\n\t\tconst { value: authState, error } = decode(PrismicAuthState, rawAuthState);\n\n\t\tif (error) {\n\t\t\tthrow new UnexpectedDataError(\"Prismic authentication state is invalid.\");\n\t\t}\n\n\t\treturn authState;\n\t}\n\n\tprivate async _writePersistedAuthState(\n\t\tauthState: PrismicAuthState,\n\t): Promise<void> {\n\t\tconst authStateFilePath = this._getPersistedAuthStateFilePath();\n\n\t\tconst preparedAuthState = {\n\t\t\t...authState,\n\t\t\tcookies: serializeCookies(authState.cookies),\n\t\t};\n\n\t\ttry {\n\t\t\tawait fs.writeFile(\n\t\t\t\tauthStateFilePath,\n\t\t\t\tJSON.stringify(preparedAuthState, null, 2),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new InternalError(\n\t\t\t\t\"Failed to write Prismic authentication state to the file system.\",\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _getPersistedAuthStateFilePath(): string {\n\t\treturn path.resolve(this.scopedDirectory, PERSISTED_AUTH_STATE_FILE_NAME);\n\t}\n}\n"],"names":["t","os","API_ENDPOINTS","getPort","h3","createPrismicAuthManagerMiddleware","http","resolve","fetch","SLICE_MACHINE_USER_AGENT","UnauthenticatedError","InternalError","decode","UnexpectedDataError","fs","serializeCookies","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAE3B,MAAM,iCAAiC;AACvC,MAAM,+BAAiD;AAAA,EACtD,MAAM;AAAA,EACN,SAAS,CAAE;;AAGZ,MAAM,mBAAmBA,aAAE,aAAa;AAAA,EACvCA,aAAE,KAAK;AAAA,IACN,MAAMA,aAAE;AAAA,IACR,SAASA,aAAE,aAAa;AAAA,MACvBA,aAAE,QAAQ;AAAA,QACT,CAAC,eAAe,GAAGA,aAAE;AAAA,QACrB,SAASA,aAAE;AAAA,MAAA,CACX;AAAA,MACDA,aAAE,OAAOA,aAAE,QAAQA,aAAE,MAAM;AAAA,IAAA,CAC3B;AAAA,EAAA,CACD;AAAA,EACDA,aAAE,QAAQ;AAAA,IACT,SAASA,aAAE;AAAA,IACX,cAAcA,aAAE;AAAA,IAChB,kBAAkBA,aAAE;AAAA,IACpB,SAASA,aAAE;AAAA,EAAA,CACX;AACD,CAAA;AAGD,MAAM,qBAAqBA,aAAE,MAC5BA,aAAE,KAAK;AAAA,EACN,QAAQA,aAAE;AAAA,EACV,SAASA,aAAE;AAAA,EACX,cAAcA,aAAE;AAAA,EAChB,OAAOA,aAAE;AAAA,EACT,WAAWA,aAAE;AAAA,EACb,UAAUA,aAAE;AACZ,CAAA,CAAC;AA2BH,MAAM,8BAA8B,CACnC,cAQG;AACI,SAAA,QACN,UAAU,QAAQ,eAAe,KAAK,UAAU,QAAQ,kBAAkB,CAAC;AAE7E;AAEA,MAAM,eAAe,CAAC,YAA2C;AACzD,SAAA,OAAO,MAAM,SAAS;AAAA;AAAA,IAE5B,QAAQ,CAAC,UAAU;AAAA,EAAA,CACnB;AACF;MAEa,mBAAkB;AAAA,EAK9B,YAAY,EACX,kBAAkBC,cAAG,cACiB,CAAA,GAAE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3,"file":"PrismicAuthManager.cjs","sources":["../../../src/auth/PrismicAuthManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport * as http from \"node:http\";\n\nimport * as h3 from \"h3\";\nimport fetch from \"../lib/fetch\";\nimport cookie from \"cookie\";\nimport cors from \"cors\";\nimport getPort from \"get-port\";\n\nimport { decode } from \"../lib/decode\";\nimport { serializeCookies } from \"../lib/serializeCookies\";\n\nimport { API_ENDPOINTS } from \"../constants/API_ENDPOINTS\";\nimport { SLICE_MACHINE_USER_AGENT } from \"../constants/SLICE_MACHINE_USER_AGENT\";\nimport { createPrismicAuthManagerMiddleware } from \"./createPrismicAuthManagerMiddleware\";\nimport {\n\tInternalError,\n\tUnauthenticatedError,\n\tUnexpectedDataError,\n} from \"../errors\";\n\nconst COOKIE_SEPARATOR = \"; \";\nconst AUTH_COOKIE_KEY = \"prismic-auth\";\nconst SESSION_COOKIE_KEY = \"SESSION\";\n\nconst PERSISTED_AUTH_STATE_FILE_NAME = \".prismic\";\nconst DEFAULT_PERSISTED_AUTH_STATE: PrismicAuthState = {\n\tbase: \"https://prismic.io\",\n\tcookies: {},\n};\n\nconst PrismicAuthState = t.intersection([\n\tt.type({\n\t\tbase: t.string,\n\t\tcookies: t.intersection([\n\t\t\tt.partial({\n\t\t\t\t[AUTH_COOKIE_KEY]: t.string,\n\t\t\t\tSESSION: t.string,\n\t\t\t}),\n\t\t\tt.record(t.string, t.string),\n\t\t]),\n\t}),\n\tt.partial({\n\t\tshortId: t.string,\n\t\tintercomHash: t.string,\n\t\toauthAccessToken: t.string,\n\t\tauthUrl: t.string,\n\t}),\n]);\nexport type PrismicAuthState = t.TypeOf<typeof PrismicAuthState>;\n\nconst PrismicUserProfile = t.exact(\n\tt.type({\n\t\tuserId: t.string,\n\t\tshortId: t.string,\n\t\tintercomHash: t.string,\n\t\temail: t.string,\n\t\tfirstName: t.string,\n\t\tlastName: t.string,\n\t}),\n);\nexport type PrismicUserProfile = t.TypeOf<typeof PrismicUserProfile>;\n\ntype PrismicAuthManagerConstructorArgs = {\n\tscopedDirectory?: string;\n};\n\ntype PrismicAuthManagerLoginArgs = {\n\temail: string;\n\tcookies: string[];\n};\n\ntype PrismicAuthManagerGetLoginSessionInfoReturnType = {\n\tport: number;\n\turl: string;\n};\n\ntype PrismicAuthManagerNodeLoginSessionArgs = {\n\tport: number;\n\tonListenCallback?: () => void;\n};\n\ntype GetProfileForAuthenticationTokenArgs = {\n\tauthenticationToken: string;\n};\n\nconst checkHasAuthenticationToken = (\n\tauthState: PrismicAuthState,\n): authState is PrismicAuthState & {\n\tcookies: Required<\n\t\tPick<\n\t\t\tPrismicAuthState[\"cookies\"],\n\t\t\ttypeof AUTH_COOKIE_KEY | typeof SESSION_COOKIE_KEY\n\t\t>\n\t>;\n} => {\n\treturn Boolean(\n\t\tauthState.cookies[AUTH_COOKIE_KEY] && authState.cookies[SESSION_COOKIE_KEY],\n\t);\n};\n\nconst parseCookies = (cookies: string): Record<string, string> => {\n\treturn cookie.parse(cookies, {\n\t\t// Don't escape any values.\n\t\tdecode: (value) => value,\n\t});\n};\n\nexport class PrismicAuthManager {\n\t// TODO: Automatically scope the manager to the current Slice Machine\n\t// project? If not, this internal state can be removed.\n\tscopedDirectory: string;\n\n\tconstructor({\n\t\tscopedDirectory = os.homedir(),\n\t}: PrismicAuthManagerConstructorArgs = {}) {\n\t\tthis.scopedDirectory = scopedDirectory;\n\t}\n\n\t// TODO: Make the `cookies` argument more explicit. What are these\n\t// mysterious cookies?\n\tasync login(args: PrismicAuthManagerLoginArgs): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t// Set the auth's URL base to the current base at runtime.\n\t\tauthState.base = API_ENDPOINTS.PrismicWroom;\n\t\tauthState.cookies = {\n\t\t\t...authState.cookies,\n\t\t\t...parseCookies(args.cookies.join(COOKIE_SEPARATOR)),\n\t\t};\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst authenticationToken = authState.cookies[AUTH_COOKIE_KEY];\n\t\t\tconst profile = await this._getProfileForAuthenticationToken({\n\t\t\t\tauthenticationToken,\n\t\t\t});\n\n\t\t\tauthState.shortId = profile.shortId;\n\t\t\tauthState.intercomHash = profile.intercomHash;\n\t\t}\n\n\t\tawait this._writePersistedAuthState(authState);\n\t}\n\n\tasync getLoginSessionInfo(): Promise<PrismicAuthManagerGetLoginSessionInfoReturnType> {\n\t\t// Pick a random port, with a preference for historic `5555`\n\t\tconst port = await getPort({ port: 5555 });\n\n\t\tconst url = new URL(\n\t\t\t`./dashboard/cli/login?source=slice-machine&port=${port}`,\n\t\t\tAPI_ENDPOINTS.PrismicWroom,\n\t\t).toString();\n\n\t\treturn {\n\t\t\tport,\n\t\t\turl,\n\t\t};\n\t}\n\n\tasync nodeLoginSession(\n\t\targs: PrismicAuthManagerNodeLoginSessionArgs,\n\t): Promise<void> {\n\t\treturn new Promise<void>(async (resolve) => {\n\t\t\t// Timeout attempt after 3 minutes\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tserver.close();\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Login timeout, server did not receive a response within a 3-minute delay\",\n\t\t\t\t);\n\t\t\t}, 180_000);\n\n\t\t\tconst app = h3.createApp();\n\t\t\tapp.use(h3.fromNodeMiddleware(cors()));\n\t\t\tapp.use(\n\t\t\t\th3.fromNodeMiddleware(\n\t\t\t\t\tcreatePrismicAuthManagerMiddleware({\n\t\t\t\t\t\tprismicAuthManager: this,\n\t\t\t\t\t\tonLoginCallback() {\n\t\t\t\t\t\t\t// Cleanup process and resolve\n\t\t\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\t\t\tserver.close();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\t// Start server\n\t\t\tconst server = http.createServer(h3.toNodeListener(app));\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tserver.once(\"listening\", () => {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tserver.listen(args.port, \"127.0.0.1\");\n\t\t\t});\n\n\t\t\tif (args.onListenCallback) {\n\t\t\t\targs.onListenCallback();\n\t\t\t}\n\t\t});\n\t}\n\n\tasync logout(): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t// Remove all Prismic cookies, short ID, and Intercom hash\n\t\t// associated with the currently logged in user.\n\t\tauthState.cookies = {};\n\t\tauthState.shortId = undefined;\n\t\tauthState.intercomHash = undefined;\n\n\t\tawait this._writePersistedAuthState(authState);\n\t}\n\n\tasync checkIsLoggedIn(): Promise<boolean> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst url = new URL(\"./validate\", API_ENDPOINTS.PrismicAuthentication);\n\t\t\turl.searchParams.set(\"token\", authState.cookies[AUTH_COOKIE_KEY]);\n\n\t\t\tlet res;\n\t\t\ttry {\n\t\t\t\tres = await fetch(url.toString(), {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t// Noop, we return if `res` is not defined.\n\t\t\t}\n\n\t\t\tif (!res || !res.ok) {\n\t\t\t\tawait this.logout();\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tasync getAuthenticationCookies(): Promise<\n\t\tPrismicAuthState[\"cookies\"] &\n\t\t\tRequired<\n\t\t\t\tPick<\n\t\t\t\t\tPrismicAuthState[\"cookies\"],\n\t\t\t\t\ttypeof AUTH_COOKIE_KEY | typeof SESSION_COOKIE_KEY\n\t\t\t\t>\n\t\t\t>\n\t> {\n\t\tconst isLoggedIn = await this.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\tconst authState = await this._readPersistedAuthState();\n\n\t\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\t\treturn authState.cookies;\n\t\t\t}\n\t\t}\n\n\t\tthrow new UnauthenticatedError();\n\t}\n\n\tasync getAuthenticationToken(): Promise<string> {\n\t\tconst cookies = await this.getAuthenticationCookies();\n\n\t\treturn cookies[AUTH_COOKIE_KEY];\n\t}\n\n\tasync refreshAuthenticationToken(): Promise<void> {\n\t\tconst authState = await this._readPersistedAuthState();\n\n\t\tif (checkHasAuthenticationToken(authState)) {\n\t\t\tconst url = new URL(\n\t\t\t\t\"./refreshtoken\",\n\t\t\t\tAPI_ENDPOINTS.PrismicAuthentication,\n\t\t\t);\n\t\t\turl.searchParams.set(\"token\", authState.cookies[AUTH_COOKIE_KEY]);\n\n\t\t\tconst res = await fetch(url.toString(), {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst text = await res.text();\n\n\t\t\tif (res.ok) {\n\t\t\t\tauthState.cookies[AUTH_COOKIE_KEY] = text;\n\n\t\t\t\tawait this._writePersistedAuthState(authState);\n\t\t\t} else {\n\t\t\t\tthrow new InternalError(\"Failed to refresh authentication token.\", {\n\t\t\t\t\tcause: text,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new UnauthenticatedError();\n\t\t}\n\t}\n\n\tasync getProfile(): Promise<PrismicUserProfile> {\n\t\tconst authenticationToken = await this.getAuthenticationToken();\n\n\t\treturn await this._getProfileForAuthenticationToken({\n\t\t\tauthenticationToken,\n\t\t});\n\t}\n\n\tprivate async _getProfileForAuthenticationToken(\n\t\targs: GetProfileForAuthenticationTokenArgs,\n\t): Promise<PrismicUserProfile> {\n\t\tconst url = new URL(\"./profile\", API_ENDPOINTS.PrismicUser);\n\t\tconst res = await fetch(url.toString(), {\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${args.authenticationToken}`,\n\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t},\n\t\t});\n\n\t\tif (res.ok) {\n\t\t\tconst json = await res.json();\n\t\t\tconst { value: profile, error } = decode(PrismicUserProfile, json);\n\n\t\t\tif (error) {\n\t\t\t\tthrow new UnexpectedDataError(\n\t\t\t\t\t\"Received invalid data from the Prismic user service.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn profile;\n\t\t} else {\n\t\t\tconst text = await res.text();\n\t\t\tthrow new InternalError(\n\t\t\t\t\"Failed to retrieve profile from the Prismic user service.\",\n\t\t\t\t{\n\t\t\t\t\tcause: text,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate async _readPersistedAuthState(): Promise<PrismicAuthState> {\n\t\tconst authStateFilePath = this._getPersistedAuthStateFilePath();\n\n\t\tlet authStateFileContents: string = JSON.stringify({});\n\t\tlet rawAuthState: Record<string, unknown> = {};\n\n\t\ttry {\n\t\t\tauthStateFileContents = await fs.readFile(authStateFilePath, \"utf8\");\n\t\t\trawAuthState = JSON.parse(authStateFileContents);\n\t\t} catch {\n\t\t\t// Write a default persisted state if it doesn't already exist.\n\n\t\t\trawAuthState = {\n\t\t\t\t...DEFAULT_PERSISTED_AUTH_STATE,\n\t\t\t\tcookies: serializeCookies(DEFAULT_PERSISTED_AUTH_STATE.cookies),\n\t\t\t};\n\t\t\tauthStateFileContents = JSON.stringify(rawAuthState, null, \"\\t\");\n\n\t\t\tawait fs.mkdir(path.dirname(authStateFilePath), { recursive: true });\n\t\t\tawait fs.writeFile(authStateFilePath, authStateFileContents);\n\t\t}\n\n\t\t// Decode cookies into a record for convenience.\n\t\tif (typeof rawAuthState.cookies === \"string\") {\n\t\t\trawAuthState.cookies = parseCookies(rawAuthState.cookies);\n\t\t}\n\n\t\tconst { value: authState, error } = decode(PrismicAuthState, rawAuthState);\n\n\t\tif (error) {\n\t\t\tthrow new UnexpectedDataError(\"Prismic authentication state is invalid.\");\n\t\t}\n\n\t\treturn authState;\n\t}\n\n\tprivate async _writePersistedAuthState(\n\t\tauthState: PrismicAuthState,\n\t): Promise<void> {\n\t\tconst authStateFilePath = this._getPersistedAuthStateFilePath();\n\n\t\tconst preparedAuthState = {\n\t\t\t...authState,\n\t\t\tcookies: serializeCookies(authState.cookies),\n\t\t};\n\n\t\ttry {\n\t\t\tawait fs.writeFile(\n\t\t\t\tauthStateFilePath,\n\t\t\t\tJSON.stringify(preparedAuthState, null, 2),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new InternalError(\n\t\t\t\t\"Failed to write Prismic authentication state to the file system.\",\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _getPersistedAuthStateFilePath(): string {\n\t\treturn path.resolve(this.scopedDirectory, PERSISTED_AUTH_STATE_FILE_NAME);\n\t}\n}\n"],"names":["t","os","API_ENDPOINTS","getPort","h3","createPrismicAuthManagerMiddleware","http","resolve","fetch","SLICE_MACHINE_USER_AGENT","UnauthenticatedError","InternalError","decode","UnexpectedDataError","fs","serializeCookies","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAE3B,MAAM,iCAAiC;AACvC,MAAM,+BAAiD;AAAA,EACtD,MAAM;AAAA,EACN,SAAS,CAAE;;AAGZ,MAAM,mBAAmBA,aAAE,aAAa;AAAA,EACvCA,aAAE,KAAK;AAAA,IACN,MAAMA,aAAE;AAAA,IACR,SAASA,aAAE,aAAa;AAAA,MACvBA,aAAE,QAAQ;AAAA,QACT,CAAC,eAAe,GAAGA,aAAE;AAAA,QACrB,SAASA,aAAE;AAAA,MAAA,CACX;AAAA,MACDA,aAAE,OAAOA,aAAE,QAAQA,aAAE,MAAM;AAAA,IAAA,CAC3B;AAAA,EAAA,CACD;AAAA,EACDA,aAAE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ChC,mBAAA,UAAU,aAAa,aAAa,OAAO;AAAA,IACzD;AAEA,UAAM,EAAE,OAAO,WAAW,MAAU,IAAAF,cAAO,kBAAkB,YAAY;AAEzE,QAAI,OAAO;AACJ,YAAA,IAAIC,OAAAA,oBAAoB,0CAA0C;AAAA,IACzE;AAEO,WAAA;AAAA,EACR;AAAA,EAEQ,MAAM,yBACb,WAA2B;AAErB,UAAA,oBAAoB,KAAK;AAE/B,UAAM,oBAAoB;AAAA,MACzB,GAAG;AAAA,MACH,SAASE,iBAAAA,iBAAiB,UAAU,OAAO;AAAA,IAAA;AAGxC,QAAA;AACG,YAAAD,cAAG,UACR,mBACA,KAAK,UAAU,mBAAmB,MAAM,CAAC,CAAC;AAAA,aAEnC,OAAO;AACT,YAAA,IAAIH,qBACT,oEACA;AAAA,QACC,OAAO;AAAA,MAAA,CACP;AAAA,IAEH;AAAA,EACD;AAAA,EAEQ,iCAA8B;AACrC,WAAOK,gBAAK,QAAQ,KAAK,iBAAiB,8BAA8B;AAAA,EACzE;AACA;;"}
@@ -118,7 +118,7 @@ class PrismicAuthManager {
118
118
  server.once("listening", () => {
119
119
  resolve2();
120
120
  });
121
- server.listen(args.port);
121
+ server.listen(args.port, "127.0.0.1");
122
122
  });
123
123
  if (args.onListenCallback) {
124
124
  args.onListenCallback();