Skip to content

Commit b3d7080

Browse files
committed
build: enable esModuleInterop TypeScript option
The `esModuleInterop` option is recommended to be enable by TypeScript and corrects several assumptions TypeScript would otherwise make when importing CommonJS files. This option change helps ensure compatibility as packages move towards ESM. Reference: https://www.typescriptlang.org/tsconfig#esModuleInterop
1 parent 528b7f1 commit b3d7080

File tree

43 files changed

+280
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+280
-226
lines changed

packages/angular/cli/commands/doc-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import * as open from 'open';
9+
import open from 'open';
1010
import { Command } from '../models/command';
1111
import { Arguments } from '../models/interface';
1212
import { Schema as DocCommandSchema } from './doc';

packages/angular/cli/models/analytics-collector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { analytics } from '@angular-devkit/core';
1010
import { execSync } from 'child_process';
11-
import * as debug from 'debug';
11+
import debug from 'debug';
1212
import * as https from 'https';
1313
import * as os from 'os';
1414
import * as querystring from 'querystring';

packages/angular/cli/models/analytics.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { json, tags } from '@angular-devkit/core';
10-
import * as debug from 'debug';
10+
import debug from 'debug';
1111
import * as inquirer from 'inquirer';
1212
import { v4 as uuidV4 } from 'uuid';
1313
import { colors } from '../utilities/color';
@@ -298,9 +298,8 @@ export async function getWorkspaceAnalytics(): Promise<AnalyticsCollector | unde
298298
analyticsDebug('getWorkspaceAnalytics');
299299
try {
300300
const globalWorkspace = await getWorkspace('local');
301-
const analyticsConfig: string | undefined | null | { uid?: string } = globalWorkspace?.getCli()[
302-
'analytics'
303-
];
301+
const analyticsConfig: string | undefined | null | { uid?: string } =
302+
globalWorkspace?.getCli()['analytics'];
304303
analyticsDebug('Workspace Analytics config found: %j', analyticsConfig);
305304

306305
if (analyticsConfig === false) {

packages/angular/cli/utilities/spinner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import * as ora from 'ora';
9+
import ora from 'ora';
1010
import { colors } from './color';
1111

1212
export class Spinner {

packages/angular/pwa/pwa/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function updateIndexFile(path: string): Rule {
3030
throw new SchematicsException(`Could not read index file: ${path}`);
3131
}
3232

33-
const rewriter = new (await import('parse5-html-rewriting-stream'))();
33+
const rewriter = new (await import('parse5-html-rewriting-stream')).default();
3434
let needsNoScript = true;
3535
rewriter.on('startTag', (startTag) => {
3636
if (startTag.tagName === 'noscript') {

packages/angular_devkit/architect/node/node-modules-architect-host.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
9191
throw new Error(`Project "${project}" does not exist.`);
9292
}
9393

94-
return ({
94+
return {
9595
root: projectDefinition.root,
9696
sourceRoot: projectDefinition.sourceRoot,
9797
prefix: projectDefinition.prefix,
9898
...(clone(projectDefinition.extensions) as {}),
99-
} as unknown) as json.JsonObject;
99+
} as unknown as json.JsonObject;
100100
},
101101
async hasTarget(project, target) {
102102
return !!workspaceOrHost.projects.get(project)?.targets.has(target);
@@ -201,6 +201,11 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
201201
return builder;
202202
}
203203

204+
// Default handling code is for old builders that incorrectly export `default` with non-ESM module
205+
if (builder?.default[BuilderSymbol]) {
206+
return builder.default;
207+
}
208+
204209
throw new Error('Builder is not a builder');
205210
}
206211
}

packages/angular_devkit/architect_cli/bin/architect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { logging, schema, tags, workspaces } from '@angular-devkit/core';
1313
import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node';
1414
import * as ansiColors from 'ansi-colors';
1515
import { existsSync } from 'fs';
16-
import * as minimist from 'minimist';
16+
import minimist from 'minimist';
1717
import * as path from 'path';
1818
import { tap } from 'rxjs/operators';
1919
import { MultiProgressBar } from '../src/progress';

packages/angular_devkit/architect_cli/src/progress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import * as ProgressBar from 'progress';
9+
import ProgressBar from 'progress';
1010
import * as readline from 'readline';
1111

1212
export class MultiProgressBar<Key, T> {

packages/angular_devkit/benchmark/src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { logging, tags } from '@angular-devkit/core';
1111
import { ProcessOutput } from '@angular-devkit/core/node';
1212
import * as ansiColors from 'ansi-colors';
1313
import { appendFileSync, writeFileSync } from 'fs';
14-
import * as minimist from 'minimist';
14+
import minimist from 'minimist';
1515
import { filter, map, toArray } from 'rxjs/operators';
1616
import { Command } from '../src/command';
1717
import { defaultReporter } from '../src/default-reporter';
@@ -73,7 +73,7 @@ export async function main({
7373
}
7474

7575
// Parse the command line.
76-
const argv = (minimist(args, {
76+
const argv = minimist(args, {
7777
boolean: ['help', 'verbose', 'overwrite-output-file'],
7878
string: ['watch-matcher', 'watch-script'],
7979
default: {
@@ -86,7 +86,7 @@ export async function main({
8686
'watch-timeout': 10000,
8787
},
8888
'--': true,
89-
}) as {}) as BenchmarkCliArgv;
89+
}) as {} as BenchmarkCliArgv;
9090

9191
// Create the DevKit Logger used through the CLI.
9292
const logger = new logging.TransformLogger('benchmark-prefix-logger', (stream) =>

packages/angular_devkit/benchmark/src/monitored-process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { SpawnOptions, spawn } from 'child_process';
10-
import * as pidusage from 'pidusage';
10+
import pidusage from 'pidusage';
1111
import { Observable, Subject, from, timer } from 'rxjs';
1212
import { concatMap, map, onErrorResumeNext, tap } from 'rxjs/operators';
1313
import { Command } from './command';

0 commit comments

Comments
 (0)