@jigging/jig 0.1.0-alpha.20 → 0.1.0-alpha.22

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.
@@ -15,11 +15,9 @@ Logic:
15
15
 
16
16
  const segmenter = new Intl.Segmenter();
17
17
 
18
- // Whole-cluster zero-width
19
- const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
20
-
21
- // Pick the base scalar if the cluster starts with Prepend/Format/Marks
22
- const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
18
+ // Matches a visible (printing) character. Used to find the base scalar of a cluster (skipping leading Prepend/Format/Marks) and to detect whole-cluster zero-width.
19
+ // Intentionally a single negated class without a quantifier: a repeated pattern like `^(?:…|…)+$` backtracks exponentially on overlapping properties, and even `^[…]+$` overflows V8's backtrack stack (RangeError) on clusters with millions of marks.
20
+ const visibleCharacterRegex = /[^\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]/v;
23
21
  const spacingMarkRegex = /\p{Spacing_Mark}/v;
24
22
 
25
23
  // RGI emoji sequences
@@ -48,12 +46,10 @@ function isDoubleWidthNonRgiEmojiSequence(segment) {
48
46
  return false;
49
47
  }
50
48
 
49
+ // Returns the cluster starting at its first visible character, or `undefined` if the whole cluster is zero-width.
51
50
  function baseVisible(segment) {
52
- return segment.replace(leadingNonPrintingRegex, '');
53
- }
54
-
55
- function isZeroWidthCluster(segment) {
56
- return zeroWidthClusterRegex.test(segment);
51
+ const index = segment.search(visibleCharacterRegex);
52
+ return index === -1 ? undefined : segment.slice(index);
57
53
  }
58
54
 
