Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove support for down-leveling of TypeScript declarations files to ts3.9 to improve performance #1474

Merged
merged 10 commits into from
Nov 13, 2024
4 changes: 0 additions & 4 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ project.addDeps(
'@jsii/spec',
'case',
'chalk@^4',
'downlevel-dts',
'fast-deep-equal',
'log4js',
'semver',
Expand Down
8 changes: 0 additions & 8 deletions fixtures/@scope/jsii-calc-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typesVersions": {
"<=3.9": {
"*": [
".types-compat/ts3.9/*",
".types-compat/ts3.9/*/index.d.ts"
]
}
},
"exports": {
".": {
"types": "./lib/index.d.ts",
Expand Down
8 changes: 0 additions & 8 deletions fixtures/jsii-calc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typesVersions": {
"<=3.9": {
"*": [
".types-compat/ts3.9/*",
".types-compat/ts3.9/*/index.d.ts"
]
}
},
"dependencies": {
"@fixtures/jsii-calc-bundled": "file:../@fixtures/jsii-calc-bundled",
"@scope/jsii-calc-base": "^0.0.0",
Expand Down
1 change: 0 additions & 1 deletion package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions src/ambient/downlevel-dts.d.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import * as ts from 'typescript';

import { Assembler } from './assembler';
import { findDependencyDirectory } from './common/find-utils';
import { emitDownleveledDeclarations, TYPES_COMPAT } from './downlevel-dts';
import { Emitter } from './emitter';
import { normalizeConfigPath } from './helpers';
import { JsiiDiagnostic } from './jsii-diagnostic';
import { ProjectInfo } from './project-info';
import { WARNINGSCODE_FILE_NAME } from './transforms/deprecation-warnings';
Expand Down Expand Up @@ -314,15 +312,6 @@ export class Compiler implements Emitter {
LOG.error('Compilation errors prevented the JSII assembly from being created');
}

if (!hasErrors) {
emitDownleveledDeclarations(
this.projectRoot,
this.options.projectInfo.packageJson,
// outDir might be absolute. Need to normalize it.
normalizeConfigPath(this.projectRoot, this.tsconfig.compilerOptions.outDir),
);
}

// Some extra validation on the config.
// Make sure that { "./.warnings.jsii.js": "./.warnings.jsii.js" } is in the set of
// exports, if they are specified.
Expand Down Expand Up @@ -365,9 +354,6 @@ export class Compiler implements Emitter {
}

const pi = this.options.projectInfo;
const configDir = path.dirname(this.configPath);
const absoluteTypesCompat = path.resolve(configDir, pi.tsc?.outDir ?? '.', TYPES_COMPAT);
const relativeTypesCompat = path.relative(configDir, absoluteTypesCompat);

return {
compilerOptions: {
Expand All @@ -381,7 +367,6 @@ export class Compiler implements Emitter {
include: [pi.tsc?.rootDir != null ? path.join(pi.tsc.rootDir, '**', '*.ts') : path.join('**', '*.ts')],
exclude: [
'node_modules',
relativeTypesCompat,
...(pi.excludeTypescript ?? []),
...(pi.tsc?.outDir != null &&
(pi.tsc?.rootDir == null || path.resolve(pi.tsc.outDir).startsWith(path.resolve(pi.tsc.rootDir) + path.sep))
Expand Down
221 changes: 0 additions & 221 deletions src/downlevel-dts.ts

This file was deleted.

Loading
Loading