@speedkit/cli 4.44.0-beta.1 → 4.44.0-beta.2

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 (25) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/services/bundler/bundle-service-factory.d.ts +1 -3
  3. package/dist/services/bundler/bundle-service-factory.js +3 -6
  4. package/dist/services/bundler/packjockel-service.d.ts +24 -22
  5. package/dist/services/bundler/packjockel-service.js +53 -68
  6. package/dist/services/bundler/spec/packjockel-service.spec.js +39 -45
  7. package/dist/services/cli/cli-environment.js +0 -1
  8. package/dist/services/cli/cli-settings.d.ts +0 -5
  9. package/dist/services/cli/cli-settings.js +0 -1
  10. package/dist/services/deploy/deploy-service-factory.js +1 -1
  11. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +1 -1
  12. package/dist/services/document-handler-runtime/document-handler-runtime-model.d.ts +0 -2
  13. package/dist/services/document-handler-runtime/document-handler-runtime-model.js +0 -2
  14. package/dist/services/document-handler-runtime/document-handler-server.js +8 -8
  15. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +1 -1
  16. package/dist/services/integration-api/integration-api-factory.js +1 -1
  17. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +2 -4
  18. package/dist/services/integration-api/struct/customer-config.d.ts +16 -3
  19. package/dist/services/integration-api/struct/customer-config.js +28 -6
  20. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +2 -2
  21. package/dist/services/integration-api/struct/speed-kit-config-file.js +1 -4
  22. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +1 -5
  23. package/dist/services/onboarding/onboarding-service-factory.js +1 -1
  24. package/oclif.manifest.json +1 -1
  25. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.44.0-beta.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.44.0-beta.1...v4.44.0-beta.2) (2026-10-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * **bundler:** follow packjockel 3.0.0 and run it through binaryPath() ([200ae27](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/200ae276087eee79d4791652ff712eb0cd0237fb))
7
+
1
8
  # [4.44.0-beta.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.43.0...v4.44.0-beta.1) (2026-10-09)
2
9
 
3
10
 
@@ -1,11 +1,9 @@
1
1
  import { BundleService } from "./bundle-service.js";
2
2
  export declare class BundleServiceFactory {
3
3
  private customerFolder?;
4
- private packjockelPath;
5
4
  /**
6
5
  * @param customerFolder the directory bundled code resolves its own imports from
7
- * @param packjockelPath the `PACKJOCKEL_PATH` setting; empty means the installed npm package
8
6
  */
9
- constructor(customerFolder?: string, packjockelPath?: string);
7
+ constructor(customerFolder?: string);
10
8
  buildService(): BundleService;
11
9
  }
@@ -1,17 +1,14 @@
1
1
  import { BundleService } from "./bundle-service.js";
2
- import { PackjockelService, resolvePackjockelBinary, } from "./packjockel-service.js";
2
+ import { PackjockelService } from "./packjockel-service.js";
3
3
  export class BundleServiceFactory {
4
4
  customerFolder;
5
- packjockelPath;
6
5
  /**
7
6
  * @param customerFolder the directory bundled code resolves its own imports from
8
- * @param packjockelPath the `PACKJOCKEL_PATH` setting; empty means the installed npm package
9
7
  */
10
- constructor(customerFolder, packjockelPath = "") {
8
+ constructor(customerFolder) {
11
9
  this.customerFolder = customerFolder;
12
- this.packjockelPath = packjockelPath;
13
10
  }
14
11
  buildService() {
15
- return new BundleService(this.customerFolder, new PackjockelService(resolvePackjockelBinary(this.packjockelPath)));
12
+ return new BundleService(this.customerFolder, new PackjockelService());
16
13
  }
17
14
  }
@@ -1,39 +1,36 @@
1
1
  /**
2
- * The packjockel binary to run.
3
- *
4
- * `@speedkit/packjockel` installs one package per platform, `@speedkit/packjockel-<platform>-<arch>`.
5
- * The CLI runs its binary directly, not the `bin` script of the meta package, which would start a
6
- * second node process for every bundle.
7
- *
8
- * @param configured the `PACKJOCKEL_PATH` setting; empty means the npm package, else the `PATH`
9
- * @param resolve resolves a module path, for tests
10
- */
11
- export declare function resolvePackjockelBinary(configured: string, resolve?: (request: string) => string): string;
12
- /**
13
- * The base path of the `speed-kit-config` imports for a pinned plugin release.
14
- *
15
- * @param configPluginsVersion a version such as `1.8.0`, or a channel such as `@release`;
16
- * empty means the `release` channel
2
+ * The tags of the Speed Kit assets that packjockel bundles, each a version such as `1.8.0` or a channel
3
+ * such as `@release`. packjockel takes `latest` for a tag that is not set. The names are the client
4
+ * config keys of packjockel.
17
5
  */
18
- export declare function speedKitConfigBasePath(configPluginsVersion?: string): string;
6
+ export interface AssetVersions {
7
+ /** Speed Kit: snippet, service worker and dynamic fetcher */
8
+ speedKitVersion?: string;
9
+ rumPluginVersion?: string;
10
+ /** predictive preloading */
11
+ ppVersion?: string;
12
+ configPluginsVersion?: string;
13
+ documentHandlerVersion?: string;
14
+ }
19
15
  export interface PackjockelBundleRequest {
20
16
  /** The entry points by file name, in output order. */
21
17
  entryPoints: Record<string, string>;
22
- basePaths?: Record<string, string>;
18
+ versions?: AssetVersions;
23
19
  define?: Record<string, string>;
24
20
  platform?: "browser" | "node";
25
21
  target?: "es5" | "es6";
26
22
  minify?: boolean;
27
23
  }
28
24
  export interface PackjockelDocumentHandlerRequest {
29
- documentHandler: string;
25
+ /** The document handler library; without it packjockel bundles the published one of `documentHandlerVersion`. */
26
+ documentHandler?: string;
30
27
  documentHandlerConfig: string;
31
28
  speedKitConfig: string;
32
29
  appName: string;
33
30
  dynamicFetcher?: string;
34
31
  dynamicFetcherConfig?: string;
35
32
  customStyle?: string;
36
- basePaths?: Record<string, string>;
33
+ versions?: AssetVersions;
37
34
  }
38
35
  /**
39
36
  * Bundles with the packjockel binary in embedded mode, so no packjockel server is needed.
@@ -42,11 +39,12 @@ export interface PackjockelDocumentHandlerRequest {
42
39
  * command line argument.
43
40
  */
44
41
  export declare class PackjockelService {
45
- private readonly binaryPath;
42
+ private readonly resolveBinary;
46
43
  /**
47
- * @param binaryPath the packjockel binary, a path or a command on the `PATH`
44
+ * @param resolveBinary returns the packjockel binary; it runs only when a bundle is needed, so
45
+ * a platform without a packjockel package fails only for the `configPlugins` feature
48
46
  */
49
- constructor(binaryPath: string);
47
+ constructor(resolveBinary?: () => string);
50
48
  /**
51
49
  * Bundles the entry points in their order into one script. packjockel puts a script before them
52
50
  * which exposes the `SpeedKit` global.
@@ -66,5 +64,9 @@ export declare class PackjockelService {
66
64
  * @param buildArgs writes the inputs into the directory and returns the arguments that read them
67
65
  */
68
66
  private run;
67
+ /**
68
+ * Runs the binary without stdin: packjockel reads a piped stdin as the document handler, and only
69
+ * without input it bundles the published one.
70
+ */
69
71
  private execute;
70
72
  }
@@ -1,50 +1,16 @@
1
- import { execFile } from "node:child_process";
2
- import { createRequire } from "node:module";
1
+ import { spawn } from "node:child_process";
3
2
  import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
4
3
  import { tmpdir } from "node:os";
5
4
  import { join } from "node:path";
6
- import { promisify } from "node:util";
5
+ import { binaryPath } from "@speedkit/packjockel";
7
6
  import { PackjockelError } from "./error/packjockel-error.js";
8
- const execFileAsync = promisify(execFile);
9
- /** The binary on the `PATH`, when no npm package of packjockel is installed. */
10
- const PACKJOCKEL_ON_PATH = "packjockel";
11
- /**
12
- * The packjockel binary to run.
13
- *
14
- * `@speedkit/packjockel` installs one package per platform, `@speedkit/packjockel-<platform>-<arch>`.
15
- * The CLI runs its binary directly, not the `bin` script of the meta package, which would start a
16
- * second node process for every bundle.
17
- *
18
- * @param configured the `PACKJOCKEL_PATH` setting; empty means the npm package, else the `PATH`
19
- * @param resolve resolves a module path, for tests
20
- */
21
- export function resolvePackjockelBinary(configured, resolve = createRequire(import.meta.url).resolve) {
22
- if (configured) {
23
- return configured;
24
- }
25
- const executable = process.platform === "win32" ? "packjockel.exe" : "packjockel";
26
- try {
27
- return resolve(`@speedkit/packjockel-${process.platform}-${process.arch}/bin/${executable}`);
28
- }
29
- catch {
30
- return PACKJOCKEL_ON_PATH;
31
- }
32
- }
33
- /** Where speed-kit-config publishes its plugins, one folder per version and channel. */
34
- const SPEED_KIT_CONFIG_URL = "https://www.baqend.com/speed-kit-config/";
35
- /** The channel the plugins in the `export` format are published to. */
36
- const DEFAULT_CONFIG_PLUGINS_CHANNEL = "release";
37
- /**
38
- * The base path of the `speed-kit-config` imports for a pinned plugin release.
39
- *
40
- * @param configPluginsVersion a version such as `1.8.0`, or a channel such as `@release`;
41
- * empty means the `release` channel
42
- */
43
- export function speedKitConfigBasePath(configPluginsVersion) {
44
- const folder = configPluginsVersion?.trim().replace(/^@/, "") ||
45
- DEFAULT_CONFIG_PLUGINS_CHANNEL;
46
- return `${SPEED_KIT_CONFIG_URL}${folder}/`;
47
- }
7
+ const VERSION_FLAGS = {
8
+ speedKitVersion: "--speed-kit-version",
9
+ rumPluginVersion: "--rum-plugin-version",
10
+ ppVersion: "--pp-version",
11
+ configPluginsVersion: "--config-plugins-version",
12
+ documentHandlerVersion: "--document-handler-version",
13
+ };
48
14
  /**
49
15
  * Bundles with the packjockel binary in embedded mode, so no packjockel server is needed.
50
16
  *
@@ -52,12 +18,13 @@ export function speedKitConfigBasePath(configPluginsVersion) {
52
18
  * command line argument.
53
19
  */
54
20
  export class PackjockelService {
55
- binaryPath;
21
+ resolveBinary;
56
22
  /**
57
- * @param binaryPath the packjockel binary, a path or a command on the `PATH`
23
+ * @param resolveBinary returns the packjockel binary; it runs only when a bundle is needed, so
24
+ * a platform without a packjockel package fails only for the `configPlugins` feature
58
25
  */
59
- constructor(binaryPath) {
60
- this.binaryPath = binaryPath;
26
+ constructor(resolveBinary = binaryPath) {
27
+ this.resolveBinary = resolveBinary;
61
28
  }
62
29
  /**
63
30
  * Bundles the entry points in their order into one script. packjockel puts a script before them
@@ -81,7 +48,7 @@ export class PackjockelService {
81
48
  args.push(await writeInput(directory, name, code));
82
49
  }
83
50
  return args;
84
- }, request.basePaths);
51
+ }, request.versions);
85
52
  }
86
53
  /**
87
54
  * Bundles a document handler with its config, the embedded Speed Kit config and the default `post`.
@@ -90,14 +57,11 @@ export class PackjockelService {
90
57
  */
91
58
  async bundleDocumentHandler(request) {
92
59
  return this.run(async (directory) => {
93
- const args = [
94
- "bundle",
95
- "document-handler",
96
- await writeInput(directory, "DocumentHandler.js", request.documentHandler),
97
- `--document-handler-config=${await writeInput(directory, "documentHandlerConfig.js", request.documentHandlerConfig)}`,
98
- `--speed-kit-config=${await writeInput(directory, "speedKitConfig.js", request.speedKitConfig)}`,
99
- `--app-name=${request.appName}`,
100
- ];
60
+ const args = ["bundle", "document-handler"];
61
+ if (request.documentHandler !== undefined) {
62
+ args.push(await writeInput(directory, "DocumentHandler.js", request.documentHandler));
63
+ }
64
+ args.push(`--document-handler-config=${await writeInput(directory, "documentHandlerConfig.js", request.documentHandlerConfig)}`, `--speed-kit-config=${await writeInput(directory, "speedKitConfig.js", request.speedKitConfig)}`, `--app-name=${request.appName}`);
101
65
  const optional = {
102
66
  "dynamic-fetcher": ["dynamicFetcher.js", request.dynamicFetcher],
103
67
  "dynamic-fetcher-config": [
@@ -112,20 +76,20 @@ export class PackjockelService {
112
76
  }
113
77
  }
114
78
  return args;
115
- }, request.basePaths);
79
+ }, request.versions);
116
80
  }
117
81
  /**
118
82
  * Runs packjockel in a scratch directory, which is removed afterwards.
119
83
  *
120
84
  * @param buildArgs writes the inputs into the directory and returns the arguments that read them
121
85
  */
122
- async run(buildArgs, basePaths = {}) {
86
+ async run(buildArgs, versions = {}) {
123
87
  const directory = await mkdtemp(join(tmpdir(), "sk-packjockel-"));
124
88
  try {
125
89
  const output = join(directory, "out.js");
126
90
  const args = [
127
91
  ...(await buildArgs(directory)),
128
- ...keyValueFlags("--base-path", basePaths),
92
+ ...versionFlags(versions),
129
93
  "--embedded",
130
94
  `--output=${output}`,
131
95
  ];
@@ -136,19 +100,34 @@ export class PackjockelService {
136
100
  await rm(directory, { recursive: true, force: true });
137
101
  }
138
102
  }
139
- async execute(args) {
103
+ /**
104
+ * Runs the binary without stdin: packjockel reads a piped stdin as the document handler, and only
105
+ * without input it bundles the published one.
106
+ */
107
+ execute(args) {
108
+ let binary;
140
109
  try {
141
- await execFileAsync(this.binaryPath, args, {
142
- maxBuffer: 64 * 1024 * 1024,
143
- });
110
+ binary = this.resolveBinary();
144
111
  }
145
112
  catch (error) {
146
- const failure = error;
147
- if (failure.code === "ENOENT") {
148
- throw new PackjockelError(`packjockel not found at "${this.binaryPath}". Install @speedkit/packjockel or set PACKJOCKEL_PATH to the packjockel binary.`);
149
- }
150
- throw new PackjockelError(`packjockel failed: ${withoutLogLines(failure.stderr) || failure.message}`);
113
+ return Promise.reject(new PackjockelError(error.message));
151
114
  }
115
+ return new Promise((resolve, reject) => {
116
+ const child = spawn(binary, args, {
117
+ stdio: ["ignore", "ignore", "pipe"],
118
+ });
119
+ let stderr = "";
120
+ child.stderr.on("data", (chunk) => (stderr += chunk));
121
+ child.on("error", (error) => reject(new PackjockelError(`packjockel failed: ${error.message}`)));
122
+ child.on("close", (code) => {
123
+ if (code === 0) {
124
+ resolve();
125
+ }
126
+ else {
127
+ reject(new PackjockelError(`packjockel failed: ${withoutLogLines(stderr) || `exit code ${code}`}`));
128
+ }
129
+ });
130
+ });
152
131
  }
153
132
  }
154
133
  /** Writes one input into the scratch directory and returns the `file://` value that reads it. */
@@ -157,6 +136,12 @@ async function writeInput(directory, name, content) {
157
136
  await writeFile(path, content);
158
137
  return `file://${path}`;
159
138
  }
139
+ /** The flags of the tags that are set. */
140
+ function versionFlags(versions) {
141
+ return Object.entries(VERSION_FLAGS)
142
+ .filter(([key]) => versions[key])
143
+ .map(([key, flag]) => `${flag}=${versions[key]}`);
144
+ }
160
145
  function keyValueFlags(flag, values = {}) {
161
146
  return Object.entries(values).map(([key, value]) => `${flag}=${key}=${value}`);
162
147
  }
@@ -1,15 +1,19 @@
1
1
  import { expect } from "chai";
2
2
  import { afterEach, beforeEach, describe, it } from "mocha";
3
3
  import { chmod, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
4
+ import { existsSync } from "node:fs";
4
5
  import { tmpdir } from "node:os";
5
6
  import { join } from "node:path";
6
- import { PackjockelService, resolvePackjockelBinary, speedKitConfigBasePath, } from "../packjockel-service.js";
7
+ import { PackjockelService } from "../packjockel-service.js";
7
8
  import { PackjockelError } from "../error/packjockel-error.js";
8
9
  /**
9
- * A packjockel stand-in: it records its arguments and the content of every `file://` input,
10
- * and writes a fixed bundle to `--output`.
10
+ * A packjockel stand-in: it records its arguments, the content of every `file://` input and a
11
+ * piped stdin, and writes a fixed bundle to `--output`.
11
12
  */
12
13
  const FAKE_PACKJOCKEL = `#!/bin/sh
14
+ if [ -p /dev/stdin ] || [ -f /dev/stdin ]; then
15
+ echo "piped" > "$RECORD_DIR/stdin"
16
+ fi
13
17
  out=""
14
18
  for arg in "$@"; do
15
19
  echo "$arg" >> "$RECORD_DIR/args"
@@ -37,7 +41,7 @@ describe("PackjockelService", () => {
37
41
  await writeFile(binary, FAKE_PACKJOCKEL);
38
42
  await chmod(binary, 0o755);
39
43
  process.env.RECORD_DIR = directory;
40
- service = new PackjockelService(binary);
44
+ service = new PackjockelService(() => binary);
41
45
  });
42
46
  afterEach(async () => {
43
47
  delete process.env.RECORD_DIR;
@@ -56,9 +60,7 @@ describe("PackjockelService", () => {
56
60
  it("should bundle the entry points in their order", async () => {
57
61
  const bundle = await service.bundle({
58
62
  entryPoints: { "rum.js": "rum()", "config.js": "SpeedKit.config = {}" },
59
- basePaths: {
60
- "speed-kit-config": "https://cdn/speed-kit-config/release/",
61
- },
63
+ versions: { configPluginsVersion: "@release", rumPluginVersion: "" },
62
64
  define: { APP: '"shop"' },
63
65
  platform: "browser",
64
66
  });
@@ -71,7 +73,8 @@ describe("PackjockelService", () => {
71
73
  "--target=es5",
72
74
  '--define=APP="shop"',
73
75
  ]);
74
- expect(args).to.include("--base-path=speed-kit-config=https://cdn/speed-kit-config/release/");
76
+ expect(args).to.include("--config-plugins-version=@release");
77
+ expect(args.filter((arg) => arg.endsWith("-version=")), "a tag that is not set is left to packjockel").to.deep.equal([]);
75
78
  expect(args).to.include("--embedded");
76
79
  expect(inputs).to.deep.equal([
77
80
  "rum.js: rum()",
@@ -97,6 +100,29 @@ describe("PackjockelService", () => {
97
100
  "dynamicFetcherConfig.js: window.dynamicBlockConfig = {}",
98
101
  ]);
99
102
  });
103
+ it("should leave the document handler to packjockel without one", async () => {
104
+ await service.bundleDocumentHandler({
105
+ documentHandlerConfig: "export default new DomDocumentHandler()",
106
+ speedKitConfig: "SpeedKit.config = {}",
107
+ appName: "shop",
108
+ versions: {
109
+ documentHandlerVersion: "1.8.0",
110
+ speedKitVersion: "2.22.4",
111
+ rumPluginVersion: "@release",
112
+ },
113
+ });
114
+ const { args, inputs } = await recorded();
115
+ expect(args.slice(0, 2)).to.deep.equal(["bundle", "document-handler"]);
116
+ expect(args[2], "no handler argument").to.match(/^--document-handler-config=/);
117
+ expect(args).to.include("--document-handler-version=1.8.0");
118
+ expect(args).to.include("--speed-kit-version=2.22.4");
119
+ expect(args).to.include("--rum-plugin-version=@release");
120
+ expect(existsSync(join(directory, "stdin")), "packjockel reads a piped stdin as the handler").to.equal(false);
121
+ expect(inputs).to.deep.equal([
122
+ "documentHandlerConfig.js: export default new DomDocumentHandler()",
123
+ "speedKitConfig.js: SpeedKit.config = {}",
124
+ ]);
125
+ });
100
126
  it("should report the error of packjockel without its log lines", async () => {
101
127
  process.env.FAIL = "1";
102
128
  const failure = await service
@@ -105,45 +131,13 @@ describe("PackjockelService", () => {
105
131
  expect(failure).to.be.instanceOf(PackjockelError);
106
132
  expect(failure.message).to.equal("packjockel failed: invalid bundle: could not resolve x");
107
133
  });
108
- it("should say how to set the binary when it is missing", async () => {
109
- const failure = await new PackjockelService(join(directory, "missing"))
134
+ it("should report a platform without a packjockel package", async () => {
135
+ const failure = await new PackjockelService(() => {
136
+ throw new Error("packjockel: @speedkit/packjockel-aix-ppc64 is not installed.");
137
+ })
110
138
  .bundle({ entryPoints: { "config.js": "x" } })
111
139
  .catch((error) => error);
112
140
  expect(failure).to.be.instanceOf(PackjockelError);
113
- expect(failure.message).to.contain("PACKJOCKEL_PATH");
114
- });
115
- });
116
- describe("speedKitConfigBasePath", () => {
117
- it("should use the release channel by default", () => {
118
- expect(speedKitConfigBasePath()).to.equal("https://www.baqend.com/speed-kit-config/release/");
119
- });
120
- it("should read a channel with or without its @", () => {
121
- expect(speedKitConfigBasePath("@latest")).to.equal("https://www.baqend.com/speed-kit-config/latest/");
122
- expect(speedKitConfigBasePath("latest")).to.equal("https://www.baqend.com/speed-kit-config/latest/");
123
- });
124
- it("should read a version", () => {
125
- expect(speedKitConfigBasePath("1.8.0")).to.equal("https://www.baqend.com/speed-kit-config/1.8.0/");
126
- });
127
- });
128
- describe("resolvePackjockelBinary", () => {
129
- const executable = process.platform === "win32" ? "packjockel.exe" : "packjockel";
130
- it("should use the configured binary", () => {
131
- expect(resolvePackjockelBinary("/opt/packjockel")).to.equal("/opt/packjockel");
132
- });
133
- it("should use the binary of the platform package", () => {
134
- const requests = [];
135
- const binary = resolvePackjockelBinary("", (request) => {
136
- requests.push(request);
137
- return `/node_modules/${request}`;
138
- });
139
- const request = `@speedkit/packjockel-${process.platform}-${process.arch}/bin/${executable}`;
140
- expect(requests).to.deep.equal([request]);
141
- expect(binary).to.equal(`/node_modules/${request}`);
142
- });
143
- it("should fall back to the PATH without the package", () => {
144
- const binary = resolvePackjockelBinary("", () => {
145
- throw new Error("Cannot find module");
146
- });
147
- expect(binary).to.equal("packjockel");
141
+ expect(failure.message).to.contain("is not installed");
148
142
  });
149
143
  });
@@ -16,7 +16,6 @@ const environmentMapping = {
16
16
  ideaDirectory: "IDEA_INITIAL_DIRECTORY",
17
17
  slackToken: "SLACK_TOKEN",
18
18
  testApp: "TEST_APP",
19
- packjockelPath: "PACKJOCKEL_PATH",
20
19
  };
21
20
  const CONFIG_FILE_NAME = "config.json";
22
21
  /** Variables CI providers set besides `CI`. */
@@ -24,11 +24,6 @@ export interface CliSettings {
24
24
  ideaDirectory: string;
25
25
  slackToken: string;
26
26
  testApp: string;
27
- /**
28
- * the packjockel binary, run for customers with the `configPlugins` feature; empty means the one of
29
- * the installed `@speedkit/packjockel` package
30
- */
31
- packjockelPath: string;
32
27
  browserChannel: string;
33
28
  browserBuildId: string;
34
29
  browserAutoUpdate: boolean;
@@ -11,7 +11,6 @@ export function defaultSettings() {
11
11
  ideaDirectory: "",
12
12
  slackToken: "",
13
13
  testApp: "",
14
- packjockelPath: "",
15
14
  browserChannel: "",
16
15
  browserBuildId: "",
17
16
  browserAutoUpdate: false,
@@ -60,7 +60,7 @@ export default class DeployServiceFactory {
60
60
  })).getService();
61
61
  const policy = this.policyOverride ?? new InteractiveDeployPolicy(cliService);
62
62
  const installResourceBuilder = new InstallResourceBuilder(configApi);
63
- const bundler = new BundleServiceFactory("./", this.context.environment.settings.packjockelPath).buildService();
63
+ const bundler = new BundleServiceFactory("./").buildService();
64
64
  const deletedFilesChecker = new DeletedFileCheck(cliService, policy, this.context.hasArtifacts);
65
65
  this.service = new DeployService(files, [
66
66
  new CustomerConfigHandler(customer, configApi, configName, diffService, cliService, installResourceBuilder, policy),
@@ -63,6 +63,6 @@ export class MergeRequestDeployServiceFactory {
63
63
  whitelist: [],
64
64
  }))
65
65
  .buildService()
66
- .run()), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy, new BundleServiceFactory("./", this.context.environment.settings.packjockelPath).buildService()), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
66
+ .run()), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy, new BundleServiceFactory("./").buildService()), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
67
67
  }
68
68
  }
@@ -4,6 +4,4 @@ export declare const LOCAL_DYNAMIC_FETCHER = "custom_dynamicFetcher";
4
4
  export declare const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
5
5
  export declare const LOCAL_STYLES = "config_dynamicStyles";
6
6
  export declare const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
7
- /** Where the imports of the latest dynamic fetcher resolve. */
8
- export declare const DYNAMIC_FETCHER_BASE_PATH = "https://www.baqend.com/speed-kit/latest/";
9
7
  export declare const LOCAL_TRIGGERED_BY = "STREAM:QA";
@@ -4,8 +4,6 @@ export const LOCAL_DYNAMIC_FETCHER = "custom_dynamicFetcher";
4
4
  export const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
5
5
  export const LOCAL_STYLES = "config_dynamicStyles";
6
6
  export const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
7
- /** Where the imports of the latest dynamic fetcher resolve. */
8
- export const DYNAMIC_FETCHER_BASE_PATH = "https://www.baqend.com/speed-kit/latest/";
9
7
  // Local runs have no persistent cache, so an origin HTML is served straight to the developer and may
10
8
  // legitimately be older than the default five minutes. STREAM:QA relaxes the document handler's
11
9
  // Shopify staleness check to one hour, see ONE_HOUR_STALENESS_TRIGGERS in document-handler.
@@ -1,8 +1,7 @@
1
- import { DYNAMIC_FETCHER_BASE_PATH, LATEST_DYNAMIC_FETCHER_URL, LOCAL_DOCUMENT_HANDLER, LOCAL_DOCUMENT_HANDLER_CONFIG, LOCAL_DYNAMIC_FETCHER, LOCAL_DYNAMIC_FETCHER_CONFIG, LOCAL_STYLES, } from "./document-handler-runtime-model.js";
1
+ import { LATEST_DYNAMIC_FETCHER_URL, LOCAL_DOCUMENT_HANDLER, LOCAL_DOCUMENT_HANDLER_CONFIG, LOCAL_DYNAMIC_FETCHER, LOCAL_DYNAMIC_FETCHER_CONFIG, LOCAL_STYLES, } from "./document-handler-runtime-model.js";
2
2
  import RequiredFileNotFoundError from "./error/required-file-not-found-error.js";
3
3
  import DatabaseMock from "./templates/database-mock.js";
4
4
  import * as vm from "node:vm";
5
- import { speedKitConfigBasePath, } from "../bundler/index.js";
6
5
  import { usesConfigPlugins, } from "../integration-api/index.js";
7
6
  import { INTEGRATION_FILES } from "../../models/files.js";
8
7
  // documentHandlerDependencies
@@ -140,8 +139,12 @@ export class DocumentHandlerServer {
140
139
  * deploys a customer with the `configPlugins` feature.
141
140
  */
142
141
  async bundleWithPackjockel() {
142
+ const customDocumentHandler = this.files.getByName(INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER);
143
143
  return this.bundler.packjockel.bundleDocumentHandler({
144
- documentHandler: await this.getDocumentHandler(),
144
+ // Without a custom one, packjockel bundles the published handler of documentHandlerVersion.
145
+ documentHandler: customDocumentHandler?.path
146
+ ? await this.getDocumentHandler()
147
+ : undefined,
145
148
  documentHandlerConfig: this.deactivateReleaseAndDeploymentDetection(),
146
149
  speedKitConfig: this.files
147
150
  .getByName(INTEGRATION_FILES.CONFIG.SPEED_KIT)
@@ -150,10 +153,7 @@ export class DocumentHandlerServer {
150
153
  dynamicFetcher: await this.getDynamicFetcherSource(),
151
154
  dynamicFetcherConfig: await this.getDynamicFetcherConfig(),
152
155
  customStyle: this.getStyles(),
153
- basePaths: {
154
- "speed-kit-config": speedKitConfigBasePath(this.customerConfig.configPluginsVersion),
155
- "dynamic-fetcher": DYNAMIC_FETCHER_BASE_PATH,
156
- },
156
+ versions: this.customerConfig,
157
157
  });
158
158
  }
159
159
  deactivateReleaseAndDeploymentDetection() {
@@ -169,7 +169,7 @@ export class DocumentHandlerServer {
169
169
  }
170
170
  async getDynamicFetcher() {
171
171
  if (!this.files.hasFile(LOCAL_DYNAMIC_FETCHER)) {
172
- return await this.bundleDynamicFetcher({ "dynamic-fetcher": DYNAMIC_FETCHER_BASE_PATH }, await this.getDynamicFetcherSource());
172
+ return await this.bundleDynamicFetcher({ "dynamic-fetcher": "https://www.baqend.com/speed-kit/latest/" }, await this.getDynamicFetcherSource());
173
173
  }
174
174
  return this.getDynamicFetcherSource();
175
175
  }
@@ -25,7 +25,7 @@ export default class DocumentHandlerRuntimeServiceFactory {
25
25
  const customerConfig = this.getCustomerConfig(files);
26
26
  const cliService = this.context.environment.cli;
27
27
  await this.installAdditionalDependencies(customerConfig, cliService);
28
- const bundler = new BundleServiceFactory(this.context.customerPath, this.context.environment.settings.packjockelPath).buildService();
28
+ const bundler = new BundleServiceFactory(this.context.customerPath).buildService();
29
29
  // the non-prompting lookup: the document handler runs with a session when
30
30
  // there is one and without when there is not, so it must not stop the
31
31
  // command at a login prompt to find out
@@ -30,7 +30,7 @@ export class IntegrationApiFactory {
30
30
  const virtualFileHandler = new VirtualFileHandler(cli);
31
31
  this.service = new IntegrationApiService(fileReader, virtualFileHandler, new MandatoryFilesValidator(), [
32
32
  new CustomerConfigHandler(fileReader, cli, new CustomerConfigValidator(), this.context.configName, this.context.environment.settings.testApp, this.context.useTestConfig ?? false),
33
- new InstallResourceHandler(fileReader, new BundleServiceFactory("./", this.context.environment.settings.packjockelPath).buildService()),
33
+ new InstallResourceHandler(fileReader, new BundleServiceFactory("./").buildService()),
34
34
  new ServerConfigHandler(fileReader),
35
35
  new ModuleHandler(fileReader),
36
36
  ], new FileWriter(fs, this.context.basePath), this.whitelist.length === 0);
@@ -143,15 +143,13 @@ describe("SpeedKitConfigFile", () => {
143
143
  }, new BundleService("./", packjockel));
144
144
  return { file, packjockel };
145
145
  }
146
- it("should bundle with packjockel and its plugins of the pinned release", async () => {
146
+ it("should bundle with packjockel and the tags of the customer", async () => {
147
147
  const { file, packjockel } = embeddedFile(`SpeedKit.config = {};`);
148
148
  await file.evaluate(EMBEDDED, "https://www.shop.de");
149
149
  expect(packjockel.requests).to.have.length(1);
150
150
  expect(packjockel.requests[0]).to.deep.equal({
151
151
  entryPoints: { "config.js": SOURCE },
152
- basePaths: {
153
- "speed-kit-config": "https://www.baqend.com/speed-kit-config/release/",
154
- },
152
+ versions: EMBEDDED,
155
153
  define: { APP: '"shop-de"' },
156
154
  platform: "browser",
157
155
  });
@@ -1,3 +1,4 @@
1
+ import type { AssetVersions } from "../../bundler/index.js";
1
2
  /**
2
3
  * The installation features of a config. `null` leaves a feature at its default.
3
4
  */
@@ -35,10 +36,22 @@ export declare class CustomerConfig {
35
36
  readonly needsCustomerApproval?: boolean;
36
37
  readonly features?: CustomerFeatures;
37
38
  /**
38
- * The speed-kit-config release the packjockel bundles import plugins from: a version such as
39
- * `1.8.0`, or a channel such as `@release`.
39
+ * The tag of Speed Kit (snippet, service worker, dynamic fetcher) for the `configPlugins` feature: a
40
+ * version such as `2.22.4`, or a channel such as `@release`; `latest` when not set. This and the other
41
+ * tags are named like the client config keys of packjockel.
40
42
  */
43
+ readonly speedKitVersion?: string;
44
+ /** The tag of RUM for the `configPlugins` feature, see {@link speedKitVersion}. */
45
+ readonly rumPluginVersion?: string;
46
+ /** The tag of predictive preloading for the `configPlugins` feature, see {@link speedKitVersion}. */
47
+ readonly ppVersion?: string;
48
+ /** The tag of the speed-kit-config plugins for the `configPlugins` feature, see {@link speedKitVersion}. */
41
49
  readonly configPluginsVersion?: string;
42
- constructor(app: string, origins: string[], domain: string, swPath: string, scope: string, appDomain?: string, installPath?: string, installParameters?: string, name?: string, forceInstall?: boolean, chromeFlags?: string[], dependencies?: Record<string, string>, needsCustomerApproval?: boolean, features?: CustomerFeatures, configPluginsVersion?: string);
50
+ /**
51
+ * The tag of the published document handler for the `configPlugins` feature, see {@link speedKitVersion}.
52
+ * A `custom_documentHandler.js` replaces it.
53
+ */
54
+ readonly documentHandlerVersion?: string;
55
+ constructor(app: string, origins: string[], domain: string, swPath: string, scope: string, appDomain?: string, installPath?: string, installParameters?: string, name?: string, forceInstall?: boolean, chromeFlags?: string[], dependencies?: Record<string, string>, needsCustomerApproval?: boolean, features?: CustomerFeatures, versions?: AssetVersions);
43
56
  static createFrom(configFile: Partial<CustomerConfig>, configName?: string): CustomerConfig;
44
57
  }
@@ -20,11 +20,23 @@ export class CustomerConfig {
20
20
  needsCustomerApproval;
21
21
  features;
22
22
  /**
23
- * The speed-kit-config release the packjockel bundles import plugins from: a version such as
24
- * `1.8.0`, or a channel such as `@release`.
23
+ * The tag of Speed Kit (snippet, service worker, dynamic fetcher) for the `configPlugins` feature: a
24
+ * version such as `2.22.4`, or a channel such as `@release`; `latest` when not set. This and the other
25
+ * tags are named like the client config keys of packjockel.
25
26
  */
27
+ speedKitVersion;
28
+ /** The tag of RUM for the `configPlugins` feature, see {@link speedKitVersion}. */
29
+ rumPluginVersion;
30
+ /** The tag of predictive preloading for the `configPlugins` feature, see {@link speedKitVersion}. */
31
+ ppVersion;
32
+ /** The tag of the speed-kit-config plugins for the `configPlugins` feature, see {@link speedKitVersion}. */
26
33
  configPluginsVersion;
27
- constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies, needsCustomerApproval, features, configPluginsVersion) {
34
+ /**
35
+ * The tag of the published document handler for the `configPlugins` feature, see {@link speedKitVersion}.
36
+ * A `custom_documentHandler.js` replaces it.
37
+ */
38
+ documentHandlerVersion;
39
+ constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies, needsCustomerApproval, features, versions = {}) {
28
40
  this.app = app;
29
41
  this.origins = origins;
30
42
  this.domain = domain;
@@ -39,12 +51,22 @@ export class CustomerConfig {
39
51
  this.dependencies = dependencies;
40
52
  this.needsCustomerApproval = needsCustomerApproval;
41
53
  this.features = features;
42
- this.configPluginsVersion = configPluginsVersion;
54
+ this.speedKitVersion = versions.speedKitVersion;
55
+ this.rumPluginVersion = versions.rumPluginVersion;
56
+ this.ppVersion = versions.ppVersion;
57
+ this.configPluginsVersion = versions.configPluginsVersion;
58
+ this.documentHandlerVersion = versions.documentHandlerVersion;
43
59
  }
44
60
  static createFrom(configFile, configName) {
45
- const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, needsCustomerApproval, features, configPluginsVersion, } = configFile;
61
+ const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, needsCustomerApproval, features, speedKitVersion, rumPluginVersion, ppVersion, configPluginsVersion, documentHandlerVersion, } = configFile;
46
62
  return new CustomerConfig(new RequiredParameter("app", app).isString().getValue(), new RequiredParameter("origins", origins).isArray().getValue(), domain, new RequiredParameter("swPath", swPath).isString().getValue(), new RequiredParameter("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
47
- `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || false, chromeFlags, dependencies || {}, needsCustomerApproval || false, features || {}, configPluginsVersion);
63
+ `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || false, chromeFlags, dependencies || {}, needsCustomerApproval || false, features || {}, {
64
+ speedKitVersion,
65
+ rumPluginVersion,
66
+ ppVersion,
67
+ configPluginsVersion,
68
+ documentHandlerVersion,
69
+ });
48
70
  }
49
71
  }
50
72
  class RequiredParameter {
@@ -1,10 +1,10 @@
1
- import { type BundleService } from "../../bundler/index.js";
1
+ import type { AssetVersions, BundleService } from "../../bundler/index.js";
2
2
  import type { SpeedKitConfigInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model.js";
3
3
  import { InstallResourceFile } from "./install-resource-file.js";
4
4
  import { SpeedKitConfig } from "./speed-kit-config.js";
5
5
  import type { CustomerConfig } from "./customer-config.js";
6
6
  /** What of the customer config decides how a Speed Kit config is bundled and read. */
7
- export type SpeedKitConfigCustomer = Pick<CustomerConfig, "app" | "features" | "configPluginsVersion">;
7
+ export type SpeedKitConfigCustomer = Pick<CustomerConfig, "app" | "features"> & AssetVersions;
8
8
  /** The name the config deployed to the app is read back under. */
9
9
  export declare const REMOTE_SPEED_KIT_CONFIG = "config_SpeedKit@remote";
10
10
  /** The file a {@link SpeedKitConfigFile} stands for. */
@@ -1,5 +1,4 @@
1
1
  import * as vm from "node:vm";
2
- import { speedKitConfigBasePath, } from "../../bundler/index.js";
3
2
  import { EvaluateSkConfigError } from "../error/evaluate-sk-config-error.js";
4
3
  import ApplicationError from "../../error-handling/error/application-error.js";
5
4
  import { StaticRecipe } from "../virtual/static-recipe.js";
@@ -231,9 +230,7 @@ async function bundle(bundler, content, customer) {
231
230
  if (usesConfigPlugins(customer)) {
232
231
  return bundler.packjockel.bundle({
233
232
  entryPoints: { "config.js": content },
234
- basePaths: {
235
- "speed-kit-config": speedKitConfigBasePath(customer.configPluginsVersion),
236
- },
233
+ versions: customer,
237
234
  define: { APP: JSON.stringify(app) },
238
235
  platform: "browser",
239
236
  });
@@ -1,4 +1,3 @@
1
- import { speedKitConfigBasePath } from "../../bundler/index.js";
2
1
  import { usesConfigPlugins, } from "../../integration-api/index.js";
3
2
  import { INTEGRATION_FILES } from "../../../models/files.js";
4
3
  const IMPORT_PATHS = {
@@ -43,10 +42,7 @@ export class SpeedKitInstallContext {
43
42
  if (configPlugins) {
44
43
  return this.bundler.packjockel.bundle({
45
44
  entryPoints,
46
- basePaths: {
47
- ...IMPORT_PATHS,
48
- "speed-kit-config": speedKitConfigBasePath(this.customerConfig.configPluginsVersion),
49
- },
45
+ versions: this.customerConfig,
50
46
  define: { APP: JSON.stringify(this.customerConfig.app) },
51
47
  platform: "browser",
52
48
  });
@@ -230,7 +230,7 @@ export class OnboardingServiceFactory {
230
230
  customerPath: this.context.customerPath,
231
231
  verboseLevel: this.context.verboseLevel,
232
232
  }), files).buildDocumentHandlerServer();
233
- const bundler = new BundleServiceFactory(this.context.customerPath, this.context.environment.settings.packjockelPath).buildService();
233
+ const bundler = new BundleServiceFactory(this.context.customerPath).buildService();
234
234
  const skTemplate = new InstallSpeedKitJsTemplate();
235
235
  const speedKitInstallContext = new SpeedKitInstallContext(customerConfig, this.context.configName, files, bundler, skTemplate);
236
236
  await this.buildInstallResource(speedKitInstallContext, files, cli);
@@ -1788,5 +1788,5 @@
1788
1788
  ]
1789
1789
  }
1790
1790
  },
1791
- "version": "4.44.0-beta.1"
1791
+ "version": "4.44.0-beta.2"
1792
1792
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "4.44.0-beta.1",
4
+ "version": "4.44.0-beta.2",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"
@@ -110,7 +110,7 @@
110
110
  "@oclif/plugin-help": "^6.2.45",
111
111
  "@oclif/plugin-not-found": "^3.2.81",
112
112
  "@oclif/plugin-warn-if-update-available": "^3.1.61",
113
- "@speedkit/packjockel": "2.0.0-beta",
113
+ "@speedkit/packjockel": "3.0.0",
114
114
  "@speedkit/rules": "^1.3.0-0",
115
115
  "baqend": "^4.2.5",
116
116
  "chalk": "^5.6.2",