59
55
  function isHangulLeadingJamo(codePoint) {
@@ -81,7 +77,7 @@ function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
81
77
  const codePoints = [];
82
78
 
83
79
  for (const character of visibleSegment) {
84
- if (zeroWidthClusterRegex.test(character)) {
80
+ if (!visibleCharacterRegex.test(character)) {
85
81
  continue;
86
82
  }
87
83
 
@@ -178,7 +174,8 @@ export default function stringWidth(input, options = {}) {
178
174
 
179
175
  for (const {segment} of segmenter.segment(string)) {
180
176
  // Zero-width / non-printing clusters
181
- if (isZeroWidthCluster(segment)) {
177
+ const visibleSegment = baseVisible(segment);
178
+ if (visibleSegment === undefined) {
182
179
  continue;
183
180
  }
184
181
 
@@ -188,7 +185,6 @@ export default function stringWidth(input, options = {}) {
188
185
  continue;
189
186
  }
190
187
 
191
- const visibleSegment = baseVisible(segment);
192
188
  const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
193
189
  if (hangulWidth !== undefined) {
194
190
  width += hangulWidth;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-width",
3
- "version": "8.2.2",
3
+ "version": "8.3.0",
4
4
  "description": "Get the visual width of a string - the number of columns required to display it",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/string-width",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vscode-languageserver-textdocument",
3
3
  "description": "A simple text document implementation for Node LSP servers",
4
- "version": "1.0.14",
4
+ "version": "1.0.15",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "scripts": {
26
- "prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
26
+ "prepublishOnly": "npm run all:publish",
27
27
  "prepack": "npm run all:publish",
28
28
  "compile": "tsc -b ./tsconfig.json",
29
29
  "clean": "rimraf lib",
@@ -7510,7 +7510,7 @@ import { setTimeout as delay } from "timers/promises";
7510
7510
  // package.json
7511
7511
  var package_default = {
7512
7512
  name: "@jigging/jig",
7513
- version: "0.1.0-alpha.20",
7513
+ version: "0.1.0-alpha.22",
7514
7514
  description: "A local, secure host for admitted FLOW packages",
7515
7515
  license: "SEE LICENSE IN LICENSE.md",
7516
7516
  repository: {
@@ -13035,6 +13035,7 @@ var PRIVATE_FILE_LIMITS = Object.freeze({
13035
13035
  });
13036
13036
  var NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
13037
13037
  var CLOSED_SEALS = 15;
13038
+ var F_DUPFD_CLOEXEC = 1030;
13038
13039
  var O_PATH = 2097152;
13039
13040
  var O_CLOEXEC = 524288;
13040
13041
  var O_DIRECTORY = 65536;
@@ -13330,6 +13331,11 @@ function privateVerifySealedFile(fd, bytes, digest) {
13330
13331
  if (!info.isFile() || info.nlink !== 0 || info.size !== bytes || (result(calls().symbols.fcntl(fd, 1034, 0)) & CLOSED_SEALS) !== CLOSED_SEALS || sha256(readFileSync(`/proc/self/fd/${fd}`)) !== digest)
13331
13332
  throw new TypeError("captured input descriptor changed");
13332
13333
  }
13334
+ function privateDuplicateInputForStdio(fd, minimum) {
13335
+ if (!Number.isSafeInteger(fd) || fd < 0 || !Number.isSafeInteger(minimum) || minimum < 6)
13336
+ throw new TypeError("invalid captured input descriptor handoff");
13337
+ return result(calls().symbols.fcntl(fd, F_DUPFD_CLOEXEC, minimum));
13338
+ }
13333
13339
  function sha256(bytes) {
13334
13340
  return `sha256:${createHash4("sha256").update(bytes).digest("hex")}`;
13335
13341
  }
@@ -17798,7 +17804,7 @@ function directoryEntryName2(entry) {
17798
17804
  }
17799
17805
 
17800
17806
  // src/internal/bound-attachments.ts
17801
- import { closeSync as closeSync2, fstatSync as fstatSync2, readFileSync as readFileSync2 } from "fs";
17807
+ import { closeSync as closeSync3, fstatSync as fstatSync2, readFileSync as readFileSync2 } from "fs";
17802
17808
 
17803
17809
  // src/internal/package-artifact-store.ts
17804
17810
  import { createHash as createHash6, randomUUID } from "crypto";
@@ -18472,6 +18478,7 @@ async function privateFileDigest(path) {
18472
18478
  // src/internal/linux-rootless-backend.ts
18473
18479
  import { spawn } from "child_process";
18474
18480
  import { randomBytes as randomBytes2 } from "crypto";
18481
+ import { closeSync as closeSync2 } from "fs";
18475
18482
  import {
18476
18483
  link as link3,
18477
18484
  lstat as lstat6,
@@ -19174,28 +19181,29 @@ class PrivateLinuxCgroupBackend {
19174
19181
  try {
19175
19182
  await listen(server, controlPath);
19176
19183
  const accepted = acceptOne(server, this.#options.startupTimeoutMs);
19177
- supervisor = requirePipedChild(spawn(data.mechanism.support.trustedCoordinatorBunPath, [
19178
- ...BUN_POLICY,
19179
- data.mechanism.support.trustedSupervisorPath,
19180
- "--supervisor",
19181
- controlPath,
19182
- String(this.#options.startupTimeoutMs)
19183
- ], {
19184
- cwd: "/",
19185
- env: {
19186
- LD_LIBRARY_PATH: data.mechanism.support.trustedCoordinatorLibraryPath
19187
- },
19188
- detached: true,
19189
- stdio: [
19190
- "pipe",
19191
- "pipe",
19192
- "pipe",
19193
- "ignore",
19194
- "ignore",
19195
- "ignore",
19196
- ...data.sealedPlan.capturedInputs.map((file) => file.fd)
19197
- ]
19198
- }));
19184
+ const inputFds = [];
19185
+ try {
19186
+ const minimum = 6 + data.sealedPlan.capturedInputs.length;
19187
+ for (const file of data.sealedPlan.capturedInputs)
19188
+ inputFds.push(privateDuplicateInputForStdio(file.fd, minimum));
19189
+ supervisor = requirePipedChild(spawn(data.mechanism.support.trustedCoordinatorBunPath, [
19190
+ ...BUN_POLICY,
19191
+ data.mechanism.support.trustedSupervisorPath,
19192
+ "--supervisor",
19193
+ controlPath,
19194
+ String(this.#options.startupTimeoutMs)
19195
+ ], {
19196
+ cwd: "/",
19197
+ env: {
19198
+ LD_LIBRARY_PATH: data.mechanism.support.trustedCoordinatorLibraryPath
19199
+ },
19200
+ detached: true,
19201
+ stdio: ["pipe", "pipe", "pipe", "ignore", "ignore", "ignore", ...inputFds]
19202
+ }));
19203
+ } finally {
19204
+ for (const fd of inputFds)
19205
+ closeSync2(fd);
19206
+ }
19199
19207
  const closed = childClose(supervisor);
19200
19208
  control = await Promise.race([
19201
19209
  accepted,
@@ -20911,7 +20919,7 @@ async function captureBoundAttachments(root, selections, storeRoot) {
20911
20919
  return invalid("PROJECT_BINDING_ATTACHMENTS_INVALID", error instanceof PrivateFileInputError ? error.message : "cannot capture the selected Binding files; use stable, bounded project directories without links or protected state");
20912
20920
  } finally {
20913
20921
  if (parent !== undefined)
20914
- closeSync2(parent);
20922
+ closeSync3(parent);
20915
20923
  }
20916
20924
  }
20917
20925
  async function verifyBoundAttachment(captured, expected) {
@@ -20928,7 +20936,7 @@ async function openBoundAttachments(storeRoot, value = {}) {
20928
20936
  const opened = [];
20929
20937
  const close = () => {
20930
20938
  for (const fd of opened.splice(0))
20931
- closeSync2(fd);
20939
+ closeSync3(fd);
20932
20940
  };
20933
20941
  try {
20934
20942
  for (const [name, item2] of Object.entries(bindings)) {
@@ -33519,12 +33527,12 @@ class PrivateCliOutput {
33519
33527
  // src/internal/file-command.ts
33520
33528
  import { spawn as spawn2 } from "child_process";
33521
33529
  import { randomBytes as randomBytes5 } from "crypto";
33522
- import { closeSync as closeSync4, fstatSync as fstatSync4 } from "fs";
33530
+ import { closeSync as closeSync5, fstatSync as fstatSync4 } from "fs";
33523
33531
  import { connect, createServer as createServer2 } from "net";
33524
33532
 
33525
33533
  // src/internal/file-delivery.ts
33526
33534
  import { randomBytes as randomBytes4 } from "crypto";
33527
- import { closeSync as closeSync3, fstatSync as fstatSync3, lstatSync, mkdirSync, opendirSync as opendirSync2 } from "fs";
33535
+ import { closeSync as closeSync4, fstatSync as fstatSync3, lstatSync, mkdirSync, opendirSync as opendirSync2 } from "fs";
33528
33536
  import { mkdir as mkdir7, open as open12, rm as rm3, statfs as statfs3 } from "fs/promises";
33529
33537
  import { basename as basename5, dirname as dirname11, resolve as resolve10 } from "path";
33530
33538
  class PrivateFileDeliveryOwner {
@@ -33574,7 +33582,7 @@ class PrivateFileDeliveryOwner {
33574
33582
  this.#destination = destination;
33575
33583
  } finally {
33576
33584
  if (parent !== undefined)
33577
- closeSync3(parent);
33585
+ closeSync4(parent);
33578
33586
  this.#preparing = false;
33579
33587
  }
33580
33588
  }
@@ -33635,7 +33643,7 @@ class PrivateFileDeliveryOwner {
33635
33643
  } finally {
33636
33644
  directory.closeSync();
33637
33645
  if (fd !== output.fd)
33638
- closeSync3(fd);
33646
+ closeSync4(fd);
33639
33647
  }
33640
33648
  };
33641
33649
  walk("");
@@ -33712,7 +33720,7 @@ class PrivateFileDeliveryOwner {
33712
33720
  async close() {
33713
33721
  await this.#cleanupStage();
33714
33722
  if (this.#parent !== undefined) {
33715
- closeSync3(this.#parent);
33723
+ closeSync4(this.#parent);
33716
33724
  this.#parent = undefined;
33717
33725
  }
33718
33726
  }
@@ -33723,7 +33731,7 @@ class PrivateFileDeliveryOwner {
33723
33731
  if (before.dev !== after.dev || before.ino !== after.ino)
33724
33732
  throw new Error("destination parent changed");
33725
33733
  } finally {
33726
- closeSync3(current2);
33734
+ closeSync4(current2);
33727
33735
  }
33728
33736
  }
33729
33737
  async#cleanupStage() {
@@ -33757,14 +33765,14 @@ function directoryContains(root, candidate) {
33757
33765
  return true;
33758
33766
  const next2 = privateOpenAt(current2, "..", 2097152 | 65536, false);
33759
33767
  const parent = fstatSync3(next2, { bigint: true });
33760
- closeSync3(current2);
33768
+ closeSync4(current2);
33761
33769
  current2 = next2;
33762
33770
  if (parent.dev === info.dev && parent.ino === info.ino)
33763
33771
  return false;
33764
33772
  }
33765
33773
  throw new Error("output ancestry exceeds limit");
33766
33774
  } finally {
33767
- closeSync3(current2);
33775
+ closeSync4(current2);
33768
33776
  }
33769
33777
  }
33770
33778
 
@@ -33958,7 +33966,7 @@ async function privateOwnFileCommand(command, arguments_, signal, lifetimeMs, on
33958
33966
  await task;
33959
33967
  checkpoints?.close();
33960
33968
  if (projectFd !== undefined)
33961
- closeSync4(projectFd);
33969
+ closeSync5(projectFd);
33962
33970
  try {
33963
33971
  await owner.close();
33964
33972
  } catch {
@@ -39996,7 +40004,7 @@ function fail2(message) {
39996
40004
  }
39997
40005
 
39998
40006
  // src/internal/codex-session-state.ts
39999
- import { closeSync as closeSync5, opendirSync as opendirSync3 } from "fs";
40007
+ import { closeSync as closeSync6, opendirSync as opendirSync3 } from "fs";
40000
40008
  var PRIVATE_CODEX_SESSION_BYTES = 8 * 1024 * 1024;
40001
40009
  var UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\s\S])/;
40002
40010
  var PATH = /^sessions\/\d{4}\/\d{2}\/\d{2}\/rollout-[0-9T-]+-([0-9a-f-]{36})\.jsonl(?![\s\S])/;
@@ -40169,7 +40177,7 @@ function collectPrivateCodexSession(output, nativeId, secrets2) {
40169
40177
  directory2?.closeSync();
40170
40178
  } finally {
40171
40179
  if (fd !== output.fd)
40172
- closeSync5(fd);
40180
+ closeSync6(fd);
40173
40181
  }
40174
40182
  }
40175
40183
  };
@@ -41542,7 +41550,7 @@ function failed(code2, message, details) {
41542
41550
  }
41543
41551
 
41544
41552
  // src/internal/root-contained-effect-controller.ts
41545
- import { closeSync as closeSync6 } from "fs";
41553
+ import { closeSync as closeSync7 } from "fs";
41546
41554
  var KIND = "private-contained-effect-owner/1";
41547
41555
  var ROOT = "/jig-input/project";
41548
41556
  async function executePrivateContainedEffect(input) {
@@ -41726,7 +41734,7 @@ async function executePrivateContainedEffect(input) {
41726
41734
  return failed2(attempted ? "UNCERTAIN" : "EXECUTION_FAILED", attempted ? "operation dispatch may have occurred but no result was proved" : "contained operation setup failed before dispatch");
41727
41735
  } finally {
41728
41736
  for (const file of files)
41729
- closeSync6(file.fd);
41737
+ closeSync7(file.fd);
41730
41738
  }
41731
41739
  }
41732
41740
  function privateContainedDeadlineLimit(kind, rootDeadlineUnixMs, parentDeadlineUnixMs, ownDeadlineUnixMs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jigging/jig",
3
- "version": "0.1.0-alpha.20",
3
+ "version": "0.1.0-alpha.22",
4
4
  "description": "A local, secure host for admitted FLOW packages",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {