Skip to content

[finding] pg-connection-string, a Node Postgres DSN parser, is bundled into the console's eagerly-loaded vendor chunk through @objectstack/spec's driver schemas #9771

Description

@os-steve

Out-of-scope finding from the #9707 measurement round. Small in bytes, filed for the shape rather than the weight — the reporter's judgement of severity at filing time is not reliable in either direction, so this is a plain record for triage.

Measured

Console built from framework main @ 6f40ed736 at objectui pin 82a94170c405 (scripts/build-console.sh, unmodified).

pg-connection-string@2.14.0 is present in assets/vendor-objectstack-*.js — the largest chunk in the app and a static import of the entry chunk, so it is downloaded and parsed on every console page load. Its real parser body is there, not just a path string: the emitted chunk contains the module's postgres://base placeholder-base logic, matched three times.

Size, from the build's own visualizer payload (per-module, gzipped in isolation):

modulerawgzip
pg-connection-string/index.js5,4761,971
pg-connection-string/esm/index.mjs615265
total6,0912,236

So roughly 2.2 KiB gzipped. That is small — it is filed because a Postgres connection-string parser is not something the browser bundle should be able to reach at all, not because 2 KiB matters.

Where it comes from

It is a declared dependency of packages/spec (package.json, pg-connection-string: ^2.14.0) and is imported from the driver schemas that the spec's . / data entries reach:

  • packages/spec/src/data/driver/postgres.zod.ts
  • packages/spec/src/data/driver/common.zod.ts
  • packages/spec/src/migrations/registry.ts and two migrations/entries/semantic/18.* entries

The console bundles @objectstack/spec (and, since #9660, THIS tree's copy via OBJECTSTACK_SPEC_DIST), so the driver schemas come with it.

It is also the only browser-externalization warning the console build still emits once @objectstack/lint is taken out of the picture — measured directly: with lint's entry replaced by a stub, the build's externalization warnings drop from 4 to 1, and the survivor is this module's fs import.

Not a bug as measured

Nothing in the console calls the parser, and its fs import is replaced by Vite's browser stub, so no user-visible break was observed. This is a dependency-direction and bundle-shape observation: an authoring/validation schema in @objectstack/spec pulling a Node database client's URL parser into every browser consumer of the spec.

Deliberately not proposing a fix here — whether this is worth acting on, and whether the answer is a lazy require, a split entry, or leaving it alone at 2 KiB, is a triage call.

Refs: #9707 (the card this came out of), #9660 / #8134 (the spec injection that puts this tree's spec in the chunk), #9091 (a different, closed card about the same parser's authoring-time semantics — unrelated to bundling).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions