@zveltio/cli 3.0.0-beta.82 → 3.0.0-beta.83

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 (2) hide show
  1. package/dist/index.js +57 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2045,7 +2045,7 @@ function resolvePackIsolation(opts) {
2045
2045
 
2046
2046
  // src/lib/publisher-tier.ts
2047
2047
  function tierAllowsInline(tier) {
2048
- return tier === "first-party" || tier === "verified";
2048
+ return tier === "first-party";
2049
2049
  }
2050
2050
  async function resolvePublisherTier(opts = {}) {
2051
2051
  if (opts.firstParty) {
@@ -2259,9 +2259,9 @@ async function extensionPackCommand(opts) {
2259
2259
  });
2260
2260
  if (!resolved.allowsInline) {
2261
2261
  communityInject = true;
2262
- console.log(` ${c5.yellow("\u26A0")} ${resolved.tier} publisher \u2014 auto-set ${c5.bold('engine.isolation: "worker"')} ` + `(community extensions can't run inline).`);
2262
+ console.log(` ${c5.yellow("\u26A0")} ${resolved.tier} publisher \u2014 auto-set ${c5.bold('engine.isolation: "worker"')} ` + `(only first-party extensions run inline).`);
2263
2263
  if (resolved.source === "default") {
2264
- console.log(c5.dim(" Tier defaulted to community (no --first-party flag, no registry token). " + "If you are verified/first-party, pass --first-party or set ZVELTIO_REGISTRY_TOKEN."));
2264
+ console.log(c5.dim(" Tier defaulted to community (no --first-party flag, no registry token). " + "If you are first-party, pass --first-party or set ZVELTIO_REGISTRY_TOKEN."));
2265
2265
  }
2266
2266
  }
2267
2267
  } else if (opts.firstParty && manifest.engine.isolation === "worker" && !opts.keepIsolation) {
@@ -4475,6 +4475,57 @@ function validateManifest(input) {
4475
4475
  }
4476
4476
  }
4477
4477
  }
