pepr 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -6,7 +6,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ try {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ } catch (e) {
12
+ throw mod = 0, e;
13
+ }
10
14
  };
11
15
  var __copyProps = (to, from, except, desc) => {
12
16
  if (from && typeof from === "object" || typeof from === "function") {
@@ -626,6 +630,8 @@ var require_Alias = __commonJS({
626
630
  * instance of the `source` anchor before this node.
627
631
  */
628
632
  resolve(doc, ctx) {
633
+ if (ctx?.maxAliasCount === 0)
634
+ throw new ReferenceError("Alias resolution is disabled");
629
635
  let nodes;
630
636
  if (ctx?.aliasResolveCache) {
631
637
  nodes = ctx.aliasResolveCache;
@@ -1698,18 +1704,18 @@ var require_merge = __commonJS({
1698
1704
  };
1699
1705
  var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
1700
1706
  function addMergeToJSMap(ctx, map, value) {
1701
- value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1702
- if (identity.isSeq(value))
1703
- for (const it of value.items)
1707
+ const source = resolveAliasValue(ctx, value);
1708
+ if (identity.isSeq(source))
1709
+ for (const it of source.items)
1704
1710
  mergeValue(ctx, map, it);
1705
- else if (Array.isArray(value))
1706
- for (const it of value)
1711
+ else if (Array.isArray(source))
1712
+ for (const it of source)
1707
1713
  mergeValue(ctx, map, it);
1708
1714
  else
1709
- mergeValue(ctx, map, value);
1715
+ mergeValue(ctx, map, source);
1710
1716
  }
1711
1717
  function mergeValue(ctx, map, value) {
1712
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1718
+ const source = resolveAliasValue(ctx, value);
1713
1719
  if (!identity.isMap(source))
1714
1720
  throw new Error("Merge sources must be maps or map aliases");
1715
1721
  const srcMap = source.toJSON(null, ctx, Map);
@@ -1730,6 +1736,9 @@ var require_merge = __commonJS({
1730
1736
  }
1731
1737
  return map;
1732
1738
  }
1739
+ function resolveAliasValue(ctx, value) {
1740
+ return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
1741
+ }
1733
1742
  exports2.addMergeToJSMap = addMergeToJSMap;
1734
1743
  exports2.isMergeKey = isMergeKey;
1735
1744
  exports2.merge = merge;
@@ -2360,14 +2369,14 @@ var require_bool = __commonJS({
2360
2369
  var require_stringifyNumber = __commonJS({
2361
2370
  "node_modules/yaml/dist/stringify/stringifyNumber.js"(exports2) {
2362
2371
  "use strict";
2363
- function stringifyNumber({ format: format2, minFractionDigits, tag, value }) {
2372
+ function stringifyNumber({ format, minFractionDigits, tag, value }) {
2364
2373
  if (typeof value === "bigint")
2365
2374
  return String(value);
2366
2375
  const num = typeof value === "number" ? value : Number(value);
2367
2376
  if (!isFinite(num))
2368
2377
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
2369
2378
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2370
- if (!format2 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
2379
+ if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
2371
2380
  let i = n.indexOf(".");
2372
2381
  if (i < 0) {
2373
2382
  i = n.length;
@@ -4739,7 +4748,7 @@ var require_resolve_flow_scalar = __commonJS({
4739
4748
  while (next === " " || next === " ")
4740
4749
  next = source[++i + 1];
4741
4750
  } else if (next === "x" || next === "u" || next === "U") {
4742
- const length = { x: 2, u: 4, U: 8 }[next];
4751
+ const length = next === "x" ? 2 : next === "u" ? 4 : 8;
4743
4752
  res += parseCharCode(source, i + 1, length, onError);
4744
4753
  i += length;
4745
4754
  } else {
@@ -4814,12 +4823,13 @@ var require_resolve_flow_scalar = __commonJS({
4814
4823
  const cc = source.substr(offset, length);
4815
4824
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4816
4825
  const code = ok ? parseInt(cc, 16) : NaN;
4817
- if (isNaN(code)) {
4826
+ try {
4827
+ return String.fromCodePoint(code);
4828
+ } catch {
4818
4829
  const raw = source.substr(offset - 2, length + 2);
4819
4830
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4820
4831
  return raw;
4821
4832
  }
4822
- return String.fromCodePoint(code);
4823
4833
  }
4824
4834
  exports2.resolveFlowScalar = resolveFlowScalar;
4825
4835
  }
@@ -5169,8 +5179,10 @@ ${cb}` : comment;
5169
5179
  }
5170
5180
  }
5171
5181
  if (afterDoc) {
5172
- Array.prototype.push.apply(doc.errors, this.errors);
5173
- Array.prototype.push.apply(doc.warnings, this.warnings);
5182
+ for (let i = 0; i < this.errors.length; ++i)
5183
+ doc.errors.push(this.errors[i]);
5184
+ for (let i = 0; i < this.warnings.length; ++i)
5185
+ doc.warnings.push(this.warnings[i]);
5174
5186
  } else {
5175
5187
  doc.errors = this.errors;
5176
5188
  doc.warnings = this.warnings;
@@ -5903,7 +5915,7 @@ var require_lexer = __commonJS({
5903
5915
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
5904
5916
  this.indentNext = this.indentValue + 1;
5905
5917
  this.indentValue += n;
5906
- return yield* this.parseBlockStart();
5918
+ return "block-start";
5907
5919
  }
5908
5920
  return "doc";
5909
5921
  }
@@ -6202,28 +6214,38 @@ var require_lexer = __commonJS({
6202
6214
  return 0;
6203
6215
  }
6204
6216
  *pushIndicators() {
6205
- switch (this.charAt(0)) {
6206
- case "!":
6207
- return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6208
- case "&":
6209
- return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6210
- case "-":
6211
- // this is an error
6212
- case "?":
6213
- // this is an error outside flow collections
6214
- case ":": {
6215
- const inFlow = this.flowLevel > 0;
6216
- const ch1 = this.charAt(1);
6217
- if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
6218
- if (!inFlow)
6219
- this.indentNext = this.indentValue + 1;
6220
- else if (this.flowKey)
6221
- this.flowKey = false;
6222
- return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6217
+ let n = 0;
6218
+ loop: while (true) {
6219
+ switch (this.charAt(0)) {
6220
+ case "!":
6221
+ n += yield* this.pushTag();
6222
+ n += yield* this.pushSpaces(true);
6223
+ continue loop;
6224
+ case "&":
6225
+ n += yield* this.pushUntil(isNotAnchorChar);
6226
+ n += yield* this.pushSpaces(true);
6227
+ continue loop;
6228
+ case "-":
6229
+ // this is an error
6230
+ case "?":
6231
+ // this is an error outside flow collections
6232
+ case ":": {
6233
+ const inFlow = this.flowLevel > 0;
6234
+ const ch1 = this.charAt(1);
6235
+ if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
6236
+ if (!inFlow)
6237
+ this.indentNext = this.indentValue + 1;
6238
+ else if (this.flowKey)
6239
+ this.flowKey = false;
6240
+ n += yield* this.pushCount(1);
6241
+ n += yield* this.pushSpaces(true);
6242
+ continue loop;
6243
+ }
6223
6244
  }
6224
6245
  }
6246
+ break loop;
6225
6247
  }
6226
- return 0;
6248
+ return n;
6227
6249
  }
6228
6250
  *pushTag() {
6229
6251
  if (this.charAt(1) === "<") {
@@ -6382,6 +6404,13 @@ var require_parser = __commonJS({
6382
6404
  }
6383
6405
  return prev.splice(i, prev.length);
6384
6406
  }
6407
+ function arrayPushArray(target, source) {
6408
+ if (source.length < 1e5)
6409
+ Array.prototype.push.apply(target, source);
6410
+ else
6411
+ for (let i = 0; i < source.length; ++i)
6412
+ target.push(source[i]);
6413
+ }
6385
6414
  function fixFlowSeqItems(fc) {
6386
6415
  if (fc.start.type === "flow-seq-start") {
6387
6416
  for (const it of fc.items) {
@@ -6391,11 +6420,11 @@ var require_parser = __commonJS({
6391
6420
  delete it.key;
6392
6421
  if (isFlowToken(it.value)) {
6393
6422
  if (it.value.end)
6394
- Array.prototype.push.apply(it.value.end, it.sep);
6423
+ arrayPushArray(it.value.end, it.sep);
6395
6424
  else
6396
6425
  it.value.end = it.sep;
6397
6426
  } else
6398
- Array.prototype.push.apply(it.start, it.sep);
6427
+ arrayPushArray(it.start, it.sep);
6399
6428
  delete it.sep;
6400
6429
  }
6401
6430
  }
@@ -6750,7 +6779,7 @@ var require_parser = __commonJS({
6750
6779
  const prev = map.items[map.items.length - 2];
6751
6780
  const end = prev?.value?.end;
6752
6781
  if (Array.isArray(end)) {
6753
- Array.prototype.push.apply(end, it.start);
6782
+ arrayPushArray(end, it.start);
6754
6783
  end.push(this.sourceToken);
6755
6784
  map.items.pop();
6756
6785
  return;
@@ -6878,14 +6907,14 @@ var require_parser = __commonJS({
6878
6907
  case "scalar":
6879
6908
  case "single-quoted-scalar":
6880
6909
  case "double-quoted-scalar": {
6881
- const fs15 = this.flowScalar(this.type);
6910
+ const fs14 = this.flowScalar(this.type);
6882
6911
  if (atNextItem || it.value) {
6883
- map.items.push({ start, key: fs15, sep: [] });
6912
+ map.items.push({ start, key: fs14, sep: [] });
6884
6913
  this.onKeyLine = true;
6885
6914
  } else if (it.sep) {
6886
- this.stack.push(fs15);
6915
+ this.stack.push(fs14);
6887
6916
  } else {
6888
- Object.assign(it, { key: fs15, sep: [] });
6917
+ Object.assign(it, { key: fs14, sep: [] });
6889
6918
  this.onKeyLine = true;
6890
6919
  }
6891
6920
  return;
@@ -6938,7 +6967,7 @@ var require_parser = __commonJS({
6938
6967
  const prev = seq.items[seq.items.length - 2];
6939
6968
  const end = prev?.value?.end;
6940
6969
  if (Array.isArray(end)) {
6941
- Array.prototype.push.apply(end, it.start);
6970
+ arrayPushArray(end, it.start);
6942
6971
  end.push(this.sourceToken);
6943
6972
  seq.items.pop();
6944
6973
  return;
@@ -7013,13 +7042,13 @@ var require_parser = __commonJS({
7013
7042
  case "scalar":
7014
7043
  case "single-quoted-scalar":
7015
7044
  case "double-quoted-scalar": {
7016
- const fs15 = this.flowScalar(this.type);
7045
+ const fs14 = this.flowScalar(this.type);
7017
7046
  if (!it || it.value)
7018
- fc.items.push({ start: [], key: fs15, sep: [] });
7047
+ fc.items.push({ start: [], key: fs14, sep: [] });
7019
7048
  else if (it.sep)
7020
- this.stack.push(fs15);
7049
+ this.stack.push(fs14);
7021
7050
  else
7022
- Object.assign(it, { key: fs15, sep: [] });
7051
+ Object.assign(it, { key: fs14, sep: [] });
7023
7052
  return;
7024
7053
  }
7025
7054
  case "flow-map-end":
@@ -7922,8 +7951,7 @@ function namespaceComplianceValidator(capability, ignoredNamespaces, watch) {
7922
7951
  var matchRegexToCapababilityNamespace = (bindingRegexNamespaces, capabilityNamespaces) => {
7923
7952
  if (bindingRegexNamespaces.length > 0 && capabilityNamespaces && capabilityNamespaces.length > 0) {
7924
7953
  for (const regexNamespace of bindingRegexNamespaces) {
7925
- let matches = false;
7926
- matches = regexNamespace !== "" && capabilityNamespaces.some(
7954
+ const matches = regexNamespace !== "" && capabilityNamespaces.some(
7927
7955
  (capabilityNamespace) => matchesRegex(regexNamespace, capabilityNamespace)
7928
7956
  );
7929
7957
  if (!matches) {
@@ -8227,18 +8255,19 @@ function runIdsForImage(image) {
8227
8255
  }
8228
8256
  function commonProbes() {
8229
8257
  return {
8230
- startupProbe: {
8231
- httpGet: { path: "/healthz", port: 3e3, scheme: "HTTPS" },
8232
- initialDelaySeconds: 10
8233
- },
8234
- readinessProbe: {
8235
- httpGet: { path: "/healthz", port: 3e3, scheme: "HTTPS" },
8236
- initialDelaySeconds: 10
8237
- },
8238
- livenessProbe: {
8239
- httpGet: { path: "/healthz", port: 3e3, scheme: "HTTPS" },
8240
- initialDelaySeconds: 10
8241
- }
8258
+ startupProbe: defaultProbe(),
8259
+ readinessProbe: defaultProbe(),
8260
+ livenessProbe: defaultProbe()
8261
+ };
8262
+ }
8263
+ function defaultProbe() {
8264
+ return {
8265
+ httpGet: { path: "/healthz", port: 3e3, scheme: "HTTPS" },
8266
+ initialDelaySeconds: 10,
8267
+ periodSeconds: 10,
8268
+ timeoutSeconds: 1,
8269
+ successThreshold: 1,
8270
+ failureThreshold: 3
8242
8271
  };
8243
8272
  }
8244
8273
  function commonResources() {
@@ -8638,7 +8667,8 @@ var Assets = class {
8638
8667
  );
8639
8668
  }
8640
8669
  } catch (err) {
8641
- throw new Error(`Error generating helm chart: ${err.message}`);
8670
+ const message = err instanceof Error ? err.message : String(err);
8671
+ throw new Error(`Error generating helm chart: ${message}`, { cause: err });
8642
8672
  }
8643
8673
  };
8644
8674
  };
@@ -8674,6 +8704,20 @@ var import_client_node3 = require("@kubernetes/client-node");
8674
8704
 
8675
8705
  // src/lib/assets/k8sObjects.ts
8676
8706
  var import_zlib = require("zlib");
8707
+ function defaultProbe2() {
8708
+ return {
8709
+ httpGet: {
8710
+ path: "/healthz",
8711
+ port: 3e3,
8712
+ scheme: "HTTPS"
8713
+ },
8714
+ initialDelaySeconds: 10,
8715
+ periodSeconds: 10,
8716
+ timeoutSeconds: 1,
8717
+ successThreshold: 1,
8718
+ failureThreshold: 3
8719
+ };
8720
+ }
8677
8721
  function getNamespace(namespaceLabels) {
8678
8722
  if (namespaceLabels) {
8679
8723
  return {
@@ -8751,30 +8795,9 @@ function getWatcher(assets, hash, buildTimestamp, imagePullSecret) {
8751
8795
  image,
8752
8796
  imagePullPolicy: "IfNotPresent",
8753
8797
  args: ["/app/node_modules/pepr/dist/controller.js", hash],
8754
- startupProbe: {
8755
- httpGet: {
8756
- path: "/healthz",
8757
- port: 3e3,
8758
- scheme: "HTTPS"
8759
- },
8760
- initialDelaySeconds: 10
8761
- },
8762
- readinessProbe: {
8763
- httpGet: {
8764
- path: "/healthz",
8765
- port: 3e3,
8766
- scheme: "HTTPS"
8767
- },
8768
- initialDelaySeconds: 10
8769
- },
8770
- livenessProbe: {
8771
- httpGet: {
8772
- path: "/healthz",
8773
- port: 3e3,
8774
- scheme: "HTTPS"
8775
- },
8776
- initialDelaySeconds: 10
8777
- },
8798
+ startupProbe: defaultProbe2(),
8799
+ readinessProbe: defaultProbe2(),
8800
+ livenessProbe: defaultProbe2(),
8778
8801
  ports: [
8779
8802
  {
8780
8803
  containerPort: 3e3
@@ -8892,30 +8915,9 @@ function getDeployment(assets, hash, buildTimestamp, imagePullSecret) {
8892
8915
  image,
8893
8916
  imagePullPolicy: "IfNotPresent",
8894
8917
  args: ["/app/node_modules/pepr/dist/controller.js", hash],
8895
- startupProbe: {
8896
- httpGet: {
8897
- path: "/healthz",
8898
- port: 3e3,
8899
- scheme: "HTTPS"
8900
- },
8901
- initialDelaySeconds: 10
8902
- },
8903
- readinessProbe: {
8904
- httpGet: {
8905
- path: "/healthz",
8906
- port: 3e3,
8907
- scheme: "HTTPS"
8908
- },
8909
- initialDelaySeconds: 10
8910
- },
8911
- livenessProbe: {
8912
- httpGet: {
8913
- path: "/healthz",
8914
- port: 3e3,
8915
- scheme: "HTTPS"
8916
- },
8917
- initialDelaySeconds: 10
8918
- },
8918
+ startupProbe: defaultProbe2(),
8919
+ readinessProbe: defaultProbe2(),
8920
+ livenessProbe: defaultProbe2(),
8919
8921
  ports: [
8920
8922
  {
8921
8923
  containerPort: 3e3
@@ -9669,7 +9671,7 @@ var packageJSON = {
9669
9671
  "!src/fixtures/**",
9670
9672
  "!dist/**/*.test.d.ts*"
9671
9673
  ],
9672
- version: "1.3.0",
9674
+ version: "2.0.0",
9673
9675
  main: "dist/lib.js",
9674
9676
  types: "dist/lib.d.ts",
9675
9677
  scripts: {
@@ -9703,28 +9705,32 @@ var packageJSON = {
9703
9705
  },
9704
9706
  dependencies: {
9705
9707
  "@types/ramda": "0.32.0",
9706
- "@typescript-eslint/eslint-plugin": "8.63.0",
9707
- "@typescript-eslint/parser": "8.63.0",
9708
- commander: "14.0.3",
9709
- eslint: "9.39.4",
9708
+ "@typescript-eslint/eslint-plugin": "8.66.0",
9709
+ "@typescript-eslint/parser": "8.66.0",
9710
+ commander: "15.0.0",
9711
+ eslint: "^10.8.0",
9710
9712
  express: "5.2.1",
9711
9713
  "fast-json-patch": "3.1.1",
9714
+ globals: "17.9.0",
9712
9715
  "http-status-codes": "^2.3.0",
9713
9716
  "json-pointer": "^0.6.2",
9714
- "kubernetes-fluent-client": "3.11.10",
9717
+ "kubernetes-fluent-client": "3.11.11",
9715
9718
  pino: "10.3.1",
9716
9719
  "pino-pretty": "13.1.3",
9717
9720
  "prom-client": "15.1.3",
9718
- "quicktype-core": "^23.2.6",
9721
+ "quicktype-core": "^26.0.0",
9719
9722
  ramda: "0.32.0"
9720
9723
  },
9721
9724
  devDependencies: {
9722
9725
  "@commitlint/cli": "21.2.1",
9723
9726
  "@commitlint/config-conventional": "21.2.0",
9727
+ "@eslint/eslintrc": "^3.3.6",
9728
+ "@eslint/js": "^10.0.1",
9724
9729
  "@types/command-line-args": "^5.2.3",
9725
9730
  "@types/express": "5.0.6",
9726
9731
  "@types/json-pointer": "^1.0.34",
9727
9732
  "@types/json-schema": "^7.0.15",
9733
+ "@types/ms": "^2.1.0",
9728
9734
  "@types/node": "^24.13.3",
9729
9735
  "@types/node-forge": "1.3.14",
9730
9736
  "@types/readable-stream": "^4.0.21",
@@ -9732,26 +9738,26 @@ var packageJSON = {
9732
9738
  "@types/ws": "^8.18.1",
9733
9739
  "@vitest/coverage-v8": "^4.0.4",
9734
9740
  "fast-check": "^4.0.0",
9735
- globals: "^17.0.0",
9736
9741
  husky: "^9.1.6",
9737
- "js-yaml": "^4.1.0",
9742
+ "js-yaml": "^5.2.1",
9743
+ ms: "^2.1.3",
9744
+ prettier: "^3.6.2",
9738
9745
  selfsigned: "^5.5.0",
9739
9746
  shellcheck: "^4.1.0",
9740
9747
  tsx: "^4.20.3",
9741
- undici: "8.7.0",
9748
+ undici: "8.10.0",
9742
9749
  vitest: "^4.0.4"
9743
9750
  },
9744
9751
  overrides: {
9745
- "brace-expansion": "^5.0.7",
9746
- "ip-address": "^10.1.1",
9752
+ "brace-expansion": "^5.0.9",
9753
+ "ip-address": "^10.5.0",
9747
9754
  tar: "^7.5.16",
9748
- "fast-uri": "^3.1.4"
9755
+ "fast-uri": "^3.1.5"
9749
9756
  },
9750
9757
  peerDependencies: {
9751
9758
  "@types/prompts": "^2.4.9",
9752
9759
  esbuild: "^0.28.0",
9753
9760
  "node-forge": "^1.4.0",
9754
- prettier: "^3.6.2",
9755
9761
  prompts: "^2.4.2",
9756
9762
  typescript: "^5.8.3",
9757
9763
  uuid: "^13.0.0"
@@ -9776,7 +9782,7 @@ async function createDir(dir) {
9776
9782
  await import_fs7.promises.mkdir(dir);
9777
9783
  } catch (err) {
9778
9784
  if (err && err.code === "EEXIST") {
9779
- throw new Error(`Directory ${dir} already exists`);
9785
+ throw new Error(`Directory ${dir} already exists`, { cause: err });
9780
9786
  } else {
9781
9787
  throw err;
9782
9788
  }
@@ -9836,7 +9842,13 @@ function genPkgJSON(opts) {
9836
9842
  undici: "^7.0.1"
9837
9843
  },
9838
9844
  devDependencies: {
9845
+ "@eslint/eslintrc": devDependencies["@eslint/eslintrc"],
9846
+ "@eslint/js": devDependencies["@eslint/js"],
9847
+ "@typescript-eslint/eslint-plugin": dependencies["@typescript-eslint/eslint-plugin"],
9848
+ "@typescript-eslint/parser": dependencies["@typescript-eslint/parser"],
9839
9849
  "@types/node": devDependencies["@types/node"],
9850
+ eslint: dependencies.eslint,
9851
+ globals: dependencies.globals,
9840
9852
  typescript
9841
9853
  },
9842
9854
  overrides: {
@@ -9901,71 +9913,6 @@ var eslint = {
9901
9913
  )
9902
9914
  };
9903
9915
 
9904
- // src/cli/format/index.ts
9905
- var import_eslint = require("eslint");
9906
-
9907
- // src/cli/format/format.helpers.ts
9908
- var import_fs9 = require("fs");
9909
- var import_prettier = require("prettier");
9910
- async function formatWithPrettier(results, validateOnly) {
9911
- let hasFailure = false;
9912
- for (const { filePath } of results) {
9913
- const content = await import_fs9.promises.readFile(filePath, "utf8");
9914
- const cfg = await (0, import_prettier.resolveConfig)(filePath);
9915
- const formatted = await (0, import_prettier.format)(content, { filepath: filePath, ...cfg });
9916
- if (validateOnly && formatted !== content) {
9917
- hasFailure = true;
9918
- console.error(`File ${filePath} is not formatted correctly`);
9919
- } else {
9920
- await import_fs9.promises.writeFile(filePath, formatted);
9921
- }
9922
- }
9923
- return hasFailure;
9924
- }
9925
-
9926
- // src/cli/format/index.ts
9927
- function format_default(program2) {
9928
- program2.command("format").description("Lint and format this Pepr module").option("-v, --validate-only", "Do not modify files, only validate formatting.").action(async (opts) => {
9929
- logger_default.warn(
9930
- "DEPRECATION NOTICE: The pepr format command will be removed in summer 2026. Once removed, module authors must run a linter separately from the pepr CLI."
9931
- );
9932
- const success = await peprFormat(opts.validateOnly);
9933
- if (success) {
9934
- logger_default.info("Module formatted");
9935
- } else {
9936
- process.exit(1);
9937
- }
9938
- });
9939
- }
9940
- async function peprFormat(validateOnly) {
9941
- {
9942
- try {
9943
- const eslint2 = new import_eslint.ESLint();
9944
- const results = await eslint2.lintFiles(["./**/*.ts"]);
9945
- let hasFailure = false;
9946
- results.forEach(async (result) => {
9947
- const errorCount = result.fatalErrorCount + result.errorCount;
9948
- if (errorCount > 0) {
9949
- hasFailure = true;
9950
- }
9951
- });
9952
- const formatter = await eslint2.loadFormatter("stylish");
9953
- const resultText = await formatter.format(results, {});
9954
- if (resultText) {
9955
- logger_default.info(resultText);
9956
- }
9957
- if (!validateOnly) {
9958
- await import_eslint.ESLint.outputFixes(results);
9959
- }
9960
- hasFailure = hasFailure || await formatWithPrettier(results, validateOnly);
9961
- return !hasFailure;
9962
- } catch (error) {
9963
- logger_default.error(error, `Error formatting module:`);
9964
- return false;
9965
- }
9966
- }
9967
- }
9968
-
9969
9916
  // src/cli/build/loadModule.ts
9970
9917
  var import_promises = __toESM(require("fs/promises"));
9971
9918
  var import_posix = require("path/posix");
@@ -10022,8 +9969,7 @@ async function buildModule(outputDir, options = {}) {
10022
9969
  } = options;
10023
9970
  try {
10024
9971
  const { cfg, modulePath, path: loadedPath, uuid } = await loadModule(outputDir, entryPoint);
10025
- const { format: format2, path: path4 } = resolveFormatAndPath(embed, requestedFormat, loadedPath);
10026
- await checkFormat();
9972
+ const { format, path: path4 } = resolveFormatAndPath(embed, requestedFormat, loadedPath);
10027
9973
  const npmRoot = (0, import_child_process3.execFileSync)("npm", ["root"]).toString().trim();
10028
9974
  (0, import_child_process3.execFileSync)(`${npmRoot}/.bin/tsc`, [
10029
9975
  "--project",
@@ -10035,7 +9981,7 @@ async function buildModule(outputDir, options = {}) {
10035
9981
  bundle: true,
10036
9982
  entryPoints: [entryPoint],
10037
9983
  external: externalLibs,
10038
- format: format2,
9984
+ format,
10039
9985
  keepNames: true,
10040
9986
  legalComments: "external",
10041
9987
  metafile: true,
@@ -10065,7 +10011,7 @@ async function buildModule(outputDir, options = {}) {
10065
10011
  }
10066
10012
  if (!embed) {
10067
10013
  ctxCfg.minify = false;
10068
- const outputExtension = format2 === "esm" ? ".mjs" : ".js";
10014
+ const outputExtension = format === "esm" ? ".mjs" : ".js";
10069
10015
  ctxCfg.outfile = (0, import_path4.resolve)(outputDir, (0, import_path4.basename)(entryPoint, (0, import_path4.extname)(entryPoint))) + outputExtension;
10070
10016
  ctxCfg.packages = "external";
10071
10017
  ctxCfg.treeShaking = false;
@@ -10105,15 +10051,6 @@ function handleModuleBuildError(e) {
10105
10051
  });
10106
10052
  }
10107
10053
  }
10108
- async function checkFormat() {
10109
- const validFormat = await peprFormat(true);
10110
- if (!validFormat) {
10111
- console.info(
10112
- "\x1B[33m%s\x1B[0m",
10113
- "Formatting errors were found. The build will continue, but you may want to run `npx pepr format` to address any issues."
10114
- );
10115
- }
10116
- }
10117
10054
 
10118
10055
  // src/cli/build/index.ts
10119
10056
  var import_path5 = require("path");
@@ -10170,8 +10107,8 @@ function build_default(program2) {
10170
10107
  ])
10171
10108
  ).addOption(
10172
10109
  new import_commander.Option(
10173
- "-I, --registry-info <registry/username>",
10174
- "Provide the image registry and username for building and pushing a custom WASM container. Requires authentication. Conflicts with --custom-image and --registry. Builds and pushes `'<registry/username>/custom-pepr-controller:<current-version>'`."
10110
+ "-I, --registry-info <registry[/namespace]>",
10111
+ "Provide the image registry (and optional namespace) for building and pushing a custom WASM container. Requires authentication. Conflicts with --custom-image and --registry. Builds and pushes `'<registry[/namespace]>/custom-pepr-controller:<current-version>'` (e.g. docker.io/myuser, localhost:5000)."
10175
10112
  ).conflicts(["customImage", "registry"])
10176
10113
  ).option("-P, --with-pull-secret <name>", "Use image pull secret for controller Deployment.", "").addOption(
10177
10114
  new import_commander.Option(
@@ -10203,11 +10140,11 @@ function build_default(program2) {
10203
10140
  new import_commander.Option("-z, --zarf <manifest|chart>", "Set Zarf package type").choices(["manifest", "chart"]).default("manifest")
10204
10141
  ).action(async (opts) => {
10205
10142
  const outputDir = await createOutputDirectory(opts.output);
10206
- const format2 = determineModuleFormat((0, import_path5.resolve)(process.cwd(), "package.json"));
10143
+ const format = determineModuleFormat((0, import_path5.resolve)(process.cwd(), "package.json"));
10207
10144
  const buildModuleResult = await buildModule(outputDir, {
10208
10145
  entryPoint: opts.entryPoint,
10209
10146
  embed: opts.embed,
10210
- format: format2
10147
+ format
10211
10148
  });
10212
10149
  if (!buildModuleResult) {
10213
10150
  return;
@@ -10226,7 +10163,7 @@ function build_default(program2) {
10226
10163
 
10227
10164
  // src/lib/assets/deploy.ts
10228
10165
  var import_crypto3 = __toESM(require("crypto"));
10229
- var import_fs10 = require("fs");
10166
+ var import_fs9 = require("fs");
10230
10167
  var import_kubernetes_fluent_client3 = require("kubernetes-fluent-client");
10231
10168
 
10232
10169
  // src/lib/k8s.ts
@@ -10335,7 +10272,7 @@ async function deployWebhook(assets, force, webhookTimeout) {
10335
10272
  logger_default.debug("Applying the Pepr Store CRD if it doesn't exist");
10336
10273
  await (0, import_kubernetes_fluent_client3.K8s)(import_kubernetes_fluent_client3.kind.CustomResourceDefinition).Apply(peprStoreCRD, { force });
10337
10274
  if (assets.host) return;
10338
- const code = await import_fs10.promises.readFile(assets.path);
10275
+ const code = await import_fs9.promises.readFile(assets.path);
10339
10276
  if (!code.length) throw new Error("No code provided");
10340
10277
  const hash = import_crypto3.default.createHash("sha256").update(code).digest("hex");
10341
10278
  await setupRBAC(assets.name, assets.capabilities, force, assets.config);
@@ -10553,7 +10490,7 @@ function deploy_default(program2) {
10553
10490
  var import_prompts2 = __toESM(require("prompts"));
10554
10491
  var import_child_process4 = require("child_process");
10555
10492
  var import_kubernetes_fluent_client5 = require("kubernetes-fluent-client");
10556
- var import_fs11 = require("fs");
10493
+ var import_fs10 = require("fs");
10557
10494
  function dev_default(program2) {
10558
10495
  program2.command("dev").description("Setup a local webhook development environment").option("-H, --host <host>", "Host to listen on", "host.k3d.internal").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
10559
10496
  if (!opts.yes) {
@@ -10577,8 +10514,8 @@ function dev_default(program2) {
10577
10514
  [],
10578
10515
  opts.host
10579
10516
  );
10580
- await import_fs11.promises.writeFile("insecure-tls.crt", webhook.tls.pem.crt);
10581
- await import_fs11.promises.writeFile("insecure-tls.key", webhook.tls.pem.key);
10517
+ await import_fs10.promises.writeFile("insecure-tls.crt", webhook.tls.pem.crt);
10518
+ await import_fs10.promises.writeFile("insecure-tls.key", webhook.tls.pem.key);
10582
10519
  try {
10583
10520
  let program3;
10584
10521
  const name2 = `pepr-${cfg.pepr.uuid}`;
@@ -10734,7 +10671,7 @@ ${filteredFailures.length > 0 ? "\u274C" : "\u2705"} VALIDATE ${name2} (${uid
10734
10671
  var import_commander2 = require("commander");
10735
10672
 
10736
10673
  // src/cli/init/walkthrough.ts
10737
- var import_fs12 = require("fs");
10674
+ var import_fs11 = require("fs");
10738
10675
  var import_prompts3 = __toESM(require("prompts"));
10739
10676
 
10740
10677
  // src/cli/init/enums.ts
@@ -10784,7 +10721,7 @@ async function setName(name2) {
10784
10721
  validate: async (val) => {
10785
10722
  try {
10786
10723
  const name3 = sanitizeName(val);
10787
- await import_fs12.promises.access(name3, import_fs12.promises.constants.F_OK);
10724
+ await import_fs11.promises.access(name3, import_fs11.promises.constants.F_OK);
10788
10725
  return "A directory with this name already exists";
10789
10726
  } catch {
10790
10727
  return val.length > 2 || "The name must be at least 3 characters long";
@@ -11027,7 +10964,7 @@ var import_commander7 = require("commander");
11027
10964
 
11028
10965
  // src/cli/update/index.ts
11029
10966
  var import_child_process6 = require("child_process");
11030
- var import_fs13 = __toESM(require("fs"));
10967
+ var import_fs12 = __toESM(require("fs"));
11031
10968
  var import_path7 = require("path");
11032
10969
  var import_prompts4 = __toESM(require("prompts"));
11033
10970
  function update_default(program2) {
@@ -11067,12 +11004,12 @@ function update_default(program2) {
11067
11004
  await write((0, import_path7.resolve)(".vscode", snippet.path), snippet.data);
11068
11005
  await write((0, import_path7.resolve)(".vscode", codeSettings.path), codeSettings.data);
11069
11006
  const samplePath = (0, import_path7.resolve)("capabilities", samplesYaml.path);
11070
- if (import_fs13.default.existsSync(samplePath)) {
11071
- import_fs13.default.unlinkSync(samplePath);
11007
+ if (import_fs12.default.existsSync(samplePath)) {
11008
+ import_fs12.default.unlinkSync(samplePath);
11072
11009
  await write(samplePath, samplesYaml.data);
11073
11010
  }
11074
11011
  const tsPath = (0, import_path7.resolve)("capabilities", helloPepr.path);
11075
- if (import_fs13.default.existsSync(tsPath)) {
11012
+ if (import_fs12.default.existsSync(tsPath)) {
11076
11013
  await write(tsPath, helloPepr.data);
11077
11014
  }
11078
11015
  }
@@ -11120,7 +11057,7 @@ var import_commander6 = require("commander");
11120
11057
  var import_commander4 = require("commander");
11121
11058
 
11122
11059
  // src/cli/crd/generate/generators.ts
11123
- var import_fs14 = __toESM(require("fs"));
11060
+ var import_fs13 = __toESM(require("fs"));
11124
11061
  var import_path8 = __toESM(require("path"));
11125
11062
  var import_typescript = __toESM(require("typescript"));
11126
11063
  var import_yaml = __toESM(require_dist());
@@ -11171,10 +11108,10 @@ async function generateCRDs(options) {
11171
11108
  }
11172
11109
  }
11173
11110
  function getAPIVersions(apiRoot) {
11174
- return import_fs14.default.readdirSync(apiRoot).filter((v) => import_fs14.default.statSync(import_path8.default.join(apiRoot, v)).isDirectory());
11111
+ return import_fs13.default.readdirSync(apiRoot).filter((v) => import_fs13.default.statSync(import_path8.default.join(apiRoot, v)).isDirectory());
11175
11112
  }
11176
11113
  function loadVersionFilePaths(versionDir) {
11177
- const files = import_fs14.default.readdirSync(versionDir).filter((f) => f.endsWith(".ts"));
11114
+ const files = import_fs13.default.readdirSync(versionDir).filter((f) => f.endsWith(".ts"));
11178
11115
  return files.map((f) => import_path8.default.join(versionDir, f));
11179
11116
  }
11180
11117
  function createProgram(filePaths) {
@@ -11210,7 +11147,7 @@ function processSourceFile(sourceFile, checker, version3, outputDir) {
11210
11147
  conditionSchema
11211
11148
  });
11212
11149
  const outPath = import_path8.default.join(outputDir, `${kind8.toLowerCase()}.yaml`);
11213
- import_fs14.default.writeFileSync(outPath, (0, import_yaml.stringify)(crd), "utf8");
11150
+ import_fs13.default.writeFileSync(outPath, (0, import_yaml.stringify)(crd), "utf8");
11214
11151
  logger_default.info(`\u2714 Created ${outPath}`);
11215
11152
  }
11216
11153
  function extractSingleLineComment(content, label) {
@@ -11429,7 +11366,7 @@ function generate_default() {
11429
11366
 
11430
11367
  // src/cli/crd/create/index.ts
11431
11368
  var import_commander5 = require("commander");
11432
- var import_fs15 = require("fs");
11369
+ var import_fs14 = require("fs");
11433
11370
 
11434
11371
  // src/cli/crd/create/createCRDscaffold.ts
11435
11372
  var createCRDscaffold = (group2, version3, kind8, data) => {
@@ -11524,7 +11461,7 @@ function create_default() {
11524
11461
  logger_default.warn("This feature is currently in alpha.");
11525
11462
  const outputDir = import_path9.default.resolve(`./api/${version3}`);
11526
11463
  await createDirectoryIfNotExists(outputDir);
11527
- await import_fs15.promises.writeFile(
11464
+ await import_fs14.promises.writeFile(
11528
11465
  `./api/${version3}/${kind8.toLowerCase()}_types.ts`,
11529
11466
  createCRDscaffold(group2, version3, kind8, { domain, scope, plural: plural2, shortName })
11530
11467
  );
@@ -11643,7 +11580,6 @@ build_default(program);
11643
11580
  deploy_default(program);
11644
11581
  dev_default(program);
11645
11582
  update_default(program);
11646
- format_default(program);
11647
11583
  monitor_default(program);
11648
11584
  uuid_default(program);
11649
11585
  kfc_default(program);