Skip to content

Commit

Permalink
Fixing broccoli-debug
Browse files Browse the repository at this point in the history
If you try to enable broccoli-debug these actually crash, because buildDebugCallback is really a static method that needs the correct `this`. This used to work, but something about the CJS-interop implementation changed at some point.
  • Loading branch information
ef4 committed Sep 20, 2024
1 parent d82727f commit 4e4ea85
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

4 changes: 2 additions & 2 deletions packages/ember-auto-import/ts/auto-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Bundler, debugBundler } from './bundler';
import Analyzer from './analyzer';
import type { TreeType } from './analyzer';
import Package from './package';
import { buildDebugCallback } from 'broccoli-debug';
import BroccoliDebug from 'broccoli-debug';
import BundleConfig from './bundle-config';
import type { Node } from 'broccoli-node-api';
import { LeaderChooser } from './leader';
Expand All @@ -28,7 +28,7 @@ import path from 'path';
import funnel from 'broccoli-funnel';
import makeDebug from 'debug';

const debugTree = buildDebugCallback('ember-auto-import');
const debugTree = BroccoliDebug.buildDebugCallback('ember-auto-import');
const debugWatch = makeDebug('ember-auto-import:watch');

// This interface must be stable across all versions of ember-auto-import that
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-auto-import/ts/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type Splitter from './splitter';
import type Package from './package';
import type BundleConfig from './bundle-config';
import type { BundleName } from './bundle-config';
import { buildDebugCallback } from 'broccoli-debug';
import BroccoliDebug from 'broccoli-debug';
import type webpack from 'webpack';

const debugTree = buildDebugCallback('ember-auto-import');
const debugTree = BroccoliDebug.buildDebugCallback('ember-auto-import');

export interface BundlerOptions {
consoleWrite: (msg: string) => void;
Expand Down
5 changes: 2 additions & 3 deletions types/broccoli-debug/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
declare module 'broccoli-debug' {
import { InputNode, Node } from "broccoli-plugin";
import { InputNode, Node } from 'broccoli-plugin';
export default class BroccoliDebug implements Tree {
constructor(inputTree: InputNode, name: 'string');
__broccoliGetInfo__(): any;
static buildDebugCallback(name: string): (inputTree: InputNode, name: string) => Node;
}
export function buildDebugCallback(name: string): (inputTree: InputNode, name: string) => Node;
}

0 comments on commit 4e4ea85

Please sign in to comment.