Skip to content

Commit 0945aac

Browse files
committed
share rollup onLog across all builds
1 parent 6232f4a commit 0945aac

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

packages/@ember/engine/lib/engine-parent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
@module @ember/engine
33
*/
4-
import type EngineInstance from './instance';
4+
import type EngineInstance from '../instance';
55

66
export const ENGINE_PARENT = Symbol('ENGINE_PARENT');
77

rollup.config.mjs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,7 @@ function esmConfig() {
4848
];
4949

5050
return {
51-
onLog(level, log, handler) {
52-
switch (log.code) {
53-
case 'CIRCULAR_DEPENDENCY':
54-
if (log.ids.some((id) => id.includes('node_modules/rsvp/lib/rsvp'))) {
55-
// rsvp has some internal cycles but they don't bother us
56-
return;
57-
}
58-
process.stderr.write(
59-
`Circular dependency:\n${log.ids.map((id) => ' ' + id).join('\n')}\n`
60-
);
61-
throw new Error(`Circular dependencies are forbidden`);
62-
case 'EMPTY_BUNDLE':
63-
// Some of our entrypoints are type-only and result in empty bundles.
64-
// We prune the actual empty files elsewhere in this config (see
65-
// pruneEmptyBundles). This silences the warning from rollup about
66-
// them.
67-
return;
68-
default:
69-
handler(level, log);
70-
}
71-
},
51+
onLog: handleRollupWarnings,
7252
input: {
7353
...renameEntrypoints(exposedDependencies(), (name) => join('packages', name, 'index')),
7454
...renameEntrypoints(packages(), (name) => join('packages', name)),
@@ -126,6 +106,7 @@ function legacyBundleConfig(input, output, { isDeveloping, isExternal }) {
126106

127107
interop: 'esModule',
128108
},
109+
onLog: handleRollupWarnings,
129110
plugins: [
130111
amdDefineSupport(),
131112
...(isDeveloping ? [concatenateAMDEntrypoints()] : []),
@@ -516,3 +497,25 @@ function pruneEmptyBundles() {
516497
},
517498
};
518499
}
500+
501+
function handleRollupWarnings(level, log, handler) {
502+
switch (log.code) {
503+
case 'CIRCULAR_DEPENDENCY':
504+
if (log.ids.some((id) => id.includes('node_modules/rsvp/lib/rsvp'))) {
505+
// rsvp has some internal cycles but they don't bother us
506+
return;
507+
}
508+
process.stderr.write(
509+
`Circular dependency:\n${log.ids.map((id) => ' ' + id).join('\n')}\n`
510+
);
511+
throw new Error(`Circular dependencies are forbidden`);
512+
case 'EMPTY_BUNDLE':
513+
// Some of our entrypoints are type-only and result in empty bundles.
514+
// We prune the actual empty files elsewhere in this config (see
515+
// pruneEmptyBundles). This silences the warning from rollup about
516+
// them.
517+
return;
518+
default:
519+
handler(level, log);
520+
}
521+
}

0 commit comments

Comments
 (0)