From d8283326589fbb158d09c566ebc63bca9f7dd250 Mon Sep 17 00:00:00 2001 From: Taksh Date: Wed, 2 Dec 2026 08:54:13 +0530 Subject: [PATCH] Strip the sourceMappingURL left behind after angular-table deletes its maps. --- packages/angular-table/package.json | 2 +- .../scripts/strip-source-map-comments.mjs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/angular-table/scripts/strip-source-map-comments.mjs diff --git a/packages/angular-table/package.json b/packages/angular-table/package.json index 43d7d9ee3e..5e04739693 100644 --- a/packages/angular-table/package.json +++ b/packages/angular-table/package.json @@ -54,7 +54,7 @@ "skills" ], "scripts": { - "build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./dist/package.json && find dist -name '*.map' -delete", + "build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./dist/package.json && find dist -name '*.map' -delete && node scripts/strip-source-map-comments.mjs dist", "build:types": "tsc --emitDeclarationOnly", "bench:flex-render": "vitest bench --run tests/flex-render/flex-render.bench.ts", "clean": "rimraf ./build && rimraf ./dist", diff --git a/packages/angular-table/scripts/strip-source-map-comments.mjs b/packages/angular-table/scripts/strip-source-map-comments.mjs new file mode 100644 index 0000000000..8ef383080a --- /dev/null +++ b/packages/angular-table/scripts/strip-source-map-comments.mjs @@ -0,0 +1,21 @@ +import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' + +const root = process.argv[2] ?? 'dist' +const comment = /\r?\n\/\/# sourceMappingURL=.*\n?$/ + +function walk(dir) { + for (const name of readdirSync(dir)) { + const path = join(dir, name) + if (statSync(path).isDirectory()) { + walk(path) + continue + } + if (!name.endsWith('.mjs')) continue + const text = readFileSync(path, 'utf8') + const next = text.replace(comment, '\n') + if (next !== text) writeFileSync(path, next) + } +} + +walk(root)