@adobe/aio-commerce-lib-app 1.7.0 → 1.8.0-beta-20260714082406

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 (93) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/cjs/actions/app-config/index.cjs +41 -38
  3. package/dist/cjs/actions/app-config/index.d.cts +1 -1
  4. package/dist/cjs/actions/association/index.cjs +85 -0
  5. package/dist/cjs/actions/{registration → association}/index.d.cts +9 -13
  6. package/dist/cjs/actions/config/index.cjs +21 -32
  7. package/dist/cjs/actions/installation/index.cjs +72 -51
  8. package/dist/cjs/actions/installation/index.d.cts +2 -2
  9. package/dist/cjs/actions/scope-tree/index.cjs +18 -17
  10. package/dist/{es/app-DrYHK-z1.d.mts → cjs/app-D3P-Z6uY.d.cts} +1085 -1035
  11. package/dist/cjs/association-repository-BAs3-VkW.cjs +69 -0
  12. package/dist/cjs/commands/index.cjs +512 -298
  13. package/dist/cjs/commands/templates/admin-ui/tsconfig.json +14 -0
  14. package/dist/cjs/commands/templates/admin-ui/web-src/index.css +5 -0
  15. package/dist/cjs/commands/templates/admin-ui/web-src/index.html +17 -0
  16. package/dist/cjs/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
  17. package/dist/cjs/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
  18. package/dist/cjs/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
  19. package/dist/cjs/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
  20. package/dist/cjs/commands/templates/app-management/app-config.js.template +1 -14
  21. package/dist/cjs/commands/templates/app-management/association.js.template +6 -0
  22. package/dist/cjs/commands/templates/app-management/installation.js.template +1 -13
  23. package/dist/cjs/commands/templates/business-configuration/config.js.template +2 -15
  24. package/dist/cjs/commands/templates/business-configuration/scope-tree.js.template +0 -12
  25. package/dist/cjs/config/index.browser.cjs +18 -0
  26. package/dist/cjs/config/index.browser.d.cts +16 -0
  27. package/dist/cjs/config/{index.cjs → index.node.cjs} +9 -8
  28. package/dist/cjs/config/{index.d.cts → index.node.d.cts} +954 -386
  29. package/dist/cjs/define-DBxAlJfN.d.cts +34 -0
  30. package/dist/cjs/define-hlcQw7Cv.cjs +41 -0
  31. package/dist/cjs/environment-B7EnozSg.cjs +135 -0
  32. package/dist/cjs/{index-B5gJ-q4U.d.cts → index-CzReNwbF.d.cts} +17 -12
  33. package/dist/cjs/index.cjs +250 -0
  34. package/dist/cjs/index.d.cts +217 -0
  35. package/dist/cjs/{config-D-s0GSep.cjs → index.node-Dz4lV4qe.cjs} +119 -35
  36. package/dist/cjs/{logging-BVz3weoC.cjs → logging-udPuAJPt.cjs} +2 -2
  37. package/dist/cjs/management/index.cjs +1 -1
  38. package/dist/cjs/management/index.d.cts +1 -1
  39. package/dist/cjs/{management-Dehz9qSJ.cjs → management-B9ItB80R.cjs} +385 -582
  40. package/dist/cjs/{openapi-Cux6K4ZD.cjs → openapi-CwytYdWl.cjs} +476 -600
  41. package/dist/cjs/{router-BOR7T6qR.cjs → router-hA_Y9gZ1.cjs} +42 -44
  42. package/dist/cjs/{schemas-FngDuIeo.cjs → schemas-mLxMh_ko.cjs} +2 -2
  43. package/dist/cjs/utils-DSCmZ_iJ.cjs +408 -0
  44. package/dist/cjs/{validate-oAOpyFyb.cjs → validate-BfxhZ5Wv.cjs} +20 -20
  45. package/dist/cjs/{webhooks-tbZy9G3p.cjs → webhooks-B5tb9NeF.cjs} +159 -151
  46. package/dist/es/actions/app-config/index.d.mts +1 -1
  47. package/dist/es/actions/app-config/index.mjs +39 -36
  48. package/dist/es/actions/{registration → association}/index.d.mts +9 -13
  49. package/dist/es/actions/association/index.mjs +82 -0
  50. package/dist/es/actions/config/index.mjs +17 -28
  51. package/dist/es/actions/installation/index.d.mts +2 -2
  52. package/dist/es/actions/installation/index.mjs +69 -48
  53. package/dist/es/actions/scope-tree/index.mjs +14 -13
  54. package/dist/{cjs/app-DrYHK-z1.d.cts → es/app-D3P-Z6uY.d.mts} +1085 -1035
  55. package/dist/es/association-repository-BbQv9WCl.mjs +52 -0
  56. package/dist/es/commands/index.mjs +544 -328
  57. package/dist/es/commands/templates/admin-ui/tsconfig.json +14 -0
  58. package/dist/es/commands/templates/admin-ui/web-src/index.css +5 -0
  59. package/dist/es/commands/templates/admin-ui/web-src/index.html +17 -0
  60. package/dist/es/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
  61. package/dist/es/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
  62. package/dist/es/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
  63. package/dist/es/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
  64. package/dist/es/commands/templates/app-management/app-config.js.template +1 -14
  65. package/dist/es/commands/templates/app-management/association.js.template +6 -0
  66. package/dist/es/commands/templates/app-management/installation.js.template +1 -13
  67. package/dist/es/commands/templates/business-configuration/config.js.template +2 -15
  68. package/dist/es/commands/templates/business-configuration/scope-tree.js.template +0 -12
  69. package/dist/es/config/index.browser.d.mts +16 -0
  70. package/dist/es/config/index.browser.mjs +17 -0
  71. package/dist/es/config/{index.d.mts → index.node.d.mts} +954 -386
  72. package/dist/es/config/{index.mjs → index.node.mjs} +5 -4
  73. package/dist/es/define-EoYRZbpe.d.mts +34 -0
  74. package/dist/es/define-Z_Glf1-_.mjs +35 -0
  75. package/dist/es/environment-C84BPRJZ.mjs +104 -0
  76. package/dist/es/{index-DLMbTtKS.d.mts → index-D52xglhZ.d.mts} +17 -12
  77. package/dist/es/index.d.mts +217 -0
  78. package/dist/es/index.mjs +242 -0
  79. package/dist/es/{config-3I4eLyyR.mjs → index.node-CDH5gwJE.mjs} +94 -30
  80. package/dist/es/management/index.d.mts +1 -1
  81. package/dist/es/management/index.mjs +1 -1
  82. package/dist/es/{management-BUX-w2Ji.mjs → management-B89ApQVY.mjs} +353 -550
  83. package/dist/es/{openapi-B6uP0SRn.mjs → openapi-CXonvevE.mjs} +476 -600
  84. package/dist/es/{router-D58JJHHA.mjs → router-B_h0cvjc.mjs} +40 -42
  85. package/dist/es/utils-_gj8L6eN.mjs +289 -0
  86. package/dist/es/{validate-Dfajrp99.mjs → validate-9cRZWGrA.mjs} +17 -17
  87. package/dist/es/{webhooks-B5oq9ULL.mjs → webhooks-BBPbY2mb.mjs} +150 -142
  88. package/package.json +40 -17
  89. package/dist/cjs/actions/registration/index.cjs +0 -50
  90. package/dist/cjs/admin-ui-sdk-EU915zlR.d.cts +0 -664
  91. package/dist/es/actions/registration/index.mjs +0 -49
  92. package/dist/es/admin-ui-sdk-BwnD0xjK.d.mts +0 -664
  93. /package/dist/cjs/{chunk-Cozy-1ZF.cjs → rolldown-runtime-Cozy-1ZF.cjs} +0 -0