4478
+ const NAME = /^[a-z][a-zA-Z0-9]*$/;
4479
+ const strings = (v) => v === undefined || Array.isArray(v) && v.every((s) => typeof s === "string");
4480
+ const isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
4481
+ const entries = (field, code) => {
4482
+ const v = obj[field];
4483
+ if (v === undefined)
4484
+ return [];
4485
+ if (!Array.isArray(v)) {
4486
+ out.push(err(code, `"${field}" must be an array`));
4487
+ return [];
4488
+ }
4489
+ const seen = new Set;
4490
+ return v.filter((e, i) => {
4491
+ if (!isObject(e) || typeof e.name !== "string" || !NAME.test(e.name)) {
4492
+ out.push(err(code, `${field}[${i}] needs a camelCase "name"`));
4493
+ return false;
4494
+ }
4495
+ if (seen.has(e.name))
4496
+ out.push(err(code, `"${e.name}" is declared twice in ${field}`));
4497
+ seen.add(e.name);
4498
+ if (!isObject(e.input))
4499
+ out.push(err(code, `"${e.name}": "input" must be a JSON Schema object`));
4500
+ for (const k of ["reads", "writes", "enqueues"]) {
4501
+ if (!strings(e[k]))
4502
+ out.push(err(code, `"${e.name}": "${k}" must be an array of names`));
4503
+ }
4504
+ return true;
4505
+ });
4506
+ };
4507
+ const jobs = entries("jobs", "MANIFEST_BAD_JOB");
4508
+ const resources = Array.isArray(obj.resources) ? obj.resources : [];
4509
+ for (const a of entries("actions", "MANIFEST_BAD_ACTION")) {
4510
+ const p = a.permission;
4511
+ if (!isObject(p) || typeof p.resource !== "string" || !resources.includes(p.resource)) {
4512
+ out.push(err("MANIFEST_BAD_ACTION", `action "${a.name}": "permission.resource" must be in resources`));
4513
+ } else if (p.action !== undefined && (typeof p.action !== "string" || !p.action)) {
4514
+ out.push(err("MANIFEST_BAD_ACTION", `action "${a.name}": "permission.action" must be a name`));
4515
+ }
4516
+ for (const job of Array.isArray(a.enqueues) ? a.enqueues : []) {
4517
+ if (!jobs.some((j) => j.name === job)) {
4518
+ out.push(err("MANIFEST_BAD_ACTION", `action "${a.name}" enqueues "${job}", which is not in jobs`));
4519
+ }
4520
+ }
4521
+ }
4522
+ for (const j of jobs) {
4523
+ const r = j.retry;
4524
+ const limit = isObject(r) ? r.limit : undefined;
4525
+ if (r !== undefined && (!isObject(r) || limit !== undefined && !(Number.isInteger(limit) && limit >= 0 && limit <= 10) || r.backoff !== undefined && typeof r.backoff !== "boolean")) {
4526
+ out.push(err("MANIFEST_BAD_JOB", `job "${j.name}": "retry" is { limit: 0-10, backoff: boolean }`));
4527
+ }
4528
+ }
4478
4529
  if (obj.forwardCredentials !== undefined) {
4479
4530
  const fwd = obj.forwardCredentials;
4480
4531
  const publicRoutes = Array.isArray(obj.publicRoutes) ? obj.publicRoutes : [];
@@ -5286,7 +5337,7 @@ ${c7.bold("Extension validate")}
5286
5337
  console.log("");
5287
5338
  if (isolation !== "worker" && !inlineOk) {
5288
5339
  console.error(c7.red(`Validation failed: ${resolved.tier} publishers must declare ` + `engine.isolation: "worker" (marketplace-policy.md \xA72).`));
5289
- console.error(c7.dim(' Add `"isolation": "worker"` to the engine block in manifest.json, ' + "then re-pack. If you are a verified/first-party publisher, pass " + "--first-party or set ZVELTIO_REGISTRY_TOKEN so the tier can be confirmed. " + "See docs/extensions/marketplace-policy.md \xA72."));
5340
+ console.error(c7.dim(' Add `"isolation": "worker"` to the engine block in manifest.json, ' + "then re-pack. If you are a first-party publisher, pass " + "--first-party or set ZVELTIO_REGISTRY_TOKEN so the tier can be confirmed. " + "See docs/extensions/marketplace-policy.md \xA72."));
5290
5341
  if (opts.silentExit)
5291
5342
  throw new Error("Validation failed: community inline isolation");
5292
5343
  process.exit(1);
@@ -7139,7 +7190,7 @@ async function getLocalVersion() {
7139
7190
  // package.json
7140
7191
  var package_default = {
7141
7192
  name: "@zveltio/cli",
7142
- version: "3.0.0-beta.82",
7193
+ version: "3.0.0-beta.83",
7143
7194
  type: "module",
7144
7195
  bin: {
7145
7196
  zveltio: "./dist/index.js"
@@ -7154,7 +7205,7 @@ var package_default = {
7154
7205
  dev: "bun run --watch src/index.ts"
7155
7206
  },
7156
7207
  dependencies: {
7157
- "@zveltio/sdk": "3.0.0-beta.82",
7208
+ "@zveltio/sdk": "3.0.0-beta.83",
7158
7209
  commander: "^12.1.0"
7159
7210
  },
7160
7211
  devDependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zveltio/cli",
3
- "version": "3.0.0-beta.82",
3
+ "version": "3.0.0-beta.83",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zveltio": "./dist/index.js"
@@ -15,7 +15,7 @@
15
15
  "dev": "bun run --watch src/index.ts"
16
16
  },
17
17
  "dependencies": {
18
- "@zveltio/sdk": "3.0.0-beta.82",
18
+ "@zveltio/sdk": "3.0.0-beta.83",
19
19
  "commander": "^12.1.0"
20
20
  },
21
21
  "devDependencies": {