From 82b3165b31ad21939f442cf7fb34477e9cb96ed0 Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Fri, 4 Sep 2026 13:02:40 +0200 Subject: [PATCH 1/2] use two step build to stripe comments --- packages/comark-angular/package.json | 2 +- packages/comark-ansi/package.json | 4 ++-- packages/comark-html/package.json | 4 ++-- packages/comark-nuxt/package.json | 4 ++-- packages/comark-react/package.json | 4 ++-- packages/comark-svelte/package.json | 2 +- packages/comark-svelte/tsconfig.build.json | 18 ++++++++++++++++++ packages/comark-vue/package.json | 4 ++-- packages/comark/package.json | 4 ++-- 9 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 packages/comark-svelte/tsconfig.build.json diff --git a/packages/comark-angular/package.json b/packages/comark-angular/package.json index 38ffa8e4..07b6866f 100644 --- a/packages/comark-angular/package.json +++ b/packages/comark-angular/package.json @@ -38,7 +38,7 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "ngc -p tsconfig.json && node scripts/verify-build.mjs", + "build": "ngc -p tsconfig.json && ngc -p tsconfig.json --removeComments true --declaration false && node scripts/verify-build.mjs", "dev": "ngc -p tsconfig.json --watch", "test": "vitest run", "prepack": "pnpm run build", diff --git a/packages/comark-ansi/package.json b/packages/comark-ansi/package.json index 3331673f..72d118a8 100644 --- a/packages/comark-ansi/package.json +++ b/packages/comark-ansi/package.json @@ -41,10 +41,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it" }, "dependencies": { diff --git a/packages/comark-html/package.json b/packages/comark-html/package.json index 150f85c3..86f29fd9 100644 --- a/packages/comark-html/package.json +++ b/packages/comark-html/package.json @@ -40,10 +40,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it" }, "dependencies": { diff --git a/packages/comark-nuxt/package.json b/packages/comark-nuxt/package.json index aa0712e9..1a3f0d89 100644 --- a/packages/comark-nuxt/package.json +++ b/packages/comark-nuxt/package.json @@ -42,10 +42,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run --passWithNoTests", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it" }, "dependencies": { diff --git a/packages/comark-react/package.json b/packages/comark-react/package.json index b6fb2923..59300519 100644 --- a/packages/comark-react/package.json +++ b/packages/comark-react/package.json @@ -43,10 +43,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it" }, "dependencies": { diff --git a/packages/comark-svelte/package.json b/packages/comark-svelte/package.json index a95c3082..ab8cc572 100644 --- a/packages/comark-svelte/package.json +++ b/packages/comark-svelte/package.json @@ -57,7 +57,7 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "svelte-package --input src && node ../../scripts/sync-plugins.mjs", + "build": "svelte-package --input src && svelte-package --input src --types false --preserve-output --tsconfig ./tsconfig.build.json && node ../../scripts/sync-plugins.mjs", "build:watch": "svelte-package --input src --watch", "test": "vitest run", "check": "svelte-check --tsconfig ./tsconfig.json", diff --git a/packages/comark-svelte/tsconfig.build.json b/packages/comark-svelte/tsconfig.build.json new file mode 100644 index 00000000..ce381dc5 --- /dev/null +++ b/packages/comark-svelte/tsconfig.build.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es2024", + "lib": ["esnext", "DOM", "DOM.Iterable"], + "module": "esnext", + "moduleResolution": "bundler", + "strict": true, + "strictNullChecks": true, + "esModuleInterop": true, + "skipDefaultLibCheck": true, + "allowImportingTsExtensions": true, + "skipLibCheck": true, + "noEmit": true, + "removeComments": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/comark-vue/package.json b/packages/comark-vue/package.json index 9296decf..01a62294 100644 --- a/packages/comark-vue/package.json +++ b/packages/comark-vue/package.json @@ -42,10 +42,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it" }, "dependencies": { diff --git a/packages/comark/package.json b/packages/comark/package.json index 00c583bd..e910aba9 100644 --- a/packages/comark/package.json +++ b/packages/comark/package.json @@ -51,10 +51,10 @@ }, "scripts": { "stub": "node ../../scripts/stub.mjs", - "build": "tsc", + "build": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "dev": "tsc --watch", "test": "vitest run", - "prepack": "tsc", + "prepack": "tsc --removeComments --declaration false && tsc --emitDeclarationOnly", "release": "release-it", "release:dry": "release-it --dry-run" }, From 5e3c7fc6799590ac9fd76b70d7b3e8a81be07726 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 11:10:05 +0000 Subject: [PATCH 2/2] test: update bundle size snapshot --- test/bundle.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/bundle.test.ts b/test/bundle.test.ts index bfab5ded..c0dc230e 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -60,14 +60,14 @@ describe('package bundle size', { timeout: 60_000 }, () => { expect(report).toMatchInlineSnapshot(` { - "@comark/angular": "60.6k (70 files)", - "@comark/ansi": "42.0k (98 files)", - "@comark/html": "18.9k (58 files)", + "@comark/angular": "54.0k (70 files)", + "@comark/ansi": "36.6k (98 files)", + "@comark/html": "15.7k (58 files)", "@comark/nuxt": "11.8k (58 files)", - "@comark/react": "43.6k (74 files)", + "@comark/react": "36.9k (74 files)", "@comark/svelte": "43.9k (82 files)", - "@comark/vue": "60.5k (78 files)", - "comark": "440k (156 files)", + "@comark/vue": "51.7k (78 files)", + "comark": "363k (156 files)", } `) })