@@ -0,0 +1,217 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
16
+ import { ImsAuthParams, ImsAuthProvider } from "@adobe/aio-commerce-lib-auth";
17
+ import { CommerceEnv } from "@adobe/aio-commerce-lib-core/commerce";
18
+ import { AdobeIoEventsApiClient } from "@adobe/aio-commerce-lib-events/io-events";
19
+ import { CommerceSdkErrorBase, CommerceSdkErrorBaseOptions } from "@adobe/aio-commerce-lib-core/error";
20
+
21
+ //#region source/management/association/types.d.ts
22
+ /**
23
+ * The Commerce instance an app is associated with.
24
+ */
25
+ type AssociatedCommerceInstance = {
26
+ /** Commerce API base URL. */baseUrl: string; /** Deployment type of the Commerce instance. */
27
+ env: CommerceEnv;
28
+ };
29
+ //#endregion
30
+ //#region source/access/commerce-instance.d.ts
31
+ /**
32
+ * Returns the Commerce instance this app is currently associated with.
33
+ *
34
+ * @throws {AppNotAssociatedError} If the app is not associated, was
35
+ * unassociated, or was associated by an older SDK that did not store this
36
+ * data. Re-associating the app resolves the error.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { getCommerceInstance } from "@adobe/aio-commerce-lib-app";
41
+ *
42
+ * export async function main() {
43
+ * const instance = await getCommerceInstance();
44
+ *
45
+ * // instance.baseUrl — e.g. "https://my-store.example.com"
46
+ * // instance.env — "saas" | "paas"
47
+ * }
48
+ * ```
49
+ */
50
+ declare function getCommerceInstance(): Promise<AssociatedCommerceInstance>;
51
+ /**
52
+ * Returns an initialised `AdobeCommerceHttpClient` for the Commerce instance
53
+ * this app is currently associated with.
54
+ *
55
+ * The base URL and flavor come from the stored association data
56
+ * ({@link getCommerceInstance}); the caller supplies the resolved IMS auth.
57
+ *
58
+ * @param auth - Resolved IMS auth params or an IMS auth provider.
59
+ * @param fetchOptions - Optional global fetch options forwarded to the
60
+ * underlying `AdobeCommerceHttpClient` (e.g. `headers`, `timeout`, `retry`).
61
+ * @throws {AppNotAssociatedError} If the app is not associated, was
62
+ * unassociated, or was associated by an older SDK that did not store this
63
+ * data. Re-associating the app resolves the error.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { getCommerceClient } from "@adobe/aio-commerce-lib-app";
68
+ * import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
69
+ *
70
+ * export async function main(params) {
71
+ * const client = await getCommerceClient(resolveImsAuthParams(params));
72
+ * const products = await client.get("products").json();
73
+ * }
74
+ * ```
75
+ */
76
+ declare function getCommerceClient(auth: ImsAuthParams | ImsAuthProvider, fetchOptions?: CommerceHttpClientParams["fetchOptions"]): Promise<AdobeCommerceHttpClient>;
77
+ //#endregion
78
+ //#region source/access/events.d.ts
79
+ /**
80
+ * Publishes an event declared in the app's eventing configuration.
81
+ *
82
+ * Resolves the provider key and event name to their respective I/O Events IDs from
83
+ * data written to system storage at installation time, then delegates the HTTP call
84
+ * to the given client. No management API round-trip is needed at runtime.
85
+ *
86
+ * @param params.client - An {@link AdobeIoEventsApiClient} configured with the correct IMS auth.
87
+ * @param params.provider - The `key` of an event provider declared in `app.commerce.config.ts`.
88
+ * @param params.event - The `name` of an event within that provider.
89
+ * @param params.payload - The event payload. Must be a JSON object.
90
+ *
91
+ * @throws {EventsDataNotInitializedError} If no eventing installation data is found in system storage.
92
+ * @throws {ProviderNotFoundError} If the provider key is not found in the stored data.
93
+ * @throws {EventNotFoundError} If the event name is not found under the given provider.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { publishEvent } from "@adobe/aio-commerce-lib-app";
98
+ * import { createAdobeIoEventsApiClient } from "@adobe/aio-commerce-lib-events";
99
+ * import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
100
+ *
101
+ * export async function main(params) {
102
+ * const client = createAdobeIoEventsApiClient({
103
+ * auth: resolveImsAuthParams(params),
104
+ * config: { ingressBaseUrl: params.AIO_EVENTS_INGRESS_BASE_URL },
105
+ * });
106
+ *
107
+ * await publishEvent({
108
+ * client,
109
+ * provider: "order-events",
110
+ * event: "order.created",
111
+ * payload: { orderId: "100000123", total: 149.99 },
112
+ * });
113
+ * }
114
+ * ```
115
+ */
116
+ declare function publishEvent<TPayload extends Record<string, unknown> = Record<string, unknown>>(params: {
117
+ client: AdobeIoEventsApiClient;
118
+ provider: string;
119
+ event: string;
120
+ payload: TPayload;
121
+ }): Promise<void>;
122
+ //#endregion
123
+ //#region source/errors/app-not-associated-error.d.ts
124
+ /** Options accepted by {@link AppNotAssociatedError}. */
125
+ type AppNotAssociatedErrorOptions = CommerceSdkErrorBaseOptions;
126
+ /**
127
+ * Thrown when a runtime action calls `getCommerceInstance` or `getCommerceClient`
128
+ * but the app has no stored association data — for example, when the app has
129
+ * never been associated, has been unassociated, or was associated by an older
130
+ * SDK that did not store this data.
131
+ *
132
+ * Re-associating the app resolves the error.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import { getCommerceClient, AppNotAssociatedError } from "@adobe/aio-commerce-lib-app";
137
+ * import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
138
+ *
139
+ * try {
140
+ * const client = await getCommerceClient(resolveImsAuthParams(params));
141
+ * // ... use client
142
+ * } catch (error) {
143
+ * if (error instanceof AppNotAssociatedError) {
144
+ * // handle the unassociated case (e.g. return a 400 response)
145
+ * }
146
+ * throw error;
147
+ * }
148
+ * ```
149
+ */
150
+ declare class AppNotAssociatedError extends CommerceSdkErrorBase {
151
+ constructor(message?: string, options?: AppNotAssociatedErrorOptions);
152
+ }
153
+ //#endregion
154
+ //#region source/errors/publish-event-errors.d.ts
155
+ /**
156
+ * Base error thrown by {@link publishEvent} when event resolution or publishing fails.
157
+ * Catch this to handle all publish-event failures in a single clause.
158
+ */
159
+ declare class PublishEventError extends CommerceSdkErrorBase {}
160
+ /**
161
+ * Thrown when {@link publishEvent} cannot find the eventing installation data in system storage.
162
+ *
163
+ * This typically means the app installation has not run yet, or ran with an older SDK version
164
+ * that did not write event provider metadata to storage. Re-running the installation resolves it.
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * try {
169
+ * await publishEvent({ client, provider: "order-events", event: "order.created", payload });
170
+ * } catch (error) {
171
+ * if (error instanceof EventsDataNotInitializedError) {
172
+ * // Prompt re-installation
173
+ * }
174
+ * }
175
+ * ```
176
+ */
177
+ declare class EventsDataNotInitializedError extends PublishEventError {
178
+ constructor();
179
+ }
180
+ /**
181
+ * Thrown when the provider key passed to {@link publishEvent} does not match any provider
182
+ * declared in the app's eventing configuration.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * try {
187
+ * await publishEvent({ client, provider: "order-events", event: "order.created", payload });
188
+ * } catch (error) {
189
+ * if (error instanceof ProviderNotFoundError) {
190
+ * // "order-events" was not found — check app.commerce.config.ts
191
+ * }
192
+ * }
193
+ * ```
194
+ */
195
+ declare class ProviderNotFoundError extends PublishEventError {
196
+ constructor(providerKey: string);
197
+ }
198
+ /**
199
+ * Thrown when the event name passed to {@link publishEvent} does not match any event
200
+ * declared under the given provider in the app's eventing configuration.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * try {
205
+ * await publishEvent({ client, provider: "order-events", event: "order.created", payload });
206
+ * } catch (error) {
207
+ * if (error instanceof EventNotFoundError) {
208
+ * // "order.created" was not found under "order-events" — check app.commerce.config.ts
209
+ * }
210
+ * }
211
+ * ```
212
+ */
213
+ declare class EventNotFoundError extends PublishEventError {
214
+ constructor(eventName: string, providerKey: string);
215
+ }
216
+ //#endregion
217
+ export { AppNotAssociatedError, type AssociatedCommerceInstance, EventNotFoundError, EventsDataNotInitializedError, ProviderNotFoundError, PublishEventError, getCommerceClient, getCommerceInstance, publishEvent };
@@ -12,34 +12,19 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
+ const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
15
16
  const require_error = require('./error-D-N0PKSl.cjs');
