Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions packages/dev/scripts/polkadot-dev-build-ts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,7 @@ async function compileJs (compileType, type) {
// split src prefix, replace .ts extension with .js
const outFile = path.join(buildDir, filename.split(/[\\/]/).slice(1).join('/').replace(/\.tsx?$/, '.js'));

// Until we hit the es2022 target, all private fields are compiled to using
// WeakMap with less than stellar performannce of get/set on the polyfill. We
// replace usages of these with TS-only private fields.
//
// As used these are internal-only, completely hidden fields should be done via
// closures, see e.g. the common keypairs where this is done
const source = fs
.readFileSync(filename, 'utf-8')
.replace(/(this|other|source)\.#/g, '$1.__internal__')
.replace(/ {2}(async|readonly) #/g, ' private $1 __internal__')
.replace(/ {2}#/g, ' private __internal__');
const source = fs.readFileSync(filename, 'utf-8');

// compile with the options aligning with our tsconfig
const { outputText } = ts.transpileModule(source, {
Expand Down