@venn-lang/cli 0.1.1 → 0.1.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 (2) hide show
  1. package/dist/cli.mjs +25 -1
  2. package/package.json +12 -12
package/dist/cli.mjs CHANGED
@@ -1454,6 +1454,29 @@ function readBare(cur) {
1454
1454
  const num = Number(raw);
1455
1455
  return raw !== "" && !Number.isNaN(num) ? num : raw;
1456
1456
  }
1457
+ /**
1458
+ * Keys that reach the prototype rather than the object.
1459
+ *
1460
+ * A manifest is data that arrives with somebody else's project, and assigning
1461
+ * one of these from it changes how every object in the process behaves. A
1462
+ * `venn.toml` containing `[package.__proto__]` was enough to put a property on
1463
+ * `Object.prototype`.
1464
+ */
1465
+ const RESERVED$1 = /* @__PURE__ */ new Set([
1466
+ "__proto__",
1467
+ "constructor",
1468
+ "prototype"
1469
+ ]);
1470
+ /**
1471
+ * Whether a key read from a manifest may be assigned.
1472
+ *
1473
+ * @param key The key exactly as it was written in the file.
1474
+ * @returns `false` for a key that would reach the prototype, which the caller
1475
+ * should skip rather than assign.
1476
+ */
1477
+ function isSafeKey(key) {
1478
+ return !RESERVED$1.has(key);
1479
+ }
1457
1480
  /** The table `[path]` names, created along the way if it is not there yet. */
1458
1481
  function enterSection(root, path) {
1459
1482
  let node = root;
@@ -1481,7 +1504,7 @@ function enterTableArray(root, path) {
1481
1504
  return table;
1482
1505
  }
1483
1506
  function keysOf$1(path) {
1484
- return path.split(".").map((part) => part.trim().replace(/^["']|["']$/g, "")).filter((part) => part !== "");
1507
+ return path.split(".").map((part) => part.trim().replace(/^["']|["']$/g, "")).filter((part) => part !== "" && isSafeKey(part));
1485
1508
  }
1486
1509
  /**
1487
1510
  * A TOML reader for `venn.toml`: sections, nested `[a.b]`, arrays of tables
@@ -1522,6 +1545,7 @@ function assign(section, line) {
1522
1545
  const eq = line.indexOf("=");
1523
1546
  if (eq < 0) return;
1524
1547
  const key = line.slice(0, eq).trim().replace(/^["']|["']$/g, "");
1548
+ if (!isSafeKey(key)) return;
1525
1549
  section[key] = readValue(cursor(line.slice(eq + 1)));
1526
1550
  }
1527
1551
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venn-lang/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The venn binary: one command for starting, checking, running and testing a Venn project.",
5
5
  "keywords": [
6
6
  "venn",
@@ -41,17 +41,17 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "citty": "^0.2.2",
44
- "@venn-lang/assert": "0.1.1",
45
- "@venn-lang/contracts": "0.1.1",
46
- "@venn-lang/core": "0.1.1",
47
- "@venn-lang/dts": "0.1.1",
48
- "@venn-lang/http": "0.1.1",
49
- "@venn-lang/io": "0.1.1",
50
- "@venn-lang/project": "0.1.1",
51
- "@venn-lang/runtime": "0.1.1",
52
- "@venn-lang/sdk": "0.1.1",
53
- "@venn-lang/stdlib": "0.1.1",
54
- "@venn-lang/types": "0.1.1"
44
+ "@venn-lang/assert": "0.1.2",
45
+ "@venn-lang/contracts": "0.1.2",
46
+ "@venn-lang/core": "0.1.2",
47
+ "@venn-lang/dts": "0.1.2",
48
+ "@venn-lang/http": "0.1.2",
49
+ "@venn-lang/io": "0.1.2",
50
+ "@venn-lang/project": "0.1.2",
51
+ "@venn-lang/runtime": "0.1.2",
52
+ "@venn-lang/sdk": "0.1.2",
53
+ "@venn-lang/stdlib": "0.1.2",
54
+ "@venn-lang/types": "0.1.2"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "^24",