16
- const require_validate = require('./validate-oAOpyFyb.cjs');
17
+ const require_validate = require('./validate-BfxhZ5Wv.cjs');
17
18
  let path = require("path");
18
19
  let fs = require("fs");
19
20
  let fs_promises = require("fs/promises");
21
+ let _npmcli_package_json = require("@npmcli/package-json");
22
+ _npmcli_package_json = require_rolldown_runtime.__toESM(_npmcli_package_json, 1);
23
+ let local_pkg = require("local-pkg");
20
24
  let package_manager_detector = require("package-manager-detector");
21
25
  let package_manager_detector_detect = require("package-manager-detector/detect");
26
+ let semver = require("semver");
22
27
 
23
- //#region source/config/lib/define.ts
24
- /**
25
- * Helper to type-safely define the app config.
26
- * @param config - The app config to define.
27
- *
28
- * @example
29
- * ```typescript
30
- * import { defineConfig } from "@adobe/aio-commerce-lib-app";
31
- *
32
- * // In app.commerce.config.js
33
- * export default defineConfig({
34
- * // You get autocompletion and type-safety for the config object.
35
- * businessConfig: { ... }
36
- * });
37
- */
38
- function defineConfig(config) {
39
- return config;
40
- }
41
-
42
- //#endregion
43
28
  //#region ../../packages-private/scripting-utils/source/project.ts
