Skip to content

Commit

Permalink
Switch to sync-child-process (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme authored Nov 4, 2024
1 parent a72459f commit 833a4d6
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 848 deletions.
15 changes: 8 additions & 7 deletions lib/src/compiler/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

import {Subject} from 'rxjs';
import {SyncChildProcess} from 'sync-child-process';

import * as path from 'path';
import {
Expand All @@ -20,7 +21,6 @@ import {FunctionRegistry} from '../function-registry';
import {ImporterRegistry} from '../importer-registry';
import {MessageTransformer} from '../message-transformer';
import {PacketTransformer} from '../packet-transformer';
import {SyncProcess} from '../sync-process';
import * as utils from '../utils';
import * as proto from '../vendor/embedded_sass_pb';
import {CompileResult} from '../vendor/sass/compile';
Expand All @@ -36,7 +36,7 @@ const initFlag = Symbol();
/** A synchronous wrapper for the embedded Sass compiler */
export class Compiler {
/** The underlying process that's being wrapped. */
private readonly process = new SyncProcess(
private readonly process = new SyncChildProcess(
compilerCommand[0],
[...compilerCommand.slice(1), '--embedded'],
{
Expand Down Expand Up @@ -77,7 +77,12 @@ export class Compiler {

/** Yields the next event from the underlying process. */
private yield(): boolean {
const event = this.process.yield();
const result = this.process.next();
if (result.done) {
this.disposed = true;
return false;
}
const event = result.value;
switch (event.type) {
case 'stdout':
this.stdout$.next(event.data);
Expand All @@ -86,10 +91,6 @@ export class Compiler {
case 'stderr':
this.stderr$.next(event.data);
return true;

case 'exit':
this.disposed = true;
return false;
}
}

Expand Down
72 changes: 0 additions & 72 deletions lib/src/sync-process/event.ts

This file was deleted.

157 changes: 0 additions & 157 deletions lib/src/sync-process/index.test.ts

This file was deleted.

Loading

0 comments on commit 833a4d6

Please sign in to comment.