@speedkit/cli 4.31.0 → 4.32.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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/services/onboarding/empty-service-worker.d.ts +8 -0
- package/dist/services/onboarding/empty-service-worker.js +17 -0
- package/dist/services/onboarding/empty-service-worker.spec.d.ts +1 -0
- package/dist/services/onboarding/empty-service-worker.spec.js +22 -0
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +3 -2
- package/dist/services/onboarding/onboarding-service.js +2 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [4.32.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.31.0...v4.32.0) (2026-09-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **onboarding:** recognize r=empty as the empty service worker ([d37d0c7](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d37d0c74ae536aa8697101ddc053073164d40547))
|
|
7
|
+
|
|
1
8
|
# [4.31.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.30.0...v4.31.0) (2026-09-22)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether a service worker script URL asks for the empty worker that the snippet installs on
|
|
3
|
+
* each disabled scope.
|
|
4
|
+
*
|
|
5
|
+
* `r=empty` carries the marker in the reference parameter, so it survives an edge that forwards only
|
|
6
|
+
* the query parameters it expects. `empty=1` is the marker older snippets register, and stays valid.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isEmptyServiceWorkerUrl(url: string): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether a service worker script URL asks for the empty worker that the snippet installs on
|
|
3
|
+
* each disabled scope.
|
|
4
|
+
*
|
|
5
|
+
* `r=empty` carries the marker in the reference parameter, so it survives an edge that forwards only
|
|
6
|
+
* the query parameters it expects. `empty=1` is the marker older snippets register, and stays valid.
|
|
7
|
+
*/
|
|
8
|
+
export function isEmptyServiceWorkerUrl(url) {
|
|
9
|
+
let params;
|
|
10
|
+
try {
|
|
11
|
+
params = new URL(url).searchParams;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return params.get("r") === "empty" || params.get("empty") === "1";
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { isEmptyServiceWorkerUrl } from "./empty-service-worker.js";
|
|
4
|
+
describe("isEmptyServiceWorkerUrl", () => {
|
|
5
|
+
it("recognizes the r=empty marker", () => {
|
|
6
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js?r=empty")).to.equal(true);
|
|
7
|
+
});
|
|
8
|
+
it("still recognizes the empty=1 marker older snippets register", () => {
|
|
9
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js?empty=1")).to.equal(true);
|
|
10
|
+
});
|
|
11
|
+
it("is false for the real worker, which carries a config reference", () => {
|
|
12
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js?r=6993efd7&v=2.22.3&gr=A")).to.equal(false);
|
|
13
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js")).to.equal(false);
|
|
14
|
+
});
|
|
15
|
+
it("is false for other values of the marker parameters", () => {
|
|
16
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js?empty=0")).to.equal(false);
|
|
17
|
+
expect(isEmptyServiceWorkerUrl("https://www.example.com/wrapper-sw.js?r=emptyish")).to.equal(false);
|
|
18
|
+
});
|
|
19
|
+
it("is false for a string that is not a URL", () => {
|
|
20
|
+
expect(isEmptyServiceWorkerUrl("not a url")).to.equal(false);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaqendResponse } from "../browser/baqend-response.js";
|
|
2
|
+
import { isEmptyServiceWorkerUrl } from "../empty-service-worker.js";
|
|
2
3
|
/**
|
|
3
4
|
* Intercepts request to /wrapper-sw.js
|
|
4
5
|
*
|
|
@@ -20,10 +21,10 @@ export class CustomerServiceWorkerJs {
|
|
|
20
21
|
this.customerConfig = customerConfig;
|
|
21
22
|
}
|
|
22
23
|
async handle(event) {
|
|
23
|
-
// When the SW is registered
|
|
24
|
+
// When the SW is registered for a disabled scope, the caller wants a no-op
|
|
24
25
|
// service worker on that scope — serve an empty script instead of the
|
|
25
26
|
// skonboarding wrapper that imports Speed Kit's sw.js.
|
|
26
|
-
if (
|
|
27
|
+
if (isEmptyServiceWorkerUrl(event.request.url)) {
|
|
27
28
|
return new BaqendResponse("// skonboarding empty sw", "text/javascript; charset=utf-8");
|
|
28
29
|
}
|
|
29
30
|
const wrapperSwCode = `importScripts(\`https://${this.customerConfig.appDomain}/v1/speedkit/sw.js\${location.search}\`); // skonboarding`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import puppeteerExtra from "puppeteer-extra";
|
|
2
2
|
import { BROWSER_EVENTS, CDP_SESSION, } from "./onboarding-model.js";
|
|
3
3
|
import { safe } from "../../helpers/safe.js";
|
|
4
|
+
import { isEmptyServiceWorkerUrl } from "./empty-service-worker.js";
|
|
4
5
|
// A SW version activating later than this after the last locally served sw.js
|
|
5
6
|
// cannot originate from our interception — it is a deployed-build takeover.
|
|
6
7
|
const LOCAL_SW_SERVE_GRACE_MS = 10_000;
|
|
@@ -179,7 +180,7 @@ export class OnboardingService {
|
|
|
179
180
|
if (!version.scriptURL.includes(this.customerConfig.swPath)) {
|
|
180
181
|
return false;
|
|
181
182
|
}
|
|
182
|
-
if (version.scriptURL
|
|
183
|
+
if (isEmptyServiceWorkerUrl(version.scriptURL)) {
|
|
183
184
|
return false;
|
|
184
185
|
}
|
|
185
186
|
// Activation events repeat per version (runningStatus changes) — handle each version once.
|
package/oclif.manifest.json
CHANGED