Skip to content

Commit

Permalink
Address some of the code review comments from #226.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseppstein committed Mar 28, 2019
1 parent 035b17f commit 50be128
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
16 changes: 8 additions & 8 deletions packages/broccoli-eyeglass/src/broccoli_sass_compiler.ts
Expand Up @@ -118,11 +118,11 @@ export interface CompilationDetails {
/**
* The path of the sass file being compiled (relative to srcPath).
*/
sassFilename: string;
sassFilename: string;
/**
* The absolute path of the Sass file.
*/
fullSassFilename: string;
fullSassFilename: string;
/**
* The directory where compiled css files are being written.
*/
Expand Down Expand Up @@ -161,21 +161,21 @@ export interface BroccoliSassOptions extends BroccoliPlugin.BroccoliPluginOption
discover?: boolean;
/**
* The directory to look for scss files to compile. Defaults to tree root.
*
*
*/
sassDir?: string;

/**
* Force sass rendering to use node-sass's synchronous rendering.
* Defaults to * `false`.
*
*
*/
renderSync?: boolean;
/**
* Array of file names or glob patterns (relative to the sass directory) that
* should be compiled. Note that file names must include the file extension
* (unlike @import in Sass). E.g.: ['application.scss']
*
*
*/
sourceFiles?: Array<string>;

Expand All @@ -191,7 +191,7 @@ export interface BroccoliSassOptions extends BroccoliPlugin.BroccoliPluginOption
* compiler needs. Defaults to 10. Note: do not set
* eyeglassCompiler.events.setMaxListeners() yourself as eyeglass has its own
* listeners it uses internally.
*
*
*/
maxListeners?: number;

Expand Down Expand Up @@ -921,7 +921,7 @@ export default class BroccoliSassCompiler extends BroccoliPlugin {
this.events.addListener("additional-output", additionalOutputListener);
this.events.addListener("dependency", dependencyListener);
let sassPromise = sass(details.options as nodeSass.SyncOptions); // XXX This cast sucks
return sassPromise
return sassPromise
.finally(() => {
this.events.removeListener("dependency", dependencyListener);
this.events.removeListener("additional-output", additionalOutputListener);
Expand All @@ -937,7 +937,7 @@ export default class BroccoliSassCompiler extends BroccoliPlugin {
debug(`render of ${result.stats.entry} took ${result.stats.duration}`)
return success(result).then(() => result);
}, failure);
});
}) as Promise<nodeSass.Result>;
}

handleSuccess(details: CompilationDetails, result: nodeSass.Result): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/broccoli-eyeglass/src/types/chained-emitter.d.ts
Expand Up @@ -2,7 +2,7 @@ export class EventEmitter {
constructor(conf?: any);
newListener: any;
addListener(type: any, listener: any): any;
emit(...args: any[]): any;
emit(...args: any[]): Promise<any>;
listeners(type: any): any;
listenersAny(): any;
many(event: any, ttl: any, fn: any): any;
Expand Down
11 changes: 3 additions & 8 deletions packages/ember-cli-eyeglass/src/index.ts
Expand Up @@ -98,7 +98,7 @@ interface EyeglassAppInfo {
}

const EMBER_CLI_EYEGLASS = {
name: 'ember-cli-eyeglass',
name: require("../package.json").name,
included(parent) {
this._super.included.apply(this, arguments);
this.initSelf();
Expand Down Expand Up @@ -132,13 +132,8 @@ const EMBER_CLI_EYEGLASS = {
Eyeglass.resetGlobalCaches();
for (let app of apps) {
let appInfo = EYEGLASS_INFO_PER_APP.get(app);
if (appInfo) {
appInfo.assets.reset();
appInfo.sessionCache.clear();
} else {
// eslint-disable-next-line no-console
console.warn("eyeglass app info is missing during postBuild.");
}
appInfo.assets.reset();
appInfo.sessionCache.clear();
}
},
postprocessTree(type, tree) {
Expand Down
2 changes: 1 addition & 1 deletion packages/eyeglass/src/assets/Assets.ts
Expand Up @@ -22,7 +22,7 @@ interface Resolution {
query?: string;
}

type ResolverCallback = (error: unknown, result: Resolution | undefined) => unknown;
type ResolverCallback = (error: unknown, result?: Resolution) => unknown;
type Resolver = (assetFile: string, assetUri: string, cb: ResolverCallback) => void;
type WrappedResolver = (assetFile: string, assetUri: string, fallback: Resolver, cb: ResolverCallback) => void;

Expand Down

0 comments on commit 50be128

Please sign in to comment.