@superwall/cli 2.5.0 → 2.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Dyr7OFBx.js → apple-Bmt_iywx.js} +14 -14
  3. package/dist/{approve-Czs1-JO9.js → approve-D2UgqaRx.js} +31 -27
  4. package/dist/{assets-BrB9jQPQ.js → assets-B_quADds.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-ChTi42M0.js} +35 -35
  8. package/dist/{billing-D5qqIlVb.js → billing-ZIETn0j4.js} +3 -3
  9. package/dist/{bind-B3eEcRyp.js → bind-ClFjTt0U.js} +4 -4
  10. package/dist/{build-DD9pSwHX.js → build-BWjXurjs.js} +11 -9
  11. package/dist/{client-AI9H4GGB.js → client-CyrYJzBF.js} +3 -3
  12. package/dist/create-7HDW3DCl.js +20 -0
  13. package/dist/{create-B4m-IKlr.js → create-BCIgjRHn.js} +6 -6
  14. package/dist/{create-ChfgWpiM.js → create-C3uklw-U.js} +31 -31
  15. package/dist/design-lint-CiFc78aM.js +158 -0
  16. package/dist/{doctor-XtXW6tKE.js → doctor-D2Q1EZe8.js} +6 -6
  17. package/dist/{drivers-CMEL13gp.js → drivers-BQkO5tHs.js} +3 -3
  18. package/dist/entry.js +20 -20
  19. package/dist/{environment-BWT2S4qC.js → environment-BocmdvZ-.js} +3 -3
  20. package/dist/{existing-b0GxFcnc.js → existing-Cl5x6_5u.js} +2 -2
  21. package/dist/{selection-BltBpyp5.js → framework-CLmf4swr.js} +50 -50
  22. package/dist/{held-D3PUNky2.js → held-Bykbwy-m.js} +6 -6
  23. package/dist/held-Chw3BtBV.js +17 -0
  24. package/dist/install-dXZZ79Oe.js +109 -0
  25. package/dist/{integrate-qvKd9pVW.js → integrate-DiSjlOjC.js} +23 -23
  26. package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
  27. package/dist/{login-PMoXUGqq.js → login-5sWIKDI2.js} +6 -6
  28. package/dist/login-DZ8Pipf6.js +17 -0
  29. package/dist/{login-COmGHrU5.js → login-Jp6E6d2e.js} +1 -1
  30. package/dist/{lookup-gjcKIZvh.js → lookup-CWzVfPpq.js} +3 -3
  31. package/dist/{migrate-SkkLLdmr.js → migrate-BKiOUsMY.js} +29 -29
  32. package/dist/{migration-DS44-3Zr.js → migration-Z69tLeHC.js} +29 -11
  33. package/dist/{notification-url-BjQPLf4-.js → notification-url-BDBxbwZq.js} +2 -2
  34. package/dist/{open-DQpm2yVs.js → open-DNd49kT-.js} +2 -2
  35. package/dist/{org-C04eAO-j.js → org-Dud1rF9f.js} +3 -3
  36. package/dist/{organization-BOECL3vZ.js → organization-7vJA3uy1.js} +8 -8
  37. package/dist/{orgs-D6Kk96mG.js → orgs-Z0H9WOs1.js} +1 -1
  38. package/dist/{paths-REb-GrbX.js → paths-CzTJVpfi.js} +1 -1
  39. package/dist/{playbook-Du4Oydbf.js → playbook-DJ__edOW.js} +10 -10
  40. package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
  41. package/dist/{promote-Dm2_b1WK.js → promote-DLtPSvmL.js} +23 -22
  42. package/dist/{pull-F6pvO4To.js → pull-AoUmaiMK.js} +8 -8
  43. package/dist/pull-C1xm2zqG.js +36 -0
  44. package/dist/pull-D-YuT3e0.js +106 -0
  45. package/dist/push-B42D8fKf.js +22 -0
  46. package/dist/{push-BIFLhAiO.js → push-BMblzg_6.js} +122 -22
  47. package/dist/{push-D_l9KJZN.js → push-BrzMFd4Z.js} +47 -47
  48. package/dist/push-Co5jk6Kr.js +30 -0
  49. package/dist/{registry-DIJB0mJa.js → registry-DDU10_Ix.js} +176 -155
  50. package/dist/resolve-DpOSDDdr.js +196 -0
  51. package/dist/{resources-BaP3p_LY.js → resources-CptT7HD6.js} +2 -2
  52. package/dist/{run-C5OPwhvS.js → run-c1O2_8pp.js} +2 -2
  53. package/dist/{run-CgLmD2vR.js → run-r3foWfhV.js} +93 -70
  54. package/dist/scan-D86kLtM7.js +4 -0
  55. package/dist/{scan-Bj5y0zTZ.js → scan-nVQO7JLx.js} +1 -1
  56. package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
  57. package/dist/{scope-Bp_zwJOo.js → scope-l1qGLsgz.js} +5 -5
  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-BEcsQaPu.js +29 -0
  61. package/dist/{server-CdVIboQn.js → server-DLARhh1k.js} +9 -9
  62. package/dist/session-Csuaw6RU.js +6 -0
  63. package/dist/{session-Ywim-P8M.js → session-Z0BeaJPf.js} +1 -1
  64. package/dist/{setup-zzjtTy8k.js → setup-C6NFy14d.js} +9 -9
  65. package/dist/skills/index.json +2 -2
  66. package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +41 -31
  67. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +31 -28
  68. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
  69. package/dist/{skills-2qYaUXGE.js → skills-421SFEyF.js} +4 -4
  70. package/dist/{skills-8um2fBPS.js → skills-CdKwaTRS.js} +8 -8
  71. package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
  72. package/dist/{source-push-kAep4gPe.js → source-push-B4s6r9bB.js} +43 -26
  73. package/dist/{spinner-BANVLncC.js → spinner-DPdBlZe2.js} +3 -3
  74. package/dist/{starter-CiLrp1cN.js → starter-0OdVPH4l.js} +27 -27
  75. package/dist/{status-CoYMK7QL.js → status-Dsc7d3z2.js} +42 -39
  76. package/dist/{storage-DzP22xKn.js → storage-DT_wxwJ8.js} +1 -1
  77. package/dist/{storekit-n1x0bWkQ.js → storekit-B9M2raxe.js} +3 -3
  78. package/dist/storekit-BWZf-fNE.js +17 -0
  79. package/dist/{telemetry-CXN6f-ZX.js → telemetry-ovPiseFm.js} +1 -1
  80. package/dist/{token-FmeHywYt.js → token-Bu3FaRkv.js} +1 -1
  81. package/dist/tools.d.ts +1 -1
  82. package/dist/tools.js +148 -128
  83. package/dist/{try-BWbzgelb.js → try-B8FYkTvQ.js} +29 -29
  84. package/dist/{upgrade-Bk5boOgW.js → upgrade-B7TmvEPP.js} +2 -2
  85. package/dist/{upgrade-CoWCEnoi.js → upgrade-CAHyrWUL.js} +2 -2
  86. package/package.json +2 -2
  87. package/dist/create-CJljlkJK.js +0 -20
  88. package/dist/held-CX7Zf8u-.js +0 -17
  89. package/dist/install-CVUXsx8c.js +0 -103
  90. package/dist/login-ClnJi1Ea.js +0 -17
  91. package/dist/pull-DsdOoG-D.js +0 -36
  92. package/dist/pull-zYAbqo9n.js +0 -106
  93. package/dist/push-CJVfvFZq.js +0 -29
  94. package/dist/push-SVzv7fzE.js +0 -22
  95. package/dist/resolve--GsHj0Q1.js +0 -171
  96. package/dist/scan-v_WTE722.js +0 -4
  97. package/dist/server-CvJVusw3.js +0 -29
  98. package/dist/session-B8JNXkwN.js +0 -6
  99. package/dist/storekit-D5eopLM0.js +0 -17
  100. /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
  101. /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
  102. /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
