From 9ac1cf26eebeed081ead7efe9f3863e904758ce0 Mon Sep 17 00:00:00 2001 From: Andrew Ray Date: Sat, 7 Mar 2026 13:27:42 -0800 Subject: [PATCH 1/2] Fixing type export --- package.json | 2 +- prepublish.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index df8c4dc..8d229ea 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=16" }, - "version": "7.0.0", + "version": "7.0.1", "type": "module", "description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments", "scripts": { diff --git a/prepublish.sh b/prepublish.sh index 9f8cfa9..ccb2df2 100755 --- a/prepublish.sh +++ b/prepublish.sh @@ -10,7 +10,9 @@ cp -r dist/src/* . # Copy peggy-generated parsers to their directories (build.sh places these in # dist/parser/ and dist/preprocessor/, separate from the compiled TypeScript in dist/src/) cp dist/parser/parser.js parser/ +cp dist/parser/parser.d.ts parser/ cp dist/preprocessor/preprocessor-parser.js preprocessor/ +cp dist/preprocessor/preprocessor-parser.d.ts preprocessor/ # Remove test files from the published directories - they're not part of the package # and if present they confuse Vitest into running compiled JS tests with broken module paths From 946ef9780f8eb60d0f5d62acf391b3531f8367ff Mon Sep 17 00:00:00 2001 From: Andrew Ray Date: Sat, 7 Mar 2026 13:31:49 -0800 Subject: [PATCH 2/2] Adding test publish step --- package.json | 3 ++- test-publish.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 test-publish.sh diff --git a/package.json b/package.json index 8d229ea..220ea72 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "postpublish": "./postbuild.sh", "build": "./build.sh", "watch-test": "vitest --watch", - "test": "vitest" + "test": "vitest", + "test-publish": "./test-publish.sh" }, "files": [ "ast", diff --git a/test-publish.sh b/test-publish.sh new file mode 100755 index 0000000..c2959f3 --- /dev/null +++ b/test-publish.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -e + +# Test that the published package contains all required type declaration files. +# Run this before publishing to catch missing .d.ts files. + +PACK_OUTPUT=$(npm pack --dry-run 2>&1) + +REQUIRED_FILES=( + "parser/parser.d.ts" + "preprocessor/preprocessor-parser.d.ts" + "index.d.ts" + "parser/index.d.ts" + "preprocessor/index.d.ts" + "ast/index.d.ts" +) + +FAILED=0 +for FILE in "${REQUIRED_FILES[@]}"; do + if echo "$PACK_OUTPUT" | grep -q "$FILE"; then + echo " ok $FILE" + else + echo "MISSING $FILE" + FAILED=1 + fi +done + +if [ $FAILED -ne 0 ]; then + echo "" + echo "Publish type check FAILED — missing .d.ts files in package" + exit 1 +else + echo "" + echo "Publish type check passed" +fi