@gadicc/loom 2.0.1 → 2.0.3

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.
@@ -5,6 +5,7 @@ export interface MailAdminRecipientRow {
5
5
  status?: string;
6
6
  }
7
7
  export interface MailAdminRow {
8
+ /** Absolute ISO timestamp with an explicit zone; other strings display verbatim. */
8
9
  createdAt: string;
9
10
  id: string;
10
11
  providerMessageId?: string | null;
@@ -14,6 +15,11 @@ export interface MailAdminRow {
14
15
  tag?: string | null;
15
16
  }
16
17
  export declare function mailStatusColor(status: LoomMailMessageStatus): "error" | "default" | "success" | "warning" | "info";
18
+ /**
19
+ * Formats an absolute ISO timestamp in UTC so server and client markup agree.
20
+ * Ambiguous, non-ISO and invalid inputs display verbatim instead of using the
21
+ * host's date parsing defaults.
22
+ */
17
23
  export declare function formatMailAdminDate(value: string): string;
18
24
  export declare function canCancelMail(status: LoomMailMessageStatus): status is "failed" | "queued";
19
25
  export declare function canRetryMail(status: LoomMailMessageStatus): status is "failed" | "cancelled";
@@ -1 +1 @@
1
- {"version":3,"file":"mailView.d.ts","sourceRoot":"","sources":["../../../source/src/mui/mailView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,qBAAqB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,wDAe5D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,UAGhD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,qBAAqB,iCAE1D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,qBAAqB,oCAEzD"}
1
+ {"version":3,"file":"mailView.d.ts","sourceRoot":"","sources":["../../../source/src/mui/mailView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,qBAAqB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,wDAe5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,UAehD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,qBAAqB,iCAE1D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,qBAAqB,oCAEzD"}
@@ -14,9 +14,22 @@ export function mailStatusColor(status) {
14
14
  return "default";
15
15
  }
16
16
  }
17
+ /**
18
+ * Formats an absolute ISO timestamp in UTC so server and client markup agree.
19
+ * Ambiguous, non-ISO and invalid inputs display verbatim instead of using the
20
+ * host's date parsing defaults.
21
+ */
17
22
  export function formatMailAdminDate(value) {
23
+ if (!/^(?:\d{4}|[+-]\d{6})-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i.test(value))
24
+ return value;
18
25
  const date = new Date(value);
19
- return Number.isNaN(date.valueOf()) ? value : date.toLocaleString();
26
+ // Host locale/timezone defaults differ between SSR and the browser.
27
+ return Number.isNaN(date.valueOf())
28
+ ? value
29
+ : date
30
+ .toISOString()
31
+ .replace("T", " ")
32
+ .replace(/\.\d{3}Z$/, " UTC");
20
33
  }
21
34
  export function canCancelMail(status) {
22
35
  return status === "queued" || status === "failed";
@@ -1 +1 @@
1
- {"version":3,"file":"mailView.js","sourceRoot":"","sources":["../../../source/src/mui/mailView.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,eAAe,CAAC,MAA6B;IAC3D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,SAAkB,CAAC;QAC5B,KAAK,QAAQ,CAAC;QACd,KAAK,qBAAqB;YACxB,OAAO,OAAgB,CAAC;QAC1B,KAAK,MAAM;YACT,OAAO,MAAe,CAAC;QACzB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAkB,CAAC;QAC5B,KAAK,WAAW;YACd,OAAO,SAAkB,CAAC;IAC9B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA6B;IACzD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,WAAW,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"mailView.js","sourceRoot":"","sources":["../../../source/src/mui/mailView.ts"],"names":[],"mappings":"AAsBA,MAAM,UAAU,eAAe,CAAC,MAA6B;IAC3D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,SAAkB,CAAC;QAC5B,KAAK,QAAQ,CAAC;QACd,KAAK,qBAAqB;YACxB,OAAO,OAAgB,CAAC;QAC1B,KAAK,MAAM;YACT,OAAO,MAAe,CAAC;QACzB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAkB,CAAC;QAC5B,KAAK,WAAW;YACd,OAAO,SAAkB,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IACE,CAAC,2FAA2F,CAAC,IAAI,CAC/F,KAAK,CACN;QAED,OAAO,KAAK,CAAC;IACf,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,oEAAoE;IACpE,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI;aACD,WAAW,EAAE;aACb,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;aACjB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA6B;IACzD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,WAAW,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadicc/loom",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Shared helpers and verification tooling for Next.js applications.",
5
5
  "homepage": "https://github.com/gadicc/loom#readme",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "url": "https://github.com/gadicc/loom/issues"
12
12
  },
13
13
  "loom": {
14
- "gitCommit": "489920a2d5d2b552f552e8465d5d6fac55eb0344"
14
+ "gitCommit": "231b0c2bd829b9b2436ae54a27ac4e08f338cc82"
15
15
  },
16
16
  "type": "module",
17
17
  "main": "./esm/mod.js",
@@ -3,8 +3,8 @@
3
3
  ## Local development
4
4
 
5
5
  Managed Loom local development supports pnpm and Deno dependency owners, plus
6
- standalone Bun owners with the verified text-lock v2/config1 and project-local
7
- isolated store (Bun 1.4.3; retained 1.4.2 profile). Bun workspaces/global stores, redirected state/store
6
+ standalone Bun owners with verified text-lock v2/v3 config1 and a project-local
7
+ isolated store (Bun 1.4.3; retained v2/1.4.2 profile). Bun workspaces/global stores, redirected state/store
8
8
  paths, patched or ambiguous resolutions and unsupported locks fail closed. Start
9
9
  with `bun install --linker isolated`; a Deno task owner with Bun dependencies
10
10
  still installs through Bun. See `docs/project-tooling.md` in the Loom repository
@@ -11,7 +11,10 @@ import {
11
11
  import { homedir } from "node:os";
12
12
  import { dirname, join, relative, resolve, sep } from "node:path";
13
13
 
14
- import { inspectBunLoomReleaseState } from "./bunProject.ts";
14
+ import {
15
+ canonicalV3Overrides,
16
+ inspectBunLoomReleaseState,
17
+ } from "./bunProject.ts";
15
18
  import { mutatePackageJsonOverride, parseJsonc } from "./projectTooling.ts";
16
19
 
17
20
  const LOOM = "@gadicc/loom";
@@ -313,11 +316,24 @@ export async function assertBunLocalProject(
313
316
  );
314
317
  }
315
318
  const lock = object(parseJsonc(lockText, "bun.lock"));
316
- if (!lock || lock.lockfileVersion !== 2 || lock.configVersion !== 1) {
319
+ if (
320
+ !lock ||
321
+ ![2, 3].includes(lock.lockfileVersion as number) ||
322
+ lock.configVersion !== 1
323
+ ) {
317
324
  throw new Error(
318
- "Managed Bun local development supports bun.lock version 2/configVersion 1 only; other formats must be reviewed before use.",
325
+ "Managed Bun local development supports bun.lock version 2 or 3/configVersion 1 only; other formats must be reviewed before use.",
319
326
  );
320
327
  }
328
+ if (lock.lockfileVersion === 3) {
329
+ for (const field of ["overrides", "resolutions"]) {
330
+ if (lock[field] !== undefined && !canonicalV3Overrides(lock[field])) {
331
+ throw new Error(
332
+ `Unsupported bun.lock v3 ${field} tree; expected string overrides or two-level selector maps.`,
333
+ );
334
+ }
335
+ }
336
+ }
321
337
  const workspaces = object(lock.workspaces);
322
338
  if (
323
339
  !object(workspaces?.[""]) ||
@@ -32,6 +32,32 @@ function object(value: unknown): JsonObject | null {
32
32
  : null;
33
33
  }
34
34
 
35
+ /**
36
+ * Recognizes Bun 1.4.3's v3 override encoding: ordinary string values or
37
+ * one parent map with string self/dependency selectors, never deeper maps.
38
+ */
39
+ export function canonicalV3Overrides(value: unknown): boolean {
40
+ const map = object(value);
41
+ return (
42
+ map !== null &&
43
+ Object.entries(map).every(([key, value]) => {
44
+ if (key === "." || key.length === 0) return false;
45
+ if (typeof value === "string") return value.length > 0;
46
+ const selectors = object(value);
47
+ return (
48
+ key !== "." &&
49
+ key.length > 0 &&
50
+ selectors !== null &&
51
+ Object.keys(selectors).length > 0 &&
52
+ Object.entries(selectors).every(
53
+ ([selector, spec]) =>
54
+ selector.length > 0 && typeof spec === "string" && spec.length > 0,
55
+ )
56
+ );
57
+ })
58
+ );
59
+ }
60
+
35
61
  function missing(error: unknown) {
36
62
  return ["ENOENT", "ENOTDIR"].includes(
37
63
  (error as NodeJS.ErrnoException).code ?? "",
@@ -200,7 +226,7 @@ async function findPackageSymlink(
200
226
 
201
227
  /**
202
228
  * Inspects standalone Bun text-lock projects without invoking Bun or changing
203
- * files. Bun 1.4.2's isolated linker gives registry and directory packages
229
+ * files. Bun 1.4.2/1.4.3's isolated linker gives registry and directory packages
204
230
  * distinct store paths. Its hoisted linker has no installed provenance record,
205
231
  * so a matching version and registry lock alone cannot prove a copied local
206
232
  * build was replaced. Such installations require an isolated reinstall before
@@ -290,12 +316,25 @@ export async function inspectBunLoomReleaseState(
290
316
  "error",
291
317
  "Missing bun.lock; run `bun install` before release checks.",
292
318
  );
293
- } else if (lock.lockfileVersion !== 2 || lock.configVersion !== 1) {
319
+ } else if (
320
+ ![2, 3].includes(lock.lockfileVersion as number) ||
321
+ lock.configVersion !== 1
322
+ ) {
294
323
  add(
295
324
  "error",
296
- "Unsupported bun.lock format; expected lockfileVersion 2 and configVersion 1.",
325
+ "Unsupported bun.lock format; expected lockfileVersion 2 or 3 and configVersion 1.",
297
326
  );
298
327
  } else {
328
+ if (lock.lockfileVersion === 3) {
329
+ for (const field of ["overrides", "resolutions"]) {
330
+ if (lock[field] !== undefined && !canonicalV3Overrides(lock[field])) {
331
+ add(
332
+ "error",
333
+ `Unsupported bun.lock v3 ${field} tree; expected string overrides or two-level selector maps.`,
334
+ );
335
+ }
336
+ }
337
+ }
299
338
  const workspaces = object(lock.workspaces);
300
339
  const lockedRoot = object(workspaces?.[""]);
301
340
  if (!lockedRoot || Object.keys(workspaces!).some((key) => key !== "")) {
@@ -9043,13 +9043,15 @@ function workflowStepRunsDbMigrate(block: string) {
9043
9043
  block,
9044
9044
  ) ||
9045
9045
  /\bdrizzle-kit\s+migrate\b/.test(block) ||
9046
- /spawnSync\(\s*["']pnpm["'][\s\S]*["']db:migrate["']/.test(block)
9046
+ /\bspawnSync\(\s*["'](?:pnpm|bun)["']\s*,\s*\[\s*(?:["']run["']\s*,\s*)?["']db:migrate["']\s*,?\s*\](?=\s*[,)])/.test(
9047
+ block,
9048
+ )
9047
9049
  );
9048
9050
  }
9049
9051
 
9050
9052
  function workflowStepUsesVercelCommand(block: string, subcommand: string) {
9051
9053
  block = block.replace(/\\\r?\n\s*/g, " ");
9052
- const launcher = String.raw`(?:vercel|deno\s+run\s+-A\s+npm:vercel(?:@[^\s]+)?|pnpm\s+(?:dlx|exec)\s+vercel(?:@[^\s]+)?|npx\s+vercel(?:@[^\s]+)?|yarn\s+(?:dlx\s+)?vercel(?:@[^\s]+)?|bunx\s+vercel(?:@[^\s]+)?)`;
9054
+ const launcher = String.raw`(?:vercel|deno\s+run\s+-A\s+npm:vercel(?:@[^\s]+)?|pnpm\s+(?:dlx|exec)\s+vercel(?:@[^\s]+)?|npx\s+vercel(?:@[^\s]+)?|yarn\s+(?:dlx\s+)?vercel(?:@[^\s]+)?|(?:bunx|bun\s+x)(?:\s+--no-install)?\s+vercel(?:@[^\s]+)?)`;
9053
9055
  const globalFlags = String.raw`(?:\s+(?:--[A-Za-z-]+(?:=(?:"[^"]+"|'[^']+'|[^\s]+)|\s+(?:"[^"]+"|'[^']+'|[^\s]+))?|-[A-Za-z](?:\s+(?:"[^"]+"|'[^']+'|[^\s]+))?))*`;
9054
9056
  return new RegExp(
9055
9057
  String.raw`\b${launcher}${globalFlags}\s+${subcommand}\b`,
@@ -9111,7 +9113,7 @@ function workflowStepPreparesVercelProject(block: string) {
9111
9113
  * `@gadicc/loom` fetched by `npx`, `pnpm dlx`, `bunx` or Deno, or by path as
9112
9114
  * `node_modules/.bin/loom`.
9113
9115
  */
9114
- const LOOM_INVOCATION = String.raw`(?:(?:pnpm\s+(?:exec|dlx)|pnpm|npm\s+exec(?:\s+--)?|npx(?:\s+(?:-y|--yes))?|yarn(?:\s+dlx)?|bun\s+run|bunx|deno\s+task|deno\s+run\s+-A)\s+)?(?:(?:\.\/)?node_modules\/\.bin\/loom|(?:npm:)?@gadicc\/loom(?:@[^\s]+)?|loom)`;
9116
+ const LOOM_INVOCATION = String.raw`(?:(?:pnpm\s+(?:exec|dlx)|pnpm|npm\s+exec(?:\s+--)?|npx(?:\s+(?:-y|--yes))?|yarn(?:\s+dlx)?|bun\s+run|(?:bunx|bun\s+x)(?:\s+--no-install)?|deno\s+task|deno\s+run\s+-A)\s+)?(?:(?:\.\/)?node_modules\/\.bin\/loom|(?:npm:)?@gadicc\/loom(?:@[^\s]+)?|loom)`;
9115
9117
 
9116
9118
  /**
9117
9119
  * Drops YAML and shell comments so a commented-out step or command is not
@@ -9345,7 +9347,7 @@ function workflowStepPromotesVercelDeploymentWithLoom(block: string) {
9345
9347
 
9346
9348
  function workflowStepUsesMaterializedVercelLink(block: string) {
9347
9349
  block = block.replace(/\\\r?\n\s*/g, " ");
9348
- const launcher = String.raw`(?:vercel|deno\s+run\s+-A\s+npm:vercel(?:@[^\s]+)?|pnpm\s+(?:dlx|exec)\s+vercel(?:@[^\s]+)?|npx\s+vercel(?:@[^\s]+)?|yarn\s+(?:dlx\s+)?vercel(?:@[^\s]+)?|bunx\s+vercel(?:@[^\s]+)?)`;
9350
+ const launcher = String.raw`(?:vercel|deno\s+run\s+-A\s+npm:vercel(?:@[^\s]+)?|pnpm\s+(?:dlx|exec)\s+vercel(?:@[^\s]+)?|npx\s+vercel(?:@[^\s]+)?|yarn\s+(?:dlx\s+)?vercel(?:@[^\s]+)?|(?:bunx|bun\s+x)(?:\s+--no-install)?\s+vercel(?:@[^\s]+)?)`;
9349
9351
  const prefix = block.match(
9350
9352
  new RegExp(String.raw`\benv\s+([^\n]*?)(?=\b${launcher}\b)`),
9351
9353
  )?.[1];
@@ -10,6 +10,7 @@ export interface MailAdminRecipientRow {
10
10
  }
11
11
 
12
12
  export interface MailAdminRow {
13
+ /** Absolute ISO timestamp with an explicit zone; other strings display verbatim. */
13
14
  createdAt: string;
14
15
  id: string;
15
16
  providerMessageId?: string | null;
@@ -36,9 +37,26 @@ export function mailStatusColor(status: LoomMailMessageStatus) {
36
37
  }
37
38
  }
38
39
 
40
+ /**
41
+ * Formats an absolute ISO timestamp in UTC so server and client markup agree.
42
+ * Ambiguous, non-ISO and invalid inputs display verbatim instead of using the
43
+ * host's date parsing defaults.
44
+ */
39
45
  export function formatMailAdminDate(value: string) {
46
+ if (
47
+ !/^(?:\d{4}|[+-]\d{6})-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i.test(
48
+ value,
49
+ )
50
+ )
51
+ return value;
40
52
  const date = new Date(value);
41
- return Number.isNaN(date.valueOf()) ? value : date.toLocaleString();
53
+ // Host locale/timezone defaults differ between SSR and the browser.
54
+ return Number.isNaN(date.valueOf())
55
+ ? value
56
+ : date
57
+ .toISOString()
58
+ .replace("T", " ")
59
+ .replace(/\.\d{3}Z$/, " UTC");
42
60
  }
43
61
 
44
62
  export function canCancelMail(status: LoomMailMessageStatus) {