package/README.md CHANGED
@@ -239,6 +239,13 @@ landed stays pending, so `promote` still won't ship it. With no project,
239
239
  `superwall pull --app <id> [dir]` creates `superwall/` from the app's source,
240
240
  so you can work on an app's paywalls without its codebase or GitHub.
241
241
 
242
+ A change to the shared design system (`DESIGN.md`, `design/`, `components/`)
243
+ reaches every paywall that imports it. `publish --existing --source` ships it:
244
+ `--existing` rebuilds only the paywalls already on Superwall and never creates
245
+ one, and `--source` pushes the project source to every app, also those whose
246
+ paywalls built the same. Push and build warn when a paywall hard-codes a value
247
+ that `design/tokens.css` already holds, naming the token to use instead.
248
+
242
249
  The full reference — assets, localization, trials, transitions, web
243
250
  checkout, troubleshooting — lives at
244
251
  [superwall.com/docs/framework](https://superwall.com/docs/framework).
@@ -1,22 +1,22 @@
1
- import "./token-FmeHywYt.js";
1
+ import "./token-Bu3FaRkv.js";
2
2
  import { t as blocks } from "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import { t as ApiError } from "./client-AI9H4GGB.js";
6
- import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-D3PUNky2.js";
3
+ import "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
+ import { t as ApiError } from "./client-CyrYJzBF.js";
6
+ import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-Bykbwy-m.js";
7
7
  import "./config-CGcG7GOt.js";
8
- import { t as apiCall } from "./spinner-BANVLncC.js";
8
+ import { t as apiCall } from "./spinner-DPdBlZe2.js";
9
9
  import "./ui-D_qf3Gvw.js";
10
- import "./paths-REb-GrbX.js";
11
- import "./orgs-D6Kk96mG.js";
12
- import "./resources-BaP3p_LY.js";
13
- import "./org-C04eAO-j.js";
14
- import "./lookup-gjcKIZvh.js";
15
- import "./scope-Bp_zwJOo.js";
10
+ import "./paths-CzTJVpfi.js";
11
+ import "./orgs-Z0H9WOs1.js";
12
+ import "./resources-CptT7HD6.js";
13
+ import "./org-Dud1rF9f.js";
14
+ import "./lookup-CWzVfPpq.js";
15
+ import "./scope-l1qGLsgz.js";
16
16
  import "./client-BJQXl62Q.js";
17
17
  import "./timing-Ca0TXY-A.js";
18
- import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-BjQPLf4-.js";
19
- import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-B4m-IKlr.js";
18
+ import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-BDBxbwZq.js";
19
+ import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-BCIgjRHn.js";
20
20
 
21
21
  //#region src/core/app-store-connect/setup/apple.ts
22
22
  const STEPS = [
@@ -1,16 +1,16 @@
1
- import "./token-FmeHywYt.js";
1
+ import "./token-Bu3FaRkv.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import { t as ApiError } from "./client-AI9H4GGB.js";
3
+ import "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
+ import { t as ApiError } from "./client-CyrYJzBF.js";
6
6
  import "./config-CGcG7GOt.js";
7
- import "./orgs-D6Kk96mG.js";
8
- import "./types-JdxmnCko.js";
9
- import "./scope-CCb_7UvN.js";
10
- import { c as resolveWorkspace, l as roleCanApprove, m as approveVersion, o as pickVersion } from "./resolve--GsHj0Q1.js";
11
- import { r as WorkspaceError } from "./project-CP6hiHra.js";
7
+ import "./orgs-Z0H9WOs1.js";
8
+ import { h as approveVersion, l as resolveArtifact, n as awaitingInstall, s as pickVersion, u as roleCanApprove } from "./resolve-DpOSDDdr.js";
9
+ import { t as ArtifactError } from "./project-NoMtbMyl.js";
10
+ import "./lock-DgSx-p8Y.js";
11
+ import "./scope-ehZ7L1nj.js";
12
12
 
13
- //#region src/core/workspaces/approve.ts
13
+ //#region src/core/artifacts/approve.ts
14
14
  const SECTIONS = [
15
15
  ["scopes", "Scopes"],
16
16
  ["backgroundScopes", "Background scopes"],
@@ -91,12 +91,16 @@ const diffLines = (diff) => diff.flatMap(({ title, added, removed }) => [
91
91
  ...added.map((item) => ` + ${item}`),
92
92
  ...removed.map((item) => ` - ${item}`)
93
93
  ]);
94
- const ONLY_ADMINS = "Only organization owners and admins can approve workspace versions. Ask one of them to review this version.";
95
- async function runWorkspaceApprove(ctx, input) {
96
- const workspace = await resolveWorkspace(ctx, input);
97
- const { version, versions } = await pickVersion(ctx, workspace, input.version, (candidate) => candidate.build_status === "SUCCEEDED" && candidate.id !== workspace.active_version_id);
98
- if (version.build_status !== "SUCCEEDED" || version.manifest === null) throw new WorkspaceError(`Version ${version.id} is ${version.build_status.toLowerCase()}. Only a built version can be approved.`);
99
- if (version.id === workspace.active_version_id && version.grant !== null) {
94
+ function commitLine(message) {
95
+ const [subject = "", note] = message.split(/\n\n+/);
96
+ return subject.startsWith("push artifact/") && note && !note.startsWith("Superwall-") ? note : subject;
97
+ }
98
+ const ONLY_ADMINS = "Only organization owners and admins can approve artifact versions. Ask one of them to review this version.";
99
+ async function runArtifactApprove(ctx, input) {
100
+ const artifact = await resolveArtifact(ctx, input);
101
+ const { version, versions } = await pickVersion(ctx, artifact, input.version, (candidate) => candidate.build_status === "SUCCEEDED" && candidate.id !== artifact.active_version_id);
102
+ if (version.build_status !== "SUCCEEDED" || version.manifest === null) throw new ArtifactError(`Version ${version.id} is ${version.build_status.toLowerCase()}. Only a built version can be approved.`);
103
+ if (version.id === artifact.active_version_id && version.grant !== null) {
100
104
  if (ctx.json) ctx.output.data({
101
105
  approved: false,
102
106
  reason: "already_active",
@@ -105,11 +109,11 @@ async function runWorkspaceApprove(ctx, input) {
105
109
  else ctx.ui.info(`Version ${version.id} is already live.`);
106
110
  return;
107
111
  }
108
- const active = versions.find((candidate) => candidate.id === workspace.active_version_id);
112
+ const active = versions.find((candidate) => candidate.id === artifact.active_version_id);
109
113
  const proposed = sideOf(version, false);
110
114
  const diff = diffSides(sideOf(active, true), proposed);
111
115
  const details = {
112
- workspace_id: workspace.id,
116
+ artifact_id: artifact.id,
113
117
  version_id: version.id,
114
118
  commit_sha: version.commit_sha,
115
119
  active_version_id: active?.id ?? null,
@@ -119,8 +123,8 @@ async function runWorkspaceApprove(ctx, input) {
119
123
  diff
120
124
  };
121
125
  if (!ctx.json) ctx.ui.report([
122
- `${workspace.name}, version ${version.id} (${version.commit_sha.slice(0, 12)})`,
123
- ...version.commit_message ? [version.commit_message.split("\n")[0] ?? ""] : [],
126
+ `${artifact.name}, version ${version.id} (${version.commit_sha.slice(0, 12)})`,
127
+ ...version.commit_message ? [commitLine(version.commit_message)] : [],
124
128
  "",
125
129
  "What it can do:",
126
130
  ...manifestLines(proposed),
@@ -137,9 +141,9 @@ async function runWorkspaceApprove(ctx, input) {
137
141
  else ctx.ui.error(message);
138
142
  ctx.fail();
139
143
  };
140
- if (!await roleCanApprove(ctx, workspace)) {
144
+ if (!await roleCanApprove(ctx, artifact)) {
141
145
  refuse("needs_admin", ONLY_ADMINS);
142
- if (!ctx.json) ctx.ui.info("To ask for review, run `superwall workspaces share`.");
146
+ if (!ctx.json) ctx.ui.info("To ask for review, run `superwall artifacts share`.");
143
147
  return;
144
148
  }
145
149
  const changes = diff.length > 0;
@@ -158,13 +162,13 @@ async function runWorkspaceApprove(ctx, input) {
158
162
  return;
159
163
  }
160
164
  if (!accepted) {
161
- refuse("needs_accept_changes", "Nothing was approved, because this changes what the workspace can do. Read the changes above, then pass --accept-changes too.");
165
+ refuse("needs_accept_changes", "Nothing was approved, because this changes what the artifact can do. Read the changes above, then pass --accept-changes too.");
162
166
  return;
163
167
  }
164
168
  }
165
169
  let approved;
166
170
  try {
167
- approved = await approveVersion(ctx.api, workspace.id, version.id);
171
+ approved = await approveVersion(ctx.api, artifact.id, version.id);
168
172
  } catch (error) {
169
173
  if (!(error instanceof ApiError) || error.status !== 403) throw error;
170
174
  refuse("forbidden", error.message);
@@ -178,9 +182,9 @@ async function runWorkspaceApprove(ctx, input) {
178
182
  });
179
183
  return;
180
184
  }
181
- ctx.ui.success(`Approved version ${version.id}. It's live for everyone it's installed for.`);
182
- ctx.ui.info(`Choose where it shows with \`superwall workspaces install <entrypoint> --workspace ${workspace.id}\`.`);
185
+ ctx.ui.success(await awaitingInstall(ctx.api, artifact.id, version.manifest) ? `Approved version ${version.id}. Nothing is installed yet, so only its author can see it until you choose where it shows.` : `Approved version ${version.id}. It's live for everyone it's installed for.`);
186
+ ctx.ui.info(`Choose where it shows with \`superwall artifacts install <entrypoint> --artifact ${artifact.id}\`.`);
183
187
  }
184
188
 
185
189
  //#endregion
186
- export { diffSides, runWorkspaceApprove, sideOf };
190
+ export { diffSides, runArtifactApprove, sideOf };
@@ -1,6 +1,6 @@
1
- import { r as ASSET_HOST } from "./environment-BWT2S4qC.js";
2
- import { t as ApiError } from "./client-AI9H4GGB.js";
3
- import { S as pushPaywallAssets } from "./resources-BaP3p_LY.js";
1
+ import { r as ASSET_HOST } from "./environment-BocmdvZ-.js";
2
+ import { t as ApiError } from "./client-CyrYJzBF.js";
3
+ import { S as pushPaywallAssets } from "./resources-CptT7HD6.js";
4
4
  import * as fs from "node:fs";
5
5
 
6
6
  //#region src/core/paywalls/assets.ts
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Session } from "./storage-BjQCiTuz.js";
1
+ import { t as Session } from "./storage-Bdz5AmqS.js";
2
2
 
3
3
  //#region src/core/account/errors.d.ts
4
4
  declare class NotLoggedInError extends Error {
package/dist/auth.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-FmeHywYt.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-Bu3FaRkv.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
3
+ import "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
5
 
6
6
  export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
@@ -1,10 +1,10 @@
1
- import { S as apiKeyFromEnv, f as ENV_API_KEY, t as API_HOST } from "./environment-BWT2S4qC.js";
2
- import { n as readSession } from "./storage-DzP22xKn.js";
3
- import { r as createSuperwallApi } from "./client-AI9H4GGB.js";
1
+ import { S as apiKeyFromEnv, f as ENV_API_KEY, t as API_HOST } from "./environment-BocmdvZ-.js";
2
+ import { n as readSession } from "./storage-DT_wxwJ8.js";
3
+ import { r as createSuperwallApi } from "./client-CyrYJzBF.js";
4
4
  import { n as ui } from "./ui-D_qf3Gvw.js";
5
- import { k as isRecord, p as listApplications, y as platformLabel } from "./resources-BaP3p_LY.js";
6
- import { b as writeSources, d as parseSources, f as readLock, m as writeApp } from "./types-JdxmnCko.js";
7
- import { n as performLoginWithUi } from "./login-COmGHrU5.js";
5
+ import { k as isRecord, p as listApplications, y as platformLabel } from "./resources-CptT7HD6.js";
6
+ import { _ as writeSources, c as parseSources, d as writeApp, l as readLock } from "./lock-DgSx-p8Y.js";
7
+ import { n as performLoginWithUi } from "./login-Jp6E6d2e.js";
8
8
  import * as fs from "node:fs";
9
9
  import * as path from "node:path";
10
10
 
@@ -159,34 +159,6 @@ function writeProjectScaffold(options) {
159
159
  writeIfAbsent(path.join(options.superwallDir, ".gitignore"), GITIGNORE);
160
160
  }
161
161
 
162
- //#endregion
163
- //#region src/core/paywalls/source/base.ts
164
- const LEGACY_FILE = path.join(".superwall", "source.json");
165
- function readLegacyBases(superwallDir) {
166
- const file = path.join(superwallDir, LEGACY_FILE);
167
- if (!fs.existsSync(file)) return {};
168
- let parsed;
169
- try {
170
- parsed = JSON.parse(fs.readFileSync(file, "utf8"));
171
- } catch (error) {
172
- const reason = error instanceof Error ? error.message : String(error);
173
- throw new Error(`Can't read ${file} (${reason}) — fix or delete it, then push again.`);
174
- }
175
- if (!isRecord(parsed) || !isRecord(parsed.repos)) throw new Error(`${file} isn't a source sync record — fix or delete it, then push again.`);
176
- return parseSources(parsed.repos);
177
- }
178
- function readSourceBase(superwallDir, repo) {
179
- return readLock(superwallDir).sources?.[repo] ?? readLegacyBases(superwallDir)[repo];
180
- }
181
- function writeSourceBase(superwallDir, repo, commitSha) {
182
- writeSources(superwallDir, {
183
- ...readLegacyBases(superwallDir),
184
- ...readLock(superwallDir).sources,
185
- [repo]: commitSha
186
- });
187
- fs.rmSync(path.join(superwallDir, LEGACY_FILE), { force: true });
188
- }
189
-
190
162
  //#endregion
191
163
  //#region src/core/paywalls/project/session.ts
192
164
  var LoginRequiredError = class extends Error {
@@ -216,4 +188,32 @@ async function requireApi(interactive, login = performLoginWithUi) {
216
188
  }
217
189
 
218
190
  //#endregion
219
- export { projectPackageName as a, planTargets as c, PLATFORMS as d, requirePlatform as f, writeSourceBase as i, targetLabel as l, requireApi as n, writeProjectScaffold as o, resolveApps as p, readSourceBase as r, parsePlatformFlags as s, LoginRequiredError as t, wantedPlatforms as u };
191
+ //#region src/core/paywalls/source/base.ts
192
+ const LEGACY_FILE = path.join(".superwall", "source.json");
193
+ function readLegacyBases(superwallDir) {
194
+ const file = path.join(superwallDir, LEGACY_FILE);
195
+ if (!fs.existsSync(file)) return {};
196
+ let parsed;
197
+ try {
198
+ parsed = JSON.parse(fs.readFileSync(file, "utf8"));
199
+ } catch (error) {
200
+ const reason = error instanceof Error ? error.message : String(error);
201
+ throw new Error(`Can't read ${file} (${reason}) — fix or delete it, then push again.`);
202
+ }
203
+ if (!isRecord(parsed) || !isRecord(parsed.repos)) throw new Error(`${file} isn't a source sync record — fix or delete it, then push again.`);
204
+ return parseSources(parsed.repos);
205
+ }
206
+ function readSourceBase(superwallDir, repo) {
207
+ return readLock(superwallDir).sources?.[repo] ?? readLegacyBases(superwallDir)[repo];
208
+ }
209
+ function writeSourceBase(superwallDir, repo, commitSha) {
210
+ writeSources(superwallDir, {
211
+ ...readLegacyBases(superwallDir),
212
+ ...readLock(superwallDir).sources,
213
+ [repo]: commitSha
214
+ });
215
+ fs.rmSync(path.join(superwallDir, LEGACY_FILE), { force: true });
216
+ }
217
+
218
+ //#endregion
219
+ export { projectPackageName as a, planTargets as c, wantedPlatforms as d, PLATFORMS as f, resolveApps as h, requireApi as i, surfaceKey as l, requirePlatform as m, writeSourceBase as n, writeProjectScaffold as o, platformFor as p, LoginRequiredError as r, parsePlatformFlags as s, readSourceBase as t, targetLabel as u };
@@ -1,6 +1,6 @@
1
- import { h as Integration } from "./environment-BWT2S4qC.js";
2
- import { i as readPackageJson, r as allDeps } from "./scan-Bj5y0zTZ.js";
3
- import { d as readBundledSkill } from "./skills-2qYaUXGE.js";
1
+ import { h as Integration } from "./environment-BocmdvZ-.js";
2
+ import { i as readPackageJson, r as allDeps } from "./scan-nVQO7JLx.js";
3
+ import { d as readBundledSkill } from "./skills-421SFEyF.js";
4
4
  import { readFileSync } from "node:fs";
5
5
  import fg from "fast-glob";
6
6
 
@@ -1,8 +1,8 @@
1
- import { h as Integration } from "./environment-BWT2S4qC.js";
2
- import { n as withSpinner } from "./spinner-BANVLncC.js";
1
+ import { h as Integration } from "./environment-BocmdvZ-.js";
2
+ import { n as withSpinner } from "./spinner-DPdBlZe2.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BaP3p_LY.js";
5
- import { n as orgForNewProject } from "./org-C04eAO-j.js";
4
+ import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-CptT7HD6.js";
5
+ import { n as orgForNewProject } from "./org-Dud1rF9f.js";
6
6
 
7
7
  //#region src/core/account/bind.ts
8
8
  const NEW = "__new__";
@@ -1,15 +1,16 @@
1
- import "./token-FmeHywYt.js";
1
+ import "./token-Bu3FaRkv.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { x as VERSION } from "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
3
+ import { x as VERSION } from "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
+ import "./client-CyrYJzBF.js";
6
6
  import "./config-CGcG7GOt.js";
7
7
  import { n as ui } from "./ui-D_qf3Gvw.js";
8
- import "./orgs-D6Kk96mG.js";
9
- import "./resources-BaP3p_LY.js";
10
- import { t as assetBaseUrl } from "./assets-BrB9jQPQ.js";
11
- import { a as resolveProjectDir, d as kb, h as took, i as requireProject, n as parseIds, s as selectSurfaces, y as resolveFramework } from "./selection-BltBpyp5.js";
12
- import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-JdxmnCko.js";
8
+ import "./orgs-Z0H9WOs1.js";
9
+ import "./resources-CptT7HD6.js";
10
+ import { b as writeProjectTypes, l as readLock, y as collectProjectDeclarations } from "./lock-DgSx-p8Y.js";
11
+ import { _ as took, i as parseIds, l as selectSurfaces, n as resolveFramework, o as requireProject, p as kb, s as resolveProjectDir } from "./framework-CLmf4swr.js";
12
+ import { t as assetBaseUrl } from "./assets-B_quADds.js";
13
+ import { n as lintDesignTokens, t as formatTokenFinding } from "./design-lint-CiFc78aM.js";
13
14
  import * as fs from "node:fs";
14
15
  import * as path from "node:path";
15
16
  import pc from "picocolors";
@@ -49,6 +50,7 @@ async function runBuildPipeline(context, options = {}) {
49
50
  text: `Superwall ${pc.dim(`v${VERSION}`)}`
50
51
  });
51
52
  for (const surface of surfaces) for (const problem of surface.diagnostics ?? []) ui.warn(problem);
53
+ for (const finding of lintDesignTokens(project, surfaces)) ui.warn(formatTokenFinding(finding));
52
54
  const outcomes = [];
53
55
  const at = Date.now();
54
56
  for (const surface of surfaces) for (const platform of platforms) {
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError } from "./token-FmeHywYt.js";
2
- import { b as USER_AGENT } from "./environment-BWT2S4qC.js";
3
- import { a as resolveApiHost, n as readSession } from "./storage-DzP22xKn.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError } from "./token-Bu3FaRkv.js";
2
+ import { b as USER_AGENT } from "./environment-BocmdvZ-.js";
3
+ import { a as resolveApiHost, n as readSession } from "./storage-DT_wxwJ8.js";
4
4
 
5
5
  //#region src/core/api/client.ts
6
6
  const BODY_SNIPPET = 200;
@@ -0,0 +1,20 @@
1
+ import "./token-Bu3FaRkv.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
+ import "./client-CyrYJzBF.js";
6
+ import "./held-Bykbwy-m.js";
7
+ import "./config-CGcG7GOt.js";
8
+ import "./spinner-DPdBlZe2.js";
9
+ import "./ui-D_qf3Gvw.js";
10
+ import "./paths-CzTJVpfi.js";
11
+ import "./orgs-Z0H9WOs1.js";
12
+ import "./resources-CptT7HD6.js";
13
+ import "./org-Dud1rF9f.js";
14
+ import "./lookup-CWzVfPpq.js";
15
+ import "./scope-l1qGLsgz.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-BCIgjRHn.js";
19
+
20
+ export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
@@ -1,10 +1,10 @@
1
1
  import { r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
2
- import { C as appleCredentialsFromEnv, m as ENV_APPLE_PASSWORD, p as ENV_APPLE_ID, x as VERSION } from "./environment-BWT2S4qC.js";
3
- import { t as ApiError } from "./client-AI9H4GGB.js";
4
- import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-D3PUNky2.js";
5
- import { t as apiCall } from "./spinner-BANVLncC.js";
6
- import { n as SUPERWALL_HOME } from "./paths-REb-GrbX.js";
7
- import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BaP3p_LY.js";
2
+ import { C as appleCredentialsFromEnv, m as ENV_APPLE_PASSWORD, p as ENV_APPLE_ID, x as VERSION } from "./environment-BocmdvZ-.js";
3
+ import { t as ApiError } from "./client-CyrYJzBF.js";
4
+ import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-Bykbwy-m.js";
5
+ import { t as apiCall } from "./spinner-DPdBlZe2.js";
6
+ import { n as SUPERWALL_HOME } from "./paths-CzTJVpfi.js";
7
+ import { A as listField, M as textField, O as field, j as parseJson } from "./resources-CptT7HD6.js";
8
8
  import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BJQXl62Q.js";
9
9
  import { t as timing } from "./timing-Ca0TXY-A.js";
10
10
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
@@ -1,41 +1,41 @@
1
- import "./token-FmeHywYt.js";
1
+ import "./token-Bu3FaRkv.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
3
+ import "./environment-BocmdvZ-.js";
4
+ import "./storage-DT_wxwJ8.js";
5
+ import "./client-CyrYJzBF.js";
6
6
  import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
7
+ import "./telemetry-ovPiseFm.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
9
+ import "./spinner-DPdBlZe2.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
11
  import "./theme-DUsCh-Vd.js";
12
12
  import "./log-C0MDCfA2.js";
13
- import "./scan-Bj5y0zTZ.js";
14
- import "./existing-b0GxFcnc.js";
15
- import "./paths-REb-GrbX.js";
16
- import "./orgs-D6Kk96mG.js";
17
- import { O as field } from "./resources-BaP3p_LY.js";
18
- import "./org-C04eAO-j.js";
19
- import "./lookup-gjcKIZvh.js";
20
- import "./bind-B3eEcRyp.js";
21
- import "./login-PMoXUGqq.js";
22
- import "./skills-2qYaUXGE.js";
13
+ import "./scan-nVQO7JLx.js";
14
+ import "./existing-Cl5x6_5u.js";
15
+ import "./paths-CzTJVpfi.js";
16
+ import "./orgs-Z0H9WOs1.js";
17
+ import { O as field } from "./resources-CptT7HD6.js";
18
+ import "./org-Dud1rF9f.js";
19
+ import "./lookup-CWzVfPpq.js";
20
+ import "./bind-ClFjTt0U.js";
21
+ import "./login-5sWIKDI2.js";
22
+ import "./skills-421SFEyF.js";
23
23
  import "./browser-Bp3yRKlU.js";
24
- import "./assets-BrB9jQPQ.js";
25
- import "./selection-BltBpyp5.js";
26
- import "./types-JdxmnCko.js";
27
- import { a as projectPackageName, n as requireApi, t as LoginRequiredError } from "./session-D3fgXQBt.js";
28
- import "./source-push-kAep4gPe.js";
29
- import "./git-D7AVdugb.js";
30
- import "./scope-CCb_7UvN.js";
31
- import "./login-COmGHrU5.js";
32
- import "./run-C5OPwhvS.js";
33
- import "./drivers-CMEL13gp.js";
34
- import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-DS44-3Zr.js";
35
- import "./server-CdVIboQn.js";
36
- import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-DQpm2yVs.js";
37
- import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError, t as PUBLIC_REF } from "./download-2Zu2I_Og.js";
38
- import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-zzjtTy8k.js";
24
+ import "./lock-DgSx-p8Y.js";
25
+ import "./scope-ehZ7L1nj.js";
26
+ import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError, t as PUBLIC_REF } from "./download-DhGd4hOB.js";
27
+ import { a as projectPackageName, i as requireApi, r as LoginRequiredError } from "./base-ChTi42M0.js";
28
+ import "./framework-CLmf4swr.js";
29
+ import "./run-c1O2_8pp.js";
30
+ import "./drivers-BQkO5tHs.js";
31
+ import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-Z69tLeHC.js";
32
+ import "./login-Jp6E6d2e.js";
33
+ import "./source-BccdO4aL.js";
34
+ import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-C6NFy14d.js";
35
+ import "./assets-B_quADds.js";
36
+ import "./source-push-B4s6r9bB.js";
37
+ import "./server-DLARhh1k.js";
38
+ import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-DNd49kT-.js";
39
39
  import * as fs from "node:fs";
40
40
  import * as path from "node:path";
41
41
  import pc from "picocolors";
@@ -0,0 +1,158 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+
4
+ //#region src/core/paywalls/project/design-lint.ts
5
+ const TOKENS_FILE = path.join("design", "tokens.css");
6
+ const SCANNED = /\.(css|tsx|ts|jsx|js)$/;
7
+ const SKIPPED_DIRS = new Set([
8
+ "node_modules",
9
+ ".superwall",
10
+ "dist",
11
+ "public",
12
+ "assets"
13
+ ]);
14
+ const COLOR = /#[0-9a-fA-F]{3,8}\b|rgba?\([^)]*\)|hsla?\([^)]*\)/g;
15
+ const LENGTH = /(?<![\w.#-])-?\d*\.?\d+(?:px|rem|em)\b/g;
16
+ const NUMBER = /(?<![\w.#%-])\d*\.?\d+(?![\w.%(])/g;
17
+ const PAINTS = /color|background|border|outline|fill|stroke|shadow|caret|accent|decoration|column-rule/;
18
+ const URL_VALUE = /url\([^)]*\)/gi;
19
+ const DECLARATION = /(?<![\w-])["']?([a-zA-Z][\w-]*)["']?\s*:\s*((?:[^;{},]|,(?!\s*["']?[a-zA-Z][\w-]*["']?\s*:))+)/g;
20
+ const PREFIXES = {
21
+ text: "--text-",
22
+ leading: "--leading-",
23
+ tracking: "--tracking-",
24
+ weight: "--weight-",
25
+ radius: "--radius",
26
+ space: "--space-"
27
+ };
28
+ const kebab = (name) => name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
29
+ function categoryOf(property) {
30
+ if (property === "font-size") return "text";
31
+ if (property === "line-height") return "leading";
32
+ if (property === "letter-spacing") return "tracking";
33
+ if (property === "font-weight") return "weight";
34
+ if (property.includes("radius")) return "radius";
35
+ if (/^(padding|margin|gap|row-gap|column-gap)(-|$)/.test(property)) return "space";
36
+ return null;
37
+ }
38
+ function normalizeColor(literal) {
39
+ const value = literal.toLowerCase().trim().replace(/\s+/g, " ").replace(/\s*([(),/])\s*/g, "$1");
40
+ if (!value.startsWith("#")) return value;
41
+ const hex = value.slice(1);
42
+ const long = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
43
+ return `#${long.length === 8 && long.endsWith("ff") ? long.slice(0, 6) : long}`;
44
+ }
45
+ function normalizeLength(literal) {
46
+ const unit = literal.match(/(px|rem|em)$/)?.[1];
47
+ const amount = Number.parseFloat(literal);
48
+ if (unit === "rem") return `${amount * 16}px`;
49
+ return `${amount}${unit ?? ""}`;
50
+ }
51
+ function tokenLiteral(value) {
52
+ const trimmed = value.trim();
53
+ if (/^(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\))$/.test(trimmed)) return {
54
+ kind: "color",
55
+ value: normalizeColor(trimmed)
56
+ };
57
+ if (/^-?\d*\.?\d+(px|rem|em)$/.test(trimmed)) return {
58
+ kind: "length",
59
+ value: normalizeLength(trimmed)
60
+ };
61
+ if (/^\d*\.?\d+$/.test(trimmed)) return {
62
+ kind: "number",
63
+ value: String(Number(trimmed))
64
+ };
65
+ return null;
66
+ }
67
+ function readTokens(css) {
68
+ const index = {
69
+ colors: /* @__PURE__ */ new Map(),
70
+ values: /* @__PURE__ */ new Map()
71
+ };
72
+ for (const match of css.replace(/\/\*[\s\S]*?\*\//g, "").matchAll(/(--[\w-]+)\s*:\s*([^;}]+)/g)) {
73
+ const [, name, raw] = match;
74
+ if (!name || raw === void 0) continue;
75
+ const literal = tokenLiteral(raw);
76
+ if (!literal) continue;
77
+ const map = literal.kind === "color" ? index.colors : index.values;
78
+ const key = literal.kind === "color" ? literal.value : `${literal.kind}:${literal.value}`;
79
+ map.set(key, (map.get(key) ?? /* @__PURE__ */ new Set()).add(name));
80
+ }
81
+ return index;
82
+ }
83
+ function lintValue(index, property, value) {
84
+ const findings = [];
85
+ const painted = PAINTS.test(property) ? value.replace(URL_VALUE, " ") : "";
86
+ for (const [literal] of painted.matchAll(COLOR)) {
87
+ const tokens = index.colors.get(normalizeColor(literal));
88
+ if (tokens) findings.push({
89
+ literal,
90
+ tokens: [...tokens].sort()
91
+ });
92
+ }
93
+ const category = categoryOf(property);
94
+ if (!category) return findings;
95
+ const prefix = PREFIXES[category];
96
+ const unitless = category === "weight" || category === "leading";
97
+ const literals = [...value.replace(COLOR, " ").matchAll(LENGTH)].map(([literal]) => ({
98
+ literal,
99
+ key: `length:${normalizeLength(literal)}`
100
+ }));
101
+ if (unitless) for (const [literal] of value.replace(COLOR, " ").replace(LENGTH, " ").matchAll(NUMBER)) literals.push({
102
+ literal,
103
+ key: `number:${Number(literal)}`
104
+ });
105
+ for (const { literal, key } of literals) {
106
+ if (Number.parseFloat(literal) === 0) continue;
107
+ const tokens = [...index.values.get(key) ?? []].filter((name) => name.startsWith(prefix)).sort();
108
+ if (tokens.length > 0) findings.push({
109
+ literal,
110
+ tokens
111
+ });
112
+ }
113
+ return findings;
114
+ }
115
+ function lintSource(index, text) {
116
+ const findings = [];
117
+ const lines = text.replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, " ")).split("\n");
118
+ for (const [index_, line] of lines.entries()) {
119
+ if (/^\s*\/\//.test(line)) continue;
120
+ for (const [, rawProperty, rawValue] of line.matchAll(DECLARATION)) {
121
+ if (!rawProperty || rawValue === void 0) continue;
122
+ for (const finding of lintValue(index, kebab(rawProperty), rawValue.replace(/["'`]/g, " "))) findings.push({
123
+ line: index_ + 1,
124
+ ...finding
125
+ });
126
+ }
127
+ }
128
+ return findings;
129
+ }
130
+ function walk(dir, into) {
131
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
132
+ for (const entry of entries) {
133
+ const full = path.join(dir, entry.name);
134
+ if (entry.isDirectory()) {
135
+ if (!SKIPPED_DIRS.has(entry.name)) walk(full, into);
136
+ } else if (SCANNED.test(entry.name)) into.push(full);
137
+ }
138
+ }
139
+ function lintDesignTokens(project, surfaces) {
140
+ const tokensFile = path.join(project.superwallDir, TOKENS_FILE);
141
+ if (!fs.existsSync(tokensFile)) return [];
142
+ const index = readTokens(fs.readFileSync(tokensFile, "utf8"));
143
+ if (index.colors.size === 0 && index.values.size === 0) return [];
144
+ const files = [];
145
+ for (const dir of [...surfaces.map((surface) => surface.dir), path.join(project.superwallDir, "components")]) if (fs.existsSync(dir)) walk(dir, files);
146
+ const configFiles = new Set(surfaces.map((surface) => surface.configFile));
147
+ return [...new Set(files)].filter((file) => !configFiles.has(file)).flatMap((file) => lintSource(index, fs.readFileSync(file, "utf8")).map((finding) => ({
148
+ file: path.relative(project.superwallDir, file),
149
+ ...finding
150
+ })));
151
+ }
152
+ function formatTokenFinding(finding) {
153
+ const tokens = finding.tokens.map((token) => `var(${token})`).join(" or ");
154
+ return `${finding.file}:${finding.line} hard-codes ${finding.literal}, which the design system holds as ${tokens}. Use the token so a design-system change reaches it.`;
155
+ }
156
+
157
+ //#endregion
158
+ export { lintDesignTokens as n, formatTokenFinding as t };