@shopify/create-app 3.94.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-XLT3JDGP.js +33 -0
- package/dist/analytics-XUVDQAYG.js +39 -0
- package/dist/chunk-37G3KLO2.js +78 -0
- package/dist/chunk-4CS37CS5.js +665 -0
- package/dist/chunk-6OOTYTVB.js +1133 -0
- package/dist/{chunk-NIYBO6HO.js → chunk-ACS6S42W.js} +3 -3
- package/dist/chunk-ANIFE3UR.js +12 -0
- package/dist/{chunk-2ZQ4JUYQ.js → chunk-DHAC6KEL.js} +47 -12
- package/dist/chunk-DJW2W7VA.js +21 -0
- package/dist/chunk-DNF3EUMN.js +1771 -0
- package/dist/{chunk-LI75HRH4.js → chunk-DWGHKWV5.js} +1 -1
- package/dist/chunk-IGDZPTDH.js +371 -0
- package/dist/chunk-JCETIRLI.js +30 -0
- package/dist/chunk-JUV7D377.js +264 -0
- package/dist/{chunk-QCVAV5PM.js → chunk-LNOZTAML.js} +3618 -10143
- package/dist/{chunk-IFG7N3S2.js → chunk-OO33NRTL.js} +8 -12671
- package/dist/chunk-PES3XMQM.js +70 -0
- package/dist/chunk-QMXFPY46.js +55 -0
- package/dist/chunk-QN5KFM2B.js +104 -0
- package/dist/{chunk-XDAJMLCV.js → chunk-STHW3YIX.js} +43773 -43784
- package/dist/chunk-UMSYG5WJ.js +110 -0
- package/dist/chunk-UX6FRPFM.js +11555 -0
- package/dist/{chunk-CXPWSYGC.js → chunk-X2WZCKNE.js} +4 -14
- package/dist/chunk-YIHECXVH.js +5652 -0
- package/dist/chunk-YUPQUA3D.js +6106 -0
- package/dist/conf-store-RAVX2WFV.js +54 -0
- package/dist/custom-oclif-loader-354VAVF4.js +54 -0
- package/dist/deprecations-2QTB3736.js +55 -0
- package/dist/environments-LTWWRWCC.js +26 -0
- package/dist/error-handler-KHJE653Z.js +37 -0
- package/dist/fs-XENRLBMU.js +109 -0
- package/dist/hooks/postrun.js +6 -9
- package/dist/hooks/prerun.js +12 -25
- package/dist/{http-proxy-node16-U5VBDLS3.js → http-proxy-node16-XB2DSBCB.js} +3 -2
- package/dist/index.js +8987 -10518
- package/dist/is-global-KZMSAFQT.js +21 -0
- package/dist/latest-version-3PFKLJZM.js +7713 -0
- package/dist/lib-HWIFANCM.js +11 -0
- package/dist/{local-HD6YAL26.js → local-NQALOHJX.js} +3 -8
- package/dist/metadata-FXCUDE5I.js +20 -0
- package/dist/{node-package-manager-FD3ZCHSY.js → node-package-manager-7R7HDW4R.js} +17 -7
- package/dist/notifications-system-7QMDSL5Y.js +40 -0
- package/dist/output-PQSQ7U45.js +51 -0
- package/dist/{path-NQ6GZ2WO.js → path-EOPO7QNL.js} +2 -2
- package/dist/{prettier-67WYXU6J.js → prettier-UAG5TKE4.js} +2 -2
- package/dist/system-W4MMMHEV.js +47 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typescript-TKTDYKKG.js +6 -0
- package/dist/{ui-TJ7NU25P.js → ui-2FROV2IT.js} +15 -6
- package/dist/{chunk-Q2E5NGP3.js → upgrade-FAUZ7VAF.js} +77 -125
- package/dist/version-HKPHVW5M.js +30 -0
- package/dist/version-T73ZLUJK.js +8 -0
- package/oclif.manifest.json +63 -66
- package/package.json +5 -5
- package/dist/chunk-27ZXSSGX.js +0 -14117
- package/dist/error-handler-ZQMQHJ3W.js +0 -25
- package/dist/lib-PPI2FZOR.js +0 -8
|
@@ -13859,4 +13859,4 @@ export {
|
|
|
13859
13859
|
debugApis,
|
|
13860
13860
|
init_prettier
|
|
13861
13861
|
};
|
|
13862
|
-
//# sourceMappingURL=chunk-
|
|
13862
|
+
//# sourceMappingURL=chunk-DWGHKWV5.js.map
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cacheRetrieve,
|
|
3
|
+
cacheRetrieveOrRepopulate
|
|
4
|
+
} from "./chunk-YUPQUA3D.js";
|
|
5
|
+
import {
|
|
6
|
+
AbortController,
|
|
7
|
+
exec
|
|
8
|
+
} from "./chunk-YIHECXVH.js";
|
|
9
|
+
import {
|
|
10
|
+
runWithTimer
|
|
11
|
+
} from "./chunk-37G3KLO2.js";
|
|
12
|
+
import {
|
|
13
|
+
AbortError,
|
|
14
|
+
BugError
|
|
15
|
+
} from "./chunk-JUV7D377.js";
|
|
16
|
+
import {
|
|
17
|
+
require_semver
|
|
18
|
+
} from "./chunk-6OOTYTVB.js";
|
|
19
|
+
import {
|
|
20
|
+
fileExists,
|
|
21
|
+
fileExistsSync,
|
|
22
|
+
findPathUp,
|
|
23
|
+
glob,
|
|
24
|
+
inferPackageManagerForGlobalCLI,
|
|
25
|
+
outputContent,
|
|
26
|
+
outputDebug,
|
|
27
|
+
outputToken,
|
|
28
|
+
readFile,
|
|
29
|
+
writeFile
|
|
30
|
+
} from "./chunk-LNOZTAML.js";
|
|
31
|
+
import {
|
|
32
|
+
dirname,
|
|
33
|
+
joinPath
|
|
34
|
+
} from "./chunk-ACS6S42W.js";
|
|
35
|
+
import {
|
|
36
|
+
__toESM,
|
|
37
|
+
init_cjs_shims
|
|
38
|
+
} from "./chunk-PKR7KJ6P.js";
|
|
39
|
+
|
|
40
|
+
// ../cli-kit/dist/public/node/node-package-manager.js
|
|
41
|
+
init_cjs_shims();
|
|
42
|
+
|
|
43
|
+
// ../cli-kit/dist/public/common/json.js
|
|
44
|
+
init_cjs_shims();
|
|
45
|
+
function parseJSON(jsonString, context) {
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(jsonString);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
let errorMessage = error instanceof Error ? error.message : String(error), contextMessage = context ? ` from ${context}` : "";
|
|
50
|
+
throw new AbortError(`Failed to parse JSON${contextMessage}.
|
|
51
|
+
${errorMessage}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ../cli-kit/dist/public/node/node-package-manager.js
|
|
56
|
+
var import_semver = __toESM(require_semver(), 1), yarnLockfile = "yarn.lock", npmLockfile = "package-lock.json", pnpmLockfile = "pnpm-lock.yaml", bunLockfile = "bun.lockb", modernBunLockfile = "bun.lock", pnpmWorkspaceFile = "pnpm-workspace.yaml", lockfiles = [yarnLockfile, pnpmLockfile, npmLockfile, bunLockfile, modernBunLockfile], lockfilesByManager = {
|
|
57
|
+
yarn: [yarnLockfile],
|
|
58
|
+
npm: [npmLockfile],
|
|
59
|
+
pnpm: [pnpmLockfile],
|
|
60
|
+
bun: [bunLockfile, modernBunLockfile],
|
|
61
|
+
homebrew: [],
|
|
62
|
+
unknown: []
|
|
63
|
+
}, packageManager = ["yarn", "npm", "pnpm", "bun", "homebrew", "unknown"], UnknownPackageManagerError = class extends AbortError {
|
|
64
|
+
constructor() {
|
|
65
|
+
super("Unknown package manager");
|
|
66
|
+
}
|
|
67
|
+
}, PackageJsonNotFoundError = class extends AbortError {
|
|
68
|
+
constructor(directory) {
|
|
69
|
+
super(outputContent`The directory ${outputToken.path(directory)} doesn't have a package.json.`);
|
|
70
|
+
}
|
|
71
|
+
}, FindUpAndReadPackageJsonNotFoundError = class extends BugError {
|
|
72
|
+
constructor(directory) {
|
|
73
|
+
super(outputContent`Couldn't find a a package.json traversing directories from ${outputToken.path(directory)}`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
function packageManagerFromUserAgent(env = process.env) {
|
|
77
|
+
return env.npm_config_user_agent?.includes("yarn") ? "yarn" : env.npm_config_user_agent?.includes("pnpm") ? "pnpm" : env.npm_config_user_agent?.includes("bun") ? "bun" : env.npm_config_user_agent?.includes("npm") ? "npm" : "unknown";
|
|
78
|
+
}
|
|
79
|
+
function hasBunLockfileSync(directory) {
|
|
80
|
+
return fileExistsSync(joinPath(directory, bunLockfile)) || fileExistsSync(joinPath(directory, modernBunLockfile));
|
|
81
|
+
}
|
|
82
|
+
function normalizePackageManagerForProject(packageManager2) {
|
|
83
|
+
switch (packageManager2) {
|
|
84
|
+
case "yarn":
|
|
85
|
+
case "npm":
|
|
86
|
+
case "pnpm":
|
|
87
|
+
case "bun":
|
|
88
|
+
return packageManager2;
|
|
89
|
+
case "homebrew":
|
|
90
|
+
case "unknown":
|
|
91
|
+
return "npm";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function packageManagerBinaryCommand(packageManager2, binary, ...binaryArgs) {
|
|
95
|
+
switch (packageManager2) {
|
|
96
|
+
case "npm":
|
|
97
|
+
return { command: "npm", args: ["exec", "--", binary, ...binaryArgs] };
|
|
98
|
+
case "pnpm":
|
|
99
|
+
return { command: "pnpm", args: ["exec", binary, ...binaryArgs] };
|
|
100
|
+
case "yarn":
|
|
101
|
+
return { command: "yarn", args: ["run", binary, ...binaryArgs] };
|
|
102
|
+
case "bun":
|
|
103
|
+
return { command: "bun", args: ["x", binary, ...binaryArgs] };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function getPackageManager(fromDirectory) {
|
|
107
|
+
let current = fromDirectory;
|
|
108
|
+
for (outputDebug(outputContent`Looking for a lockfile in ${outputToken.path(current)}...`); ; ) {
|
|
109
|
+
if (fileExistsSync(joinPath(current, yarnLockfile)))
|
|
110
|
+
return "yarn";
|
|
111
|
+
if (fileExistsSync(joinPath(current, pnpmLockfile)) || fileExistsSync(joinPath(current, pnpmWorkspaceFile)))
|
|
112
|
+
return "pnpm";
|
|
113
|
+
if (hasBunLockfileSync(current))
|
|
114
|
+
return "bun";
|
|
115
|
+
if (fileExistsSync(joinPath(current, npmLockfile)))
|
|
116
|
+
return "npm";
|
|
117
|
+
let parent = dirname(current);
|
|
118
|
+
if (parent === current)
|
|
119
|
+
break;
|
|
120
|
+
current = parent;
|
|
121
|
+
}
|
|
122
|
+
let pm = packageManagerFromUserAgent();
|
|
123
|
+
return pm !== "unknown" ? pm : "npm";
|
|
124
|
+
}
|
|
125
|
+
async function packageManagerBinaryCommandForDirectory(fromDirectory, binary, ...binaryArgs) {
|
|
126
|
+
let packageManager2 = normalizePackageManagerForProject(await getPackageManager(fromDirectory));
|
|
127
|
+
return packageManagerBinaryCommand(packageManager2, binary, ...binaryArgs);
|
|
128
|
+
}
|
|
129
|
+
async function installNPMDependenciesRecursively(options) {
|
|
130
|
+
let packageJsons = await glob(joinPath(options.directory, "**/package.json"), {
|
|
131
|
+
ignore: [joinPath(options.directory, "node_modules/**/package.json")],
|
|
132
|
+
cwd: options.directory,
|
|
133
|
+
onlyFiles: !0,
|
|
134
|
+
deep: options.deep
|
|
135
|
+
}), abortController = new AbortController();
|
|
136
|
+
try {
|
|
137
|
+
await Promise.all(packageJsons.map(async (packageJsonPath) => {
|
|
138
|
+
let directory = dirname(packageJsonPath);
|
|
139
|
+
await installNodeModules({
|
|
140
|
+
directory,
|
|
141
|
+
packageManager: options.packageManager,
|
|
142
|
+
stdout: void 0,
|
|
143
|
+
stderr: void 0,
|
|
144
|
+
signal: abortController.signal,
|
|
145
|
+
args: []
|
|
146
|
+
});
|
|
147
|
+
}));
|
|
148
|
+
} catch (error) {
|
|
149
|
+
throw abortController.abort(), error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function installNodeModules(options) {
|
|
153
|
+
let execOptions = {
|
|
154
|
+
cwd: options.directory,
|
|
155
|
+
stdin: void 0,
|
|
156
|
+
stdout: options.stdout,
|
|
157
|
+
stderr: options.stderr,
|
|
158
|
+
signal: options.signal
|
|
159
|
+
}, args = ["install"];
|
|
160
|
+
options.args && (args = args.concat(options.args)), await runWithTimer("cmd_all_timing_network_ms")(async () => {
|
|
161
|
+
await exec(options.packageManager, args, execOptions);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
async function getPackageName(packageJsonPath) {
|
|
165
|
+
return (await readAndParsePackageJson(packageJsonPath)).name;
|
|
166
|
+
}
|
|
167
|
+
async function getPackageVersion(packageJsonPath) {
|
|
168
|
+
return (await readAndParsePackageJson(packageJsonPath)).version;
|
|
169
|
+
}
|
|
170
|
+
async function getDependencies(packageJsonPath) {
|
|
171
|
+
let packageJsonContent = await readAndParsePackageJson(packageJsonPath), dependencies = packageJsonContent.dependencies ?? {}, devDependencies = packageJsonContent.devDependencies ?? {};
|
|
172
|
+
return { ...dependencies, ...devDependencies };
|
|
173
|
+
}
|
|
174
|
+
async function usesWorkspaces(appDirectory) {
|
|
175
|
+
let packageJsonPath = joinPath(appDirectory, "package.json"), packageJsonContent = await readAndParsePackageJson(packageJsonPath), pnpmWorkspacePath = joinPath(appDirectory, pnpmWorkspaceFile);
|
|
176
|
+
return !!packageJsonContent.workspaces || fileExists(pnpmWorkspacePath);
|
|
177
|
+
}
|
|
178
|
+
async function checkForNewVersion(dependency, currentVersion, { cacheExpiryInHours = 0 } = {}) {
|
|
179
|
+
let getLatestVersion = async () => (outputDebug(outputContent`Checking if there's a version of ${dependency} newer than ${currentVersion}`), getLatestNPMPackageVersion(dependency)), cacheKey = `npm-package-${dependency}`, lastVersion;
|
|
180
|
+
try {
|
|
181
|
+
lastVersion = await cacheRetrieveOrRepopulate(cacheKey, getLatestVersion, cacheExpiryInHours * 3600 * 1e3);
|
|
182
|
+
} catch {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (lastVersion && new import_semver.SemVer(currentVersion).compare(lastVersion) < 0)
|
|
186
|
+
return lastVersion;
|
|
187
|
+
}
|
|
188
|
+
function checkForCachedNewVersion(dependency, currentVersion) {
|
|
189
|
+
let cacheKey = `npm-package-${dependency}`, lastVersion = cacheRetrieve(cacheKey)?.value;
|
|
190
|
+
if (lastVersion && new import_semver.SemVer(currentVersion).compare(lastVersion) < 0)
|
|
191
|
+
return lastVersion;
|
|
192
|
+
}
|
|
193
|
+
function versionSatisfies(version, requirements) {
|
|
194
|
+
return (0, import_semver.satisfies)(version, requirements);
|
|
195
|
+
}
|
|
196
|
+
async function readAndParsePackageJson(packageJsonPath) {
|
|
197
|
+
if (!await fileExists(packageJsonPath))
|
|
198
|
+
throw new PackageJsonNotFoundError(dirname(packageJsonPath));
|
|
199
|
+
return parseJSON(await readFile(packageJsonPath), packageJsonPath);
|
|
200
|
+
}
|
|
201
|
+
async function addNPMDependenciesIfNeeded(dependencies, options) {
|
|
202
|
+
outputDebug(outputContent`Adding the following dependencies if needed:
|
|
203
|
+
${outputToken.json(dependencies)}
|
|
204
|
+
With options:
|
|
205
|
+
${outputToken.json(options)}
|
|
206
|
+
`);
|
|
207
|
+
let packageJsonPath = joinPath(options.directory, "package.json");
|
|
208
|
+
if (!await fileExists(packageJsonPath))
|
|
209
|
+
throw new PackageJsonNotFoundError(options.directory);
|
|
210
|
+
let existingDependencies = Object.keys(await getDependencies(packageJsonPath)), dependenciesToAdd = dependencies.filter((dep) => !existingDependencies.includes(dep.name));
|
|
211
|
+
dependenciesToAdd.length !== 0 && await addNPMDependencies(dependenciesToAdd, options);
|
|
212
|
+
}
|
|
213
|
+
async function addNPMDependencies(dependencies, options) {
|
|
214
|
+
let dependenciesWithVersion = dependencies.map((dep) => dep.version ? `${dep.name}@${dep.version}` : dep.name);
|
|
215
|
+
switch (options.stdout?.write(`Installing ${dependenciesWithVersion.join(" ")} with ${options.packageManager}`), options.packageManager) {
|
|
216
|
+
case "npm":
|
|
217
|
+
for (let dep of dependenciesWithVersion)
|
|
218
|
+
await installDependencies(options, argumentsToAddDependenciesWithNPM(dep, options.type));
|
|
219
|
+
break;
|
|
220
|
+
case "yarn":
|
|
221
|
+
await installDependencies(options, argumentsToAddDependenciesWithYarn(dependenciesWithVersion, options.type, !!options.addToRootDirectory));
|
|
222
|
+
break;
|
|
223
|
+
case "pnpm":
|
|
224
|
+
await installDependencies(options, argumentsToAddDependenciesWithPNPM(dependenciesWithVersion, options.type, !!options.addToRootDirectory));
|
|
225
|
+
break;
|
|
226
|
+
case "bun":
|
|
227
|
+
await installDependencies(options, argumentsToAddDependenciesWithBun(dependenciesWithVersion, options.type)), await installDependencies(options, ["install"]);
|
|
228
|
+
break;
|
|
229
|
+
case "homebrew":
|
|
230
|
+
throw new AbortError("Homebrew can't be used to install project dependencies. Use npm, yarn, pnpm, or bun.");
|
|
231
|
+
case "unknown":
|
|
232
|
+
throw new UnknownPackageManagerError();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async function installDependencies(options, args) {
|
|
236
|
+
return runWithTimer("cmd_all_timing_network_ms")(async () => exec(options.packageManager, args, {
|
|
237
|
+
cwd: options.directory,
|
|
238
|
+
stdout: options.stdout,
|
|
239
|
+
stderr: options.stderr,
|
|
240
|
+
signal: options.signal
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
async function addNPMDependenciesWithoutVersionIfNeeded(dependencies, options) {
|
|
244
|
+
await addNPMDependenciesIfNeeded(dependencies.map((dependency) => ({ name: dependency, version: void 0 })), options);
|
|
245
|
+
}
|
|
246
|
+
function argumentsToAddDependenciesWithNPM(dependency, type) {
|
|
247
|
+
let command = ["install"];
|
|
248
|
+
switch (command = command.concat(dependency), type) {
|
|
249
|
+
case "dev":
|
|
250
|
+
command.push("--save-dev");
|
|
251
|
+
break;
|
|
252
|
+
case "peer":
|
|
253
|
+
command.push("--save-peer");
|
|
254
|
+
break;
|
|
255
|
+
case "prod":
|
|
256
|
+
command.push("--save-prod");
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
return dependency.match(/@\d/g) && command.push("--save-exact"), command;
|
|
260
|
+
}
|
|
261
|
+
function argumentsToAddDependenciesWithYarn(dependencies, type, addAtRoot = !1) {
|
|
262
|
+
let command = ["add"];
|
|
263
|
+
switch (addAtRoot && command.push("-W"), command = command.concat(dependencies), type) {
|
|
264
|
+
case "dev":
|
|
265
|
+
command.push("--dev");
|
|
266
|
+
break;
|
|
267
|
+
case "peer":
|
|
268
|
+
command.push("--peer");
|
|
269
|
+
break;
|
|
270
|
+
case "prod":
|
|
271
|
+
command.push("--prod");
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
return command;
|
|
275
|
+
}
|
|
276
|
+
function argumentsToAddDependenciesWithPNPM(dependencies, type, addAtRoot = !1) {
|
|
277
|
+
let command = ["add"];
|
|
278
|
+
switch (addAtRoot && command.push("-w"), command = command.concat(dependencies), type) {
|
|
279
|
+
case "dev":
|
|
280
|
+
command.push("--save-dev");
|
|
281
|
+
break;
|
|
282
|
+
case "peer":
|
|
283
|
+
command.push("--save-peer");
|
|
284
|
+
break;
|
|
285
|
+
case "prod":
|
|
286
|
+
command.push("--save-prod");
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
return command;
|
|
290
|
+
}
|
|
291
|
+
function argumentsToAddDependenciesWithBun(dependencies, type) {
|
|
292
|
+
let command = ["add"];
|
|
293
|
+
switch (command = command.concat(dependencies), type) {
|
|
294
|
+
case "dev":
|
|
295
|
+
command.push("--development");
|
|
296
|
+
break;
|
|
297
|
+
case "peer":
|
|
298
|
+
command.push("--optional");
|
|
299
|
+
break;
|
|
300
|
+
case "prod":
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
return command;
|
|
304
|
+
}
|
|
305
|
+
async function findUpAndReadPackageJson(fromDirectory) {
|
|
306
|
+
let packageJsonPath = await findPathUp("package.json", { cwd: fromDirectory, type: "file" });
|
|
307
|
+
if (packageJsonPath) {
|
|
308
|
+
let packageJson = parseJSON(await readFile(packageJsonPath), packageJsonPath);
|
|
309
|
+
return { path: packageJsonPath, content: packageJson };
|
|
310
|
+
} else
|
|
311
|
+
throw new FindUpAndReadPackageJsonNotFoundError(fromDirectory);
|
|
312
|
+
}
|
|
313
|
+
async function addResolutionOrOverride(directory, dependencies) {
|
|
314
|
+
let packageManager2 = await getPackageManager(directory), packageJsonPath = joinPath(directory, "package.json"), packageJsonContent = await readAndParsePackageJson(packageJsonPath);
|
|
315
|
+
packageManager2 === "yarn" && (packageJsonContent.resolutions = packageJsonContent.resolutions ? { ...packageJsonContent.resolutions, ...dependencies } : dependencies), (packageManager2 === "npm" || packageManager2 === "pnpm" || packageManager2 === "bun") && (packageJsonContent.overrides = packageJsonContent.overrides ? { ...packageJsonContent.overrides, ...dependencies } : dependencies), await writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
|
|
316
|
+
}
|
|
317
|
+
async function getLatestNPMPackageVersion(name) {
|
|
318
|
+
return outputDebug(outputContent`Getting the latest version of NPM package: ${outputToken.raw(name)}`), runWithTimer("cmd_all_timing_network_ms")(async () => {
|
|
319
|
+
let { default: latestVersion } = await import("./latest-version-3PFKLJZM.js");
|
|
320
|
+
return latestVersion(name);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async function writePackageJSON(directory, packageJSON) {
|
|
324
|
+
outputDebug(outputContent`JSON-encoding and writing content to package.json at ${outputToken.path(directory)}...`);
|
|
325
|
+
let packagePath = joinPath(directory, "package.json");
|
|
326
|
+
await writeFile(packagePath, JSON.stringify(packageJSON, null, 2));
|
|
327
|
+
}
|
|
328
|
+
function inferPackageManager(optionsPackageManager, env = process.env) {
|
|
329
|
+
if (optionsPackageManager && packageManager.includes(optionsPackageManager))
|
|
330
|
+
return optionsPackageManager;
|
|
331
|
+
let usedPackageManager = packageManagerFromUserAgent(env);
|
|
332
|
+
if (usedPackageManager !== "unknown")
|
|
333
|
+
return usedPackageManager;
|
|
334
|
+
let globalPackageManager = inferPackageManagerForGlobalCLI();
|
|
335
|
+
return globalPackageManager !== "unknown" ? globalPackageManager : "npm";
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export {
|
|
339
|
+
yarnLockfile,
|
|
340
|
+
npmLockfile,
|
|
341
|
+
pnpmLockfile,
|
|
342
|
+
bunLockfile,
|
|
343
|
+
pnpmWorkspaceFile,
|
|
344
|
+
lockfiles,
|
|
345
|
+
lockfilesByManager,
|
|
346
|
+
packageManager,
|
|
347
|
+
UnknownPackageManagerError,
|
|
348
|
+
PackageJsonNotFoundError,
|
|
349
|
+
FindUpAndReadPackageJsonNotFoundError,
|
|
350
|
+
packageManagerFromUserAgent,
|
|
351
|
+
getPackageManager,
|
|
352
|
+
packageManagerBinaryCommandForDirectory,
|
|
353
|
+
installNPMDependenciesRecursively,
|
|
354
|
+
installNodeModules,
|
|
355
|
+
getPackageName,
|
|
356
|
+
getPackageVersion,
|
|
357
|
+
getDependencies,
|
|
358
|
+
usesWorkspaces,
|
|
359
|
+
checkForNewVersion,
|
|
360
|
+
checkForCachedNewVersion,
|
|
361
|
+
versionSatisfies,
|
|
362
|
+
readAndParsePackageJson,
|
|
363
|
+
addNPMDependenciesIfNeeded,
|
|
364
|
+
addNPMDependencies,
|
|
365
|
+
addNPMDependenciesWithoutVersionIfNeeded,
|
|
366
|
+
findUpAndReadPackageJson,
|
|
367
|
+
addResolutionOrOverride,
|
|
368
|
+
writePackageJSON,
|
|
369
|
+
inferPackageManager
|
|
370
|
+
};
|
|
371
|
+
//# sourceMappingURL=chunk-IGDZPTDH.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_cjs_shims
|
|
3
|
+
} from "./chunk-PKR7KJ6P.js";
|
|
4
|
+
|
|
5
|
+
// ../cli-kit/dist/private/node/context/deprecations-store.js
|
|
6
|
+
init_cjs_shims();
|
|
7
|
+
var deprecationsStore = {
|
|
8
|
+
nextDeprecationDate: void 0
|
|
9
|
+
};
|
|
10
|
+
function getNextDeprecationDate() {
|
|
11
|
+
return deprecationsStore.nextDeprecationDate;
|
|
12
|
+
}
|
|
13
|
+
function setNextDeprecationDate(dates) {
|
|
14
|
+
if (dates.length < 1)
|
|
15
|
+
return;
|
|
16
|
+
let earliestFutureDateTime = earliestDateTimeAfter(Date.now(), dates);
|
|
17
|
+
if (!earliestFutureDateTime)
|
|
18
|
+
return;
|
|
19
|
+
let nextDeprecationDate = getNextDeprecationDate();
|
|
20
|
+
(!nextDeprecationDate || earliestFutureDateTime < nextDeprecationDate.getTime()) && (deprecationsStore.nextDeprecationDate = new Date(earliestFutureDateTime));
|
|
21
|
+
}
|
|
22
|
+
function earliestDateTimeAfter(afterTime, dates) {
|
|
23
|
+
return dates.map((date) => date.getTime()).sort().find((time) => time > afterTime);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
getNextDeprecationDate,
|
|
28
|
+
setNextDeprecationDate
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-JCETIRLI.js.map
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_lib
|
|
3
|
+
} from "./chunk-UX6FRPFM.js";
|
|
4
|
+
import {
|
|
5
|
+
TokenizedString,
|
|
6
|
+
stringifyMessage,
|
|
7
|
+
tokenItemToString
|
|
8
|
+
} from "./chunk-LNOZTAML.js";
|
|
9
|
+
import {
|
|
10
|
+
normalizePath
|
|
11
|
+
} from "./chunk-ACS6S42W.js";
|
|
12
|
+
import {
|
|
13
|
+
__commonJS,
|
|
14
|
+
__toESM,
|
|
15
|
+
init_cjs_shims
|
|
16
|
+
} from "./chunk-PKR7KJ6P.js";
|
|
17
|
+
|
|
18
|
+
// ../../node_modules/.pnpm/ts-error@1.0.6/node_modules/ts-error/lib/helpers.js
|
|
19
|
+
var require_helpers = __commonJS({
|
|
20
|
+
"../../node_modules/.pnpm/ts-error@1.0.6/node_modules/ts-error/lib/helpers.js"(exports) {
|
|
21
|
+
"use strict";
|
|
22
|
+
init_cjs_shims();
|
|
23
|
+
exports.__esModule = void 0;
|
|
24
|
+
exports.__esModule = !0;
|
|
25
|
+
var objectSetPrototypeOfIsDefined = typeof Object.setPrototypeOf == "function", objectGetPrototypeOfIsDefined = typeof Object.getPrototypeOf == "function", objectDefinePropertyIsDefined = typeof Object.defineProperty == "function", objectCreateIsDefined = typeof Object.create == "function", objectHasOwnPropertyIsDefined = typeof Object.prototype.hasOwnProperty == "function", setPrototypeOf = function(target, prototype) {
|
|
26
|
+
objectSetPrototypeOfIsDefined ? Object.setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
27
|
+
};
|
|
28
|
+
exports.setPrototypeOf = setPrototypeOf;
|
|
29
|
+
var getPrototypeOf = function(target) {
|
|
30
|
+
return objectGetPrototypeOfIsDefined ? Object.getPrototypeOf(target) : target.__proto__ || target.prototype;
|
|
31
|
+
};
|
|
32
|
+
exports.getPrototypeOf = getPrototypeOf;
|
|
33
|
+
var ie8ObjectDefinePropertyBug = !1, defineProperty = function defineProperty2(target, name, propertyDescriptor) {
|
|
34
|
+
if (objectDefinePropertyIsDefined && !ie8ObjectDefinePropertyBug)
|
|
35
|
+
try {
|
|
36
|
+
Object.defineProperty(target, name, propertyDescriptor);
|
|
37
|
+
} catch {
|
|
38
|
+
ie8ObjectDefinePropertyBug = !0, defineProperty2(target, name, propertyDescriptor);
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
target[name] = propertyDescriptor.value;
|
|
42
|
+
};
|
|
43
|
+
exports.defineProperty = defineProperty;
|
|
44
|
+
var hasOwnProperty = function(target, name) {
|
|
45
|
+
return objectHasOwnPropertyIsDefined ? target.hasOwnProperty(target, name) : target[name] === void 0;
|
|
46
|
+
};
|
|
47
|
+
exports.hasOwnProperty = hasOwnProperty;
|
|
48
|
+
var objectCreate = function(prototype, propertyDescriptors) {
|
|
49
|
+
if (objectCreateIsDefined)
|
|
50
|
+
return Object.create(prototype, propertyDescriptors);
|
|
51
|
+
var F = function() {
|
|
52
|
+
};
|
|
53
|
+
F.prototype = prototype;
|
|
54
|
+
var result = new F();
|
|
55
|
+
if (typeof propertyDescriptors > "u")
|
|
56
|
+
return result;
|
|
57
|
+
if (typeof propertyDescriptors == "null")
|
|
58
|
+
throw new Error("PropertyDescriptors must not be null.");
|
|
59
|
+
if (typeof propertyDescriptors == "object")
|
|
60
|
+
for (var key in propertyDescriptors)
|
|
61
|
+
hasOwnProperty(propertyDescriptors, key) && (result[key] = propertyDescriptors[key].value);
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
exports.objectCreate = objectCreate;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// ../../node_modules/.pnpm/ts-error@1.0.6/node_modules/ts-error/lib/cjs.js
|
|
69
|
+
var require_cjs = __commonJS({
|
|
70
|
+
"../../node_modules/.pnpm/ts-error@1.0.6/node_modules/ts-error/lib/cjs.js"(exports) {
|
|
71
|
+
"use strict";
|
|
72
|
+
init_cjs_shims();
|
|
73
|
+
exports.__esModule = void 0;
|
|
74
|
+
exports.__esModule = !0;
|
|
75
|
+
var helpers = require_helpers(), setPrototypeOf = helpers.setPrototypeOf, getPrototypeOf = helpers.getPrototypeOf, defineProperty = helpers.defineProperty, objectCreate = helpers.objectCreate, uglyErrorPrinting = new Error().toString() === "[object Error]", extendableErrorName = "";
|
|
76
|
+
function ExtendableError2(message) {
|
|
77
|
+
var originalConstructor = this.constructor, constructorName = originalConstructor.name || (function() {
|
|
78
|
+
var constructorNameMatch = originalConstructor.toString().match(/^function\s*([^\s(]+)/);
|
|
79
|
+
return constructorNameMatch === null ? extendableErrorName || "Error" : constructorNameMatch[1];
|
|
80
|
+
})(), constructorNameIsError = constructorName === "Error", name = constructorNameIsError ? extendableErrorName : constructorName, instance = Error.apply(this, arguments);
|
|
81
|
+
if (setPrototypeOf(instance, getPrototypeOf(this)), !(instance instanceof originalConstructor) || !(instance instanceof ExtendableError2)) {
|
|
82
|
+
var instance = this;
|
|
83
|
+
Error.apply(this, arguments), defineProperty(instance, "message", {
|
|
84
|
+
configurable: !0,
|
|
85
|
+
enumerable: !1,
|
|
86
|
+
value: message,
|
|
87
|
+
writable: !0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (defineProperty(instance, "name", {
|
|
91
|
+
configurable: !0,
|
|
92
|
+
enumerable: !1,
|
|
93
|
+
value: name,
|
|
94
|
+
writable: !0
|
|
95
|
+
}), Error.captureStackTrace && Error.captureStackTrace(
|
|
96
|
+
instance,
|
|
97
|
+
constructorNameIsError ? ExtendableError2 : originalConstructor
|
|
98
|
+
), instance.stack === void 0) {
|
|
99
|
+
var err = new Error(message);
|
|
100
|
+
err.name = instance.name, instance.stack = err.stack;
|
|
101
|
+
}
|
|
102
|
+
return uglyErrorPrinting && defineProperty(instance, "toString", {
|
|
103
|
+
configurable: !0,
|
|
104
|
+
enumerable: !1,
|
|
105
|
+
value: function() {
|
|
106
|
+
return (this.name || "Error") + (typeof this.message > "u" ? "" : ": " + this.message);
|
|
107
|
+
},
|
|
108
|
+
writable: !0
|
|
109
|
+
}), instance;
|
|
110
|
+
}
|
|
111
|
+
extendableErrorName = ExtendableError2.name || "ExtendableError";
|
|
112
|
+
ExtendableError2.prototype = objectCreate(Error.prototype, {
|
|
113
|
+
constructor: {
|
|
114
|
+
value: Error,
|
|
115
|
+
enumerable: !1,
|
|
116
|
+
writable: !0,
|
|
117
|
+
configurable: !0
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
exports.ExtendableError = ExtendableError2;
|
|
121
|
+
exports.default = exports.ExtendableError;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ../cli-kit/dist/public/node/error.js
|
|
126
|
+
init_cjs_shims();
|
|
127
|
+
var import_core = __toESM(require_lib(), 1), import_ts_error = __toESM(require_cjs(), 1), FatalErrorType;
|
|
128
|
+
(function(FatalErrorType2) {
|
|
129
|
+
FatalErrorType2[FatalErrorType2.Abort = 0] = "Abort", FatalErrorType2[FatalErrorType2.AbortSilent = 1] = "AbortSilent", FatalErrorType2[FatalErrorType2.Bug = 2] = "Bug";
|
|
130
|
+
})(FatalErrorType || (FatalErrorType = {}));
|
|
131
|
+
var CancelExecution = class extends Error {
|
|
132
|
+
}, FatalError = class extends Error {
|
|
133
|
+
/**
|
|
134
|
+
* Creates a new FatalError error.
|
|
135
|
+
*
|
|
136
|
+
* @param message - The error message.
|
|
137
|
+
* @param type - The type of fatal error.
|
|
138
|
+
* @param tryMessage - The message that recommends next steps to the user.
|
|
139
|
+
* You can pass a string a {@link TokenizedString} or a {@link TokenItem}
|
|
140
|
+
* if you need to style the message inside the error Banner component.
|
|
141
|
+
* @param nextSteps - Message to show as "next steps" with suggestions to solve the issue.
|
|
142
|
+
* @param customSections - Custom sections to show in the error banner. To be used if nextSteps is not enough.
|
|
143
|
+
*/
|
|
144
|
+
constructor(message, type, tryMessage = null, nextSteps, customSections) {
|
|
145
|
+
let messageIsOutputMessage = typeof message == "string" || "value" in message;
|
|
146
|
+
super(messageIsOutputMessage ? stringifyMessage(message) : tokenItemToString(message)), tryMessage ? tryMessage instanceof TokenizedString ? this.tryMessage = stringifyMessage(tryMessage) : this.tryMessage = tryMessage : this.tryMessage = null, this.type = type, this.nextSteps = nextSteps, this.customSections = customSections, this.skipOclifErrorHandling = !0, messageIsOutputMessage || (this.formattedMessage = message);
|
|
147
|
+
}
|
|
148
|
+
}, AbortError = class extends FatalError {
|
|
149
|
+
constructor(message, tryMessage = null, nextSteps, customSections) {
|
|
150
|
+
super(message, FatalErrorType.Abort, tryMessage, nextSteps, customSections);
|
|
151
|
+
}
|
|
152
|
+
}, ExternalError = class extends FatalError {
|
|
153
|
+
constructor(message, command, args, tryMessage = null) {
|
|
154
|
+
super(message, FatalErrorType.Abort, tryMessage), this.command = command, this.args = args;
|
|
155
|
+
}
|
|
156
|
+
}, AbortSilentError = class extends FatalError {
|
|
157
|
+
constructor() {
|
|
158
|
+
super("", FatalErrorType.AbortSilent);
|
|
159
|
+
}
|
|
160
|
+
}, BugError = class extends FatalError {
|
|
161
|
+
constructor(message, tryMessage = null) {
|
|
162
|
+
super(message, FatalErrorType.Bug, tryMessage);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
async function handler(error) {
|
|
166
|
+
let fatal;
|
|
167
|
+
if (isFatal(error))
|
|
168
|
+
fatal = error;
|
|
169
|
+
else if (typeof error == "string")
|
|
170
|
+
fatal = new BugError(error);
|
|
171
|
+
else if (error instanceof Error)
|
|
172
|
+
fatal = new BugError(error.message), fatal.stack = error.stack;
|
|
173
|
+
else {
|
|
174
|
+
let maybeError = error;
|
|
175
|
+
fatal = new BugError(maybeError?.message ?? "Unknown error"), maybeError?.stack && (fatal.stack = maybeError?.stack);
|
|
176
|
+
}
|
|
177
|
+
let { renderFatalError } = await import("./ui-2FROV2IT.js");
|
|
178
|
+
return renderFatalError(fatal), Promise.resolve(error);
|
|
179
|
+
}
|
|
180
|
+
function errorMapper(error) {
|
|
181
|
+
if (error instanceof import_core.Errors.CLIError) {
|
|
182
|
+
let mappedError = new AbortError(error.message);
|
|
183
|
+
return mappedError.stack = error.stack, Promise.resolve(mappedError);
|
|
184
|
+
} else
|
|
185
|
+
return Promise.resolve(error);
|
|
186
|
+
}
|
|
187
|
+
function isFatal(error) {
|
|
188
|
+
try {
|
|
189
|
+
return Object.prototype.hasOwnProperty.call(error, "type");
|
|
190
|
+
} catch {
|
|
191
|
+
return !1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function shouldReportErrorAsUnexpected(error) {
|
|
195
|
+
if (!isFatal(error)) {
|
|
196
|
+
if (error instanceof Error) {
|
|
197
|
+
let message = error.message;
|
|
198
|
+
return !errorMessageImpliesEnvironmentIssue(message);
|
|
199
|
+
}
|
|
200
|
+
return !0;
|
|
201
|
+
}
|
|
202
|
+
return error.type === FatalErrorType.Bug;
|
|
203
|
+
}
|
|
204
|
+
function cleanSingleStackTracePath(filePath) {
|
|
205
|
+
return normalizePath(filePath).replace("file:/", "/").replace(/^\/?[A-Z]:/, "");
|
|
206
|
+
}
|
|
207
|
+
function errorMessageImpliesEnvironmentIssue(message) {
|
|
208
|
+
return [
|
|
209
|
+
"EPERM: operation not permitted, scandir",
|
|
210
|
+
"EPERM: operation not permitted, rename",
|
|
211
|
+
"EACCES: permission denied",
|
|
212
|
+
"EPERM: operation not permitted, symlink",
|
|
213
|
+
"This version of npm supports the following node versions",
|
|
214
|
+
"EBUSY: resource busy or locked",
|
|
215
|
+
"ENOTEMPTY: directory not empty",
|
|
216
|
+
"getaddrinfo ENOTFOUND",
|
|
217
|
+
"Client network socket disconnected before secure TLS connection was established",
|
|
218
|
+
"spawn EPERM",
|
|
219
|
+
"socket hang up",
|
|
220
|
+
"The user aborted a request.",
|
|
221
|
+
"write EPIPE",
|
|
222
|
+
"Unsupported platform"
|
|
223
|
+
].some((issueMessage) => message.includes(issueMessage));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ../../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
227
|
+
init_cjs_shims();
|
|
228
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
229
|
+
if (property === "length" || property === "prototype" || property === "arguments" || property === "caller")
|
|
230
|
+
return;
|
|
231
|
+
let toDescriptor = Object.getOwnPropertyDescriptor(to, property), fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
232
|
+
!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable || Object.defineProperty(to, property, fromDescriptor);
|
|
233
|
+
}, canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
234
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
235
|
+
}, changePrototype = (to, from) => {
|
|
236
|
+
let fromPrototype = Object.getPrototypeOf(from);
|
|
237
|
+
fromPrototype !== Object.getPrototypeOf(to) && Object.setPrototypeOf(to, fromPrototype);
|
|
238
|
+
}, wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
239
|
+
${fromBody}`, toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString"), toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name"), changeToString = (to, from, name) => {
|
|
240
|
+
let withName = name === "" ? "" : `with ${name.trim()}() `, newToString = wrappedToString.bind(null, withName, from.toString());
|
|
241
|
+
Object.defineProperty(newToString, "name", toStringName), Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
242
|
+
};
|
|
243
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = !1 } = {}) {
|
|
244
|
+
let { name } = to;
|
|
245
|
+
for (let property of Reflect.ownKeys(from))
|
|
246
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
247
|
+
return changePrototype(to, from), changeToString(to, from, name), to;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export {
|
|
251
|
+
mimicFunction,
|
|
252
|
+
CancelExecution,
|
|
253
|
+
FatalError,
|
|
254
|
+
AbortError,
|
|
255
|
+
ExternalError,
|
|
256
|
+
AbortSilentError,
|
|
257
|
+
BugError,
|
|
258
|
+
handler,
|
|
259
|
+
errorMapper,
|
|
260
|
+
shouldReportErrorAsUnexpected,
|
|
261
|
+
cleanSingleStackTracePath,
|
|
262
|
+
import_ts_error
|
|
263
|
+
};
|
|
264
|
+
//# sourceMappingURL=chunk-JUV7D377.js.map
|