@salesforce/storefront-next-dev 1.4.1-alpha.0 → 1.5.0-alpha.1
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/README.md +6 -0
- 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-DM8l6IcE.js} +12 -12
- package/dist/audit/ui/index.html +2 -2
- package/dist/audit.js +5 -4
- package/dist/catalog.js +1 -1
- package/dist/commands/audit/catalog.js +3 -2
- package/dist/commands/audit/finalize.js +6 -5
- package/dist/commands/audit/prepare.js +8 -4
- package/dist/commands/audit/progress.js +3 -3
- package/dist/commands/audit/serve.js +4 -1
- package/dist/commands/deploy-cartridge.js +24 -8
- package/dist/commands/push.js +34 -6
- package/dist/events.js +3 -511
- package/dist/flags2.js +150 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/mrt/ssr.mjs +4 -4
- package/dist/mrt/ssr.mjs.map +1 -1
- package/dist/mrt/streamingHandler.mjs +11 -11
- package/dist/mrt/streamingHandler.mjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/results.js +718 -0
- package/dist/server.js +30 -1
- package/dist/server2.js +2 -3
- package/package.json +4 -3
- package/dist/assets.js +0 -25
- package/dist/sanitize.js +0 -185
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-DM8l6IcE.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
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as VERSION, a as evidenceSchema, b as sanitizeUrl, c as validateAuditResult, d as validateWaterfall, g as runIdFor, h as runDir, i as evaluationSchema, l as validateEvidence, n as SEVERITY_ORDER, o as parsePrepared, p as latestRunDir, r as auditResultSchema, t as LIGHTHOUSE_REPORT, u as validateRecommendations, v as sanitizeJsonValue, x as AUDIT_ROOT, y as sanitizeText } from "./results.js";
|
|
2
2
|
import { n as discoverCatalog, t as defaultCategoriesDir } from "./catalog.js";
|
|
3
3
|
import { i as perfFromSummary } from "./measured-run.js";
|
|
4
|
-
import { n as sanitizeText, r as sanitizeUrl, t as sanitizeJsonValue } from "./sanitize.js";
|
|
5
4
|
import { i as BUNDLE_VISUALIZER, n as BUNDLE_DIR, o as bundleAnalysisSchema, r as BUNDLE_SCHEMA_VERSION, t as BUNDLE_ANALYSIS } from "./schema.js";
|
|
6
|
-
import {
|
|
5
|
+
import { i as latestRunEvents, o as readEvents, t as appendEvent } from "./events.js";
|
|
7
6
|
import { a as parseRouterManifest, i as parseChunk, n as lexerReady, o as parseVisualizerHtml, r as moduleIdResolver, t as readLivePage } from "./live.js";
|
|
8
7
|
import { createRequire } from "node:module";
|
|
9
8
|
import { promisify } from "node:util";
|
|
@@ -246,7 +245,9 @@ async function collectWithPlayhouse(playhouse, target, outputCwd, runs = 1) {
|
|
|
246
245
|
target.url,
|
|
247
246
|
"--json",
|
|
248
247
|
"--runs",
|
|
249
|
-
String(runs)
|
|
248
|
+
String(runs),
|
|
249
|
+
"--retry-pattern-html",
|
|
250
|
+
"a^"
|
|
250
251
|
], outputCwd));
|
|
251
252
|
if (!ajv.validate(contract.describe.outputs.runResult, resultInput)) throw new Error(`Playhouse run result failed its describe schema: ${ajv.errorsText()}`);
|
|
252
253
|
const result = runResultSchema.parse(resultInput);
|
package/dist/catalog.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "../../package.js";
|
|
2
2
|
import { r as commonFlags } from "../../flags.js";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../results.js";
|
|
4
4
|
import { n as discoverCatalog, t as defaultCategoriesDir } from "../../catalog.js";
|
|
5
|
-
import "../../
|
|
5
|
+
import "../../schema.js";
|
|
6
6
|
import { i as AuditCommand, t as text } from "../../flags2.js";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/audit/catalog.ts
|
|
9
9
|
var Catalog = class Catalog extends AuditCommand {
|
|
10
10
|
static hidden = true;
|
|
11
|
+
static reportsUsage = false;
|
|
11
12
|
static summary = "Inspect the discovered category and rule catalog";
|
|
12
13
|
static examples = ["<%= config.bin %> <%= command.id %>"];
|
|
13
14
|
static flags = {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "../../package.js";
|
|
2
2
|
import { r as commonFlags } from "../../flags.js";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../results.js";
|
|
4
4
|
import "../../catalog.js";
|
|
5
5
|
import "../../measured-run.js";
|
|
6
6
|
import { n as finalize } from "../../audit.js";
|
|
7
|
-
import "../../sanitize.js";
|
|
8
7
|
import "../../schema.js";
|
|
9
8
|
import "../../events.js";
|
|
10
9
|
import "../../live.js";
|
|
11
|
-
import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
|
|
10
|
+
import { a as finalizedAttributes, i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
|
|
12
11
|
|
|
13
12
|
//#region src/commands/audit/finalize.ts
|
|
14
13
|
var Finalize = class Finalize extends AuditCommand {
|
|
@@ -30,11 +29,13 @@ var Finalize = class Finalize extends AuditCommand {
|
|
|
30
29
|
};
|
|
31
30
|
async run() {
|
|
32
31
|
const { flags } = await this.parse(Finalize);
|
|
33
|
-
|
|
32
|
+
const resultPath = await finalize({
|
|
34
33
|
workspace: workspaceFor(flags),
|
|
35
34
|
categories: flags.categories,
|
|
36
35
|
events: flags.events
|
|
37
|
-
})
|
|
36
|
+
});
|
|
37
|
+
await this.track("AUDIT_FINALIZED", () => finalizedAttributes(resultPath));
|
|
38
|
+
this.log(resultPath);
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "../../package.js";
|
|
2
2
|
import { n as PROJECT_DIRECTORY_FLAG, r as commonFlags } from "../../flags.js";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../results.js";
|
|
4
4
|
import "../../catalog.js";
|
|
5
5
|
import "../../measured-run.js";
|
|
6
6
|
import { r as prepare } from "../../audit.js";
|
|
7
|
-
import "../../sanitize.js";
|
|
8
7
|
import "../../schema.js";
|
|
9
8
|
import "../../events.js";
|
|
10
9
|
import "../../live.js";
|
|
11
|
-
import { i as AuditCommand, t as text } from "../../flags2.js";
|
|
10
|
+
import { i as AuditCommand, o as preparedAttributes, t as text } from "../../flags2.js";
|
|
12
11
|
import { Flags } from "@oclif/core";
|
|
13
12
|
|
|
14
13
|
//#region src/commands/audit/prepare.ts
|
|
@@ -65,7 +64,7 @@ var Prepare = class Prepare extends AuditCommand {
|
|
|
65
64
|
};
|
|
66
65
|
async run() {
|
|
67
66
|
const { flags } = await this.parse(Prepare);
|
|
68
|
-
|
|
67
|
+
const preparedPath = await prepare({
|
|
69
68
|
urls: flags.url,
|
|
70
69
|
archives: flags.archive,
|
|
71
70
|
expectedPages: flags["expected-page"],
|
|
@@ -76,7 +75,12 @@ var Prepare = class Prepare extends AuditCommand {
|
|
|
76
75
|
categories: flags.categories,
|
|
77
76
|
events: flags.events,
|
|
78
77
|
build: flags.build
|
|
78
|
+
});
|
|
79
|
+
await this.track("AUDIT_PREPARED", () => preparedAttributes(preparedPath, {
|
|
80
|
+
runs: flags.runs,
|
|
81
|
+
build: flags.build
|
|
79
82
|
}));
|
|
83
|
+
this.log(preparedPath);
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import "../../package.js";
|
|
2
2
|
import { r as commonFlags } from "../../flags.js";
|
|
3
|
-
import "../../
|
|
3
|
+
import { p as latestRunDir } from "../../results.js";
|
|
4
4
|
import "../../catalog.js";
|
|
5
5
|
import "../../measured-run.js";
|
|
6
6
|
import { t as eventsFileFor } from "../../audit.js";
|
|
7
|
-
import "../../sanitize.js";
|
|
8
7
|
import "../../schema.js";
|
|
9
|
-
import { a as progressEventSchema, t as appendEvent
|
|
8
|
+
import { a as progressEventSchema, t as appendEvent } from "../../events.js";
|
|
10
9
|
import "../../live.js";
|
|
11
10
|
import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
|
|
12
11
|
import path from "node:path";
|
|
@@ -15,6 +14,7 @@ import { mkdir } from "node:fs/promises";
|
|
|
15
14
|
//#region src/commands/audit/progress.ts
|
|
16
15
|
var Progress = class Progress extends AuditCommand {
|
|
17
16
|
static hidden = true;
|
|
17
|
+
static reportsUsage = false;
|
|
18
18
|
static summary = "Append one live-progress event to the run event log";
|
|
19
19
|
static examples = ["<%= config.bin %> <%= command.id %> --event '{\"type\":\"log\",\"level\":\"info\",\"message\":\"Checking SEO rules\"}'"];
|
|
20
20
|
static flags = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import "../../package.js";
|
|
1
2
|
import { r as commonFlags } from "../../flags.js";
|
|
2
|
-
import "../../
|
|
3
|
+
import "../../results.js";
|
|
4
|
+
import "../../schema.js";
|
|
3
5
|
import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
|
|
4
6
|
import { Flags } from "@oclif/core";
|
|
5
7
|
import path from "node:path";
|
|
@@ -8,6 +10,7 @@ import { spawn } from "node:child_process";
|
|
|
8
10
|
//#region src/commands/audit/serve.ts
|
|
9
11
|
var Serve = class Serve extends AuditCommand {
|
|
10
12
|
static hidden = true;
|
|
13
|
+
static reportsUsage = false;
|
|
11
14
|
static summary = "Serve the dashboard for a finalized audit-result.json or a live run";
|
|
12
15
|
static examples = ["<%= config.bin %> <%= command.id %> -d ./my-storefront --no-open"];
|
|
13
16
|
static flags = {
|
|
@@ -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}`);
|