From 3701af3f5f03fb30de849a72b0776ef4b718ec7c Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:22:06 +0000 Subject: [PATCH 01/10] Replace vulnerable protobufjs fork with upstream --- packages/pgsql-cli/README.md | 2 +- packages/pgsql-cli/__tests__/cli.test.ts | 16 ++ packages/pgsql-cli/package.json | 8 +- .../pgsql-cli/src/commands/proto-fetch.ts | 8 +- .../src/commands/proto-fetch/helpers.ts | 5 +- packages/pgsql-cli/src/utils/help.ts | 6 +- .../__tests__/runtime-schema.test.ts | 14 +- .../proto-parser/__tests__/utilities.test.ts | 2 +- packages/proto-parser/package.json | 4 +- .../proto-parser/src/ast/enums/enums-json.ts | 2 +- packages/proto-parser/src/ast/enums/enums.ts | 2 +- packages/proto-parser/src/ast/types/types.ts | 2 +- packages/proto-parser/src/parser.ts | 2 +- .../src/runtime-schema/generator.ts | 5 +- packages/proto-parser/src/store.ts | 2 +- packages/proto-parser/src/utils/deps.ts | 2 +- packages/proto-parser/src/utils/utils.ts | 2 +- packages/proto-parser/test-utils/index.ts | 2 +- pnpm-lock.yaml | 151 ++++++++---------- pnpm-policy.yaml | 1 - pnpm-workspace.yaml | 1 - 21 files changed, 123 insertions(+), 116 deletions(-) diff --git a/packages/pgsql-cli/README.md b/packages/pgsql-cli/README.md index 9f186826f..ce501517b 100644 --- a/packages/pgsql-cli/README.md +++ b/packages/pgsql-cli/README.md @@ -166,7 +166,7 @@ pgsql proto-fetch [options] | `--inFile` | Where to save the proto file | *Required* | | `--outFile` | Generated JS output file | *Required* | | `--replace-pkg` | Original package name to replace | `protobufjs/minimal` | -| `--with-pkg` | New package name | `@launchql/protobufjs/minimal` | +| `--with-pkg` | New package name | `protobufjs/minimal` | | `-h, --help` | Show help | | #### Examples diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index df48f81e5..9db42e3cd 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -4,6 +4,7 @@ import { join } from 'path'; import { deparseCommand } from '../src/commands/deparse'; import { parseCommand } from '../src/commands/parse'; +import { protoFetchCommand } from '../src/commands/proto-fetch'; const sql = `SELECT (ARRAY[1, 2, 3])[2:3] AS slice, 'line one line two' AS memo FROM t WHERE id = 1`; @@ -57,3 +58,18 @@ describe('pgsql deparse', () => { .toEqual(withoutLocations(JSON.parse(readFileSync(astFile, 'utf-8')))); }); }); + +describe('pgsql proto-fetch', () => { + it.each([ + [undefined, 'protobufjs/minimal'], + ['@custom/protobufjs', '@custom/protobufjs'], + ])('generates a module with the requested runtime (%s)', async (withPkg, runtime) => { + const inFile = join(dir, 'test input.proto'); + const outFile = join(dir, 'test output.js'); + writeFileSync(inFile, 'syntax = "proto3"; message Example { string text = 1; }'); + + await protoFetchCommand({ inFile, outFile, 'with-pkg': withPkg }); + + expect(readFileSync(outFile, 'utf-8')).toContain(`require("${runtime}")`); + }); +}); diff --git a/packages/pgsql-cli/package.json b/packages/pgsql-cli/package.json index eefdbea0f..68a024da4 100644 --- a/packages/pgsql-cli/package.json +++ b/packages/pgsql-cli/package.json @@ -1,6 +1,6 @@ { "name": "@pgsql/cli", - "version": "18.3.12", + "version": "18.3.13", "description": "Unified CLI for PostgreSQL AST parsing, deparsing, and code generation", "author": "Constructive ", "main": "index.js", @@ -45,8 +45,6 @@ "database" ], "dependencies": { - "@launchql/protobufjs": "7.2.6", - "@launchql/protobufjs-cli": "1.1.5", "chalk": "^4.1.0", "glob": "8.0.3", "minimist": "1.2.8", @@ -54,7 +52,9 @@ "nested-obj": "^0.2.2", "pg-proto-parser": "workspace:*", "pgsql-deparser": "workspace:*", - "pgsql-parser": "workspace:*" + "pgsql-parser": "workspace:*", + "protobufjs": "7.6.6", + "protobufjs-cli": "1.3.3" }, "devDependencies": { "@types/minimist": "^1.2.5", diff --git a/packages/pgsql-cli/src/commands/proto-fetch.ts b/packages/pgsql-cli/src/commands/proto-fetch.ts index ebb66c585..a913dbd65 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch.ts @@ -13,7 +13,7 @@ export async function protoFetchCommand(argv: any) { const inFile = argv.inFile; const outFile = argv.outFile; const replacePkg = argv['replace-pkg'] || 'protobufjs/minimal'; - const withPkg = argv['with-pkg'] || '@launchql/protobufjs/minimal'; + const withPkg = argv['with-pkg'] || 'protobufjs/minimal'; if (!inFile || !outFile) { console.error(chalk.red('Error: --inFile and --outFile are required')); @@ -31,8 +31,10 @@ export async function protoFetchCommand(argv: any) { console.log(chalk.blue('Generating JavaScript from proto file...')); await generateProtoJS(inFile, outFile); - console.log(chalk.blue(`Replacing package references...`)); - await replaceTextInProtoJS(outFile, replacePkg, withPkg); + if (replacePkg !== withPkg) { + console.log(chalk.blue(`Replacing package references...`)); + await replaceTextInProtoJS(outFile, replacePkg, withPkg); + } console.log(chalk.green(`✓ All operations completed successfully`)); console.log(chalk.green(`✓ Generated file: ${outFile}`)); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 2f305b1cd..6e55e8f60 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -1,8 +1,8 @@ -import { exec } from 'child_process'; import fs from 'fs'; import https from 'https'; import { sync as mkdirp } from 'mkdirp'; import { dirname } from 'path'; +import { main as pbjs } from 'protobufjs-cli/pbjs'; // Download .proto file if URL export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => { @@ -34,10 +34,9 @@ export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => new Promise((resolve, reject) => { - const command = `pbjs --keep-case -t static-module -o ${outFile} ${inFile}`; mkdirp(dirname(outFile)); - exec(command, (error, _stdout, _stderr) => { + pbjs(['--keep-case', '-t', 'static-module', '-o', outFile, '--', inFile], (error) => { if (error) { console.error(`Error during code generation: ${error.message}`); reject(error); diff --git a/packages/pgsql-cli/src/utils/help.ts b/packages/pgsql-cli/src/utils/help.ts index 9c3d92e30..3bf197f47 100644 --- a/packages/pgsql-cli/src/utils/help.ts +++ b/packages/pgsql-cli/src/utils/help.ts @@ -162,15 +162,13 @@ ${chalk.yellow('Options:')} --inFile Where to save the proto file --outFile Generated JS output file --replace-pkg Original package name to replace - --with-pkg New package name + --with-pkg New package name (default: protobufjs/minimal) -h, --help Show help ${chalk.yellow('Examples:')} pgsql proto-fetch --url https://raw.githubusercontent.com/pganalyze/libpg_query/16-latest/protobuf/pg_query.proto \\ --inFile pg_query.proto \\ - --outFile pg_query.js \\ - --replace-pkg "protobufjs/minimal" \\ - --with-pkg "@launchql/protobufjs/minimal" + --outFile pg_query.js `); } diff --git a/packages/proto-parser/__tests__/runtime-schema.test.ts b/packages/proto-parser/__tests__/runtime-schema.test.ts index e8a362dfa..72ff94e9c 100644 --- a/packages/proto-parser/__tests__/runtime-schema.test.ts +++ b/packages/proto-parser/__tests__/runtime-schema.test.ts @@ -1,6 +1,18 @@ -import { parseAndSnap } from '../test-utils'; +import { getStore, parseAndSnap } from '../test-utils'; describe('runtime-schema', () => { + it('uses explicit JSON field names rather than protobufjs camelCase names', () => { + const schema = getStore({}).getRuntimeSchema(); + const jsonObjectAgg = schema.find(node => node.name === 'JsonObjectAgg'); + + expect(jsonObjectAgg.fields).toMatchObject([ + { name: 'absent_on_null' }, + { name: 'arg' }, + { name: 'constructor' }, + { name: 'unique' }, + ]); + }); + it('json format enabled', () => { parseAndSnap('runtime-schema/json/enabled', { runtimeSchema: { diff --git a/packages/proto-parser/__tests__/utilities.test.ts b/packages/proto-parser/__tests__/utilities.test.ts index 775d9adc1..ee4521034 100644 --- a/packages/proto-parser/__tests__/utilities.test.ts +++ b/packages/proto-parser/__tests__/utilities.test.ts @@ -1,4 +1,4 @@ -import { Type } from '@launchql/protobufjs'; +import { Type } from 'protobufjs'; import { ProtoStore } from '../src/store'; import { getDependencies, getDependents, getUndefinedKey } from '../src/utils'; diff --git a/packages/proto-parser/package.json b/packages/proto-parser/package.json index 3323abcd1..8345983e5 100644 --- a/packages/proto-parser/package.json +++ b/packages/proto-parser/package.json @@ -1,6 +1,6 @@ { "name": "pg-proto-parser", - "version": "1.32.8", + "version": "1.32.9", "description": "Generate TypeScript from the PostgreSQL protobuf definitions", "author": "Constructive ", "main": "index.js", @@ -46,10 +46,10 @@ "@babel/parser": "^7.23.6", "@babel/traverse": "7.28.5", "@babel/types": "7.28.5", - "@launchql/protobufjs": "7.2.6", "case": "1.6.3", "deepmerge": "4.3.1", "nested-obj": "^0.2.2", + "protobufjs": "7.6.6", "strfy-js": "^3.1.5" }, "devDependencies": { diff --git a/packages/proto-parser/src/ast/enums/enums-json.ts b/packages/proto-parser/src/ast/enums/enums-json.ts index af1cb0a48..28884bd18 100644 --- a/packages/proto-parser/src/ast/enums/enums-json.ts +++ b/packages/proto-parser/src/ast/enums/enums-json.ts @@ -1,4 +1,4 @@ -import { Enum } from '@launchql/protobufjs'; +import { Enum } from 'protobufjs'; type EnumValueToName = Record>; type EnumNameToValue = Record>; diff --git a/packages/proto-parser/src/ast/enums/enums.ts b/packages/proto-parser/src/ast/enums/enums.ts index 2d3ed5413..2657b276d 100644 --- a/packages/proto-parser/src/ast/enums/enums.ts +++ b/packages/proto-parser/src/ast/enums/enums.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum } from '@launchql/protobufjs'; +import { Enum } from 'protobufjs'; import { createNamedImport } from '../../utils'; diff --git a/packages/proto-parser/src/ast/types/types.ts b/packages/proto-parser/src/ast/types/types.ts index 20da5d291..f433e399e 100644 --- a/packages/proto-parser/src/ast/types/types.ts +++ b/packages/proto-parser/src/ast/types/types.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Field,Type } from '@launchql/protobufjs'; +import { Field,Type } from 'protobufjs'; import { NODE_TYPE } from '../../constants'; import { PgProtoParserOptions } from '../../options'; diff --git a/packages/proto-parser/src/parser.ts b/packages/proto-parser/src/parser.ts index dc024e802..919091b20 100644 --- a/packages/proto-parser/src/parser.ts +++ b/packages/proto-parser/src/parser.ts @@ -1,4 +1,4 @@ -import { parse } from '@launchql/protobufjs'; +import { parse } from 'protobufjs'; import { readFileSync } from 'fs'; import { diff --git a/packages/proto-parser/src/runtime-schema/generator.ts b/packages/proto-parser/src/runtime-schema/generator.ts index 4deb86d56..c7f71e655 100644 --- a/packages/proto-parser/src/runtime-schema/generator.ts +++ b/packages/proto-parser/src/runtime-schema/generator.ts @@ -1,5 +1,6 @@ -import { Field, Namespace,Type } from '@launchql/protobufjs'; +import { Field, Namespace,Type } from 'protobufjs'; +import { getFieldName } from '../utils/utils'; import { FieldSpec,NodeSpec } from './types'; export class RuntimeSchemaGenerator { @@ -60,7 +61,7 @@ export class RuntimeSchemaGenerator { } private createFieldSpec(field: Field): FieldSpec | null { - const fieldName = field.name; + const fieldName = getFieldName(field, field.name); const isArray = field.repeated || false; const optional = !field.required; const fieldType = field.type; diff --git a/packages/proto-parser/src/store.ts b/packages/proto-parser/src/store.ts index 2d68b245b..3ba5498b1 100644 --- a/packages/proto-parser/src/store.ts +++ b/packages/proto-parser/src/store.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum, Field, Namespace, ReflectionObject,Service, Type } from '@launchql/protobufjs'; +import { Enum, Field, Namespace, ReflectionObject,Service, Type } from 'protobufjs'; import { mkdirSync } from 'fs'; import { dirname,join } from 'path'; import { jsStringify } from 'strfy-js'; diff --git a/packages/proto-parser/src/utils/deps.ts b/packages/proto-parser/src/utils/deps.ts index 27c180c44..bf24ad868 100644 --- a/packages/proto-parser/src/utils/deps.ts +++ b/packages/proto-parser/src/utils/deps.ts @@ -1,4 +1,4 @@ -import { Enum, Field,Type } from '@launchql/protobufjs'; +import { Enum, Field,Type } from 'protobufjs'; import { NODE_TYPE } from '../constants'; import { isPrimitiveType } from './types'; diff --git a/packages/proto-parser/src/utils/utils.ts b/packages/proto-parser/src/utils/utils.ts index 95d895b82..775fe764e 100644 --- a/packages/proto-parser/src/utils/utils.ts +++ b/packages/proto-parser/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { Enum, Field, ReflectionObject } from '@launchql/protobufjs'; +import { Enum, Field, ReflectionObject } from 'protobufjs'; import { writeFileSync } from 'fs'; import { basename,extname } from 'path'; diff --git a/packages/proto-parser/test-utils/index.ts b/packages/proto-parser/test-utils/index.ts index e68a9b59d..9183ae005 100644 --- a/packages/proto-parser/test-utils/index.ts +++ b/packages/proto-parser/test-utils/index.ts @@ -6,7 +6,7 @@ import { sync as glob } from 'glob' import { getOptionsWithDefaults, PgProtoParserOptions } from '../src/options'; import { prettyPrint } from 'recast'; import { ProtoStore } from '../src/store'; -import { parse } from '@launchql/protobufjs'; +import { parse } from 'protobufjs'; export const printAst = (ast: any) => { const results = generate(ast); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61f760f4c..ccd14614c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -162,12 +162,6 @@ importers: packages/pgsql-cli: dependencies: - "@launchql/protobufjs": - specifier: 7.2.6 - version: 7.2.6 - "@launchql/protobufjs-cli": - specifier: 1.1.5 - version: 1.1.5(@launchql/protobufjs@7.2.6) chalk: specifier: ^4.1.0 version: 4.1.2 @@ -192,6 +186,12 @@ importers: pgsql-parser: specifier: workspace:* version: link:../parser/dist + protobufjs: + specifier: 7.6.6 + version: 7.6.6 + protobufjs-cli: + specifier: 1.3.3 + version: 1.3.3(protobufjs@7.6.6) devDependencies: "@types/minimist": specifier: ^1.2.5 @@ -297,9 +297,6 @@ importers: "@babel/types": specifier: 7.28.5 version: 7.28.5 - "@launchql/protobufjs": - specifier: 7.2.6 - version: 7.2.6 case: specifier: 1.6.3 version: 1.6.3 @@ -309,6 +306,9 @@ importers: nested-obj: specifier: ^0.2.2 version: 0.2.2 + protobufjs: + specifier: 7.6.6 + version: 7.6.6 strfy-js: specifier: ^3.1.5 version: 3.1.5 @@ -1320,23 +1320,6 @@ packages: } engines: { node: ">=v12.0.0" } - "@launchql/protobufjs-cli@1.1.5": - resolution: - { - integrity: sha512-k9Zr2Ny0CKlBGV5w+1ZBgsN2sQMKdbCwYSM1Ogo/het+S3YgYFbddyIz8us/z/2EDuuexGNCVaXsU8+wRTCDng==, - } - engines: { node: ">=12.0.0" } - hasBin: true - peerDependencies: - "@launchql/protobufjs": ^7.0.0 - - "@launchql/protobufjs@7.2.6": - resolution: - { - integrity: sha512-vwi1nG2/heVFsIMHQU1KxTjUp5c757CTtRAZn/jutApCkFlle1iv8tzM/DHlSZJKDldxaYqnNYTg0pTyp8Bbtg==, - } - engines: { node: ">=12.0.0" } - "@napi-rs/wasm-runtime@0.2.12": resolution: { @@ -1752,22 +1735,22 @@ packages: integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==, } - "@protobufjs/codegen@2.0.4": + "@protobufjs/codegen@2.0.5": resolution: { - integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==, + integrity: sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==, } - "@protobufjs/eventemitter@1.1.0": + "@protobufjs/eventemitter@1.1.1": resolution: { - integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==, + integrity: sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==, } - "@protobufjs/fetch@1.1.0": + "@protobufjs/fetch@1.1.1": resolution: { - integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==, + integrity: sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==, } "@protobufjs/float@1.0.2": @@ -1776,12 +1759,6 @@ packages: integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==, } - "@protobufjs/inquire@1.1.0": - resolution: - { - integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==, - } - "@protobufjs/path@1.1.2": resolution: { @@ -1794,10 +1771,10 @@ packages: integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==, } - "@protobufjs/utf8@1.1.0": + "@protobufjs/utf8@1.1.2": resolution: { - integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==, + integrity: sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==, } "@sigstore/bundle@4.0.0": @@ -5514,6 +5491,23 @@ packages: } engines: { node: ^18.17.0 || >=20.5.0 } + protobufjs-cli@1.3.3: + resolution: + { + integrity: sha512-zwmt6JeStPjeofZbl+QADexAVzP1EgsIAsO7mCfKkW/8oBxHwgTqJ1aD7zDrcCC0Nb+SLWSvCR3RDaKgIO3P8w==, + } + engines: { node: ">=12.0.0" } + hasBin: true + peerDependencies: + protobufjs: ^7.6.2 + + protobufjs@7.6.6: + resolution: + { + integrity: sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==, + } + engines: { node: ">=12.0.0" } + protocols@2.0.2: resolution: { @@ -6047,13 +6041,6 @@ packages: } engines: { node: ">=12.0.0" } - tmp@0.2.5: - resolution: - { - integrity: sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==, - } - engines: { node: ">=14.14" } - tmp@0.2.7: resolution: { @@ -7213,35 +7200,6 @@ snapshots: dependencies: lodash: 4.17.21 - "@launchql/protobufjs-cli@1.1.5(@launchql/protobufjs@7.2.6)": - dependencies: - "@launchql/protobufjs": 7.2.6 - chalk: 4.1.2 - escodegen: 1.14.3 - espree: 9.6.1 - estraverse: 5.3.0 - glob: 8.0.3 - jsdoc: 4.0.5 - minimist: 1.2.8 - semver: 7.7.3 - tmp: 0.2.5 - uglify-js: 3.19.3 - - "@launchql/protobufjs@7.2.6": - dependencies: - "@protobufjs/aspromise": 1.1.2 - "@protobufjs/base64": 1.1.2 - "@protobufjs/codegen": 2.0.4 - "@protobufjs/eventemitter": 1.1.0 - "@protobufjs/fetch": 1.1.0 - "@protobufjs/float": 1.0.2 - "@protobufjs/inquire": 1.1.0 - "@protobufjs/path": 1.1.2 - "@protobufjs/pool": 1.1.0 - "@protobufjs/utf8": 1.1.0 - "@types/node": 20.19.25 - long: 5.3.2 - "@napi-rs/wasm-runtime@0.2.12": dependencies: "@emnapi/core": 1.7.1 @@ -7537,24 +7495,21 @@ snapshots: "@protobufjs/base64@1.1.2": {} - "@protobufjs/codegen@2.0.4": {} + "@protobufjs/codegen@2.0.5": {} - "@protobufjs/eventemitter@1.1.0": {} + "@protobufjs/eventemitter@1.1.1": {} - "@protobufjs/fetch@1.1.0": + "@protobufjs/fetch@1.1.1": dependencies: "@protobufjs/aspromise": 1.1.2 - "@protobufjs/inquire": 1.1.0 "@protobufjs/float@1.0.2": {} - "@protobufjs/inquire@1.1.0": {} - "@protobufjs/path@1.1.2": {} "@protobufjs/pool@1.1.0": {} - "@protobufjs/utf8@1.1.0": {} + "@protobufjs/utf8@1.1.2": {} "@sigstore/bundle@4.0.0": dependencies: @@ -10178,6 +10133,34 @@ snapshots: dependencies: read: 4.1.0 + protobufjs-cli@1.3.3(protobufjs@7.6.6): + dependencies: + chalk: 4.1.2 + escodegen: 1.14.3 + espree: 9.6.1 + estraverse: 5.3.0 + glob: 8.0.3 + jsdoc: 4.0.5 + minimist: 1.2.8 + protobufjs: 7.6.6 + semver: 7.8.5 + tmp: 0.2.7 + uglify-js: 3.19.3 + + protobufjs@7.6.6: + dependencies: + "@protobufjs/aspromise": 1.1.2 + "@protobufjs/base64": 1.1.2 + "@protobufjs/codegen": 2.0.5 + "@protobufjs/eventemitter": 1.1.1 + "@protobufjs/fetch": 1.1.1 + "@protobufjs/float": 1.0.2 + "@protobufjs/path": 1.1.2 + "@protobufjs/pool": 1.1.0 + "@protobufjs/utf8": 1.1.2 + "@types/node": 20.19.25 + long: 5.3.2 + protocols@2.0.2: {} proxy-from-env@2.1.0: {} @@ -10462,8 +10445,6 @@ snapshots: fdir: 6.5.0(picomatch@4.0.5) picomatch: 4.0.5 - tmp@0.2.5: {} - tmp@0.2.7: {} tmpl@1.0.5: {} diff --git a/pnpm-policy.yaml b/pnpm-policy.yaml index 4cf79663e..a71cdd358 100644 --- a/pnpm-policy.yaml +++ b/pnpm-policy.yaml @@ -35,7 +35,6 @@ intersect: true allowBuilds: nx: "Nx CLI native postinstall step (downloads/links its native project-graph daemon binary)." unrs-resolver: "unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install." - "@launchql/protobufjs": "protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile)." # Third-party escape hatches. A reason is required; `until` expires the waiver so # `check` makes you re-justify it instead of letting it live forever. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 411e65d97..8ac13ec05 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -34,6 +34,5 @@ blockExoticSubdeps: true # The only dependencies permitted to run install scripts. allowBuilds: - "@launchql/protobufjs": true # protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile). nx: true # Nx CLI native postinstall step (downloads/links its native project-graph daemon binary). unrs-resolver: true # unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install. From 684e8823481ae2d6630f440fb95b49c50e046c6e Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:37:02 +0000 Subject: [PATCH 02/10] Preserve PostgreSQL JSON names in proto-fetch codecs --- packages/pgsql-cli/__tests__/cli.test.ts | 17 ++++- .../src/commands/proto-fetch/helpers.ts | 70 +++++++++++++++---- .../commands/proto-fetch/static-module.d.ts | 9 +++ .../__tests__/runtime-schema.test.ts | 24 ++++++- 4 files changed, 105 insertions(+), 15 deletions(-) create mode 100644 packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 9db42e3cd..8c2f21a40 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -1,6 +1,7 @@ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'fs'; import { tmpdir } from 'os'; -import { join } from 'path'; +import { join, resolve } from 'path'; +import { loadModule, parseSync } from 'pgsql-parser'; import { deparseCommand } from '../src/commands/deparse'; import { parseCommand } from '../src/commands/parse'; @@ -72,4 +73,18 @@ describe('pgsql proto-fetch', () => { expect(readFileSync(outFile, 'utf-8')).toContain(`require("${runtime}")`); }); + + it('round-trips a PostgreSQL AST using its JSON field names', async () => { + const inFile = resolve(__dirname, '../../../__fixtures__/proto/18-latest.proto'); + const outFile = join(dir, 'pg-query.js'); + await protoFetchCommand({ inFile, outFile, 'with-pkg': require.resolve('protobufjs/minimal') }); + + const { ParseResult } = require(outFile).pg_query; + await loadModule(); + const ast = parseSync('SELECT 42'); + const message = ParseResult.fromObject(ast); + const decoded = ParseResult.decode(ParseResult.encode(message).finish()); + + expect(ParseResult.toObject(decoded, { enums: String, longs: Number })).toEqual(ast); + }); }); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 6e55e8f60..362913944 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -2,7 +2,8 @@ import fs from 'fs'; import https from 'https'; import { sync as mkdirp } from 'mkdirp'; import { dirname } from 'path'; -import { main as pbjs } from 'protobufjs-cli/pbjs'; +import { Field, Namespace, OneOf, Root, Type } from 'protobufjs'; +import staticModule from 'protobufjs-cli/targets/static-module'; // Download .proto file if URL export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => { @@ -32,20 +33,63 @@ export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => new Promise((resolve, reject) => { - mkdirp(dirname(outFile)); - - pbjs(['--keep-case', '-t', 'static-module', '-o', outFile, '--', inFile], (error) => { - if (error) { - console.error(`Error during code generation: ${error.message}`); - reject(error); - return; +const applyJsonFieldNames = (namespace: Namespace): void => { + if (namespace instanceof Type) { + const fields = namespace.fieldsArray.map(field => { + const name = field.options?.json_name ?? field.name; + if (typeof name !== 'string' || !/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(name) || name === '__proto__') { + throw new Error(`Invalid JSON field name on ${field.fullName}`); + } + return { field, name }; + }); + if (fields.some(({ field, name }) => field.name !== name)) { + const oneofs = new Map( + namespace.oneofsArray.map(oneof => [oneof, [...oneof.fieldsArray]]) + ); + for (const [oneof, members] of oneofs) { + members.forEach(field => oneof.remove(field)); + } + fields.forEach(({ field }) => namespace.remove(field)); + fields.forEach(({ field, name }) => { + field.name = name; + namespace.add(field); + }); + for (const [oneof, members] of oneofs) { + members.forEach(field => oneof.add(field)); + } } - console.log('Generated proto.js from proto file.'); - resolve(); + } + for (const child of namespace.nestedArray) { + if (child instanceof Namespace) applyJsonFieldNames(child); + } +}; + +export const generateProtoJS = async (inFile: string, outFile: string): Promise => { + const root = new Root().loadSync(inFile, { keepCase: true }); + applyJsonFieldNames(root); + root.resolveAll(); + const output = await new Promise((resolve, reject) => { + staticModule(root, { + beautify: true, + comments: true, + convert: true, + create: true, + decode: true, + delimited: true, + encode: true, + lint: 'eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars', + service: true, + typeurl: true, + verify: true, + }, (error, result) => { + if (error) reject(error); + else resolve(result); + }); }); -}); + mkdirp(dirname(outFile)); + await fs.promises.writeFile(outFile, output, 'utf8'); + console.log('Generated proto.js from proto file.'); +}; // Replace text in generated JS file export const replaceTextInProtoJS = (filePath: string, originalPackage: string, newPackage: string): Promise => new Promise((resolve, reject) => { diff --git a/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts b/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts new file mode 100644 index 000000000..a38278b3e --- /dev/null +++ b/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts @@ -0,0 +1,9 @@ +declare module 'protobufjs-cli/targets/static-module' { + import { Root } from 'protobufjs'; + + export default function staticModule( + root: Root, + options: Record, + callback: (error: Error | null, output?: string) => void + ): void; +} diff --git a/packages/proto-parser/__tests__/runtime-schema.test.ts b/packages/proto-parser/__tests__/runtime-schema.test.ts index 72ff94e9c..a53ec3759 100644 --- a/packages/proto-parser/__tests__/runtime-schema.test.ts +++ b/packages/proto-parser/__tests__/runtime-schema.test.ts @@ -1,6 +1,28 @@ -import { getStore, parseAndSnap } from '../test-utils'; +import { readFileSync } from 'fs'; +import { parse } from 'protobufjs'; + +import { ProtoStore } from '../src/store'; +import { getFieldName } from '../src/utils'; +import { getStore, getTestProtoPath, parseAndSnap } from '../test-utils'; describe('runtime-schema', () => { + it('preserves PG18 JSON names and the JsonAggConstructor fields', () => { + const { root } = parse(readFileSync(getTestProtoPath('18-latest.proto'), 'utf8')); + const selectStmt = root.lookupType('pg_query.Node').fields.selectStmt; + expect(getFieldName(selectStmt, selectStmt.name)).toBe('SelectStmt'); + + const schema = new ProtoStore(root).getRuntimeSchema(); + expect(schema.find(node => node.name === 'SelectStmt')).toMatchObject({ isNode: true }); + expect(schema.find(node => node.name === 'JsonAggConstructor').fields).toEqual( + expect.arrayContaining([expect.objectContaining({ name: 'agg_filter', type: 'Node' })]) + ); + for (const name of ['JsonObjectAgg', 'JsonArrayAgg']) { + expect(schema.find(node => node.name === name).fields).toEqual( + expect.arrayContaining([expect.objectContaining({ name: 'constructor', type: 'JsonAggConstructor' })]) + ); + } + }); + it('uses explicit JSON field names rather than protobufjs camelCase names', () => { const schema = getStore({}).getRuntimeSchema(); const jsonObjectAgg = schema.find(node => node.name === 'JsonObjectAgg'); From 081dbdee0f86ca0f3314a49ccf6be2c810214c80 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:42:15 +0000 Subject: [PATCH 03/10] Resolve bundled protobuf imports in proto-fetch --- packages/pgsql-cli/__tests__/cli.test.ts | 17 +++++++++++++++++ .../src/commands/proto-fetch/helpers.ts | 15 ++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 8c2f21a40..579a99d45 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -6,6 +6,7 @@ import { loadModule, parseSync } from 'pgsql-parser'; import { deparseCommand } from '../src/commands/deparse'; import { parseCommand } from '../src/commands/parse'; import { protoFetchCommand } from '../src/commands/proto-fetch'; +import { generateProtoJS } from '../src/commands/proto-fetch/helpers'; const sql = `SELECT (ARRAY[1, 2, 3])[2:3] AS slice, 'line one line two' AS memo FROM t WHERE id = 1`; @@ -61,6 +62,22 @@ describe('pgsql deparse', () => { }); describe('pgsql proto-fetch', () => { + it('resolves standard protobuf imports from the installed runtime', async () => { + const inFile = join(dir, 'descriptor-user.proto'); + const outFile = join(dir, 'descriptor-user.js'); + writeFileSync(inFile, ` + syntax = "proto2"; + import "google/protobuf/descriptor.proto"; + message Example { + optional google.protobuf.FileDescriptorProto descriptor = 1; + } + `); + + await generateProtoJS(inFile, outFile); + + expect(readFileSync(outFile, 'utf-8')).toContain('$root.google.protobuf.FileDescriptorProto'); + }); + it.each([ [undefined, 'protobufjs/minimal'], ['@custom/protobufjs', '@custom/protobufjs'], diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 362913944..192b97a1e 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -1,8 +1,8 @@ import fs from 'fs'; import https from 'https'; import { sync as mkdirp } from 'mkdirp'; -import { dirname } from 'path'; -import { Field, Namespace, OneOf, Root, Type } from 'protobufjs'; +import { dirname, resolve } from 'path'; +import { Field, Namespace, OneOf, Root, Type, util } from 'protobufjs'; import staticModule from 'protobufjs-cli/targets/static-module'; // Download .proto file if URL @@ -65,7 +65,16 @@ const applyJsonFieldNames = (namespace: Namespace): void => { }; export const generateProtoJS = async (inFile: string, outFile: string): Promise => { - const root = new Root().loadSync(inFile, { keepCase: true }); + const root = new Root(); + const includeDir = dirname(require.resolve('protobufjs/package.json')); + root.resolvePath = (origin, target) => { + const local = util.path.resolve(origin, target); + if (fs.existsSync(local)) return local; + + const bundled = resolve(includeDir, target); + return fs.existsSync(bundled) ? bundled : local; + }; + root.loadSync(inFile, { keepCase: true }); applyJsonFieldNames(root); root.resolveAll(); const output = await new Promise((resolve, reject) => { From 62567fd906b302c721161e8b58b67572d07cf412 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:43:48 +0000 Subject: [PATCH 04/10] Preserve JSON aliases and extensions in proto-fetch --- packages/pgsql-cli/__tests__/cli.test.ts | 41 ++++++++++++++++++- .../src/commands/proto-fetch/helpers.ts | 6 ++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 579a99d45..505bae1e7 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -6,7 +6,7 @@ import { loadModule, parseSync } from 'pgsql-parser'; import { deparseCommand } from '../src/commands/deparse'; import { parseCommand } from '../src/commands/parse'; import { protoFetchCommand } from '../src/commands/proto-fetch'; -import { generateProtoJS } from '../src/commands/proto-fetch/helpers'; +import { generateProtoJS, replaceTextInProtoJS } from '../src/commands/proto-fetch/helpers'; const sql = `SELECT (ARRAY[1, 2, 3])[2:3] AS slice, 'line one line two' AS memo FROM t WHERE id = 1`; @@ -78,6 +78,43 @@ describe('pgsql proto-fetch', () => { expect(readFileSync(outFile, 'utf-8')).toContain('$root.google.protobuf.FileDescriptorProto'); }); + it.each([ + { + description: 'a punctuated JSON alias', + definition: 'message Example { optional string label = 1 [json_name = "first-name"]; }', + value: { 'first-name': 'Ada' }, + }, + { + description: 'a qualified extension name', + definition: ` + message Example { extensions 100 to max; } + extend Example { optional string extra = 100; } + `, + value: { '.demo.extra': 'extension' }, + } + ])('round-trips $description', async ({ definition, value }) => { + const inFile = join(dir, 'example.proto'); + const outFile = join(dir, 'example.js'); + writeFileSync(inFile, `syntax = "proto2"; package demo; ${definition}`); + + await generateProtoJS(inFile, outFile); + await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('protobufjs/minimal')); + + const { Example } = require(outFile).demo; + expect(Example.toObject(Example.decode(Example.encode(value).finish()))).toEqual(value); + }); + + it.each(['__proto__', 'constructor', 'toJSON'])('rejects a shadowing alias (%s)', async name => { + const inFile = join(dir, 'example.proto'); + const outFile = join(dir, 'example.js'); + writeFileSync(inFile, ` + syntax = "proto3"; + message Example { string label = 1 [json_name = "${name}"]; } + `); + + await expect(generateProtoJS(inFile, outFile)).rejects.toThrow('Invalid JSON field name'); + }); + it.each([ [undefined, 'protobufjs/minimal'], ['@custom/protobufjs', '@custom/protobufjs'], @@ -103,5 +140,5 @@ describe('pgsql proto-fetch', () => { const decoded = ParseResult.decode(ParseResult.encode(message).finish()); expect(ParseResult.toObject(decoded, { enums: String, longs: Number })).toEqual(ast); - }); + }, 20_000); }); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 192b97a1e..20519dd6a 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -36,8 +36,10 @@ export const downloadProtoFile = (protoUrl: string, filePath: string): Promise { if (namespace instanceof Type) { const fields = namespace.fieldsArray.map(field => { - const name = field.options?.json_name ?? field.name; - if (typeof name !== 'string' || !/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(name) || name === '__proto__') { + const name = field.declaringField ? field.name : field.options?.json_name ?? field.name; + if (name === '__proto__' || (name !== field.name && ( + typeof name !== 'string' || Object.hasOwn(Object.prototype, name) || name === 'prototype' || name === 'toJSON' + ))) { throw new Error(`Invalid JSON field name on ${field.fullName}`); } return { field, name }; From 01fdbcb5995677f9c9c368ecd9d6f4bf0002d640 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:49:17 +0000 Subject: [PATCH 05/10] Reject unsupported JSON field aliases before code generation --- packages/pgsql-cli/__tests__/cli.test.ts | 30 ++++++++----------- .../src/commands/proto-fetch/helpers.ts | 5 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 505bae1e7..2dcf79b29 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -78,33 +78,25 @@ describe('pgsql proto-fetch', () => { expect(readFileSync(outFile, 'utf-8')).toContain('$root.google.protobuf.FileDescriptorProto'); }); - it.each([ - { - description: 'a punctuated JSON alias', - definition: 'message Example { optional string label = 1 [json_name = "first-name"]; }', - value: { 'first-name': 'Ada' }, - }, - { - description: 'a qualified extension name', - definition: ` - message Example { extensions 100 to max; } - extend Example { optional string extra = 100; } - `, - value: { '.demo.extra': 'extension' }, - } - ])('round-trips $description', async ({ definition, value }) => { + it('round-trips a qualified extension name', async () => { const inFile = join(dir, 'example.proto'); const outFile = join(dir, 'example.js'); - writeFileSync(inFile, `syntax = "proto2"; package demo; ${definition}`); + writeFileSync(inFile, ` + syntax = "proto2"; + package demo; + message Example { extensions 100 to max; } + extend Example { optional string extra = 100; } + `); await generateProtoJS(inFile, outFile); await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('protobufjs/minimal')); const { Example } = require(outFile).demo; + const value = { '.demo.extra': 'extension' }; expect(Example.toObject(Example.decode(Example.encode(value).finish()))).toEqual(value); }); - it.each(['__proto__', 'constructor', 'toJSON'])('rejects a shadowing alias (%s)', async name => { + it.each(['first-name', 'first name', '2fa', 'class', '__proto__', 'constructor', 'toJSON'])('rejects an unsupported alias (%s)', async name => { const inFile = join(dir, 'example.proto'); const outFile = join(dir, 'example.js'); writeFileSync(inFile, ` @@ -112,7 +104,9 @@ describe('pgsql proto-fetch', () => { message Example { string label = 1 [json_name = "${name}"]; } `); - await expect(generateProtoJS(inFile, outFile)).rejects.toThrow('Invalid JSON field name'); + await expect(generateProtoJS(inFile, outFile)).rejects.toThrow( + `Invalid JSON field name ${JSON.stringify(name)} on .Example.label` + ); }); it.each([ diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 20519dd6a..189cc3f54 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -38,9 +38,10 @@ const applyJsonFieldNames = (namespace: Namespace): void => { const fields = namespace.fieldsArray.map(field => { const name = field.declaringField ? field.name : field.options?.json_name ?? field.name; if (name === '__proto__' || (name !== field.name && ( - typeof name !== 'string' || Object.hasOwn(Object.prototype, name) || name === 'prototype' || name === 'toJSON' + typeof name !== 'string' || !/^[A-Za-z_$][\w$]*$/.test(name) || util.isReserved(name) || + Object.hasOwn(Object.prototype, name) || name === 'prototype' || name === 'toJSON' ))) { - throw new Error(`Invalid JSON field name on ${field.fullName}`); + throw new Error(`Invalid JSON field name ${JSON.stringify(name)} on ${field.fullName}`); } return { field, name }; }); From 2aeaffe70379c2d5acaf3468ce8fa7fc81294ace Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:49:44 +0000 Subject: [PATCH 06/10] Never substitute a bundled proto for a missing input --- packages/pgsql-cli/__tests__/cli.test.ts | 7 +++++++ packages/pgsql-cli/src/commands/proto-fetch/helpers.ts | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 2dcf79b29..7a86a0984 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -78,6 +78,13 @@ describe('pgsql proto-fetch', () => { expect(readFileSync(outFile, 'utf-8')).toContain('$root.google.protobuf.FileDescriptorProto'); }); + it.each(['descriptor.proto', 'timestamp.proto'])('does not substitute a bundled proto for a missing input (%s)', async name => { + const inFile = `google/protobuf/${name}`; + const outFile = join(dir, 'missing.js'); + + await expect(generateProtoJS(inFile, outFile)).rejects.toMatchObject({ code: 'ENOENT', path: inFile }); + }); + it('round-trips a qualified extension name', async () => { const inFile = join(dir, 'example.proto'); const outFile = join(dir, 'example.js'); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 189cc3f54..07eff5358 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -68,13 +68,15 @@ const applyJsonFieldNames = (namespace: Namespace): void => { }; export const generateProtoJS = async (inFile: string, outFile: string): Promise => { + fs.accessSync(inFile, fs.constants.R_OK); const root = new Root(); const includeDir = dirname(require.resolve('protobufjs/package.json')); root.resolvePath = (origin, target) => { const local = util.path.resolve(origin, target); - if (fs.existsSync(local)) return local; + const normalizedTarget = util.path.normalize(target); + if (!origin || !normalizedTarget.startsWith('google/protobuf/') || fs.existsSync(local)) return local; - const bundled = resolve(includeDir, target); + const bundled = resolve(includeDir, normalizedTarget); return fs.existsSync(bundled) ? bundled : local; }; root.loadSync(inFile, { keepCase: true }); From bb22257c41f49f9b6116d0643cd7711709526c5c Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 21:54:19 +0000 Subject: [PATCH 07/10] Resolve bundled Google API proto imports --- packages/pgsql-cli/__tests__/cli.test.ts | 23 +++++++++++++++++-- .../src/commands/proto-fetch/helpers.ts | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 7a86a0984..d589ebc82 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -78,8 +78,27 @@ describe('pgsql proto-fetch', () => { expect(readFileSync(outFile, 'utf-8')).toContain('$root.google.protobuf.FileDescriptorProto'); }); - it.each(['descriptor.proto', 'timestamp.proto'])('does not substitute a bundled proto for a missing input (%s)', async name => { - const inFile = `google/protobuf/${name}`; + it('resolves bundled Google API imports from the installed runtime', async () => { + const inFile = join(dir, 'annotations-user.proto'); + const outFile = join(dir, 'annotations-user.js'); + writeFileSync(inFile, ` + syntax = "proto3"; + import "google/api/annotations.proto"; + message Example { google.api.HttpRule rule = 1; } + `); + + await generateProtoJS(inFile, outFile); + + const output = readFileSync(outFile, 'utf-8'); + expect(output).toContain('$root.google.api.HttpRule'); + expect(output).toContain('$root.google.protobuf.MethodOptions'); + }); + + it.each([ + 'google/protobuf/descriptor.proto', + 'google/protobuf/timestamp.proto', + 'google/api/annotations.proto', + ])('does not substitute a bundled proto for a missing input (%s)', async inFile => { const outFile = join(dir, 'missing.js'); await expect(generateProtoJS(inFile, outFile)).rejects.toMatchObject({ code: 'ENOENT', path: inFile }); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 07eff5358..44f7e2e5b 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -74,7 +74,7 @@ export const generateProtoJS = async (inFile: string, outFile: string): Promise< root.resolvePath = (origin, target) => { const local = util.path.resolve(origin, target); const normalizedTarget = util.path.normalize(target); - if (!origin || !normalizedTarget.startsWith('google/protobuf/') || fs.existsSync(local)) return local; + if (!origin || !normalizedTarget.startsWith('google/') || fs.existsSync(local)) return local; const bundled = resolve(includeDir, normalizedTarget); return fs.existsSync(bundled) ? bundled : local; From 71ff9c3b0f92dc2f23957555b57fd7b3b3be62d1 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 22:03:03 +0000 Subject: [PATCH 08/10] Use the rebased LaunchQL protobuf fork for parser codegen --- packages/pgsql-cli/README.md | 2 +- packages/pgsql-cli/__tests__/cli.test.ts | 8 +- packages/pgsql-cli/package.json | 4 +- .../pgsql-cli/src/commands/proto-fetch.ts | 2 +- .../src/commands/proto-fetch/helpers.ts | 85 +++---------------- .../commands/proto-fetch/static-module.d.ts | 9 -- packages/pgsql-cli/src/utils/help.ts | 2 +- .../__tests__/runtime-schema.test.ts | 5 +- .../proto-parser/__tests__/utilities.test.ts | 2 +- packages/proto-parser/package.json | 2 +- .../proto-parser/src/ast/enums/enums-json.ts | 2 +- packages/proto-parser/src/ast/enums/enums.ts | 2 +- packages/proto-parser/src/ast/types/types.ts | 2 +- packages/proto-parser/src/parser.ts | 2 +- .../src/runtime-schema/generator.ts | 5 +- packages/proto-parser/src/store.ts | 2 +- packages/proto-parser/src/utils/deps.ts | 2 +- packages/proto-parser/src/utils/utils.ts | 2 +- packages/proto-parser/test-utils/index.ts | 2 +- pnpm-policy.yaml | 1 + pnpm-workspace.yaml | 1 + 21 files changed, 40 insertions(+), 104 deletions(-) delete mode 100644 packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts diff --git a/packages/pgsql-cli/README.md b/packages/pgsql-cli/README.md index ce501517b..9f186826f 100644 --- a/packages/pgsql-cli/README.md +++ b/packages/pgsql-cli/README.md @@ -166,7 +166,7 @@ pgsql proto-fetch [options] | `--inFile` | Where to save the proto file | *Required* | | `--outFile` | Generated JS output file | *Required* | | `--replace-pkg` | Original package name to replace | `protobufjs/minimal` | -| `--with-pkg` | New package name | `protobufjs/minimal` | +| `--with-pkg` | New package name | `@launchql/protobufjs/minimal` | | `-h, --help` | Show help | | #### Examples diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index d589ebc82..3229f7902 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -115,7 +115,7 @@ describe('pgsql proto-fetch', () => { `); await generateProtoJS(inFile, outFile); - await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('protobufjs/minimal')); + await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('@launchql/protobufjs/minimal')); const { Example } = require(outFile).demo; const value = { '.demo.extra': 'extension' }; @@ -131,12 +131,12 @@ describe('pgsql proto-fetch', () => { `); await expect(generateProtoJS(inFile, outFile)).rejects.toThrow( - `Invalid JSON field name ${JSON.stringify(name)} on .Example.label` + `Invalid JSON field name ${JSON.stringify(name)} on label` ); }); it.each([ - [undefined, 'protobufjs/minimal'], + [undefined, '@launchql/protobufjs/minimal'], ['@custom/protobufjs', '@custom/protobufjs'], ])('generates a module with the requested runtime (%s)', async (withPkg, runtime) => { const inFile = join(dir, 'test input.proto'); @@ -151,7 +151,7 @@ describe('pgsql proto-fetch', () => { it('round-trips a PostgreSQL AST using its JSON field names', async () => { const inFile = resolve(__dirname, '../../../__fixtures__/proto/18-latest.proto'); const outFile = join(dir, 'pg-query.js'); - await protoFetchCommand({ inFile, outFile, 'with-pkg': require.resolve('protobufjs/minimal') }); + await protoFetchCommand({ inFile, outFile, 'with-pkg': require.resolve('@launchql/protobufjs/minimal') }); const { ParseResult } = require(outFile).pg_query; await loadModule(); diff --git a/packages/pgsql-cli/package.json b/packages/pgsql-cli/package.json index 68a024da4..4704c0b52 100644 --- a/packages/pgsql-cli/package.json +++ b/packages/pgsql-cli/package.json @@ -53,8 +53,8 @@ "pg-proto-parser": "workspace:*", "pgsql-deparser": "workspace:*", "pgsql-parser": "workspace:*", - "protobufjs": "7.6.6", - "protobufjs-cli": "1.3.3" + "@launchql/protobufjs": "7.6.6", + "@launchql/protobufjs-cli": "1.3.3" }, "devDependencies": { "@types/minimist": "^1.2.5", diff --git a/packages/pgsql-cli/src/commands/proto-fetch.ts b/packages/pgsql-cli/src/commands/proto-fetch.ts index a913dbd65..a03651d97 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch.ts @@ -13,7 +13,7 @@ export async function protoFetchCommand(argv: any) { const inFile = argv.inFile; const outFile = argv.outFile; const replacePkg = argv['replace-pkg'] || 'protobufjs/minimal'; - const withPkg = argv['with-pkg'] || 'protobufjs/minimal'; + const withPkg = argv['with-pkg'] || '@launchql/protobufjs/minimal'; if (!inFile || !outFile) { console.error(chalk.red('Error: --inFile and --outFile are required')); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 44f7e2e5b..159fabf56 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -1,9 +1,8 @@ import fs from 'fs'; import https from 'https'; import { sync as mkdirp } from 'mkdirp'; -import { dirname, resolve } from 'path'; -import { Field, Namespace, OneOf, Root, Type, util } from 'protobufjs'; -import staticModule from 'protobufjs-cli/targets/static-module'; +import { dirname } from 'path'; +import { main as pbjs } from '@launchql/protobufjs-cli/pbjs'; // Download .proto file if URL export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => { @@ -33,77 +32,21 @@ export const downloadProtoFile = (protoUrl: string, filePath: string): Promise { - if (namespace instanceof Type) { - const fields = namespace.fieldsArray.map(field => { - const name = field.declaringField ? field.name : field.options?.json_name ?? field.name; - if (name === '__proto__' || (name !== field.name && ( - typeof name !== 'string' || !/^[A-Za-z_$][\w$]*$/.test(name) || util.isReserved(name) || - Object.hasOwn(Object.prototype, name) || name === 'prototype' || name === 'toJSON' - ))) { - throw new Error(`Invalid JSON field name ${JSON.stringify(name)} on ${field.fullName}`); - } - return { field, name }; - }); - if (fields.some(({ field, name }) => field.name !== name)) { - const oneofs = new Map( - namespace.oneofsArray.map(oneof => [oneof, [...oneof.fieldsArray]]) - ); - for (const [oneof, members] of oneofs) { - members.forEach(field => oneof.remove(field)); - } - fields.forEach(({ field }) => namespace.remove(field)); - fields.forEach(({ field, name }) => { - field.name = name; - namespace.add(field); - }); - for (const [oneof, members] of oneofs) { - members.forEach(field => oneof.add(field)); - } - } - } - for (const child of namespace.nestedArray) { - if (child instanceof Namespace) applyJsonFieldNames(child); - } -}; - -export const generateProtoJS = async (inFile: string, outFile: string): Promise => { +// Generate JavaScript from proto file using pbjs +export const generateProtoJS = (inFile: string, outFile: string): Promise => new Promise((resolve, reject) => { fs.accessSync(inFile, fs.constants.R_OK); - const root = new Root(); - const includeDir = dirname(require.resolve('protobufjs/package.json')); - root.resolvePath = (origin, target) => { - const local = util.path.resolve(origin, target); - const normalizedTarget = util.path.normalize(target); - if (!origin || !normalizedTarget.startsWith('google/') || fs.existsSync(local)) return local; + mkdirp(dirname(outFile)); - const bundled = resolve(includeDir, normalizedTarget); - return fs.existsSync(bundled) ? bundled : local; - }; - root.loadSync(inFile, { keepCase: true }); - applyJsonFieldNames(root); - root.resolveAll(); - const output = await new Promise((resolve, reject) => { - staticModule(root, { - beautify: true, - comments: true, - convert: true, - create: true, - decode: true, - delimited: true, - encode: true, - lint: 'eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars', - service: true, - typeurl: true, - verify: true, - }, (error, result) => { - if (error) reject(error); - else resolve(result); - }); + pbjs(['--keep-case', '-t', 'static-module', '-o', outFile, '--', inFile], (error) => { + if (error) { + console.error(`Error during code generation: ${error.message}`); + reject(error); + return; + } + console.log('Generated proto.js from proto file.'); + resolve(); }); - mkdirp(dirname(outFile)); - await fs.promises.writeFile(outFile, output, 'utf8'); - console.log('Generated proto.js from proto file.'); -}; +}); // Replace text in generated JS file export const replaceTextInProtoJS = (filePath: string, originalPackage: string, newPackage: string): Promise => new Promise((resolve, reject) => { diff --git a/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts b/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts deleted file mode 100644 index a38278b3e..000000000 --- a/packages/pgsql-cli/src/commands/proto-fetch/static-module.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare module 'protobufjs-cli/targets/static-module' { - import { Root } from 'protobufjs'; - - export default function staticModule( - root: Root, - options: Record, - callback: (error: Error | null, output?: string) => void - ): void; -} diff --git a/packages/pgsql-cli/src/utils/help.ts b/packages/pgsql-cli/src/utils/help.ts index 3bf197f47..fbe4649df 100644 --- a/packages/pgsql-cli/src/utils/help.ts +++ b/packages/pgsql-cli/src/utils/help.ts @@ -162,7 +162,7 @@ ${chalk.yellow('Options:')} --inFile Where to save the proto file --outFile Generated JS output file --replace-pkg Original package name to replace - --with-pkg New package name (default: protobufjs/minimal) + --with-pkg New package name (default: @launchql/protobufjs/minimal) -h, --help Show help ${chalk.yellow('Examples:')} diff --git a/packages/proto-parser/__tests__/runtime-schema.test.ts b/packages/proto-parser/__tests__/runtime-schema.test.ts index a53ec3759..8cc5a6805 100644 --- a/packages/proto-parser/__tests__/runtime-schema.test.ts +++ b/packages/proto-parser/__tests__/runtime-schema.test.ts @@ -1,5 +1,5 @@ import { readFileSync } from 'fs'; -import { parse } from 'protobufjs'; +import { parse } from '@launchql/protobufjs'; import { ProtoStore } from '../src/store'; import { getFieldName } from '../src/utils'; @@ -8,7 +8,8 @@ import { getStore, getTestProtoPath, parseAndSnap } from '../test-utils'; describe('runtime-schema', () => { it('preserves PG18 JSON names and the JsonAggConstructor fields', () => { const { root } = parse(readFileSync(getTestProtoPath('18-latest.proto'), 'utf8')); - const selectStmt = root.lookupType('pg_query.Node').fields.selectStmt; + const selectStmt = root.lookupType('pg_query.Node').fields.SelectStmt; + expect(selectStmt?.name).toBe('SelectStmt'); expect(getFieldName(selectStmt, selectStmt.name)).toBe('SelectStmt'); const schema = new ProtoStore(root).getRuntimeSchema(); diff --git a/packages/proto-parser/__tests__/utilities.test.ts b/packages/proto-parser/__tests__/utilities.test.ts index ee4521034..775d9adc1 100644 --- a/packages/proto-parser/__tests__/utilities.test.ts +++ b/packages/proto-parser/__tests__/utilities.test.ts @@ -1,4 +1,4 @@ -import { Type } from 'protobufjs'; +import { Type } from '@launchql/protobufjs'; import { ProtoStore } from '../src/store'; import { getDependencies, getDependents, getUndefinedKey } from '../src/utils'; diff --git a/packages/proto-parser/package.json b/packages/proto-parser/package.json index 8345983e5..bc759e2db 100644 --- a/packages/proto-parser/package.json +++ b/packages/proto-parser/package.json @@ -49,7 +49,7 @@ "case": "1.6.3", "deepmerge": "4.3.1", "nested-obj": "^0.2.2", - "protobufjs": "7.6.6", + "@launchql/protobufjs": "7.6.6", "strfy-js": "^3.1.5" }, "devDependencies": { diff --git a/packages/proto-parser/src/ast/enums/enums-json.ts b/packages/proto-parser/src/ast/enums/enums-json.ts index 28884bd18..af1cb0a48 100644 --- a/packages/proto-parser/src/ast/enums/enums-json.ts +++ b/packages/proto-parser/src/ast/enums/enums-json.ts @@ -1,4 +1,4 @@ -import { Enum } from 'protobufjs'; +import { Enum } from '@launchql/protobufjs'; type EnumValueToName = Record>; type EnumNameToValue = Record>; diff --git a/packages/proto-parser/src/ast/enums/enums.ts b/packages/proto-parser/src/ast/enums/enums.ts index 2657b276d..2d3ed5413 100644 --- a/packages/proto-parser/src/ast/enums/enums.ts +++ b/packages/proto-parser/src/ast/enums/enums.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum } from 'protobufjs'; +import { Enum } from '@launchql/protobufjs'; import { createNamedImport } from '../../utils'; diff --git a/packages/proto-parser/src/ast/types/types.ts b/packages/proto-parser/src/ast/types/types.ts index f433e399e..20da5d291 100644 --- a/packages/proto-parser/src/ast/types/types.ts +++ b/packages/proto-parser/src/ast/types/types.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Field,Type } from 'protobufjs'; +import { Field,Type } from '@launchql/protobufjs'; import { NODE_TYPE } from '../../constants'; import { PgProtoParserOptions } from '../../options'; diff --git a/packages/proto-parser/src/parser.ts b/packages/proto-parser/src/parser.ts index 919091b20..dc024e802 100644 --- a/packages/proto-parser/src/parser.ts +++ b/packages/proto-parser/src/parser.ts @@ -1,4 +1,4 @@ -import { parse } from 'protobufjs'; +import { parse } from '@launchql/protobufjs'; import { readFileSync } from 'fs'; import { diff --git a/packages/proto-parser/src/runtime-schema/generator.ts b/packages/proto-parser/src/runtime-schema/generator.ts index c7f71e655..4deb86d56 100644 --- a/packages/proto-parser/src/runtime-schema/generator.ts +++ b/packages/proto-parser/src/runtime-schema/generator.ts @@ -1,6 +1,5 @@ -import { Field, Namespace,Type } from 'protobufjs'; +import { Field, Namespace,Type } from '@launchql/protobufjs'; -import { getFieldName } from '../utils/utils'; import { FieldSpec,NodeSpec } from './types'; export class RuntimeSchemaGenerator { @@ -61,7 +60,7 @@ export class RuntimeSchemaGenerator { } private createFieldSpec(field: Field): FieldSpec | null { - const fieldName = getFieldName(field, field.name); + const fieldName = field.name; const isArray = field.repeated || false; const optional = !field.required; const fieldType = field.type; diff --git a/packages/proto-parser/src/store.ts b/packages/proto-parser/src/store.ts index 3ba5498b1..2d68b245b 100644 --- a/packages/proto-parser/src/store.ts +++ b/packages/proto-parser/src/store.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum, Field, Namespace, ReflectionObject,Service, Type } from 'protobufjs'; +import { Enum, Field, Namespace, ReflectionObject,Service, Type } from '@launchql/protobufjs'; import { mkdirSync } from 'fs'; import { dirname,join } from 'path'; import { jsStringify } from 'strfy-js'; diff --git a/packages/proto-parser/src/utils/deps.ts b/packages/proto-parser/src/utils/deps.ts index bf24ad868..27c180c44 100644 --- a/packages/proto-parser/src/utils/deps.ts +++ b/packages/proto-parser/src/utils/deps.ts @@ -1,4 +1,4 @@ -import { Enum, Field,Type } from 'protobufjs'; +import { Enum, Field,Type } from '@launchql/protobufjs'; import { NODE_TYPE } from '../constants'; import { isPrimitiveType } from './types'; diff --git a/packages/proto-parser/src/utils/utils.ts b/packages/proto-parser/src/utils/utils.ts index 775fe764e..95d895b82 100644 --- a/packages/proto-parser/src/utils/utils.ts +++ b/packages/proto-parser/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { Enum, Field, ReflectionObject } from 'protobufjs'; +import { Enum, Field, ReflectionObject } from '@launchql/protobufjs'; import { writeFileSync } from 'fs'; import { basename,extname } from 'path'; diff --git a/packages/proto-parser/test-utils/index.ts b/packages/proto-parser/test-utils/index.ts index 9183ae005..e68a9b59d 100644 --- a/packages/proto-parser/test-utils/index.ts +++ b/packages/proto-parser/test-utils/index.ts @@ -6,7 +6,7 @@ import { sync as glob } from 'glob' import { getOptionsWithDefaults, PgProtoParserOptions } from '../src/options'; import { prettyPrint } from 'recast'; import { ProtoStore } from '../src/store'; -import { parse } from 'protobufjs'; +import { parse } from '@launchql/protobufjs'; export const printAst = (ast: any) => { const results = generate(ast); diff --git a/pnpm-policy.yaml b/pnpm-policy.yaml index a71cdd358..4cf79663e 100644 --- a/pnpm-policy.yaml +++ b/pnpm-policy.yaml @@ -35,6 +35,7 @@ intersect: true allowBuilds: nx: "Nx CLI native postinstall step (downloads/links its native project-graph daemon binary)." unrs-resolver: "unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install." + "@launchql/protobufjs": "protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile)." # Third-party escape hatches. A reason is required; `until` expires the waiver so # `check` makes you re-justify it instead of letting it live forever. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8ac13ec05..411e65d97 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -34,5 +34,6 @@ blockExoticSubdeps: true # The only dependencies permitted to run install scripts. allowBuilds: + "@launchql/protobufjs": true # protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile). nx: true # Nx CLI native postinstall step (downloads/links its native project-graph daemon binary). unrs-resolver: true # unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install. From 9ed72b5a10abe6e70bdab9891186ce61b12c29b4 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 22:09:58 +0000 Subject: [PATCH 09/10] Temporarily test the rebased LaunchQL protobuf tarballs --- package.json | 5 ++ packages/pgsql-cli/package.json | 4 +- packages/proto-parser/package.json | 2 +- pnpm-lock.yaml | 107 ++++++++++++++--------------- 4 files changed, 61 insertions(+), 57 deletions(-) diff --git a/package.json b/package.json index 0bd59de97..c17f7a4cd 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,11 @@ "policy": "pnpm-policy generate", "policy:check": "pnpm-policy check" }, + "pnpm": { + "overrides": { + "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf" + } + }, "devDependencies": { "@constructive-io/eslint-config": "^0.2.0", "@constructive-io/pnpm-policy": "0.2.1", diff --git a/packages/pgsql-cli/package.json b/packages/pgsql-cli/package.json index 4704c0b52..d43bc07f7 100644 --- a/packages/pgsql-cli/package.json +++ b/packages/pgsql-cli/package.json @@ -53,8 +53,8 @@ "pg-proto-parser": "workspace:*", "pgsql-deparser": "workspace:*", "pgsql-parser": "workspace:*", - "@launchql/protobufjs": "7.6.6", - "@launchql/protobufjs-cli": "1.3.3" + "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf", + "@launchql/protobufjs-cli": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf&path:/cli" }, "devDependencies": { "@types/minimist": "^1.2.5", diff --git a/packages/proto-parser/package.json b/packages/proto-parser/package.json index bc759e2db..7fbf047d8 100644 --- a/packages/proto-parser/package.json +++ b/packages/proto-parser/package.json @@ -49,7 +49,7 @@ "case": "1.6.3", "deepmerge": "4.3.1", "nested-obj": "^0.2.2", - "@launchql/protobufjs": "7.6.6", + "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf", "strfy-js": "^3.1.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ccd14614c..1563736c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,9 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + '@launchql/protobufjs': github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + importers: .: devDependencies: @@ -162,6 +165,12 @@ importers: packages/pgsql-cli: dependencies: + "@launchql/protobufjs": + specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + "@launchql/protobufjs-cli": + specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf&path:/cli + version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli(@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf) chalk: specifier: ^4.1.0 version: 4.1.2 @@ -186,12 +195,6 @@ importers: pgsql-parser: specifier: workspace:* version: link:../parser/dist - protobufjs: - specifier: 7.6.6 - version: 7.6.6 - protobufjs-cli: - specifier: 1.3.3 - version: 1.3.3(protobufjs@7.6.6) devDependencies: "@types/minimist": specifier: ^1.2.5 @@ -297,6 +300,9 @@ importers: "@babel/types": specifier: 7.28.5 version: 7.28.5 + "@launchql/protobufjs": + specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf case: specifier: 1.6.3 version: 1.6.3 @@ -306,9 +312,6 @@ importers: nested-obj: specifier: ^0.2.2 version: 0.2.2 - protobufjs: - specifier: 7.6.6 - version: 7.6.6 strfy-js: specifier: ^3.1.5 version: 3.1.5 @@ -1320,6 +1323,19 @@ packages: } engines: { node: ">=v12.0.0" } + '@launchql/protobufjs-cli@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli': + resolution: {path: /cli, tarball: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf} + version: 1.3.3 + engines: {node: '>=12.0.0'} + hasBin: true + peerDependencies: + '@launchql/protobufjs': github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + + '@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf': + resolution: {tarball: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf} + version: 7.6.6 + engines: {node: '>=12.0.0'} + "@napi-rs/wasm-runtime@0.2.12": resolution: { @@ -5491,23 +5507,6 @@ packages: } engines: { node: ^18.17.0 || >=20.5.0 } - protobufjs-cli@1.3.3: - resolution: - { - integrity: sha512-zwmt6JeStPjeofZbl+QADexAVzP1EgsIAsO7mCfKkW/8oBxHwgTqJ1aD7zDrcCC0Nb+SLWSvCR3RDaKgIO3P8w==, - } - engines: { node: ">=12.0.0" } - hasBin: true - peerDependencies: - protobufjs: ^7.6.2 - - protobufjs@7.6.6: - resolution: - { - integrity: sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==, - } - engines: { node: ">=12.0.0" } - protocols@2.0.2: resolution: { @@ -7200,6 +7199,34 @@ snapshots: dependencies: lodash: 4.17.21 + '@launchql/protobufjs-cli@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli(@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf)': + dependencies: + '@launchql/protobufjs': https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + chalk: 4.1.2 + escodegen: 1.14.3 + espree: 9.6.1 + estraverse: 5.3.0 + glob: 8.0.3 + jsdoc: 4.0.5 + minimist: 1.2.8 + semver: 7.8.5 + tmp: 0.2.7 + uglify-js: 3.19.3 + + '@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf': + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.5 + '@protobufjs/eventemitter': 1.1.1 + '@protobufjs/fetch': 1.1.1 + '@protobufjs/float': 1.0.2 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.2 + '@types/node': 20.19.25 + long: 5.3.2 + "@napi-rs/wasm-runtime@0.2.12": dependencies: "@emnapi/core": 1.7.1 @@ -10133,34 +10160,6 @@ snapshots: dependencies: read: 4.1.0 - protobufjs-cli@1.3.3(protobufjs@7.6.6): - dependencies: - chalk: 4.1.2 - escodegen: 1.14.3 - espree: 9.6.1 - estraverse: 5.3.0 - glob: 8.0.3 - jsdoc: 4.0.5 - minimist: 1.2.8 - protobufjs: 7.6.6 - semver: 7.8.5 - tmp: 0.2.7 - uglify-js: 3.19.3 - - protobufjs@7.6.6: - dependencies: - "@protobufjs/aspromise": 1.1.2 - "@protobufjs/base64": 1.1.2 - "@protobufjs/codegen": 2.0.5 - "@protobufjs/eventemitter": 1.1.1 - "@protobufjs/fetch": 1.1.1 - "@protobufjs/float": 1.0.2 - "@protobufjs/path": 1.1.2 - "@protobufjs/pool": 1.1.0 - "@protobufjs/utf8": 1.1.2 - "@types/node": 20.19.25 - long: 5.3.2 - protocols@2.0.2: {} proxy-from-env@2.1.0: {} From b55144bb1137098b99faaed001586e4311f4386c Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 25 Nov 2026 22:49:53 +0000 Subject: [PATCH 10/10] Use published Constructive protobuf packages --- package.json | 5 - packages/pgsql-cli/README.md | 2 +- packages/pgsql-cli/__tests__/cli.test.ts | 6 +- packages/pgsql-cli/package.json | 4 +- .../pgsql-cli/src/commands/proto-fetch.ts | 2 +- .../src/commands/proto-fetch/helpers.ts | 2 +- packages/pgsql-cli/src/utils/help.ts | 2 +- .../__tests__/runtime-schema.test.ts | 2 +- .../proto-parser/__tests__/utilities.test.ts | 2 +- packages/proto-parser/package.json | 2 +- .../proto-parser/src/ast/enums/enums-json.ts | 2 +- packages/proto-parser/src/ast/enums/enums.ts | 2 +- packages/proto-parser/src/ast/types/types.ts | 2 +- packages/proto-parser/src/parser.ts | 2 +- .../src/runtime-schema/generator.ts | 2 +- packages/proto-parser/src/store.ts | 2 +- packages/proto-parser/src/utils/deps.ts | 2 +- packages/proto-parser/src/utils/utils.ts | 2 +- packages/proto-parser/test-utils/index.ts | 2 +- pnpm-lock.yaml | 101 +++++++++--------- pnpm-policy.yaml | 2 +- pnpm-workspace.yaml | 2 +- 22 files changed, 71 insertions(+), 81 deletions(-) diff --git a/package.json b/package.json index c17f7a4cd..0bd59de97 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,6 @@ "policy": "pnpm-policy generate", "policy:check": "pnpm-policy check" }, - "pnpm": { - "overrides": { - "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf" - } - }, "devDependencies": { "@constructive-io/eslint-config": "^0.2.0", "@constructive-io/pnpm-policy": "0.2.1", diff --git a/packages/pgsql-cli/README.md b/packages/pgsql-cli/README.md index 9f186826f..3a47c699d 100644 --- a/packages/pgsql-cli/README.md +++ b/packages/pgsql-cli/README.md @@ -166,7 +166,7 @@ pgsql proto-fetch [options] | `--inFile` | Where to save the proto file | *Required* | | `--outFile` | Generated JS output file | *Required* | | `--replace-pkg` | Original package name to replace | `protobufjs/minimal` | -| `--with-pkg` | New package name | `@launchql/protobufjs/minimal` | +| `--with-pkg` | New package name | `@constructive-io/protobufjs/minimal` | | `-h, --help` | Show help | | #### Examples diff --git a/packages/pgsql-cli/__tests__/cli.test.ts b/packages/pgsql-cli/__tests__/cli.test.ts index 3229f7902..4041e6245 100644 --- a/packages/pgsql-cli/__tests__/cli.test.ts +++ b/packages/pgsql-cli/__tests__/cli.test.ts @@ -115,7 +115,7 @@ describe('pgsql proto-fetch', () => { `); await generateProtoJS(inFile, outFile); - await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('@launchql/protobufjs/minimal')); + await replaceTextInProtoJS(outFile, 'protobufjs/minimal', require.resolve('@constructive-io/protobufjs/minimal')); const { Example } = require(outFile).demo; const value = { '.demo.extra': 'extension' }; @@ -136,7 +136,7 @@ describe('pgsql proto-fetch', () => { }); it.each([ - [undefined, '@launchql/protobufjs/minimal'], + [undefined, '@constructive-io/protobufjs/minimal'], ['@custom/protobufjs', '@custom/protobufjs'], ])('generates a module with the requested runtime (%s)', async (withPkg, runtime) => { const inFile = join(dir, 'test input.proto'); @@ -151,7 +151,7 @@ describe('pgsql proto-fetch', () => { it('round-trips a PostgreSQL AST using its JSON field names', async () => { const inFile = resolve(__dirname, '../../../__fixtures__/proto/18-latest.proto'); const outFile = join(dir, 'pg-query.js'); - await protoFetchCommand({ inFile, outFile, 'with-pkg': require.resolve('@launchql/protobufjs/minimal') }); + await protoFetchCommand({ inFile, outFile, 'with-pkg': require.resolve('@constructive-io/protobufjs/minimal') }); const { ParseResult } = require(outFile).pg_query; await loadModule(); diff --git a/packages/pgsql-cli/package.json b/packages/pgsql-cli/package.json index d43bc07f7..35bc07c5c 100644 --- a/packages/pgsql-cli/package.json +++ b/packages/pgsql-cli/package.json @@ -53,8 +53,8 @@ "pg-proto-parser": "workspace:*", "pgsql-deparser": "workspace:*", "pgsql-parser": "workspace:*", - "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf", - "@launchql/protobufjs-cli": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf&path:/cli" + "@constructive-io/protobufjs": "7.6.6", + "@constructive-io/protobufjs-cli": "1.3.3" }, "devDependencies": { "@types/minimist": "^1.2.5", diff --git a/packages/pgsql-cli/src/commands/proto-fetch.ts b/packages/pgsql-cli/src/commands/proto-fetch.ts index a03651d97..ff9628945 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch.ts @@ -13,7 +13,7 @@ export async function protoFetchCommand(argv: any) { const inFile = argv.inFile; const outFile = argv.outFile; const replacePkg = argv['replace-pkg'] || 'protobufjs/minimal'; - const withPkg = argv['with-pkg'] || '@launchql/protobufjs/minimal'; + const withPkg = argv['with-pkg'] || '@constructive-io/protobufjs/minimal'; if (!inFile || !outFile) { console.error(chalk.red('Error: --inFile and --outFile are required')); diff --git a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts index 159fabf56..c4268a91d 100644 --- a/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts +++ b/packages/pgsql-cli/src/commands/proto-fetch/helpers.ts @@ -2,7 +2,7 @@ import fs from 'fs'; import https from 'https'; import { sync as mkdirp } from 'mkdirp'; import { dirname } from 'path'; -import { main as pbjs } from '@launchql/protobufjs-cli/pbjs'; +import { main as pbjs } from '@constructive-io/protobufjs-cli/pbjs'; // Download .proto file if URL export const downloadProtoFile = (protoUrl: string, filePath: string): Promise => { diff --git a/packages/pgsql-cli/src/utils/help.ts b/packages/pgsql-cli/src/utils/help.ts index fbe4649df..c64ea0a22 100644 --- a/packages/pgsql-cli/src/utils/help.ts +++ b/packages/pgsql-cli/src/utils/help.ts @@ -162,7 +162,7 @@ ${chalk.yellow('Options:')} --inFile Where to save the proto file --outFile Generated JS output file --replace-pkg Original package name to replace - --with-pkg New package name (default: @launchql/protobufjs/minimal) + --with-pkg New package name (default: @constructive-io/protobufjs/minimal) -h, --help Show help ${chalk.yellow('Examples:')} diff --git a/packages/proto-parser/__tests__/runtime-schema.test.ts b/packages/proto-parser/__tests__/runtime-schema.test.ts index 8cc5a6805..a8076b304 100644 --- a/packages/proto-parser/__tests__/runtime-schema.test.ts +++ b/packages/proto-parser/__tests__/runtime-schema.test.ts @@ -1,5 +1,5 @@ import { readFileSync } from 'fs'; -import { parse } from '@launchql/protobufjs'; +import { parse } from '@constructive-io/protobufjs'; import { ProtoStore } from '../src/store'; import { getFieldName } from '../src/utils'; diff --git a/packages/proto-parser/__tests__/utilities.test.ts b/packages/proto-parser/__tests__/utilities.test.ts index 775d9adc1..66dcdffe1 100644 --- a/packages/proto-parser/__tests__/utilities.test.ts +++ b/packages/proto-parser/__tests__/utilities.test.ts @@ -1,4 +1,4 @@ -import { Type } from '@launchql/protobufjs'; +import { Type } from '@constructive-io/protobufjs'; import { ProtoStore } from '../src/store'; import { getDependencies, getDependents, getUndefinedKey } from '../src/utils'; diff --git a/packages/proto-parser/package.json b/packages/proto-parser/package.json index 7fbf047d8..e2437aab1 100644 --- a/packages/proto-parser/package.json +++ b/packages/proto-parser/package.json @@ -49,7 +49,7 @@ "case": "1.6.3", "deepmerge": "4.3.1", "nested-obj": "^0.2.2", - "@launchql/protobufjs": "github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf", + "@constructive-io/protobufjs": "7.6.6", "strfy-js": "^3.1.5" }, "devDependencies": { diff --git a/packages/proto-parser/src/ast/enums/enums-json.ts b/packages/proto-parser/src/ast/enums/enums-json.ts index af1cb0a48..4306f6ae5 100644 --- a/packages/proto-parser/src/ast/enums/enums-json.ts +++ b/packages/proto-parser/src/ast/enums/enums-json.ts @@ -1,4 +1,4 @@ -import { Enum } from '@launchql/protobufjs'; +import { Enum } from '@constructive-io/protobufjs'; type EnumValueToName = Record>; type EnumNameToValue = Record>; diff --git a/packages/proto-parser/src/ast/enums/enums.ts b/packages/proto-parser/src/ast/enums/enums.ts index 2d3ed5413..fba30a0ea 100644 --- a/packages/proto-parser/src/ast/enums/enums.ts +++ b/packages/proto-parser/src/ast/enums/enums.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum } from '@launchql/protobufjs'; +import { Enum } from '@constructive-io/protobufjs'; import { createNamedImport } from '../../utils'; diff --git a/packages/proto-parser/src/ast/types/types.ts b/packages/proto-parser/src/ast/types/types.ts index 20da5d291..87e0ad1af 100644 --- a/packages/proto-parser/src/ast/types/types.ts +++ b/packages/proto-parser/src/ast/types/types.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Field,Type } from '@launchql/protobufjs'; +import { Field,Type } from '@constructive-io/protobufjs'; import { NODE_TYPE } from '../../constants'; import { PgProtoParserOptions } from '../../options'; diff --git a/packages/proto-parser/src/parser.ts b/packages/proto-parser/src/parser.ts index dc024e802..cf76e949c 100644 --- a/packages/proto-parser/src/parser.ts +++ b/packages/proto-parser/src/parser.ts @@ -1,4 +1,4 @@ -import { parse } from '@launchql/protobufjs'; +import { parse } from '@constructive-io/protobufjs'; import { readFileSync } from 'fs'; import { diff --git a/packages/proto-parser/src/runtime-schema/generator.ts b/packages/proto-parser/src/runtime-schema/generator.ts index 4deb86d56..9a0efd214 100644 --- a/packages/proto-parser/src/runtime-schema/generator.ts +++ b/packages/proto-parser/src/runtime-schema/generator.ts @@ -1,4 +1,4 @@ -import { Field, Namespace,Type } from '@launchql/protobufjs'; +import { Field, Namespace,Type } from '@constructive-io/protobufjs'; import { FieldSpec,NodeSpec } from './types'; diff --git a/packages/proto-parser/src/store.ts b/packages/proto-parser/src/store.ts index 2d68b245b..b9badec25 100644 --- a/packages/proto-parser/src/store.ts +++ b/packages/proto-parser/src/store.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { Enum, Field, Namespace, ReflectionObject,Service, Type } from '@launchql/protobufjs'; +import { Enum, Field, Namespace, ReflectionObject,Service, Type } from '@constructive-io/protobufjs'; import { mkdirSync } from 'fs'; import { dirname,join } from 'path'; import { jsStringify } from 'strfy-js'; diff --git a/packages/proto-parser/src/utils/deps.ts b/packages/proto-parser/src/utils/deps.ts index 27c180c44..7a7122217 100644 --- a/packages/proto-parser/src/utils/deps.ts +++ b/packages/proto-parser/src/utils/deps.ts @@ -1,4 +1,4 @@ -import { Enum, Field,Type } from '@launchql/protobufjs'; +import { Enum, Field,Type } from '@constructive-io/protobufjs'; import { NODE_TYPE } from '../constants'; import { isPrimitiveType } from './types'; diff --git a/packages/proto-parser/src/utils/utils.ts b/packages/proto-parser/src/utils/utils.ts index 95d895b82..e623c8f92 100644 --- a/packages/proto-parser/src/utils/utils.ts +++ b/packages/proto-parser/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { Enum, Field, ReflectionObject } from '@launchql/protobufjs'; +import { Enum, Field, ReflectionObject } from '@constructive-io/protobufjs'; import { writeFileSync } from 'fs'; import { basename,extname } from 'path'; diff --git a/packages/proto-parser/test-utils/index.ts b/packages/proto-parser/test-utils/index.ts index e68a9b59d..1bf317aaf 100644 --- a/packages/proto-parser/test-utils/index.ts +++ b/packages/proto-parser/test-utils/index.ts @@ -6,7 +6,7 @@ import { sync as glob } from 'glob' import { getOptionsWithDefaults, PgProtoParserOptions } from '../src/options'; import { prettyPrint } from 'recast'; import { ProtoStore } from '../src/store'; -import { parse } from '@launchql/protobufjs'; +import { parse } from '@constructive-io/protobufjs'; export const printAst = (ast: any) => { const results = generate(ast); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1563736c3..20561408c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,9 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - '@launchql/protobufjs': github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - importers: .: devDependencies: @@ -165,12 +162,12 @@ importers: packages/pgsql-cli: dependencies: - "@launchql/protobufjs": - specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - "@launchql/protobufjs-cli": - specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf&path:/cli - version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli(@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf) + "@constructive-io/protobufjs": + specifier: 7.6.6 + version: 7.6.6 + "@constructive-io/protobufjs-cli": + specifier: 1.3.3 + version: 1.3.3(@constructive-io/protobufjs@7.6.6) chalk: specifier: ^4.1.0 version: 4.1.2 @@ -300,9 +297,9 @@ importers: "@babel/types": specifier: 7.28.5 version: 7.28.5 - "@launchql/protobufjs": - specifier: github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - version: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf + "@constructive-io/protobufjs": + specifier: 7.6.6 + version: 7.6.6 case: specifier: 1.6.3 version: 1.6.3 @@ -732,6 +729,17 @@ packages: integrity: sha512-tAgH3Zgwn2shQXGlfl5zxmtY/tyZw9jYX7QAOFMp5ALKSrxO5xsxZQmckwMqOeHyyV/MZJWzIZ4t/QYznJeVmw==, } + '@constructive-io/protobufjs-cli@1.3.3': + resolution: {integrity: sha512-gtOe1DLNpJW8xSUD17efDjmEufq54SfCCgCP1fNA3aee+Kg5MyHyqqTUkC+RL+zeJbiNNikIWH03YTrFeMtdhQ==} + engines: {node: '>=12.0.0'} + hasBin: true + peerDependencies: + '@constructive-io/protobufjs': ^7.6.6 + + '@constructive-io/protobufjs@7.6.6': + resolution: {integrity: sha512-BYh1700OIXGuH7MejcywOioKifQ1gzY2J99j3QqfWWk42nscKptlpZigfVL5NbwWTDHmlMpDbVZdE+O68L9FQA==} + engines: {node: '>=12.0.0'} + "@conventional-changelog/git-client@3.1.0": resolution: { @@ -1323,19 +1331,6 @@ packages: } engines: { node: ">=v12.0.0" } - '@launchql/protobufjs-cli@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli': - resolution: {path: /cli, tarball: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf} - version: 1.3.3 - engines: {node: '>=12.0.0'} - hasBin: true - peerDependencies: - '@launchql/protobufjs': github:constructive-io/protobuf.js#b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - - '@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf': - resolution: {tarball: https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf} - version: 7.6.6 - engines: {node: '>=12.0.0'} - "@napi-rs/wasm-runtime@0.2.12": resolution: { @@ -6729,6 +6724,34 @@ snapshots: "@constructive-io/pnpm-policy@0.2.1": {} + '@constructive-io/protobufjs-cli@1.3.3(@constructive-io/protobufjs@7.6.6)': + dependencies: + '@constructive-io/protobufjs': 7.6.6 + chalk: 4.1.2 + escodegen: 1.14.3 + espree: 9.6.1 + estraverse: 5.3.0 + glob: 8.0.3 + jsdoc: 4.0.5 + minimist: 1.2.8 + semver: 7.8.5 + tmp: 0.2.7 + uglify-js: 3.19.3 + + '@constructive-io/protobufjs@7.6.6': + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.5 + '@protobufjs/eventemitter': 1.1.1 + '@protobufjs/fetch': 1.1.1 + '@protobufjs/float': 1.0.2 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.2 + '@types/node': 20.19.25 + long: 5.3.2 + "@conventional-changelog/git-client@3.1.0(conventional-commits-filter@6.0.1)(conventional-commits-parser@7.1.0)": dependencies: "@simple-libs/child-process-utils": 2.0.0 @@ -7199,34 +7222,6 @@ snapshots: dependencies: lodash: 4.17.21 - '@launchql/protobufjs-cli@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf#path:/cli(@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf)': - dependencies: - '@launchql/protobufjs': https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf - chalk: 4.1.2 - escodegen: 1.14.3 - espree: 9.6.1 - estraverse: 5.3.0 - glob: 8.0.3 - jsdoc: 4.0.5 - minimist: 1.2.8 - semver: 7.8.5 - tmp: 0.2.7 - uglify-js: 3.19.3 - - '@launchql/protobufjs@https://codeload.github.com/constructive-io/protobuf.js/tar.gz/b55d8b595a8dbc3de872d0bcc511e19aaa7688bf': - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/base64': 1.1.2 - '@protobufjs/codegen': 2.0.5 - '@protobufjs/eventemitter': 1.1.1 - '@protobufjs/fetch': 1.1.1 - '@protobufjs/float': 1.0.2 - '@protobufjs/path': 1.1.2 - '@protobufjs/pool': 1.1.0 - '@protobufjs/utf8': 1.1.2 - '@types/node': 20.19.25 - long: 5.3.2 - "@napi-rs/wasm-runtime@0.2.12": dependencies: "@emnapi/core": 1.7.1 diff --git a/pnpm-policy.yaml b/pnpm-policy.yaml index 4cf79663e..0c269fe63 100644 --- a/pnpm-policy.yaml +++ b/pnpm-policy.yaml @@ -35,7 +35,7 @@ intersect: true allowBuilds: nx: "Nx CLI native postinstall step (downloads/links its native project-graph daemon binary)." unrs-resolver: "unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install." - "@launchql/protobufjs": "protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile)." + "@constructive-io/protobufjs": "protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile)." # Third-party escape hatches. A reason is required; `until` expires the waiver so # `check` makes you re-justify it instead of letting it live forever. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 411e65d97..a9f4e0a55 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -34,6 +34,6 @@ blockExoticSubdeps: true # The only dependencies permitted to run install scripts. allowBuilds: - "@launchql/protobufjs": true # protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile). + "@constructive-io/protobufjs": true # protobufjs postinstall script (environment/feature detection for the protobuf.js runtime, no native compile). nx: true # Nx CLI native postinstall step (downloads/links its native project-graph daemon binary). unrs-resolver: true # unrs-resolver ships a native (Rust/N-API) module resolver binary that must be built/linked on install.