44
29
  /**
45
30
  * This module exports shared project utilities for the AIO Commerce SDK.
@@ -57,7 +42,7 @@ async function findUp(name, options = {}) {
57
42
  const { root } = (0, path.parse)(cwd);
58
43
  const stopAt = options.stopAt || root;
59
44
  let currentDir = cwd;
60
- while (true) {
45
+ for (;;) {
61
46
  for (const fileName of names) {
62
47
  const filePath = (0, path.join)(currentDir, fileName);
63
48
  try {
@@ -88,6 +73,72 @@ async function readPackageJson(cwd = process.cwd()) {
88
73
  return JSON.parse(await (0, fs_promises.readFile)(packageJsonPath, "utf-8"));
89
74
  }
90
75
  /**
76
+ * Load the nearest package.json file with npmcli's package.json helper.
77
+ * @param cwd The current working directory
78
+ */
79
+ async function loadPackageJson(cwd = process.cwd()) {
80
+ const packageJsonPath = await findNearestPackageJson(cwd);
81
+ if (!packageJsonPath) return null;
82
+ return _npmcli_package_json.default.load((0, path.dirname)(packageJsonPath));
83
+ }
84
+ /**
85
+ * Convert package.json dependencies into a dependency map that can be written back.
86
+ * @param dependencies - Dependency map read from package.json.
87
+ */
88
+ function toWritablePackageJsonDependencies(dependencies) {
89
+ return Object.fromEntries(Object.entries(dependencies).filter((entry) => Boolean(entry[1])));
90
+ }
91
+ /**
92
+ * Resolve the installed package version from a project root.
93
+ * @param packageName - Package name to resolve.
94
+ * @param cwd - Project directory to resolve from.
95
+ */
96
+ async function getInstalledPackageVersion(packageName, cwd = process.cwd()) {
97
+ return (await (0, local_pkg.getPackageInfo)(packageName, { paths: [cwd] }))?.version ?? null;
98
+ }
99
+ /**
100
+ * Resolve which dependencies are missing or installed with incompatible versions.
101
+ *
102
+ * Installed package versions are compared with `semver.satisfies`. Declared
103
+ * package.json ranges are not used as compatibility proof because they can
104
+ * differ from what is actually installed.
105
+ *
106
+ * @param requiredDependencies - Dependencies that should exist.
107
+ * @param cwd - Project directory to resolve installed packages from.
108
+ */
109
+ async function getPackageDependencyInstallPlan(requiredDependencies, cwd = process.cwd()) {
110
+ const plan = {
111
+ incompatible: [],
112
+ missing: []
113
+ };
114
+ const installedVersions = await Promise.all(requiredDependencies.map((dependency) => getInstalledPackageVersion(dependency.name, cwd)));
115
+ requiredDependencies.forEach((dependency, index) => {
116
+ const installedVersion = installedVersions[index];
117
+ if (installedVersion === null) {
118
+ plan.missing.push(dependency);
119
+ return;
120
+ }
121
+ if ((0, semver.validRange)(dependency.version) === null) return;
122
+ if (!(0, semver.satisfies)(installedVersion, dependency.version, { includePrerelease: true })) plan.incompatible.push({
123
+ ...dependency,
124
+ installedVersion
125
+ });
126
+ });
127
+ return plan;
128
+ }
129
+ /**
130
+ * Merge required dependencies into a package.json dependency map when they are missing.
131
+ *
132
+ * @param dependencies - Dependency map to update.
133
+ * @param requiredDependencies - Dependencies that should exist.
134
+ * @param dependencyMaps - Package dependency maps to compare against.
135
+ */
136
+ function mergePackageJsonDependencies(dependencies, requiredDependencies, dependencyMaps = [dependencies]) {
137
+ const nextDependencies = toWritablePackageJsonDependencies(dependencies);
138
+ for (const { name, version } of requiredDependencies) if (!dependencyMaps.some((dependencyMap) => name in dependencyMap)) nextDependencies[name] = version;
139
+ return nextDependencies;
140
+ }
141
+ /**
91
142
  * Check if the current working directory is an ESM project.
92
143
  * @param cwd The current working directory
93
144
  */
