@superwall/cli 2.5.0 → 2.5.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 (103) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Dyr7OFBx.js → apple-D2z3tALE.js} +14 -14
  3. package/dist/{approve-Czs1-JO9.js → approve-I-lvTanp.js} +35 -28
  4. package/dist/{assets-BrB9jQPQ.js → assets-oo93EFou.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{session-D3fgXQBt.js → base-Cft9NZfU.js} +35 -35
  8. package/dist/{billing-D5qqIlVb.js → billing-Bo1UEKqV.js} +3 -3
  9. package/dist/{bind-B3eEcRyp.js → bind-BvScWziR.js} +4 -4
  10. package/dist/{build-DD9pSwHX.js → build-Co487gha.js} +11 -9
  11. package/dist/{client-AI9H4GGB.js → client-Tp6iD66_.js} +55 -5
  12. package/dist/create-CHIPz5vb.js +20 -0
  13. package/dist/{create-ChfgWpiM.js → create-G3HuOHZ4.js} +31 -31
  14. package/dist/{create-B4m-IKlr.js → create-uA3nrMIa.js} +6 -6
  15. package/dist/design-lint-CiFc78aM.js +158 -0
  16. package/dist/{doctor-XtXW6tKE.js → doctor-CHF9aNFc.js} +6 -6
  17. package/dist/{drivers-CMEL13gp.js → drivers-YZEcBiSV.js} +3 -3
  18. package/dist/entry.js +20 -20
  19. package/dist/{environment-BWT2S4qC.js → environment-EU7Mrk7j.js} +3 -3
  20. package/dist/{existing-b0GxFcnc.js → existing-DV_6NLfW.js} +2 -2
  21. package/dist/{selection-BltBpyp5.js → framework-b-Yf8sP1.js} +50 -50
  22. package/dist/held-Dd19AduK.js +17 -0
  23. package/dist/{held-D3PUNky2.js → held-L0vz0_hA.js} +6 -6
  24. package/dist/install-CXfLcLhU.js +109 -0
  25. package/dist/{integrate-qvKd9pVW.js → integrate-DS2YGLsM.js} +23 -23
  26. package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
  27. package/dist/login-C0BjJmFy.js +17 -0
  28. package/dist/{login-PMoXUGqq.js → login-Ca6FhI6R.js} +6 -6
  29. package/dist/{login-COmGHrU5.js → login-DoMmU3Bq.js} +1 -1
  30. package/dist/{lookup-gjcKIZvh.js → lookup-DhMLZmdW.js} +3 -3
  31. package/dist/{migrate-SkkLLdmr.js → migrate-CoQWqzhJ.js} +29 -29
  32. package/dist/{migration-DS44-3Zr.js → migration-C22iQzAW.js} +29 -11
  33. package/dist/{notification-url-BjQPLf4-.js → notification-url-CqnXE9yB.js} +2 -2
  34. package/dist/{open-DQpm2yVs.js → open-DriuY3di.js} +2 -2
  35. package/dist/{org-C04eAO-j.js → org-D7LQrg3k.js} +3 -3
  36. package/dist/{organization-BOECL3vZ.js → organization-DDidaGRK.js} +8 -8
  37. package/dist/{orgs-D6Kk96mG.js → orgs-CYXjVdxM.js} +1 -1
  38. package/dist/{paths-REb-GrbX.js → paths-Bf3othB-.js} +1 -1
  39. package/dist/{playbook-Du4Oydbf.js → playbook-K7vmAUsu.js} +10 -10
  40. package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
  41. package/dist/{promote-Dm2_b1WK.js → promote-DXxxj4BU.js} +23 -22
  42. package/dist/pull-Bfa3_SBt.js +106 -0
  43. package/dist/pull-DGrlBSAG.js +36 -0
  44. package/dist/{pull-F6pvO4To.js → pull-DuFUkP7t.js} +8 -8
  45. package/dist/{push-D_l9KJZN.js → push-CrowxhpU.js} +54 -48
  46. package/dist/push-DPZdch2W.js +30 -0
  47. package/dist/push-DV-kJZdw.js +22 -0
  48. package/dist/{push-BIFLhAiO.js → push-Dk5x2xP3.js} +122 -22
  49. package/dist/{registry-DIJB0mJa.js → registry-HhZVRBqY.js} +178 -155
  50. package/dist/resolve-D3RBtfkI.js +242 -0
  51. package/dist/{resources-BaP3p_LY.js → resources-CkG6SCia.js} +2 -2
  52. package/dist/{run-C5OPwhvS.js → run-CL5ZnujW.js} +2 -2
  53. package/dist/{run-CgLmD2vR.js → run-Co8u_BkN.js} +93 -70
  54. package/dist/scan-BQmjhs3g.js +4 -0
  55. package/dist/{scan-Bj5y0zTZ.js → scan-DhmGH1rF.js} +1 -1
  56. package/dist/{scope-Bp_zwJOo.js → scope-D0XpYMn4.js} +5 -5
  57. package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
  58. package/dist/{sdk-TvT0p_nO.js → sdk-DEfQttek.js} +7 -7
  59. package/dist/{series-TAixFBWW.js → series-D2ZpZ8cx.js} +96 -63
  60. package/dist/server-4ZK_1Off.js +29 -0
  61. package/dist/{server-CdVIboQn.js → server-DamMN_ig.js} +9 -9
  62. package/dist/session-4F_YWSul.js +6 -0
  63. package/dist/{session-Ywim-P8M.js → session-G1uwJI8L.js} +1 -1
  64. package/dist/{setup-zzjtTy8k.js → setup-BFTSxEWU.js} +9 -9
  65. package/dist/skills/index.json +2 -2
  66. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  67. package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +47 -32
  68. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +35 -29
  69. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
  70. package/dist/{skills-2qYaUXGE.js → skills-CE4c9eHX.js} +4 -4
  71. package/dist/{skills-8um2fBPS.js → skills-ClEVgXUB.js} +8 -8
  72. package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
  73. package/dist/{source-push-kAep4gPe.js → source-push-EyF02ekO.js} +43 -26
  74. package/dist/{spinner-BANVLncC.js → spinner-mWZnJCkN.js} +3 -3
  75. package/dist/{starter-CiLrp1cN.js → starter-BtUUQWhd.js} +38 -28
  76. package/dist/{status-CoYMK7QL.js → status-SAZxltzW.js} +42 -39
  77. package/dist/{storage-DzP22xKn.js → storage-R5-qDvHq.js} +1 -1
  78. package/dist/{storekit-n1x0bWkQ.js → storekit-CQHVFTOC.js} +3 -3
  79. package/dist/storekit-DK3xXKoY.js +17 -0
  80. package/dist/{telemetry-CXN6f-ZX.js → telemetry-B-uKuu49.js} +1 -1
  81. package/dist/{token-FmeHywYt.js → token-C2kzntVM.js} +1 -1
  82. package/dist/tools.d.ts +6 -1
  83. package/dist/tools.js +208 -130
  84. package/dist/{try-BWbzgelb.js → try-BrJJyXgq.js} +32 -32
  85. package/dist/{upgrade-CoWCEnoi.js → upgrade-g_Bd9oJe.js} +2 -2
  86. package/dist/{upgrade-Bk5boOgW.js → upgrade-zOXTIaAZ.js} +2 -2
  87. package/package.json +2 -2
  88. package/dist/create-CJljlkJK.js +0 -20
  89. package/dist/held-CX7Zf8u-.js +0 -17
  90. package/dist/install-CVUXsx8c.js +0 -103
  91. package/dist/login-ClnJi1Ea.js +0 -17
  92. package/dist/pull-DsdOoG-D.js +0 -36
  93. package/dist/pull-zYAbqo9n.js +0 -106
  94. package/dist/push-CJVfvFZq.js +0 -29
  95. package/dist/push-SVzv7fzE.js +0 -22
  96. package/dist/resolve--GsHj0Q1.js +0 -171
  97. package/dist/scan-v_WTE722.js +0 -4
  98. package/dist/server-CvJVusw3.js +0 -29
  99. package/dist/session-B8JNXkwN.js +0 -6
  100. package/dist/storekit-D5eopLM0.js +0 -17
  101. /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
  102. /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
  103. /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { i as bundleDir, o as readManifest, r as WorkspaceError, t as MANIFEST_FILE } from "./project-CP6hiHra.js";
1
+ import { i as bundleDir, n as MANIFEST_FILE, o as readManifest, t as ArtifactError } from "./project-NoMtbMyl.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { execFile } from "node:child_process";
4
4
  import * as fs from "node:fs";
@@ -7,16 +7,16 @@ import * as path from "node:path";
7
7
  import { pathToFileURL } from "node:url";
8
8
  import { promisify } from "node:util";
9
9
 
10
- //#region src/core/workspaces/wire.ts
11
- const CONTEXT_HEADER = "x-superwall-workspace-context";
12
- const ENTRYPOINT_HEADER = "x-superwall-workspace-entrypoint";
13
- const TRIGGER_HEADER = "x-superwall-workspace-trigger";
14
- const WORKSPACE_HEADER_PREFIX = "x-superwall-workspace-";
15
- const API_HOST = "api.workspace.internal";
16
- const PLATFORM_HOST = "platform.workspace.internal";
17
- const BRIDGE_PROTOCOL = "superwall-workspace@1";
18
- const MOUNT_LOAD_TIMEOUT_MS = 8e3;
19
- const WORKSPACE_COMPATIBILITY_DATE = "2026-09-01";
10
+ //#region src/core/artifacts/wire.ts
11
+ const CONTEXT_HEADER = "x-superwall-artifact-context";
12
+ const ENTRYPOINT_HEADER = "x-superwall-artifact-entrypoint";
13
+ const TRIGGER_HEADER = "x-superwall-artifact-trigger";
14
+ const ARTIFACT_HEADER_PREFIX = "x-superwall-artifact-";
15
+ const API_HOST = "api.artifact.internal";
16
+ const PLATFORM_HOST = "platform.artifact.internal";
17
+ const BRIDGE_PROTOCOL = "superwall-artifact@1";
18
+ const MOUNT_LOAD_TIMEOUT_MS = 2e4;
19
+ const ARTIFACT_COMPATIBILITY_DATE = "2026-09-01";
20
20
  const METRIC_LIMITS = {
21
21
  maxPoints: 5e3,
22
22
  maxSeries: 50,
@@ -29,7 +29,7 @@ const READOUT_LIMITS = {
29
29
  };
30
30
  const DRAFT_MODULE_MAX_BYTES = 1024 * 1024;
31
31
  const BUNDLE_MAX_BYTES = 10 * 1024 * 1024;
32
- const CLIENT_BUNDLE_MODULE = "@superwall/workspace-sdk/client-bundle";
32
+ const CLIENT_BUNDLE_MODULE = "@superwall/artifact-sdk/client-bundle";
33
33
  const isInternalPath = (pathname) => {
34
34
  let decoded;
35
35
  try {
@@ -42,7 +42,7 @@ const isInternalPath = (pathname) => {
42
42
  };
43
43
 
44
44
  //#endregion
45
- //#region src/core/workspaces/wrangler-config.ts
45
+ //#region src/core/artifacts/wrangler-config.ts
46
46
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
47
47
  const isDeclared = (value) => {
48
48
  if (value === void 0 || value === null || value === false || value === "") return false;
@@ -55,11 +55,11 @@ const REFUSED_KEYS = [
55
55
  "durable_objects",
56
56
  "migrations",
57
57
  "exports"
58
- ], "Durable Objects are not supported in workspaces: platform storage is reached through fetch."],
59
- [["workflows"], "Workflows are not supported in workspaces."],
60
- [["containers", "cloudchamber"], "Containers are not supported in workspaces."],
58
+ ], "Durable Objects are not supported in artifacts: platform storage is reached through fetch."],
59
+ [["workflows"], "Workflows are not supported in artifacts."],
60
+ [["containers", "cloudchamber"], "Containers are not supported in artifacts."],
61
61
  [["vars", "secrets"], "Environment variables and secrets are not supported in the wrangler config: declare secrets in superwall.json."],
62
- [["definedEnvironments", "targetEnvironment"], "Wrangler environments are not supported in workspaces: a workspace has one config, with no `env` section."],
62
+ [["definedEnvironments", "targetEnvironment"], "Wrangler environments are not supported in artifacts: an artifact has one config, with no `env` section."],
63
63
  [[
64
64
  "kv_namespaces",
65
65
  "r2_buckets",
@@ -101,14 +101,14 @@ const REFUSED_KEYS = [
101
101
  "wasm_modules",
102
102
  "text_blobs",
103
103
  "data_blobs"
104
- ], "Bindings are not supported in workspaces: a workspace reaches everything through fetch."],
104
+ ], "Bindings are not supported in artifacts: an artifact reaches everything through fetch."],
105
105
  [[
106
106
  "no_bundle",
107
107
  "find_additional_modules",
108
108
  "base_dir",
109
109
  "preserve_file_names",
110
110
  "rules"
111
- ], "A workspace is one bundled module: remove these and let the builder bundle `main`."],
111
+ ], "An artifact is one bundled module: remove these and let the builder bundle `main`."],
112
112
  [[
113
113
  "site",
114
114
  "pages_build_output_dir",
@@ -117,7 +117,7 @@ const REFUSED_KEYS = [
117
117
  "cache",
118
118
  "previews",
119
119
  "first_party_worker"
120
- ], "The platform serves a workspace, so these Worker settings don't apply."]
120
+ ], "The platform serves an artifact, so these Worker settings don't apply."]
121
121
  ];
