Skip to content

Switch to sync-child-process #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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