Skip to content
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
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,5 @@
],
"azureMcp.serverMode": "all",
"azureMcp.readOnly": true,
"chat.tools.terminal.outputLocation": "none",
"debug.breakpointsView.presentation": "tree"
}
3 changes: 1 addition & 2 deletions build/gulpfile.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import { tmpdir } from 'os';
import { existsSync, mkdirSync, rmSync } from 'fs';
import * as task from './lib/task.ts';
import watcher from './lib/watch/index.ts';
import { debounce } from './lib/util.ts';
import { debounce, untar } from './lib/util.ts';
import { createReporter } from './lib/reporter.ts';
import untar from 'gulp-untar';
import gunzip from 'gulp-gunzip';

const root = 'cli';
Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.reh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import vfs from 'vinyl-fs';
import packageJson from '../package.json' with { type: 'json' };
import flatmap from 'gulp-flatmap';
import gunzip from 'gulp-gunzip';
import untar from 'gulp-untar';
import { untar } from './lib/util.ts';
import File from 'vinyl';
import * as fs from 'fs';
import glob from 'glob';
Expand Down
12 changes: 0 additions & 12 deletions build/lib/typings/gulp-untar.d.ts

This file was deleted.

38 changes: 38 additions & 0 deletions build/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import through from 'through';
import sm from 'source-map';
import { pathToFileURL } from 'url';
import ternaryStream from 'ternary-stream';
import type { Transform } from 'stream';
import * as tar from 'tar';

const root = path.dirname(path.dirname(import.meta.dirname));

Expand Down Expand Up @@ -429,3 +431,39 @@ export class VinylStat implements fs.Stats {
isFIFO(): boolean { return false; }
isSocket(): boolean { return false; }
}

export function untar(): Transform {
return es.through(function (this: through.ThroughStream, f: VinylFile) {
if (!f.contents || !Buffer.isBuffer(f.contents)) {
this.emit('error', new Error('Expected file with Buffer contents'));
return;
}

const self = this;
const parser = new tar.Parser();

parser.on('entry', (entry: tar.ReadEntry) => {
if (entry.type === 'File') {
const chunks: Buffer[] = [];
entry.on('data', (chunk: Buffer) => chunks.push(chunk));
entry.on('end', () => {
const file = new VinylFile({
path: entry.path,
contents: Buffer.concat(chunks),
stat: new VinylStat({
mode: entry.mode,
mtime: entry.mtime,
size: entry.size
})
});
self.emit('data', file);
});
} else {
entry.resume();
}
});

parser.on('error', (err: Error) => self.emit('error', err));
parser.end(f.contents);
}) as Transform;
}
Loading
Loading