122
122
  const ALLOWED_KEYS = [
123
123
  "$schema",
@@ -177,11 +177,11 @@ function builderProblem(config) {
177
177
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
178
178
  if (config.compatibility_date < MIN_COMPATIBILITY_DATE || config.compatibility_date > today) return `compatibility_date must be between ${MIN_COMPATIBILITY_DATE} and today (found: ${config.compatibility_date}).`;
179
179
  const refused = (Array.isArray(config.compatibility_flags) ? config.compatibility_flags : []).filter((flag) => !COMPATIBILITY_FLAGS.has(flag));
180
- if (refused.length > 0) return `These compatibility_flags are not supported in workspaces: ${refused.join(", ")}. Allowed: ${[...COMPATIBILITY_FLAGS].join(", ")}.`;
180
+ if (refused.length > 0) return `These compatibility_flags are not supported in artifacts: ${refused.join(", ")}. Allowed: ${[...COMPATIBILITY_FLAGS].join(", ")}.`;
181
181
  }
182
182
  function assertBuilderAccepts(config) {
183
183
  const problem = builderProblem(config);
184
- if (problem !== void 0) throw new WorkspaceError(`This would fail on the builder. ${problem}`);
184
+ if (problem !== void 0) throw new ArtifactError(`This would fail on the builder. ${problem}`);
185
185
  }
186
186
  const isOutsideRepo = (input) => input === ".." || input.startsWith("../") || input.startsWith("/") || input === ".git" || input.startsWith(".git/");
187
187
  const INPUTS_SHOWN = 5;
@@ -192,10 +192,13 @@ function outsideRepoProblem(inputs) {
192
192
  const workerInputsOutside = (inputs, toolchain) => inputs.filter((input) => isOutsideRepo(input) && !toolchain(input));
193
193
 
194
194
  //#endregion
195
- //#region src/core/workspaces/client-build.ts
195
+ //#region src/core/artifacts/client-build.ts
196
196
  const ENTRY_PATTERN = /^[A-Za-z0-9_][A-Za-z0-9._\-/]*\.(?:tsx|ts|jsx|js|mts|mjs)$/;
197
197
  const ENTRY_MAX_LENGTH = 256;
198
198
  const LARGEST_SHOWN = 5;
199
+ const CONFIG_NAMES = new Set(["tsconfig.json", "jsconfig.json"]);
200
+ const CONFIG_FILES_MAX = 200;
201
+ const SKIPPED_DIRS = new Set(["node_modules", ".git"]);
199
202
  const megabytes = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
200
203
  function clientEntryProblem(entry) {
201
204
  if (typeof entry !== "string" || entry.length > ENTRY_MAX_LENGTH || !ENTRY_PATTERN.test(entry)) return `${MANIFEST_FILE}: client.entry must be a path inside the repo to a .ts, .tsx, .js, .jsx, .mts or .mjs file`;
@@ -216,52 +219,81 @@ function entryProblem(root, entry) {
216
219
  async function loadSdk(root) {
217
220
  const project = createRequire(path.join(root, "package.json"));
218
221
  try {
219
- const [build, constants] = await Promise.all([import(pathToFileURL(project.resolve("@superwall/workspace-sdk/client-build")).href), import(pathToFileURL(project.resolve("@superwall/workspace-sdk/constants")).href)]);
220
- if (typeof build.outsideRepoInputs !== "function") throw new Error("An early 0.2.0");
222
+ const [build, constants] = await Promise.all([import(pathToFileURL(project.resolve("@superwall/artifact-sdk/client-build")).href), import(pathToFileURL(project.resolve("@superwall/artifact-sdk/constants")).href)]);
223
+ if (typeof build.outsideRepoInputs !== "function" || typeof build.readClientTsconfig !== "function") throw new Error("Older than the builder's browser build");
221
224
  return {
222
225
  ...build,
223
226
  ...constants
224
227
  };
225
228
  } catch {
226
- throw new WorkspaceError("This project's workspace SDK is too old for client.entry. Run `superwall workspaces update`, then `npm install`.");
229
+ throw new ArtifactError("This project's artifact SDK is older than the builder's browser build, so client.entry would build differently here. Run `superwall artifacts update`, then `npm install`.");
227
230
  }
228
231
  }
229
232
  function loadEsbuild(wranglerPackage) {
230
233
  try {
231
234
  return createRequire(wranglerPackage)("esbuild");
232
235
  } catch {
233
- throw new WorkspaceError("client.entry is bundled with the esbuild this project's wrangler brings, and it isn't installed. Run `npm install`.");
236
+ throw new ArtifactError("client.entry is bundled with the esbuild this project's wrangler brings, and it isn't installed. Run `npm install`.");
234
237
  }
235
238
  }
239
+ function findConfigFiles(root, dir = root, found = []) {
240
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) if (entry.isDirectory()) {
241
+ if (!SKIPPED_DIRS.has(entry.name)) findConfigFiles(root, path.join(dir, entry.name), found);
242
+ } else if (CONFIG_NAMES.has(entry.name)) {
243
+ found.push(path.relative(root, path.join(dir, entry.name)).split(path.sep).join("/"));
244
+ if (found.length > CONFIG_FILES_MAX) throw new ArtifactError(`The repo has more than ${CONFIG_FILES_MAX} tsconfig.json and jsconfig.json files.`);
245
+ }
246
+ return found;
247
+ }
248
+ const readIfPresent = (file) => {
249
+ try {
250
+ return fs.readFileSync(file, "utf8");
251
+ } catch {
252
+ return null;
253
+ }
254
+ };
255
+ function rootTsconfig(root, sdk) {
256
+ const tsconfig = readIfPresent(path.join(root, "tsconfig.json"));
257
+ const jsconfig = readIfPresent(path.join(root, "jsconfig.json"));
258
+ const read = tsconfig === null && jsconfig !== null ? sdk.readClientTsconfig(jsconfig, "jsconfig.json") : sdk.readClientTsconfig(tsconfig, "tsconfig.json");
259
+ if (!read.ok) throw new ArtifactError(read.message);
260
+ return read.tsconfig;
261
+ }
262
+ const WRANGLER_TSCONFIG_REFUSAL = "This would fail on the builder. The wrangler config's `tsconfig` isn't supported in an artifact with browser code: the build reads tsconfig.json at the repo root for both.";
236
263
  function explainBundleFailure(error, hasClient) {
237
264
  if (hasClient || !error.message.includes(CLIENT_BUNDLE_MODULE)) return error;
238
- return new WorkspaceError(`${error.message}\nDeclare the browser entry in ${MANIFEST_FILE}: "client": { "entry": "src/client.tsx" }.`);
265
+ return new ArtifactError(`${error.message}\nDeclare the browser entry in ${MANIFEST_FILE}: "client": { "entry": "src/client.tsx" }.`);
239
266
  }
240
- async function buildClientAlias(projectRoot, entry, wranglerPackage) {
267
+ async function buildClientAlias(projectRoot, entry, wranglerPackage, wranglerTsconfig = false) {
268
+ if (wranglerTsconfig) throw new ArtifactError(WRANGLER_TSCONFIG_REFUSAL);
241
269
  const problem = clientEntryProblem(entry);
242
- if (problem !== void 0) throw new WorkspaceError(problem);
270
+ if (problem !== void 0) throw new ArtifactError(problem);
243
271
  const root = fs.realpathSync(projectRoot);
244
272
  const relative$1 = entry;
245
273
  const missing = entryProblem(root, relative$1);
246
- if (missing !== void 0) throw new WorkspaceError(missing);
274
+ if (missing !== void 0) throw new ArtifactError(missing);
247
275
  const sdk = await loadSdk(root);
276
+ const tsconfig = rootTsconfig(root, sdk);
277
+ const configFiles = findConfigFiles(root);
248
278
  const esbuild = loadEsbuild(wranglerPackage);
249
279
  let result;
250
280
  try {
251
281
  result = await sdk.buildClient(esbuild, {
252
282
  root,
253
- entry: relative$1
283
+ entry: relative$1,
284
+ tsconfig,
285
+ configFiles
254
286
  });
255
287
  } catch (error) {
256
- throw new WorkspaceError(`${error.message} It comes with this project's wrangler, so install the wrangler the starter pins.`);
288
+ throw new ArtifactError(`${error.message} It comes with this project's wrangler, so install the wrangler the starter pins.`);
257
289
  }
258
- if (!result.ok) throw new WorkspaceError(result.message);
290
+ if (!result.ok) throw new ArtifactError(result.message);
259
291
  const outside = outsideRepoProblem(sdk.outsideRepoInputs(result.inputPaths));
260
- if (outside !== void 0) throw new WorkspaceError(outside);
292
+ if (outside !== void 0) throw new ArtifactError(outside);
261
293
  const total = result.scriptBytes + result.styleBytes;
262
294
  if (total > sdk.CLIENT_BUNDLE_MAX_BYTES) {
263
295
  const largest = result.inputs.slice(0, LARGEST_SHOWN).map((input) => `${input.path} (${megabytes(input.bytes)})`).join(", ");
264
- throw new WorkspaceError(`The client bundle is ${total} bytes (${megabytes(total)}); the limit is ${sdk.CLIENT_BUNDLE_MAX_BYTES} (${megabytes(sdk.CLIENT_BUNDLE_MAX_BYTES)}). Largest: ${largest}.`);
296
+ throw new ArtifactError(`The client bundle is ${total} bytes (${megabytes(total)}); the limit is ${sdk.CLIENT_BUNDLE_MAX_BYTES} (${megabytes(sdk.CLIENT_BUNDLE_MAX_BYTES)}). Largest: ${largest}.`);
265
297
  }
266
298
  const dir = bundleDir(root);
267
299
  fs.mkdirSync(dir, { recursive: true });
@@ -271,13 +303,13 @@ async function buildClientAlias(projectRoot, entry, wranglerPackage) {
271
303
  }
272
304
 
273
305
  //#endregion
274
- //#region src/core/workspaces/bundle.ts
306
+ //#region src/core/artifacts/bundle.ts
275
307
  const run = promisify(execFile);
276
308
  function resolveWranglerPackage(root) {
277
309
  try {
278
310
  return createRequire(path.join(root, "package.json")).resolve("wrangler/package.json");
279
311
  } catch {
280
- throw new WorkspaceError("This workspace needs wrangler installed to bundle it. Run `npm install`, or `npm install -D wrangler` if it isn't in package.json.");
312
+ throw new ArtifactError("This artifact needs wrangler installed to bundle it. Run `npm install`, or `npm install -D wrangler` if it isn't in package.json.");
281
313
  }
282
314
  }
283
315
  const PASSED_ENV = [
@@ -308,7 +340,7 @@ const runWrangler = async (root, args) => {
308
340
  });
309
341
  } catch (error) {
310
342
  const { stdout = "", stderr = "" } = error;
311
- throw new WorkspaceError(`The workspace didn't bundle:\n${`${stdout}\n${stderr}`.trim().split("\n").slice(-30).join("\n")}`);
343
+ throw new ArtifactError(`The artifact didn't bundle:\n${`${stdout}\n${stderr}`.trim().split("\n").slice(-30).join("\n")}`);
312
344
  }
313
345
  };
314
346
  const READ_CONFIG_SCRIPT = `
@@ -349,17 +381,18 @@ const readWranglerConfig = async (root) => {
349
381
  };
350
382
  async function acceptedConfig(root, read) {
351
383
  const { config, error } = await read(root);
352
- if (error !== void 0) throw new WorkspaceError(`The wrangler config could not be read: ${error}`);
384
+ if (error !== void 0) throw new ArtifactError(`The wrangler config could not be read: ${error}`);
353
385
  assertBuilderAccepts(config);
354
386
  const accepted = config;
355
387
  const configPath = String(accepted.configPath);
356
- if (path.dirname(fs.realpathSync(path.resolve(root, configPath))) !== fs.realpathSync(root)) throw new WorkspaceError("This would fail on the builder. No wrangler config was read from the repo root.");
388
+ if (path.dirname(fs.realpathSync(path.resolve(root, configPath))) !== fs.realpathSync(root)) throw new ArtifactError("This would fail on the builder. No wrangler config was read from the repo root.");
357
389
  return {
358
390
  configPath,
359
391
  compatibility: {
360
392
  date: accepted.compatibility_date,
361
393
  flags: accepted.compatibility_flags ?? []
362
- }
394
+ },
395
+ tsconfig: typeof accepted.tsconfig === "string" && accepted.tsconfig !== ""
363
396
  };
364
397
  }
365
398
  function assertInputsInRepo(root, meta) {
@@ -369,13 +402,13 @@ function assertInputsInRepo(root, meta) {
369
402
  return path.resolve(realRoot, input).startsWith(`${toolchain}${path.sep}`);
370
403
  };
371
404
  const problem = outsideRepoProblem(workerInputsOutside(Object.keys(meta.inputs ?? {}), inToolchain));
372
- if (problem !== void 0) throw new WorkspaceError(problem);
405
+ if (problem !== void 0) throw new ArtifactError(problem);
373
406
  }
374
407
  function bundleExports(meta, output, root) {
375
408
  for (const [file, info] of Object.entries(meta.outputs ?? {})) if (info.entryPoint && path.resolve(root, file) === output) return info.exports ?? [];
376
409
  return null;
377
410
  }
378
- async function bundleWorkspace(root, wrangler = runWrangler) {
411
+ async function bundleArtifact(root, wrangler = runWrangler) {
379
412
  const dir = bundleDir(root);
380
413
  const out = path.join(dir, "out");
381
414
  const metafile = path.join(dir, "meta.json");
@@ -385,8 +418,8 @@ async function bundleWorkspace(root, wrangler = runWrangler) {
385
418
  });
386
419
  fs.mkdirSync(out, { recursive: true });
387
420
  const { client } = readManifest(root);
388
- const { configPath, compatibility } = await acceptedConfig(root, wrangler.readConfig ?? readWranglerConfig);
389
- const alias = client === void 0 ? [] : await buildClientAlias(root, client.entry, resolveWranglerPackage(root));
421
+ const { configPath, compatibility, tsconfig } = await acceptedConfig(root, wrangler.readConfig ?? readWranglerConfig);
422
+ const alias = client === void 0 ? [] : await buildClientAlias(root, client.entry, resolveWranglerPackage(root), tsconfig);
390
423
  await wrangler(root, [
391
424
  "deploy",
392
425
  "--dry-run",
@@ -405,17 +438,17 @@ async function bundleWorkspace(root, wrangler = runWrangler) {
405
438
  const files = fs.readdirSync(out).filter((file$1) => !file$1.endsWith(".map") && file$1 !== "README.md");
406
439
  const modules = files.filter((file$1) => /\.m?js$/.test(file$1));
407
440
  const [file] = modules;
408
- if (file === void 0 || modules.length !== 1 || files.length !== 1) throw new WorkspaceError(`A workspace bundles to exactly one ES module; this one made ${files.join(", ") || "nothing"}. Text, data and wasm modules aren't supported.`);
441
+ if (file === void 0 || modules.length !== 1 || files.length !== 1) throw new ArtifactError(`An artifact bundles to exactly one ES module; this one made ${files.join(", ") || "nothing"}. Text, data and wasm modules aren't supported.`);
409
442
  const output = path.join(out, file);
410
443
  const meta = JSON.parse(fs.readFileSync(metafile, "utf8"));
411
444
  assertInputsInRepo(root, meta);
412
445
  const exports = bundleExports(meta, output, root);
413
- if (exports === null || !exports.includes("default")) throw new WorkspaceError("The bundle has no default export: export defineWorkspace({ fetch }) as the module's default.");
446
+ if (exports === null || !exports.includes("default")) throw new ArtifactError("The bundle has no default export: export defineArtifact({ fetch }) as the module's default.");
414
447
  const named = exports.filter((name) => name !== "default");
415
- if (named.length > 0) throw new WorkspaceError(`The bundle exports ${named.join(", ")}: a workspace exports only its default handlers.`);
448
+ if (named.length > 0) throw new ArtifactError(`The bundle exports ${named.join(", ")}: an artifact exports only its default handlers.`);
416
449
  const module = fs.readFileSync(output, "utf8");
417
450
  const bytes = Buffer.byteLength(module);
418
- if (bytes > BUNDLE_MAX_BYTES) throw new WorkspaceError(`The bundle is ${bytes} bytes; the limit is ${BUNDLE_MAX_BYTES}.`);
451
+ if (bytes > BUNDLE_MAX_BYTES) throw new ArtifactError(`The bundle is ${bytes} bytes; the limit is ${BUNDLE_MAX_BYTES}.`);
419
452
  return {
420
453
  module,
421
454
  bytes,
@@ -424,7 +457,7 @@ async function bundleWorkspace(root, wrangler = runWrangler) {
424
457
  }
425
458
 
426
459
  //#endregion
427
- //#region src/core/workspaces/slots.ts
460
+ //#region src/core/artifacts/slots.ts
428
461
  const APP = ["organizationId", "applicationId"];
429
462
  const USER = [
430
463
  ...APP,
@@ -512,13 +545,13 @@ function defaultRange(days, now = Date.now()) {
512
545
  }
513
546
  function slotOf(slot) {
514
547
  const found = SLOTS[slot];
515
- if (!found) throw new WorkspaceError(`This CLI doesn't know the slot \`${slot}\`. Run \`superwall upgrade\`, or pass its context with --context.`);
548
+ if (!found) throw new ArtifactError(`This CLI doesn't know the slot \`${slot}\`. Run \`superwall upgrade\`, or pass its context with --context.`);
516
549
  return found;
517
550
  }
518
551
  function positive(name, value) {
519
552
  if (value === void 0 || value === "") return void 0;
520
553
  const parsed = Number(value);
521
- if (!Number.isSafeInteger(parsed) || parsed <= 0) throw new WorkspaceError(`${name} must be a positive number.`);
554
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) throw new ArtifactError(`${name} must be a positive number.`);
522
555
  return parsed;
523
556
  }
524
557
  function parseContextJson(text) {
@@ -526,9 +559,9 @@ function parseContextJson(text) {
526
559
  try {
527
560
  parsed = JSON.parse(text);
528
561
  } catch (error) {
529
- throw new WorkspaceError(`--context is not valid JSON: ${error.message}`);
562
+ throw new ArtifactError(`--context is not valid JSON: ${error.message}`);
530
563
  }
531
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new WorkspaceError("--context must be a JSON object.");
564
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new ArtifactError("--context must be a JSON object.");
532
565
  return parsed;
533
566
  }
534
567
  const FIELD_LABELS = {
@@ -545,7 +578,7 @@ const FIELD_LABELS = {
545
578
  const ENVIRONMENTS = ["PRODUCTION", "SANDBOX"];
546
579
  function environmentOf(environment = "PRODUCTION") {
547
580
  if (ENVIRONMENTS.includes(environment)) return environment;
548
- throw new WorkspaceError(`The environment must be PRODUCTION or SANDBOX, in capitals. Got ${String(environment)}.`);
581
+ throw new ArtifactError(`The environment must be PRODUCTION or SANDBOX, in capitals. Got ${String(environment)}.`);
549
582
  }
550
583
  function fieldValue(field, input) {
551
584
  switch (field) {
@@ -560,7 +593,7 @@ function fieldValue(field, input) {
560
593
  from: input.from || fallback.from,
561
594
  to: input.to || fallback.to
562
595
  };
563
- if (Number.isNaN(Date.parse(range.from)) || Number.isNaN(Date.parse(range.to))) throw new WorkspaceError("The date range needs ISO 8601 date-times, like 2026-10-01T00:00:00Z.");
596
+ if (Number.isNaN(Date.parse(range.from)) || Number.isNaN(Date.parse(range.to))) throw new ArtifactError("The date range needs ISO 8601 date-times, like 2026-10-01T00:00:00Z.");
564
597
  return {
565
598
  from: new Date(range.from).toISOString(),
566
599
  to: new Date(range.to).toISOString()
@@ -592,7 +625,7 @@ function buildContext(slotId, input) {
592
625
  }
593
626
  const slot = slotOf(slotId);
594
627
  const missing = missingFields(slot, input);
595
- if (missing.length > 0) throw new WorkspaceError(`${slotId} needs ${missing.join(", ")}.`);
628
+ if (missing.length > 0) throw new ArtifactError(`${slotId} needs ${missing.join(", ")}.`);
596
629
  const context = {};
597
630
  for (const field of slot.fields) {
598
631
  const value = fieldValue(field, input);
@@ -602,7 +635,7 @@ function buildContext(slotId, input) {
602
635
  }
603
636
 
604
637
  //#endregion
605
- //#region src/core/workspaces/series.ts
638
+ //#region src/core/artifacts/series.ts
606
639
  const ISO_TIMESTAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})$/;
607
640
  const isTimestamp = (value) => typeof value === "string" && ISO_TIMESTAMP.test(value) && !Number.isNaN(Date.parse(value));
608
641
  const isKey = (value) => value === null || value === void 0 || typeof value === "string" && value.length >= 1 && value.length <= 128;
@@ -646,17 +679,17 @@ function readoutProblem(value, variantIds) {
646
679
  }
647
680
  function checkMetricQuery(metric, query) {
648
681
  const breakdown = query.breakdown ?? null;
649
- if (breakdown !== null && !(metric?.breakdowns ?? []).some((candidate) => candidate.key === breakdown)) throw new WorkspaceError(`\`${breakdown}\` is not a breakdown this metric declares.`);
682
+ if (breakdown !== null && !(metric?.breakdowns ?? []).some((candidate) => candidate.key === breakdown)) throw new ArtifactError(`\`${breakdown}\` is not a breakdown this metric declares.`);
650
683
  for (const [key, values] of Object.entries(query.filters ?? {})) {
651
684
  const filter = (metric?.filters ?? []).find((candidate) => candidate.key === key);
652
- if (!filter || values.some((value) => !filter.values.some((option) => option.value === value))) throw new WorkspaceError(`\`${key}\` has a filter or value this metric doesn't declare.`);
685
+ if (!filter || values.some((value) => !filter.values.some((option) => option.value === value))) throw new ArtifactError(`\`${key}\` has a filter or value this metric doesn't declare.`);
653
686
  }
654
687
  }
655
688
  function parseFilters(pairs) {
656
689
  const filters = Object.create(null);
657
690
  for (const pair of pairs) {
658
691
  const separator = pair.indexOf("=");
659
- if (separator <= 0 || separator === pair.length - 1) throw new WorkspaceError(`--filter takes key=value, not \`${pair}\`.`);
692
+ if (separator <= 0 || separator === pair.length - 1) throw new ArtifactError(`--filter takes key=value, not \`${pair}\`.`);
660
693
  const key = pair.slice(0, separator);
661
694
  filters[key] = [...filters[key] ?? [], pair.slice(separator + 1)];
662
695
  }
@@ -682,4 +715,4 @@ function summarizeSeries(series) {
682
715
  }
683
716
 
684
717
  //#endregion
685
- export { WORKSPACE_HEADER_PREFIX as C, WORKSPACE_COMPATIBILITY_DATE as S, METRIC_LIMITS as _, summarizeSeries as a, READOUT_LIMITS as b, defaultRange as c, resolveWranglerPackage as d, API_HOST as f, ENTRYPOINT_HEADER as g, DRAFT_MODULE_MAX_BYTES as h, seriesProblem as i, parseContextJson as l, CONTEXT_HEADER as m, parseFilters as n, SLOTS as o, BRIDGE_PROTOCOL as p, readoutProblem as r, buildContext as s, checkMetricQuery as t, bundleWorkspace as u, MOUNT_LOAD_TIMEOUT_MS as v, isInternalPath as w, TRIGGER_HEADER as x, PLATFORM_HOST as y };
718
+ export { TRIGGER_HEADER as C, READOUT_LIMITS as S, DRAFT_MODULE_MAX_BYTES as _, summarizeSeries as a, MOUNT_LOAD_TIMEOUT_MS as b, defaultRange as c, resolveWranglerPackage as d, API_HOST as f, CONTEXT_HEADER as g, BRIDGE_PROTOCOL as h, seriesProblem as i, parseContextJson as l, ARTIFACT_HEADER_PREFIX as m, parseFilters as n, SLOTS as o, ARTIFACT_COMPATIBILITY_DATE as p, readoutProblem as r, buildContext as s, checkMetricQuery as t, bundleArtifact as u, ENTRYPOINT_HEADER as v, isInternalPath as w, PLATFORM_HOST as x, METRIC_LIMITS as y };
@@ -0,0 +1,29 @@
1
+ import "./token-C2kzntVM.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-EU7Mrk7j.js";
4
+ import "./storage-R5-qDvHq.js";
5
+ import "./client-Tp6iD66_.js";
6
+ import "./config-CGcG7GOt.js";
7
+ import "./telemetry-B-uKuu49.js";
8
+ import "./spawn-DmmmHIP-.js";
9
+ import "./spinner-mWZnJCkN.js";
10
+ import "./ui-D_qf3Gvw.js";
11
+ import "./scan-DhmGH1rF.js";
12
+ import "./paths-Bf3othB-.js";
13
+ import "./orgs-CYXjVdxM.js";
14
+ import "./resources-CkG6SCia.js";
15
+ import "./lookup-DhMLZmdW.js";
16
+ import "./login-Ca6FhI6R.js";
17
+ import "./skills-CE4c9eHX.js";
18
+ import "./browser-Bp3yRKlU.js";
19
+ import "./lock-DgSx-p8Y.js";
20
+ import "./scope-ehZ7L1nj.js";
21
+ import "./base-Cft9NZfU.js";
22
+ import "./framework-b-Yf8sP1.js";
23
+ import "./login-DoMmU3Bq.js";
24
+ import "./source-BccdO4aL.js";
25
+ import "./assets-oo93EFou.js";
26
+ import "./source-push-EyF02ekO.js";
27
+ import { t as runStudio } from "./server-DamMN_ig.js";
28
+
29
+ export { runStudio };
@@ -1,14 +1,14 @@
1
- import { x as VERSION } from "./environment-BWT2S4qC.js";
2
- import { t as ApiError } from "./client-AI9H4GGB.js";
1
+ import { x as VERSION } from "./environment-EU7Mrk7j.js";
2
+ import { t as ApiError } from "./client-Tp6iD66_.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { C as pushPaywallVersion, D as versionProducts, p as listApplications, x as promotePaywallVersion } from "./resources-BaP3p_LY.js";
4
+ import { C as pushPaywallVersion, D as versionProducts, p as listApplications, x as promotePaywallVersion } from "./resources-CkG6SCia.js";
5
5
  import { n as openBrowser } from "./browser-Bp3yRKlU.js";
6
- import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-BrB9jQPQ.js";
7
- import { i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT, v as frameworkVersion, y as resolveFramework } from "./selection-BltBpyp5.js";
8
- import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-JdxmnCko.js";
9
- import { c as planTargets, n as requireApi, o as writeProjectScaffold, p as resolveApps, u as wantedPlatforms } from "./session-D3fgXQBt.js";
10
- import { i as listApplicationCatalogue, l as resolveBinding, n as pushSource, o as listProjectProducts, r as warnNotPortable, s as projectForApplication } from "./source-push-kAep4gPe.js";
11
- import { a as collectSourceFiles } from "./git-D7AVdugb.js";
6
+ import { b as writeProjectTypes, l as readLock, y as collectProjectDeclarations } from "./lock-DgSx-p8Y.js";
7
+ import { c as planTargets, d as wantedPlatforms, h as resolveApps, i as requireApi, o as writeProjectScaffold } from "./base-Cft9NZfU.js";
8
+ import { c as resolveProjectDirs, f as LAYOUT_HINT, n as resolveFramework, o as requireProject, t as frameworkVersion } from "./framework-b-Yf8sP1.js";
9
+ import { t as collectSourceFiles } from "./source-BccdO4aL.js";
10
+ import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-oo93EFou.js";
11
+ import { a as listApplicationCatalogue, c as projectForApplication, i as warnNotPortable, r as pushSource, s as listProjectProducts, u as resolveBinding } from "./source-push-EyF02ekO.js";
12
12
  import { execFile } from "node:child_process";
13
13
  import * as fs from "node:fs";
14
14
  import * as path from "node:path";
@@ -0,0 +1,6 @@
1
+ import "./output-Ggzq5_-t.js";
2
+ import "./environment-EU7Mrk7j.js";
3
+ import "./storage-R5-qDvHq.js";
4
+ import { n as runWhoami, t as runLogout } from "./session-G1uwJI8L.js";
5
+
6
+ export { runLogout, runWhoami };
@@ -1,4 +1,4 @@
1
- import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-DzP22xKn.js";
1
+ import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-R5-qDvHq.js";
2
2
 
3
3
  //#region src/core/account/session.ts
4
4
  function runWhoami(ctx) {
@@ -1,12 +1,12 @@
1
- import { i as readPackageJson, r as allDeps, t as scanProject } from "./scan-Bj5y0zTZ.js";
2
- import { t as detectExisting } from "./existing-b0GxFcnc.js";
3
- import { m as listProjects, p as listApplications, r as createApplication, y as platformLabel } from "./resources-BaP3p_LY.js";
4
- import { n as findApplication } from "./lookup-gjcKIZvh.js";
5
- import { r as resolveScopeFromKey } from "./bind-B3eEcRyp.js";
6
- import { m as writeApp } from "./types-JdxmnCko.js";
7
- import { a as projectPackageName, f as requirePlatform, n as requireApi } from "./session-D3fgXQBt.js";
8
- import { t as gitAvailable } from "./git-D7AVdugb.js";
9
- import { r as isSuperwallProject } from "./migration-DS44-3Zr.js";
1
+ import { i as readPackageJson, r as allDeps, t as scanProject } from "./scan-DhmGH1rF.js";
2
+ import { t as detectExisting } from "./existing-DV_6NLfW.js";
3
+ import { m as listProjects, p as listApplications, r as createApplication, y as platformLabel } from "./resources-CkG6SCia.js";
4
+ import { n as findApplication } from "./lookup-DhMLZmdW.js";
5
+ import { r as resolveScopeFromKey } from "./bind-BvScWziR.js";
6
+ import { d as writeApp } from "./lock-DgSx-p8Y.js";
7
+ import { a as projectPackageName, i as requireApi, m as requirePlatform } from "./base-Cft9NZfU.js";
8
+ import { r as isSuperwallProject } from "./migration-C22iQzAW.js";
9
+ import { n as gitAvailable } from "./source-BccdO4aL.js";
10
10
  import { execFile } from "node:child_process";
11
11
  import * as fs from "node:fs";
12
12
  import * as path from "node:path";
@@ -35,8 +35,8 @@
35
35
  "summary": "Use this skill whenever the user asks about WWDC sessions, Ap..."
36
36
  },
37
37
  {
38
- "name": "superwall-workspaces",
38
+ "name": "superwall-artifacts",
39
39
  "channel": "next",
40
- "summary": "Build and ship a Superwall workspace, a small Cloudflare Work..."
40
+ "summary": "Build and ship a Superwall artifact, a small Cloudflare Worke..."
41
41
  }
42
42
  ]
@@ -104,15 +104,17 @@ plugins { id 'com.android.application' version '8.4.1' apply false }
104
104
  distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
105
105
  ```
106
106
 
107
- > **Important:** Register Superwall's activities in the `<application>` tag of
108
- > `android/app/src/main/AndroidManifest.xml`, or Android builds/paywalls fail:
107
+ > **Important:** Do not declare `SuperwallPaywallActivity` in the app's
108
+ > `AndroidManifest.xml`. The `superwallkit_flutter` plugin's manifest already
109
+ > declares it, and a second declaration with a different theme fails the
110
+ > manifest merge (`Attribute activity#...SuperwallPaywallActivity@theme ... is
111
+ > also present at [:superwallkit_flutter]`). If the app already has one, remove
112
+ > it, or keep it only with `tools:replace="android:theme"`.
113
+
114
+ Optionally, add the debug activities inside the `<application>` tag of
115
+ `android/app/src/main/AndroidManifest.xml`:
109
116
 
110
117
  ```xml
111
- <activity
112
- android:name="com.superwall.sdk.paywall.view.SuperwallPaywallActivity"
113
- android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
114
- android:configChanges="orientation|screenSize|keyboardHidden">
115
- </activity>
116
118
  <activity android:name="com.superwall.sdk.debug.DebugViewActivity" />
117
119
  <activity android:name="com.superwall.sdk.debug.localizations.SWLocalizationActivity" />
118
120
  <activity android:name="com.superwall.sdk.debug.SWConsoleActivity" />