Skip to content

Commit 551bbdb

Browse files
Continued removing unnecessary guards with improved typing
1 parent be1e31a commit 551bbdb

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/options.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ export const ERROR_WARNINGS_ENABLED_LANGUAGE_OUT_INVALID =
3030
* @param format
3131
* @return boolean
3232
*/
33-
export const isESMFormat = (format?: ModuleFormat): boolean => {
34-
// TODO: remove `| 'esm'` when rollup upgrades its typings
35-
return format === 'esm' || format === 'es';
36-
};
33+
export const isESMFormat = (format?: ModuleFormat): boolean => format === 'esm' || format === 'es';
3734

3835
/**
3936
* Throw Errors if compile options will result in unexpected behaviour.

src/transformers/exports.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,7 @@ export default class ExportTransform extends Transform implements TransformInter
128128
* @return modified input source with window scoped references.
129129
*/
130130
public async preCompilation(code: string): Promise<TransformSourceDescription> {
131-
if (this.outputOptions === null) {
132-
this.context.warn(
133-
'Rollup Plugin Closure Compiler, OutputOptions not known before Closure Compiler invocation.',
134-
);
135-
} else if (isESMFormat(this.outputOptions.format)) {
131+
if (isESMFormat(this.outputOptions.format)) {
136132
await this.deriveExports(code);
137133
const source = new MagicString(code);
138134

@@ -171,11 +167,7 @@ export default class ExportTransform extends Transform implements TransformInter
171167
* @return Promise containing the repaired source
172168
*/
173169
public async postCompilation(code: string): Promise<TransformSourceDescription> {
174-
if (this.outputOptions === null) {
175-
this.context.warn(
176-
'Rollup Plugin Closure Compiler, OutputOptions not known before Closure Compiler invocation.',
177-
);
178-
} else if (isESMFormat(this.outputOptions.format)) {
170+
if (isESMFormat(this.outputOptions.format)) {
179171
const source = new MagicString(code);
180172
const program = parse(code);
181173
let collectedExportsToAppend: Map<string | null, Array<string>> = new Map();

0 commit comments

Comments
 (0)