@speedkit/cli 4.50.3 → 4.50.4
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/CHANGELOG.md +7 -0
- package/dist/services/origin-request/asset-variations.d.ts +1 -1
- package/dist/services/origin-request/asset-variations.js +3 -1
- package/dist/services/origin-request/origin-request-service-factory.js +2 -6
- package/dist/services/origin-request/spec/asset-variations.spec.js +9 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.50.4](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.50.3...v4.50.4) (2026-11-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **origin-request:** run without configured variations and map desktop to default ([1d7306d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1d7306d79cc6ef0c1acaeeb2b7017d2488448322))
|
|
7
|
+
|
|
1
8
|
## [4.50.3](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.50.2...v4.50.3) (2026-11-02)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -56,7 +56,7 @@ export declare class UndefinedVariationError extends Error {
|
|
|
56
56
|
* Resolves which variation configs apply, in server order. The template path returns
|
|
57
57
|
* `[wildcard, template]` and skips the device defaults; otherwise `[default, wildcard, named]`.
|
|
58
58
|
*/
|
|
59
|
-
export declare function getVariations(custom: AssetVariationMap,
|
|
59
|
+
export declare function getVariations(custom: AssetVariationMap, requestedType?: string): AssetVariation[];
|
|
60
60
|
/** What a request is resolved against besides the variations. */
|
|
61
61
|
export interface ResolveOptions {
|
|
62
62
|
/** A Host header for every request, as `--host` sends it. */
|
|
@@ -77,7 +77,9 @@ function applyTemplate(entry, variationType) {
|
|
|
77
77
|
* Resolves which variation configs apply, in server order. The template path returns
|
|
78
78
|
* `[wildcard, template]` and skips the device defaults; otherwise `[default, wildcard, named]`.
|
|
79
79
|
*/
|
|
80
|
-
export function getVariations(custom,
|
|
80
|
+
export function getVariations(custom, requestedType) {
|
|
81
|
+
// The client sends `desktop` as `default`, so the server never sees it.
|
|
82
|
+
const variationType = requestedType?.toLowerCase() === "desktop" ? DEFAULT_TYPE : requestedType;
|
|
81
83
|
const entries = Object.entries(custom ?? {}).map(([key, entry]) => ({
|
|
82
84
|
...entry,
|
|
83
85
|
matchedKey: key,
|
|
@@ -23,13 +23,9 @@ export class OriginRequestServiceFactory {
|
|
|
23
23
|
: undefined;
|
|
24
24
|
// `--json` owns stdout, so the proxy line stays out of a machine-readable run.
|
|
25
25
|
applyOriginProxy(customer?.chromeFlags, this.context.json ? undefined : cli);
|
|
26
|
+
// An empty variation set still runs: device defaults resolve, originMap and authentications apply.
|
|
26
27
|
const config = await this.loadRuntimeConfig(customer?.app);
|
|
27
|
-
|
|
28
|
-
const usable = config && (!customer || Object.keys(config.variations).length > 0);
|
|
29
|
-
if (config && !usable) {
|
|
30
|
-
cli.writeError("the config carries no speedKit.variations — nothing to simulate");
|
|
31
|
-
}
|
|
32
|
-
this.service = new OriginRequestService(this.context, cli, usable
|
|
28
|
+
this.service = new OriginRequestService(this.context, cli, config
|
|
33
29
|
? new OriginFetcher({
|
|
34
30
|
cli,
|
|
35
31
|
config,
|
|
@@ -78,6 +78,15 @@ describe("asset variations", () => {
|
|
|
78
78
|
}, "https://www.example.com/plp?page=2");
|
|
79
79
|
expect(url).to.equal("https://proxy.example.com/?target=https%3A%2F%2Fwww.example.com%2Fplp%3Fpage%3D2&bq=1");
|
|
80
80
|
});
|
|
81
|
+
it("resolves desktop as the default variation, with its configured entry", () => {
|
|
82
|
+
const custom = { default: { headers: { "x-variant": "default" } } };
|
|
83
|
+
expect(getVariations(custom, "desktop")).to.deep.equal(getVariations(custom, "default"));
|
|
84
|
+
});
|
|
85
|
+
it("resolves the device variations without any configured variation", () => {
|
|
86
|
+
for (const type of ["desktop", "default", "mobile", "tablet"]) {
|
|
87
|
+
expect(() => getVariations({}, type)).not.to.throw();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
81
90
|
it("reports an unknown variation instead of guessing", () => {
|
|
82
91
|
expect(() => getVariations({}, "b2b-unknown")).to.throw(UndefinedVariationError);
|
|
83
92
|
});
|
package/oclif.manifest.json
CHANGED