@@ -120,6 +171,12 @@ const VALID_PACKAGE_MANAGERS = [
120
171
  "yarn",
121
172
  "bun"
122
173
  ];
174
+ const DEV_DEPENDENCY_INSTALL_FLAGS = {
175
+ bun: "--dev",
176
+ npm: "--save-dev",
177
+ pnpm: "--save-dev",
178
+ yarn: "--dev"
179
+ };
123
180
  /**
124
181
  * Type guard asserting that a value is a supported `PackageManager`.
125
182
  * @param value - The value to check
@@ -153,16 +210,25 @@ function getExecCommand(packageManager) {
153
210
  * manager (e.g. `pnpm add foo bar`, `npm i foo bar`).
154
211
  * @param packageManager - The detected package manager
155
212
  * @param packages - Package specifiers to install (e.g. `["foo@^1.0"]`)
213
+ * @param options - Install command options.
156
214
  */
157
- function getInstallCommand(packageManager, packages) {
158
- const resolved = (0, package_manager_detector.resolveCommand)(packageManager, "add", packages);
159
- if (!resolved) return {
160
- command: "npm",
161
- args: ["install", ...packages]
215
+ function getInstallCommand(packageManager, packages, options = {}) {
216
+ const installArgs = options.dev ? [DEV_DEPENDENCY_INSTALL_FLAGS[packageManager], ...packages] : packages;
217
+ const resolved = (0, package_manager_detector.resolveCommand)(packageManager, "add", installArgs);
218
+ return {
219
+ args: resolved?.args.filter(Boolean) ?? ["install", ...installArgs],
220
+ command: resolved?.command ?? "npm"
162
221
  };
222
+ }
223
+ /**
224
+ * Get the command that installs a project's declared dependencies.
225
+ * @param packageManager - The detected package manager
226
+ */
227
+ function getProjectInstallCommand(packageManager) {
228
+ const resolved = (0, package_manager_detector.resolveCommand)(packageManager, "install", []);
163
229
  return {
164
- args: resolved.args.filter((a) => Boolean(a)),
165
- command: resolved.command
230
+ args: resolved?.args.filter(Boolean) ?? ["install"],
231
+ command: resolved?.command ?? "npm"
166
232
  };
167
233
  }
168
234
 
@@ -242,12 +308,6 @@ async function parseCommerceAppConfig(cwd = process.cwd()) {
242
308
  }
243
309
 
244
310
  //#endregion
245
- Object.defineProperty(exports, 'defineConfig', {
246
- enumerable: true,
247
- get: function () {
248
- return defineConfig;
249
- }
250
- });
251
311
  Object.defineProperty(exports, 'detectPackageManager', {
252
312
  enumerable: true,
253
313
  get: function () {
@@ -266,6 +326,18 @@ Object.defineProperty(exports, 'getInstallCommand', {
266
326
  return getInstallCommand;
267
327
  }
268
328
  });
329
+ Object.defineProperty(exports, 'getPackageDependencyInstallPlan', {
330
+ enumerable: true,
331
+ get: function () {
332
+ return getPackageDependencyInstallPlan;
333
+ }
334
+ });
335
+ Object.defineProperty(exports, 'getProjectInstallCommand', {
336
+ enumerable: true,
337
+ get: function () {
338
+ return getProjectInstallCommand;
339
+ }
340
+ });
269
341
  Object.defineProperty(exports, 'getProjectRootDirectory', {
270
342
  enumerable: true,
271
343
  get: function () {
@@ -278,12 +350,24 @@ Object.defineProperty(exports, 'isESM', {
278
350
  return isESM;
279
351
  }
280
352
  });
353
+ Object.defineProperty(exports, 'loadPackageJson', {
354
+ enumerable: true,
355
+ get: function () {
356
+ return loadPackageJson;
357
+ }
358
+ });
281
359
  Object.defineProperty(exports, 'makeOutputDirFor', {
282
360
  enumerable: true,
283
361
  get: function () {
284
362
  return makeOutputDirFor;
285
363
  }
286
364
  });
365
+ Object.defineProperty(exports, 'mergePackageJsonDependencies', {
366
+ enumerable: true,
367
+ get: function () {
368
+ return mergePackageJsonDependencies;
369
+ }
370
+ });
287
371
  Object.defineProperty(exports, 'parseCommerceAppConfig', {
288
372
  enumerable: true,
289
373
  get: function () {
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- const require_chunk = require('./chunk-Cozy-1ZF.cjs');
15
+ const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
16
16
  let util = require("util");
17
- util = require_chunk.__toESM(util, 1);
17
+ util = require_rolldown_runtime.__toESM(util, 1);
18
18
 
19
19
  //#region ../../packages-private/common-utils/source/logging.ts
20
20
  /**
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_management = require('../management-Dehz9qSJ.cjs');
16
+ const require_management = require('../management-B9ItB80R.cjs');
17
17
 
18
18
  exports.createInitialInstallationState = require_management.createInitialInstallationState;
19
19
  exports.createInitialUninstallationState = require_management.createInitialUninstallationState;
@@ -12,5 +12,5 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { $ as StepContextFactory, A as ExecutionStatus, B as isCompletedState, C as executeUninstallWorkflow, D as StepFailedEvent, E as StepEvent, F as InstallationRetryMetadata, G as BranchStep, H as isInProgressState, I as InstallationState, J as InferStepOutput, K as BranchStepOptions, L as InstallationStatus, M as InProgressInstallationState, N as InstallationData, O as StepStartedEvent, P as InstallationError, Q as Step, R as StepStatus, S as createRetryState, T as InstallationHooks, U as isSucceededState, V as isFailedState, W as AnyStep, X as LeafStep, Y as InstallationContext, Z as LeafStepOptions, _ as ValidationSummary, a as RunValidationOptions, at as ValidationIssueSeverity, b as ExecuteWorkflowOptions, c as runInstallation, ct as isBranchStep, d as CustomInstallationStepDefinition, et as StepMeta, f as CustomInstallationStepHandler, g as ValidationResult, h as ValidateStepTreeOptions, i as RunUninstallationOptions, it as ValidationIssue, j as FailedInstallationState, k as StepSucceededEvent, l as runUninstallation, lt as isLeafStep, m as StepValidationResult, n as CreateInitialUninstallationStateOptions, nt as ValidationContext, o as createInitialInstallationState, ot as defineBranchStep, p as defineCustomInstallationStep, q as ExecutionContext, r as RunInstallationOptions, rt as ValidationExecutionContext, s as createInitialUninstallationState, st as defineLeafStep, t as CreateInitialInstallationStateOptions, tt as StepMetaInfo, u as runValidation, v as validateStepTree, w as executeWorkflow, x as createInitialState, y as CreateInitialStateOptions, z as SucceededInstallationState } from "../index-B5gJ-q4U.cjs";
15
+ import { $ as StepContextFactory, A as ExecutionStatus, B as isCompletedState, C as executeUninstallWorkflow, D as StepFailedEvent, E as StepEvent, F as InstallationRetryMetadata, G as BranchStep, H as isInProgressState, I as InstallationState, J as InferStepOutput, K as BranchStepOptions, L as InstallationStatus, M as InProgressInstallationState, N as InstallationData, O as StepStartedEvent, P as InstallationError, Q as Step, R as StepStatus, S as createRetryState, T as InstallationHooks, U as isSucceededState, V as isFailedState, W as AnyStep, X as LeafStep, Y as InstallationContext, Z as LeafStepOptions, _ as ValidationSummary, a as RunValidationOptions, at as ValidationIssueSeverity, b as ExecuteWorkflowOptions, c as runInstallation, ct as isBranchStep, d as CustomInstallationStepDefinition, et as StepMeta, f as CustomInstallationStepHandler, g as ValidationResult, h as ValidateStepTreeOptions, i as RunUninstallationOptions, it as ValidationIssue, j as FailedInstallationState, k as StepSucceededEvent, l as runUninstallation, lt as isLeafStep, m as StepValidationResult, n as CreateInitialUninstallationStateOptions, nt as ValidationContext, o as createInitialInstallationState, ot as defineBranchStep, p as defineCustomInstallationStep, q as ExecutionContext, r as RunInstallationOptions, rt as ValidationExecutionContext, s as createInitialUninstallationState, st as defineLeafStep, t as CreateInitialInstallationStateOptions, tt as StepMetaInfo, u as runValidation, v as validateStepTree, w as executeWorkflow, x as createInitialState, y as CreateInitialStateOptions, z as SucceededInstallationState } from "../index-CzReNwbF.cjs";
16
16
  export { type AnyStep, type BranchStep, type BranchStepOptions, type CreateInitialInstallationStateOptions, type CreateInitialStateOptions, type CreateInitialUninstallationStateOptions, type CustomInstallationStepDefinition, type CustomInstallationStepHandler, type ExecuteWorkflowOptions, type ExecutionContext, type ExecutionStatus, type FailedInstallationState, type InProgressInstallationState, type InferStepOutput, type InstallationContext, type InstallationData, type InstallationError, type InstallationHooks, type InstallationRetryMetadata, type InstallationState, type InstallationStatus, type LeafStep, type LeafStepOptions, type RunInstallationOptions, type RunUninstallationOptions, type RunValidationOptions, type Step, type StepContextFactory, type StepEvent, type StepFailedEvent, type StepMeta, type StepMetaInfo, type StepStartedEvent, type StepStatus, type StepSucceededEvent, type StepValidationResult, type SucceededInstallationState, type ValidateStepTreeOptions, type ValidationContext, type ValidationExecutionContext, type ValidationIssue, type ValidationIssueSeverity, type ValidationResult, type ValidationSummary, createInitialInstallationState, type createInitialState, createInitialUninstallationState, type createRetryState, type defineBranchStep, defineCustomInstallationStep, type defineLeafStep, type executeUninstallWorkflow, type executeWorkflow, type isBranchStep, isCompletedState, isFailedState, isInProgressState, type isLeafStep, isSucceededState, runInstallation, runUninstallation, runValidation, type validateStepTree };