Update capacitor version
This commit is contained in:
parent
91155bce0a
commit
f3b3a86b32
610 changed files with 28718 additions and 7101 deletions
39
@capacitor/cli/node_modules/@ionic/utils-stream/dist/index.d.ts
generated
vendored
Normal file
39
@capacitor/cli/node_modules/@ionic/utils-stream/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { Readable, ReadableOptions, Writable, WritableOptions } from 'stream';
|
||||
export declare class NullStream extends Writable {
|
||||
_write(chunk: any, encoding: string, callback: () => void): void;
|
||||
}
|
||||
export interface ReadableStreamBufferOptions extends ReadableOptions {
|
||||
chunkSize?: number;
|
||||
allocSize?: number;
|
||||
growSize?: number;
|
||||
}
|
||||
export declare class ReadableStreamBuffer extends Readable {
|
||||
protected buffer: Buffer;
|
||||
protected _size: number;
|
||||
protected _stopped: boolean;
|
||||
protected chunkSize: number;
|
||||
protected growSize: number;
|
||||
constructor(opts?: ReadableStreamBufferOptions);
|
||||
get size(): number;
|
||||
get stopped(): boolean;
|
||||
_read(): void;
|
||||
feed(data: Buffer | string, encoding?: BufferEncoding): void;
|
||||
stop(): void;
|
||||
protected _send(): void;
|
||||
}
|
||||
export interface WritableStreamBufferOptions extends WritableOptions {
|
||||
allocSize?: number;
|
||||
growSize?: number;
|
||||
}
|
||||
export declare class WritableStreamBuffer extends Writable {
|
||||
protected buffer: Buffer;
|
||||
protected _size: number;
|
||||
protected growSize: number;
|
||||
constructor(opts?: WritableStreamBufferOptions);
|
||||
get size(): number;
|
||||
_write(chunk: any, encoding: string, callback: () => void): void;
|
||||
consume(bytes?: number): Buffer;
|
||||
}
|
||||
export declare function growBufferForAppendedData(buf: Buffer, actualsize: number, appendsize: number): Buffer;
|
||||
108
@capacitor/cli/node_modules/@ionic/utils-stream/dist/index.js
generated
vendored
Normal file
108
@capacitor/cli/node_modules/@ionic/utils-stream/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.growBufferForAppendedData = exports.WritableStreamBuffer = exports.ReadableStreamBuffer = exports.NullStream = void 0;
|
||||
const stream_1 = require("stream");
|
||||
const DEFAULT_CHUNK_SIZE = 4;
|
||||
const DEFAULT_ALLOC_SIZE = 32;
|
||||
const DEFAULT_GROW_SIZE = 16;
|
||||
class NullStream extends stream_1.Writable {
|
||||
_write(chunk, encoding, callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
exports.NullStream = NullStream;
|
||||
class ReadableStreamBuffer extends stream_1.Readable {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
this._size = 0;
|
||||
this._stopped = false;
|
||||
this.buffer = Buffer.alloc(opts && opts.allocSize ? opts.allocSize : DEFAULT_ALLOC_SIZE);
|
||||
this.chunkSize = opts && opts.chunkSize ? opts.chunkSize : DEFAULT_CHUNK_SIZE;
|
||||
this.growSize = opts && opts.growSize ? opts.growSize : DEFAULT_GROW_SIZE;
|
||||
}
|
||||
get size() {
|
||||
return this._size;
|
||||
}
|
||||
get stopped() {
|
||||
return this._stopped;
|
||||
}
|
||||
_read() {
|
||||
this._send();
|
||||
}
|
||||
feed(data, encoding = 'utf8') {
|
||||
if (this._stopped) {
|
||||
throw new Error('ReadableStreamBuffer is stopped. Can no longer feed.');
|
||||
}
|
||||
const datasize = typeof data === 'string' ? Buffer.byteLength(data) : data.length;
|
||||
this.buffer = growBufferForAppendedData(this.buffer, this._size, Math.ceil(datasize / this.growSize) * this.growSize);
|
||||
if (typeof data === 'string') {
|
||||
this.buffer.write(data, this._size, datasize, encoding);
|
||||
}
|
||||
else {
|
||||
this.buffer.copy(data, this._size, 0);
|
||||
}
|
||||
this._size += datasize;
|
||||
}
|
||||
stop() {
|
||||
if (this._stopped) {
|
||||
return;
|
||||
}
|
||||
this._stopped = true;
|
||||
if (this._size === 0) {
|
||||
this.push(null);
|
||||
}
|
||||
}
|
||||
_send() {
|
||||
const chunkSize = Math.min(this.chunkSize, this._size);
|
||||
let done = false;
|
||||
if (chunkSize > 0) {
|
||||
const chunk = Buffer.alloc(chunkSize);
|
||||
this.buffer.copy(chunk, 0, 0, chunkSize);
|
||||
done = !this.push(chunk);
|
||||
this.buffer.copy(this.buffer, 0, chunkSize, this._size);
|
||||
this._size -= chunkSize;
|
||||
}
|
||||
if (this._size === 0 && this._stopped) {
|
||||
this.push(null);
|
||||
}
|
||||
if (!done) {
|
||||
setTimeout(() => this._send(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReadableStreamBuffer = ReadableStreamBuffer;
|
||||
class WritableStreamBuffer extends stream_1.Writable {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
this._size = 0;
|
||||
this.buffer = Buffer.alloc(opts && opts.allocSize ? opts.allocSize : DEFAULT_ALLOC_SIZE);
|
||||
this.growSize = opts && opts.growSize ? opts.growSize : DEFAULT_GROW_SIZE;
|
||||
}
|
||||
get size() {
|
||||
return this._size;
|
||||
}
|
||||
_write(chunk, encoding, callback) {
|
||||
this.buffer = growBufferForAppendedData(this.buffer, this._size, Math.ceil(chunk.length / this.growSize) * this.growSize);
|
||||
chunk.copy(this.buffer, this._size, 0);
|
||||
this._size += chunk.length;
|
||||
callback();
|
||||
}
|
||||
consume(bytes) {
|
||||
bytes = typeof bytes === 'number' ? bytes : this._size;
|
||||
const data = Buffer.alloc(bytes);
|
||||
this.buffer.copy(data, 0, 0, data.length);
|
||||
this.buffer.copy(this.buffer, 0, data.length);
|
||||
this._size -= data.length;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
exports.WritableStreamBuffer = WritableStreamBuffer;
|
||||
function growBufferForAppendedData(buf, actualsize, appendsize) {
|
||||
if ((buf.length - actualsize) >= appendsize) {
|
||||
return buf;
|
||||
}
|
||||
const newbuffer = Buffer.alloc(buf.length + appendsize);
|
||||
buf.copy(newbuffer, 0, 0, actualsize);
|
||||
return newbuffer;
|
||||
}
|
||||
exports.growBufferForAppendedData = growBufferForAppendedData;
|
||||
Loading…
Add table
Add a link
Reference in a new issue