@salesforce/storefront-next-dev 1.4.1-alpha.0 → 1.5.0-alpha.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/audit/catalog/categories/best-practices/rules/deferred-ui.js +575 -0
- package/dist/audit/catalog/categories/best-practices/rules/deferred-ui.md +20 -0
- package/dist/audit/catalog/categories/performance/rules/font-display.js +248 -0
- package/dist/audit/catalog/categories/performance/rules/font-display.md +21 -0
- package/dist/audit/ui/assets/{index-BKCWlO9b.css → index-CtE_JUcs.css} +1 -1
- package/dist/audit/ui/assets/{index-CUPt8e4A.js → index-aSdbHIeq.js} +12 -12
- package/dist/audit/ui/index.html +2 -2
- package/dist/audit.js +3 -1
- package/dist/commands/deploy-cartridge.js +24 -8
- package/dist/commands/push.js +34 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mrt/ssr.mjs +50 -50
- package/dist/mrt/ssr.mjs.map +1 -1
- package/dist/mrt/streamingHandler.mjs +56 -56
- package/dist/mrt/streamingHandler.mjs.map +1 -1
- package/dist/package.js +1 -1
- package/package.json +4 -3
package/dist/audit/ui/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Site Audit</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-aSdbHIeq.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CtE_JUcs.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/dist/audit.js
CHANGED
|
@@ -246,7 +246,9 @@ async function collectWithPlayhouse(playhouse, target, outputCwd, runs = 1) {
|
|
|
246
246
|
target.url,
|
|
247
247
|
"--json",
|
|
248
248
|
"--runs",
|
|
249
|
-
String(runs)
|
|
249
|
+
String(runs),
|
|
250
|
+
"--retry-pattern-html",
|
|
251
|
+
"a^"
|
|
250
252
|
], outputCwd));
|
|
251
253
|
if (!ajv.validate(contract.describe.outputs.runResult, resultInput)) throw new Error(`Playhouse run result failed its describe schema: ${ajv.errorsText()}`);
|
|
252
254
|
const result = runResultSchema.parse(resultInput);
|
|
@@ -3,7 +3,7 @@ import { Flags } from "@oclif/core";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
5
|
import { CartridgeCommand } from "@salesforce/b2c-tooling-sdk/cli";
|
|
6
|
-
import {
|
|
6
|
+
import { deleteCartridges, reloadCodeVersion, uploadCartridges } from "@salesforce/b2c-tooling-sdk/operations/code";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/deploy-cartridge.ts
|
|
9
9
|
/**
|
|
@@ -18,10 +18,23 @@ import { createScriptsBackend, deleteCartridges, reloadCodeVersion, uploadCartri
|
|
|
18
18
|
* Additional flags:
|
|
19
19
|
* - --delete: Delete existing cartridges before upload
|
|
20
20
|
* - --reload/-r: Reload (re-activate) code version after deploy (requires OAuth)
|
|
21
|
+
* - --cartridge-ignore-dirs: Directory names to skip inside cartridges, replacing the SDK default
|
|
22
|
+
* (node_modules, .git, coverage, .cache, tmp, temp)
|
|
23
|
+
*
|
|
24
|
+
* Environment variables:
|
|
25
|
+
* - SFCC_CARTRIDGE_IGNORE_DIRS (optional): comma-separated equivalent of --cartridge-ignore-dirs,
|
|
26
|
+
* e.g. `node_modules,.git`. Also settable as `cartridge-ignore-dirs` in dw.json.
|
|
27
|
+
* - SFCC_DEFAULT_CLIENT (optional): `true` is equivalent to --default-client (inherited from the SDK),
|
|
28
|
+
* which ignores any configured API client and uses browser sign-in.
|
|
29
|
+
*
|
|
30
|
+
* With only a server configured (no WebDAV access key or API client), or with --default-client,
|
|
31
|
+
* uploads sign in to Account Manager in a browser and the user's Business Manager role authorizes
|
|
32
|
+
* WebDAV access. --default-client cannot be combined with --reload, which needs an API client.
|
|
21
33
|
*
|
|
22
34
|
* Code version discovery and reload use SCAPI (scopes `sfcc.scripts` / `sfcc.scripts.rw`) when
|
|
23
35
|
* SFCC_SHORTCODE and SFCC_TENANT_ID are set with client-credentials auth, falling back to OCAPI.
|
|
24
36
|
* Override with --api-backend (env: SFCC_API_BACKEND): auto (default), scapi, or ocapi.
|
|
37
|
+
* Without an API client, the active code version is read over WebDAV; reload still needs one.
|
|
25
38
|
*/
|
|
26
39
|
var Deploy = class Deploy extends CartridgeCommand {
|
|
27
40
|
static description = "Deploy cartridges to B2C Commerce Cloud instance";
|
|
@@ -46,12 +59,18 @@ var Deploy = class Deploy extends CartridgeCommand {
|
|
|
46
59
|
delete: Flags.boolean({
|
|
47
60
|
description: "Delete existing cartridges before upload",
|
|
48
61
|
default: false
|
|
62
|
+
}),
|
|
63
|
+
"cartridge-ignore-dirs": Flags.string({
|
|
64
|
+
description: "Directory names to skip inside cartridges, replacing the default list (node_modules,.git,coverage,.cache,tmp,temp); pass an empty value to skip nothing (env: SFCC_CARTRIDGE_IGNORE_DIRS)",
|
|
65
|
+
multiple: true,
|
|
66
|
+
multipleNonGreedy: true,
|
|
67
|
+
delimiter: ","
|
|
49
68
|
})
|
|
50
69
|
};
|
|
51
70
|
_scriptsBackend;
|
|
52
|
-
/** SCAPI-first code version backend with OCAPI fallback, honoring --api-backend. */
|
|
71
|
+
/** SCAPI-first code version backend with OCAPI fallback (or WebDAV without an API client), honoring --api-backend. */
|
|
53
72
|
get scriptsBackend() {
|
|
54
|
-
this._scriptsBackend ??= createScriptsBackend(
|
|
73
|
+
this._scriptsBackend ??= this.createScriptsBackend();
|
|
55
74
|
return this._scriptsBackend;
|
|
56
75
|
}
|
|
57
76
|
async run() {
|
|
@@ -68,10 +87,7 @@ var Deploy = class Deploy extends CartridgeCommand {
|
|
|
68
87
|
this.requireServer();
|
|
69
88
|
this.requireWebDavCredentials();
|
|
70
89
|
let version = this.resolvedConfig.values.codeVersion;
|
|
71
|
-
if (
|
|
72
|
-
const reason = version ? "The --reload flag requires OAuth credentials to reload the code version via SCAPI or OCAPI." : "No code version specified. OAuth credentials are required to auto-discover the active code version.";
|
|
73
|
-
this.error(`${reason}\n\nProvide --code-version to use basic auth only, or configure OAuth credentials (--client-id and --client-secret).`);
|
|
74
|
-
}
|
|
90
|
+
if (flags.reload && !this.hasOAuthCredentials()) this.error("The --reload flag requires OAuth credentials to reload the code version via SCAPI or OCAPI.\n\nDeploy without --reload to use WebDAV only, or configure OAuth credentials (--client-id and --client-secret).");
|
|
75
91
|
if (!version) {
|
|
76
92
|
this.warn("No code version specified, discovering active code version...");
|
|
77
93
|
let activeVersion;
|
|
@@ -96,7 +112,7 @@ var Deploy = class Deploy extends CartridgeCommand {
|
|
|
96
112
|
this.log("Deleting existing cartridges...");
|
|
97
113
|
await deleteCartridges(this.instance, cartridges);
|
|
98
114
|
}
|
|
99
|
-
await uploadCartridges(this.instance, cartridges);
|
|
115
|
+
await uploadCartridges(this.instance, cartridges, { ignoreDirs: this.resolvedConfig.values.cartridgeIgnoreDirs });
|
|
100
116
|
if (flags.reload) try {
|
|
101
117
|
await reloadCodeVersion(this.scriptsBackend, version);
|
|
102
118
|
this.log("Code version reloaded.");
|
package/dist/commands/push.js
CHANGED
|
@@ -12,7 +12,7 @@ import { Flags } from "@oclif/core";
|
|
|
12
12
|
import path from "path";
|
|
13
13
|
import fs from "fs-extra";
|
|
14
14
|
import { MrtCommand } from "@salesforce/b2c-tooling-sdk/cli";
|
|
15
|
-
import { uploadCartridges } from "@salesforce/b2c-tooling-sdk/operations/code";
|
|
15
|
+
import { createScriptsBackend, uploadCartridges } from "@salesforce/b2c-tooling-sdk/operations/code";
|
|
16
16
|
import { createBundleV2, createDeploymentScapi, mrtScapiUnavailableMessage, runMrtWithFallback, uploadBundle, uploadBundleScapi, waitForDeploymentScapi, waitForEnv } from "@salesforce/b2c-tooling-sdk/operations/mrt";
|
|
17
17
|
import { DEFAULT_MRT_ORIGIN, createMrtClient } from "@salesforce/b2c-tooling-sdk/clients";
|
|
18
18
|
|
|
@@ -210,6 +210,20 @@ var Push = class Push extends MrtCommand {
|
|
|
210
210
|
}, this.getMrtAuth());
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
|
+
* Whether WebDAV can fall back to an Account Manager browser login (built-in public client)
|
|
214
|
+
* when neither a WebDAV access key nor an API client is configured. Only for interactive
|
|
215
|
+
* terminals, since the login waits for the browser; never in CI.
|
|
216
|
+
*
|
|
217
|
+
* Environment variables:
|
|
218
|
+
* - `CI` (optional): when set (e.g. `true`), disables the browser login.
|
|
219
|
+
* - `SFCC_AUTH_METHODS` (optional): when set, must include `user` (e.g. `basic,user`).
|
|
220
|
+
*/
|
|
221
|
+
canUseBrowserLoginForWebDav() {
|
|
222
|
+
if (!process.stdin.isTTY || process.env.CI) return false;
|
|
223
|
+
const authMethods = this.resolvedConfig.values.authMethods;
|
|
224
|
+
return !authMethods || authMethods.includes("user");
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
213
227
|
* Generate and deploy cartridge metadata to B2C instance.
|
|
214
228
|
* This is a pre-MRT-push step that ensures Page Designer metadata is current.
|
|
215
229
|
*/
|
|
@@ -225,15 +239,29 @@ var Push = class Push extends MrtCommand {
|
|
|
225
239
|
this.warn("B2C instance not configured, skipping cartridge deployment");
|
|
226
240
|
return;
|
|
227
241
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
242
|
+
const browserLogin = this.canUseBrowserLoginForWebDav();
|
|
243
|
+
if (!this.resolvedConfig.hasBasicAuthConfig() && !this.resolvedConfig.hasOAuthConfig()) {
|
|
244
|
+
if (!browserLogin) {
|
|
245
|
+
this.warn("WebDAV credentials not configured, skipping cartridge deployment");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.log("No WebDAV credentials configured, using Account Manager browser sign-in...");
|
|
249
|
+
}
|
|
250
|
+
const instance = this.resolvedConfig.createB2CInstance({ defaultWebDavClient: browserLogin });
|
|
251
|
+
if (!instance.config.codeVersion) {
|
|
252
|
+
const activeVersion = await createScriptsBackend({ instance }).getActiveCodeVersion();
|
|
253
|
+
if (!activeVersion?.id) {
|
|
254
|
+
this.warn("No active code version found, skipping cartridge deployment");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
instance.config.codeVersion = activeVersion.id;
|
|
258
|
+
this.log(`Using active code version "${activeVersion.id}"`);
|
|
231
259
|
}
|
|
232
|
-
await uploadCartridges(
|
|
260
|
+
await uploadCartridges(instance, [{
|
|
233
261
|
name: SFNEXT_BASE_CARTRIDGE_NAME,
|
|
234
262
|
src: path.join(projectDirectory, CARTRIDGES_BASE_DIR, SFNEXT_BASE_CARTRIDGE_NAME),
|
|
235
263
|
dest: SFNEXT_BASE_CARTRIDGE_NAME
|
|
236
|
-
}]);
|
|
264
|
+
}], { ignoreDirs: this.resolvedConfig.values.cartridgeIgnoreDirs });
|
|
237
265
|
this.log("Cartridge deployed successfully!");
|
|
238
266
|
} catch (cartridgeError) {
|
|
239
267
|
this.warn(`Failed to generate or deploy cartridge: ${cartridgeError.message}`);
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugins/pageDesignerPreloadManifest.ts","../src/plugins/staticRegistry.ts","../src/plugins/eventInstrumentationValidator.ts","../src/storefront-next-targets.ts","../src/plugins/transformTargets.ts","../src/plugins/uiTargetDevMode.ts","../src/plugins/hybridProxy.ts","../src/plugins/ecdnMatcher.ts"],"sourcesContent":[],"mappings":";;;;;AI6BgB,UJGC,iCAAA,CIOc;;;;;;;AGuG/B;;;UN3EiB,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA+Be;;;;;AE3DhC;AAkEA;;UD/EiB,mCAAA;;AEGjB;;;;ECHiB;AA4BjB;;;;ECOiB;AAyZjB;;;;ACxUA;;;;;;;AHjHgB,UDUC,2BAAA,CCV+B;;;;ACHhD;AA4BA;;;;ACOA;AAyZA;;;;ACxUA;;;;;;;;;;;;;;;;;;;mBJrEqB;;;;;;;;;kCAUe;;;;;;;;;;;;;;;;;;;;;iBAsBpB,qBAAA,UAA8B,8BAAmC;;;iBC5EjE,gCAAA,CAAA;;;EJGC,cAAA,CAAA,MAAA,EIOc,cJPmB,CAAA,EAAA,IAAA;;;;ICmCjC,GAAA,EAAA,IAAA;;;;;AE5BjB;AAkEA;;;;AC5EA;;;;ACHiB,UAAA,qBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugins/pageDesignerPreloadManifest.ts","../src/plugins/staticRegistry.ts","../src/plugins/eventInstrumentationValidator.ts","../src/storefront-next-targets.ts","../src/plugins/transformTargets.ts","../src/plugins/uiTargetDevMode.ts","../src/plugins/hybridProxy.ts","../src/plugins/ecdnMatcher.ts"],"sourcesContent":[],"mappings":";;;;;AI6BgB,UJGC,iCAAA,CIOc;;;;;;;AGuG/B;;;UN3EiB,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA+Be;;;;;AE3DhC;AAkEA;;UD/EiB,mCAAA;;AEGjB;;;;ECHiB;AA4BjB;;;;ECOiB;AAyZjB;;;;ACxUA;;;;;;;AHjHgB,UDUC,2BAAA,CCV+B;;;;ACHhD;AA4BA;;;;ACOA;AAyZA;;;;ACxUA;;;;;;;;;;;;;;;;;;;mBJrEqB;;;;;;;;;kCAUe;;;;;;;;;;;;;;;;;;;;;iBAsBpB,qBAAA,UAA8B,8BAAmC;;;iBC5EjE,gCAAA,CAAA;;;EJGC,cAAA,CAAA,MAAA,EIOc,cJPmB,CAAA,EAAA,IAAA;;;;ICmCjC,GAAA,EAAA,IAAA;;;;;AE5BjB;AAkEA;;;;AC5EA;;;;ACHiB,UAAA,qBAAA,CAcH;EAcE;;;;ECOC;AAyZjB;;;;ACxUA;;YFtGc;;;;;;;;;;;;;iBAcE,qBAAA,WAAgC,wBAAwB;;;;UCOvD,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyZD,iBAAA,UAA2B,2BAA2B;;;;;;;;;;;;;;;;;;;;;;iBCxUtD,iBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
|
|
|
7
7
|
import { parse } from "@babel/parser";
|
|
8
8
|
import { isArrayPattern, isClassDeclaration, isExportSpecifier, isFunctionDeclaration, isIdentifier, isJSXAttribute, isJSXElement, isJSXFragment, isJSXIdentifier, isMemberExpression, isObjectPattern, isObjectProperty, isRestElement, isVariableDeclaration, jsxClosingElement, jsxClosingFragment, jsxElement, jsxFragment, jsxIdentifier, jsxOpeningElement, jsxOpeningFragment, jsxText } from "@babel/types";
|
|
9
9
|
import { generate } from "@babel/generator";
|
|
10
|
-
import
|
|
10
|
+
import _traverse from "@babel/traverse";
|
|
11
11
|
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
12
12
|
import { glob } from "glob";
|
|
13
13
|
import { Node, Project, ts } from "ts-morph";
|
|
@@ -396,7 +396,7 @@ const patchReactRouterPlugin = () => {
|
|
|
396
396
|
|
|
397
397
|
//#endregion
|
|
398
398
|
//#region src/extensibility/target-utils.ts
|
|
399
|
-
const traverse$1 =
|
|
399
|
+
const traverse$1 = _traverse.default || _traverse;
|
|
400
400
|
const TARGET_COMPONENT_TAG = "UITarget";
|
|
401
401
|
const TARGET_PROVIDERS_TAG = "UITargetProviders";
|
|
402
402
|
const TARGET_ID_ATTRIBUTE = "targetId";
|
|
@@ -1822,7 +1822,7 @@ const workspacePlugin = () => {
|
|
|
1822
1822
|
|
|
1823
1823
|
//#endregion
|
|
1824
1824
|
//#region src/plugins/componentLoaders.ts
|
|
1825
|
-
const traverse =
|
|
1825
|
+
const traverse = _traverse.default || _traverse;
|
|
1826
1826
|
const generate$1 = generate.default || generate;
|
|
1827
1827
|
/**
|
|
1828
1828
|
* Names of exports to strip per environment.
|