Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(workers): generate context in worker threads
Browse files Browse the repository at this point in the history
  • Loading branch information
danbucholtz committed Dec 12, 2016
1 parent e835a65 commit af036ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/cleancss.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'path';
import { BuildContext, TaskInfo } from './util/interfaces';
import { BuildError } from './util/errors';
import { fillConfigDefaults, getUserConfigFile } from './util/config';
import { fillConfigDefaults, generateContext, getUserConfigFile } from './util/config';
import { Logger } from './logger/logger';
import { readFileAsync, writeFileAsync } from './util/helpers';
import { runWorker } from './worker-client';
Expand All @@ -25,6 +25,7 @@ export function cleancss(context: BuildContext, configFile?: string) {

export function cleancssWorker(context: BuildContext, configFile: string): Promise<any> {
return new Promise((resolve, reject) => {
context = generateContext(context);
const cleanCssConfig: CleanCssConfig = fillConfigDefaults(configFile, taskInfo.defaultConfigFile);
const srcFile = join(context.buildDir, cleanCssConfig.sourceFileName);
const destFile = join(context.buildDir, cleanCssConfig.destFileName);
Expand Down
3 changes: 2 additions & 1 deletion src/closure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execSync } from 'child_process';
import { BuildContext, TaskInfo } from './util/interfaces';
import { fillConfigDefaults, getUserConfigFile } from './util/config';
import { fillConfigDefaults, generateContext, getUserConfigFile } from './util/config';
import { Logger } from './logger/logger';
import { runWorker } from './worker-client';

Expand All @@ -20,6 +20,7 @@ export function closure(context: BuildContext, configFile?: string) {

export function closureWorker(context: BuildContext, configFile: string): Promise<any> {
return new Promise((resolve, reject) => {
context = generateContext(context);
Logger.warn('Closer Compiler unsupported at this time.');
resolve();
});
Expand Down
3 changes: 2 additions & 1 deletion src/uglifyjs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BuildContext, TaskInfo } from './util/interfaces';
import { BuildError } from './util/errors';
import { fillConfigDefaults, getUserConfigFile } from './util/config';
import { fillConfigDefaults, generateContext, getUserConfigFile } from './util/config';
import { join } from 'path';
import { Logger } from './logger/logger';
import { runWorker } from './worker-client';
Expand All @@ -27,6 +27,7 @@ export function uglifyjsWorker(context: BuildContext, configFile: string): Promi
return new Promise((resolve, reject) => {
try {
// provide a full path for the config options
context = generateContext(context);
const uglifyJsConfig: UglifyJsConfig = fillConfigDefaults(configFile, taskInfo.defaultConfigFile);
uglifyJsConfig.sourceFile = join(context.buildDir, uglifyJsConfig.sourceFile);
uglifyJsConfig.inSourceMap = join(context.buildDir, uglifyJsConfig.inSourceMap);
Expand Down

0 comments on commit af036ec

Please sign in to comment.