Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
14
Frontend-Learner/node_modules/@isaacs/cliui/LICENSE.txt
generated
vendored
Normal file
14
Frontend-Learner/node_modules/@isaacs/cliui/LICENSE.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Copyright (c) 2015, Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice
|
||||
appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
143
Frontend-Learner/node_modules/@isaacs/cliui/README.md
generated
vendored
Normal file
143
Frontend-Learner/node_modules/@isaacs/cliui/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
# @isaacs/cliui
|
||||
|
||||
Temporary fork of [cliui](http://npm.im/cliui).
|
||||
|
||||

|
||||
[](https://www.npmjs.com/package/cliui)
|
||||
[](https://conventionalcommits.org)
|
||||

|
||||
|
||||
easily create complex multi-column command-line-interfaces.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const ui = require('cliui')()
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0]
|
||||
})
|
||||
|
||||
ui.div(
|
||||
{
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
},
|
||||
{
|
||||
text: "the file to load." +
|
||||
chalk.green("(if this description is long it wraps).")
|
||||
,
|
||||
width: 20
|
||||
},
|
||||
{
|
||||
text: chalk.red("[required]"),
|
||||
align: 'right'
|
||||
}
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
## Deno/ESM Support
|
||||
|
||||
As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
|
||||
[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules):
|
||||
|
||||
```typescript
|
||||
import cliui from "https://deno.land/x/cliui/deno.ts";
|
||||
|
||||
const ui = cliui({})
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0]
|
||||
})
|
||||
|
||||
ui.div({
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
})
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
<img width="500" src="screenshot.png">
|
||||
|
||||
## Layout DSL
|
||||
|
||||
cliui exposes a simple layout DSL:
|
||||
|
||||
If you create a single `ui.div`, passing a string rather than an
|
||||
object:
|
||||
|
||||
* `\n`: characters will be interpreted as new rows.
|
||||
* `\t`: characters will be interpreted as new columns.
|
||||
* `\s`: characters will be interpreted as padding.
|
||||
|
||||
**as an example...**
|
||||
|
||||
```js
|
||||
var ui = require('./')({
|
||||
width: 60
|
||||
})
|
||||
|
||||
ui.div(
|
||||
'Usage: node ./bin/foo.js\n' +
|
||||
' <regex>\t provide a regex\n' +
|
||||
' <glob>\t provide a glob\t [required]'
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
**will output:**
|
||||
|
||||
```shell
|
||||
Usage: node ./bin/foo.js
|
||||
<regex> provide a regex
|
||||
<glob> provide a glob [required]
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
cliui = require('cliui')
|
||||
```
|
||||
|
||||
### cliui({width: integer})
|
||||
|
||||
Specify the maximum width of the UI being generated.
|
||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||
|
||||
### cliui({wrap: boolean})
|
||||
|
||||
Enable or disable the wrapping of text in a column.
|
||||
|
||||
### cliui.div(column, column, column)
|
||||
|
||||
Create a row with any number of columns, a column
|
||||
can either be a string, or an object with the following
|
||||
options:
|
||||
|
||||
* **text:** some text to place in the column.
|
||||
* **width:** the width of a column.
|
||||
* **align:** alignment, `right` or `center`.
|
||||
* **padding:** `[top, right, bottom, left]`.
|
||||
* **border:** should a border be placed around the div?
|
||||
|
||||
### cliui.span(column, column, column)
|
||||
|
||||
Similar to `div`, except the next row will be appended without
|
||||
a new line being created.
|
||||
|
||||
### cliui.resetOutput()
|
||||
|
||||
Resets the UI elements of the current cliui instance, maintaining the values
|
||||
set for `width` and `wrap`.
|
||||
317
Frontend-Learner/node_modules/@isaacs/cliui/build/index.cjs
generated
vendored
Normal file
317
Frontend-Learner/node_modules/@isaacs/cliui/build/index.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
'use strict';
|
||||
|
||||
const align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
class UI {
|
||||
constructor(opts) {
|
||||
var _a;
|
||||
this.width = opts.width;
|
||||
/* c8 ignore start */
|
||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
||||
/* c8 ignore stop */
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return args.length === 1 && typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]);
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
};
|
||||
}));
|
||||
});
|
||||
return this.rows[this.rows.length - 1];
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text)
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = mixin.stripAnsi(str);
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const { width } = row[c]; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > mixin.stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||
const fn = align[row[c].align];
|
||||
ts = fn(ts, wrapWidth);
|
||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
||||
/* c8 ignore start */
|
||||
const w = width || 0;
|
||||
/* c8 ignore stop */
|
||||
ts += ' '.repeat(w - mixin.stringWidth(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = row[c].padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(row[c], ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(row[c], ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = this.renderInline(str, lines[lines.length - 1]);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
/* c8 ignore start */
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
/* c8 ignore stop */
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = mixin.stringWidth(target.trimEnd());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
const rrow = rrows[r];
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
/* c8 ignore start */
|
||||
let wrapWidth = col.width || 0;
|
||||
/* c8 ignore stop */
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || mixin.stringWidth(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
/* c8 ignore start */
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
/* c8 ignore stop */
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
function addBorder(col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth(col) {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
}
|
||||
function getWindowWidth() {
|
||||
/* c8 ignore start */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
function alignRight(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
if (strWidth < width) {
|
||||
return ' '.repeat(width - strWidth) + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function alignCenter(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
/* c8 ignore start */
|
||||
if (strWidth >= width) {
|
||||
return str;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
||||
}
|
||||
let mixin;
|
||||
function cliui(opts, _mixin) {
|
||||
mixin = _mixin;
|
||||
return new UI({
|
||||
/* c8 ignore start */
|
||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
}
|
||||
|
||||
// Bootstrap cliui with CommonJS dependencies:
|
||||
const stringWidth = require('string-width-cjs');
|
||||
const stripAnsi = require('strip-ansi-cjs');
|
||||
const wrap = require('wrap-ansi-cjs');
|
||||
function ui(opts) {
|
||||
return cliui(opts, {
|
||||
stringWidth,
|
||||
stripAnsi,
|
||||
wrap
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = ui;
|
||||
43
Frontend-Learner/node_modules/@isaacs/cliui/build/index.d.cts
generated
vendored
Normal file
43
Frontend-Learner/node_modules/@isaacs/cliui/build/index.d.cts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
interface UIOptions {
|
||||
width: number;
|
||||
wrap?: boolean;
|
||||
rows?: string[];
|
||||
}
|
||||
interface Column {
|
||||
text: string;
|
||||
width?: number;
|
||||
align?: "right" | "left" | "center";
|
||||
padding: number[];
|
||||
border?: boolean;
|
||||
}
|
||||
interface ColumnArray extends Array<Column> {
|
||||
span: boolean;
|
||||
}
|
||||
interface Line {
|
||||
hidden?: boolean;
|
||||
text: string;
|
||||
span?: boolean;
|
||||
}
|
||||
declare class UI {
|
||||
width: number;
|
||||
wrap: boolean;
|
||||
rows: ColumnArray[];
|
||||
constructor(opts: UIOptions);
|
||||
span(...args: ColumnArray): void;
|
||||
resetOutput(): void;
|
||||
div(...args: (Column | string)[]): ColumnArray;
|
||||
private shouldApplyLayoutDSL;
|
||||
private applyLayoutDSL;
|
||||
private colFromString;
|
||||
private measurePadding;
|
||||
toString(): string;
|
||||
rowToString(row: ColumnArray, lines: Line[]): Line[];
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
private renderInline;
|
||||
private rasterize;
|
||||
private negatePadding;
|
||||
private columnWidths;
|
||||
}
|
||||
declare function ui(opts: UIOptions): UI;
|
||||
export { ui as default };
|
||||
302
Frontend-Learner/node_modules/@isaacs/cliui/build/lib/index.js
generated
vendored
Normal file
302
Frontend-Learner/node_modules/@isaacs/cliui/build/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
'use strict';
|
||||
const align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
export class UI {
|
||||
constructor(opts) {
|
||||
var _a;
|
||||
this.width = opts.width;
|
||||
/* c8 ignore start */
|
||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
||||
/* c8 ignore stop */
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return args.length === 1 && typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]);
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
};
|
||||
}));
|
||||
});
|
||||
return this.rows[this.rows.length - 1];
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text)
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = mixin.stripAnsi(str);
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const { width } = row[c]; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > mixin.stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||
const fn = align[row[c].align];
|
||||
ts = fn(ts, wrapWidth);
|
||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
||||
/* c8 ignore start */
|
||||
const w = width || 0;
|
||||
/* c8 ignore stop */
|
||||
ts += ' '.repeat(w - mixin.stringWidth(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = row[c].padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(row[c], ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(row[c], ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = this.renderInline(str, lines[lines.length - 1]);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
/* c8 ignore start */
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
/* c8 ignore stop */
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = mixin.stringWidth(target.trimEnd());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
const rrow = rrows[r];
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
/* c8 ignore start */
|
||||
let wrapWidth = col.width || 0;
|
||||
/* c8 ignore stop */
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || mixin.stringWidth(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
/* c8 ignore start */
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
/* c8 ignore stop */
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
function addBorder(col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth(col) {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
}
|
||||
function getWindowWidth() {
|
||||
/* c8 ignore start */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
function alignRight(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
if (strWidth < width) {
|
||||
return ' '.repeat(width - strWidth) + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function alignCenter(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
/* c8 ignore start */
|
||||
if (strWidth >= width) {
|
||||
return str;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
||||
}
|
||||
let mixin;
|
||||
export function cliui(opts, _mixin) {
|
||||
mixin = _mixin;
|
||||
return new UI({
|
||||
/* c8 ignore start */
|
||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
}
|
||||
14
Frontend-Learner/node_modules/@isaacs/cliui/index.mjs
generated
vendored
Normal file
14
Frontend-Learner/node_modules/@isaacs/cliui/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Bootstrap cliui with ESM dependencies:
|
||||
import { cliui } from './build/lib/index.js'
|
||||
|
||||
import stringWidth from 'string-width'
|
||||
import stripAnsi from 'strip-ansi'
|
||||
import wrap from 'wrap-ansi'
|
||||
|
||||
export default function ui (opts) {
|
||||
return cliui(opts, {
|
||||
stringWidth,
|
||||
stripAnsi,
|
||||
wrap
|
||||
})
|
||||
}
|
||||
86
Frontend-Learner/node_modules/@isaacs/cliui/package.json
generated
vendored
Normal file
86
Frontend-Learner/node_modules/@isaacs/cliui/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"name": "@isaacs/cliui",
|
||||
"version": "8.0.2",
|
||||
"description": "easily create complex multi-column command-line-interfaces",
|
||||
"main": "build/index.cjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./index.mjs",
|
||||
"scripts": {
|
||||
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
|
||||
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
|
||||
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
|
||||
"test": "c8 mocha ./test/*.cjs",
|
||||
"test:esm": "c8 mocha ./test/**/*.mjs",
|
||||
"postest": "check",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"repository": "yargs/cliui",
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"**/example/**"
|
||||
],
|
||||
"globals": [
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command-line",
|
||||
"layout",
|
||||
"design",
|
||||
"console",
|
||||
"wrap",
|
||||
"table"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^5.1.2",
|
||||
"string-width-cjs": "npm:string-width@^4.2.0",
|
||||
"strip-ansi": "^7.0.1",
|
||||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
|
||||
"wrap-ansi": "^8.1.0",
|
||||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.27",
|
||||
"@typescript-eslint/eslint-plugin": "^4.0.0",
|
||||
"@typescript-eslint/parser": "^4.0.0",
|
||||
"c8": "^7.3.0",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"gts": "^3.0.0",
|
||||
"mocha": "^10.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.23.1",
|
||||
"rollup-plugin-ts": "^3.0.2",
|
||||
"standardx": "^7.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build",
|
||||
"index.mjs",
|
||||
"!*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
15
Frontend-Learner/node_modules/@isaacs/fs-minipass/LICENSE
generated
vendored
Normal file
15
Frontend-Learner/node_modules/@isaacs/fs-minipass/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
71
Frontend-Learner/node_modules/@isaacs/fs-minipass/README.md
generated
vendored
Normal file
71
Frontend-Learner/node_modules/@isaacs/fs-minipass/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# fs-minipass
|
||||
|
||||
Filesystem streams based on [minipass](http://npm.im/minipass).
|
||||
|
||||
4 classes are exported:
|
||||
|
||||
- ReadStream
|
||||
- ReadStreamSync
|
||||
- WriteStream
|
||||
- WriteStreamSync
|
||||
|
||||
When using `ReadStreamSync`, all of the data is made available
|
||||
immediately upon consuming the stream. Nothing is buffered in memory
|
||||
when the stream is constructed. If the stream is piped to a writer,
|
||||
then it will synchronously `read()` and emit data into the writer as
|
||||
fast as the writer can consume it. (That is, it will respect
|
||||
backpressure.) If you call `stream.read()` then it will read the
|
||||
entire file and return the contents.
|
||||
|
||||
When using `WriteStreamSync`, every write is flushed to the file
|
||||
synchronously. If your writes all come in a single tick, then it'll
|
||||
write it all out in a single tick. It's as synchronous as you are.
|
||||
|
||||
The async versions work much like their node builtin counterparts,
|
||||
with the exception of introducing significantly less Stream machinery
|
||||
overhead.
|
||||
|
||||
## USAGE
|
||||
|
||||
It's just streams, you pipe them or read() them or write() to them.
|
||||
|
||||
```js
|
||||
import { ReadStream, WriteStream } from 'fs-minipass'
|
||||
// or: const { ReadStream, WriteStream } = require('fs-minipass')
|
||||
const readStream = new ReadStream('file.txt')
|
||||
const writeStream = new WriteStream('output.txt')
|
||||
writeStream.write('some file header or whatever\n')
|
||||
readStream.pipe(writeStream)
|
||||
```
|
||||
|
||||
## ReadStream(path, options)
|
||||
|
||||
Path string is required, but somewhat irrelevant if an open file
|
||||
descriptor is passed in as an option.
|
||||
|
||||
Options:
|
||||
|
||||
- `fd` Pass in a numeric file descriptor, if the file is already open.
|
||||
- `readSize` The size of reads to do, defaults to 16MB
|
||||
- `size` The size of the file, if known. Prevents zero-byte read()
|
||||
call at the end.
|
||||
- `autoClose` Set to `false` to prevent the file descriptor from being
|
||||
closed when the file is done being read.
|
||||
|
||||
## WriteStream(path, options)
|
||||
|
||||
Path string is required, but somewhat irrelevant if an open file
|
||||
descriptor is passed in as an option.
|
||||
|
||||
Options:
|
||||
|
||||
- `fd` Pass in a numeric file descriptor, if the file is already open.
|
||||
- `mode` The mode to create the file with. Defaults to `0o666`.
|
||||
- `start` The position in the file to start reading. If not
|
||||
specified, then the file will start writing at position zero, and be
|
||||
truncated by default.
|
||||
- `autoClose` Set to `false` to prevent the file descriptor from being
|
||||
closed when the stream is ended.
|
||||
- `flags` Flags to use when opening the file. Irrelevant if `fd` is
|
||||
passed in, since file won't be opened in that case. Defaults to
|
||||
`'a'` if a `pos` is specified, or `'w'` otherwise.
|
||||
118
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
generated
vendored
Normal file
118
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import EE from 'events';
|
||||
import { Minipass } from 'minipass';
|
||||
declare const _autoClose: unique symbol;
|
||||
declare const _close: unique symbol;
|
||||
declare const _ended: unique symbol;
|
||||
declare const _fd: unique symbol;
|
||||
declare const _finished: unique symbol;
|
||||
declare const _flags: unique symbol;
|
||||
declare const _flush: unique symbol;
|
||||
declare const _handleChunk: unique symbol;
|
||||
declare const _makeBuf: unique symbol;
|
||||
declare const _mode: unique symbol;
|
||||
declare const _needDrain: unique symbol;
|
||||
declare const _onerror: unique symbol;
|
||||
declare const _onopen: unique symbol;
|
||||
declare const _onread: unique symbol;
|
||||
declare const _onwrite: unique symbol;
|
||||
declare const _open: unique symbol;
|
||||
declare const _path: unique symbol;
|
||||
declare const _pos: unique symbol;
|
||||
declare const _queue: unique symbol;
|
||||
declare const _read: unique symbol;
|
||||
declare const _readSize: unique symbol;
|
||||
declare const _reading: unique symbol;
|
||||
declare const _remain: unique symbol;
|
||||
declare const _size: unique symbol;
|
||||
declare const _write: unique symbol;
|
||||
declare const _writing: unique symbol;
|
||||
declare const _defaultFlag: unique symbol;
|
||||
declare const _errored: unique symbol;
|
||||
export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
fd?: number;
|
||||
readSize?: number;
|
||||
size?: number;
|
||||
autoClose?: boolean;
|
||||
};
|
||||
export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
|
||||
open: [fd: number];
|
||||
};
|
||||
export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
|
||||
[_errored]: boolean;
|
||||
[_fd]?: number;
|
||||
[_path]: string;
|
||||
[_readSize]: number;
|
||||
[_reading]: boolean;
|
||||
[_size]: number;
|
||||
[_remain]: number;
|
||||
[_autoClose]: boolean;
|
||||
constructor(path: string, opt: ReadStreamOptions);
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
write(): void;
|
||||
end(): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
|
||||
[_makeBuf](): Buffer;
|
||||
[_read](): void;
|
||||
[_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
|
||||
[_close](): void;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_handleChunk](br: number, buf: Buffer): boolean;
|
||||
emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
|
||||
}
|
||||
export declare class ReadStreamSync extends ReadStream {
|
||||
[_open](): void;
|
||||
[_read](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export type WriteStreamOptions = {
|
||||
fd?: number;
|
||||
autoClose?: boolean;
|
||||
mode?: number;
|
||||
captureRejections?: boolean;
|
||||
start?: number;
|
||||
flags?: string;
|
||||
};
|
||||
export declare class WriteStream extends EE {
|
||||
readable: false;
|
||||
writable: boolean;
|
||||
[_errored]: boolean;
|
||||
[_writing]: boolean;
|
||||
[_ended]: boolean;
|
||||
[_queue]: Buffer[];
|
||||
[_needDrain]: boolean;
|
||||
[_path]: string;
|
||||
[_mode]: number;
|
||||
[_autoClose]: boolean;
|
||||
[_fd]?: number;
|
||||
[_defaultFlag]: boolean;
|
||||
[_flags]: string;
|
||||
[_finished]: boolean;
|
||||
[_pos]?: number;
|
||||
constructor(path: string, opt: WriteStreamOptions);
|
||||
emit(ev: string, ...args: any[]): boolean;
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
|
||||
end(buf: string, enc?: BufferEncoding): this;
|
||||
end(buf?: Buffer, enc?: undefined): this;
|
||||
write(buf: string, enc?: BufferEncoding): boolean;
|
||||
write(buf: Buffer, enc?: undefined): boolean;
|
||||
[_write](buf: Buffer): void;
|
||||
[_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
|
||||
[_flush](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export declare class WriteStreamSync extends WriteStream {
|
||||
[_open](): void;
|
||||
[_close](): void;
|
||||
[_write](buf: Buffer): void;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAInC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CA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G,OAAO;IACjD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO;IAsB5C,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;IAWpB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAwBzD,CAAC,MAAM,CAAC;IAgBR,CAAC,MAAM,CAAC;CAST;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,CAAC,KAAK,CAAC,IAAI,IAAI;IAsBf,CAAC,MAAM,CAAC;IASR,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;CAmBrB"}
|
||||
430
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
generated
vendored
Normal file
430
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0;
|
||||
const events_1 = __importDefault(require("events"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const minipass_1 = require("minipass");
|
||||
const writev = fs_1.default.writev;
|
||||
const _autoClose = Symbol('_autoClose');
|
||||
const _close = Symbol('_close');
|
||||
const _ended = Symbol('_ended');
|
||||
const _fd = Symbol('_fd');
|
||||
const _finished = Symbol('_finished');
|
||||
const _flags = Symbol('_flags');
|
||||
const _flush = Symbol('_flush');
|
||||
const _handleChunk = Symbol('_handleChunk');
|
||||
const _makeBuf = Symbol('_makeBuf');
|
||||
const _mode = Symbol('_mode');
|
||||
const _needDrain = Symbol('_needDrain');
|
||||
const _onerror = Symbol('_onerror');
|
||||
const _onopen = Symbol('_onopen');
|
||||
const _onread = Symbol('_onread');
|
||||
const _onwrite = Symbol('_onwrite');
|
||||
const _open = Symbol('_open');
|
||||
const _path = Symbol('_path');
|
||||
const _pos = Symbol('_pos');
|
||||
const _queue = Symbol('_queue');
|
||||
const _read = Symbol('_read');
|
||||
const _readSize = Symbol('_readSize');
|
||||
const _reading = Symbol('_reading');
|
||||
const _remain = Symbol('_remain');
|
||||
const _size = Symbol('_size');
|
||||
const _write = Symbol('_write');
|
||||
const _writing = Symbol('_writing');
|
||||
const _defaultFlag = Symbol('_defaultFlag');
|
||||
const _errored = Symbol('_errored');
|
||||
class ReadStream extends minipass_1.Minipass {
|
||||
[_errored] = false;
|
||||
[_fd];
|
||||
[_path];
|
||||
[_readSize];
|
||||
[_reading] = false;
|
||||
[_size];
|
||||
[_remain];
|
||||
[_autoClose];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this.readable = true;
|
||||
this.writable = false;
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('path must be a string');
|
||||
}
|
||||
this[_errored] = false;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_path] = path;
|
||||
this[_readSize] = opt.readSize || 16 * 1024 * 1024;
|
||||
this[_reading] = false;
|
||||
this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
|
||||
this[_remain] = this[_size];
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
else {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
//@ts-ignore
|
||||
write() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
//@ts-ignore
|
||||
end() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
[_open]() {
|
||||
fs_1.default.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_makeBuf]() {
|
||||
return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
|
||||
}
|
||||
[_read]() {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
if (buf.length === 0) {
|
||||
return process.nextTick(() => this[_onread](null, 0, buf));
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
|
||||
}
|
||||
}
|
||||
[_onread](er, br, buf) {
|
||||
this[_reading] = false;
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else if (this[_handleChunk](br, buf)) {
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_reading] = true;
|
||||
this[_close]();
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_handleChunk](br, buf) {
|
||||
let ret = false;
|
||||
// no effect if infinite
|
||||
this[_remain] -= br;
|
||||
if (br > 0) {
|
||||
ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
|
||||
}
|
||||
if (br === 0 || this[_remain] <= 0) {
|
||||
ret = false;
|
||||
this[_close]();
|
||||
super.end();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
switch (ev) {
|
||||
case 'prefinish':
|
||||
case 'finish':
|
||||
return false;
|
||||
case 'drain':
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
return false;
|
||||
case 'error':
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
return super.emit(ev, ...args);
|
||||
default:
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReadStream = ReadStream;
|
||||
class ReadStreamSync extends ReadStream {
|
||||
[_open]() {
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onopen](null, fs_1.default.openSync(this[_path], 'r'));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_read]() {
|
||||
let threw = true;
|
||||
try {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
do {
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
const br = buf.length === 0
|
||||
? 0
|
||||
: fs_1.default.readSync(this[_fd], buf, 0, buf.length, null);
|
||||
/* c8 ignore stop */
|
||||
if (!this[_handleChunk](br, buf)) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
this[_reading] = false;
|
||||
}
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReadStreamSync = ReadStreamSync;
|
||||
class WriteStream extends events_1.default {
|
||||
readable = false;
|
||||
writable = true;
|
||||
[_errored] = false;
|
||||
[_writing] = false;
|
||||
[_ended] = false;
|
||||
[_queue] = [];
|
||||
[_needDrain] = false;
|
||||
[_path];
|
||||
[_mode];
|
||||
[_autoClose];
|
||||
[_fd];
|
||||
[_defaultFlag];
|
||||
[_flags];
|
||||
[_finished] = false;
|
||||
[_pos];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this[_path] = path;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
|
||||
this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
// truncating makes no sense when writing into the middle
|
||||
const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
|
||||
this[_defaultFlag] = opt.flags === undefined;
|
||||
this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
|
||||
if (this[_fd] === undefined) {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
if (ev === 'error') {
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
}
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_close]();
|
||||
this[_writing] = true;
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_open]() {
|
||||
fs_1.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (this[_defaultFlag] &&
|
||||
this[_flags] === 'r+' &&
|
||||
er &&
|
||||
er.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
this[_open]();
|
||||
}
|
||||
else if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
if (!this[_writing]) {
|
||||
this[_flush]();
|
||||
}
|
||||
}
|
||||
}
|
||||
end(buf, enc) {
|
||||
if (buf) {
|
||||
//@ts-ignore
|
||||
this.write(buf, enc);
|
||||
}
|
||||
this[_ended] = true;
|
||||
// synthetic after-write logic, where drain/finish live
|
||||
if (!this[_writing] &&
|
||||
!this[_queue].length &&
|
||||
typeof this[_fd] === 'number') {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
write(buf, enc) {
|
||||
if (typeof buf === 'string') {
|
||||
buf = Buffer.from(buf, enc);
|
||||
}
|
||||
if (this[_ended]) {
|
||||
this.emit('error', new Error('write() after end()'));
|
||||
return false;
|
||||
}
|
||||
if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
|
||||
this[_queue].push(buf);
|
||||
this[_needDrain] = true;
|
||||
return false;
|
||||
}
|
||||
this[_writing] = true;
|
||||
this[_write](buf);
|
||||
return true;
|
||||
}
|
||||
[_write](buf) {
|
||||
fs_1.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
[_onwrite](er, bw) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
if (this[_pos] !== undefined && typeof bw === 'number') {
|
||||
this[_pos] += bw;
|
||||
}
|
||||
if (this[_queue].length) {
|
||||
this[_flush]();
|
||||
}
|
||||
else {
|
||||
this[_writing] = false;
|
||||
if (this[_ended] && !this[_finished]) {
|
||||
this[_finished] = true;
|
||||
this[_close]();
|
||||
this.emit('finish');
|
||||
}
|
||||
else if (this[_needDrain]) {
|
||||
this[_needDrain] = false;
|
||||
this.emit('drain');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[_flush]() {
|
||||
if (this[_queue].length === 0) {
|
||||
if (this[_ended]) {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
}
|
||||
else if (this[_queue].length === 1) {
|
||||
this[_write](this[_queue].pop());
|
||||
}
|
||||
else {
|
||||
const iovec = this[_queue];
|
||||
this[_queue] = [];
|
||||
writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.WriteStream = WriteStream;
|
||||
class WriteStreamSync extends WriteStream {
|
||||
[_open]() {
|
||||
let fd;
|
||||
// only wrap in a try{} block if we know we'll retry, to avoid
|
||||
// the rethrow obscuring the error's source frame in most cases.
|
||||
if (this[_defaultFlag] && this[_flags] === 'r+') {
|
||||
try {
|
||||
fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
return this[_open]();
|
||||
}
|
||||
else {
|
||||
throw er;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
this[_onopen](null, fd);
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
[_write](buf) {
|
||||
// throw the original, but try to close if it fails
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onwrite](null, fs_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
try {
|
||||
this[_close]();
|
||||
}
|
||||
catch {
|
||||
// ok error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.WriteStreamSync = WriteStreamSync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map
generated
vendored
Normal file
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
generated
vendored
Normal file
3
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
118
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
generated
vendored
Normal file
118
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import EE from 'events';
|
||||
import { Minipass } from 'minipass';
|
||||
declare const _autoClose: unique symbol;
|
||||
declare const _close: unique symbol;
|
||||
declare const _ended: unique symbol;
|
||||
declare const _fd: unique symbol;
|
||||
declare const _finished: unique symbol;
|
||||
declare const _flags: unique symbol;
|
||||
declare const _flush: unique symbol;
|
||||
declare const _handleChunk: unique symbol;
|
||||
declare const _makeBuf: unique symbol;
|
||||
declare const _mode: unique symbol;
|
||||
declare const _needDrain: unique symbol;
|
||||
declare const _onerror: unique symbol;
|
||||
declare const _onopen: unique symbol;
|
||||
declare const _onread: unique symbol;
|
||||
declare const _onwrite: unique symbol;
|
||||
declare const _open: unique symbol;
|
||||
declare const _path: unique symbol;
|
||||
declare const _pos: unique symbol;
|
||||
declare const _queue: unique symbol;
|
||||
declare const _read: unique symbol;
|
||||
declare const _readSize: unique symbol;
|
||||
declare const _reading: unique symbol;
|
||||
declare const _remain: unique symbol;
|
||||
declare const _size: unique symbol;
|
||||
declare const _write: unique symbol;
|
||||
declare const _writing: unique symbol;
|
||||
declare const _defaultFlag: unique symbol;
|
||||
declare const _errored: unique symbol;
|
||||
export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
fd?: number;
|
||||
readSize?: number;
|
||||
size?: number;
|
||||
autoClose?: boolean;
|
||||
};
|
||||
export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
|
||||
open: [fd: number];
|
||||
};
|
||||
export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
|
||||
[_errored]: boolean;
|
||||
[_fd]?: number;
|
||||
[_path]: string;
|
||||
[_readSize]: number;
|
||||
[_reading]: boolean;
|
||||
[_size]: number;
|
||||
[_remain]: number;
|
||||
[_autoClose]: boolean;
|
||||
constructor(path: string, opt: ReadStreamOptions);
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
write(): void;
|
||||
end(): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
|
||||
[_makeBuf](): Buffer;
|
||||
[_read](): void;
|
||||
[_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
|
||||
[_close](): void;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_handleChunk](br: number, buf: Buffer): boolean;
|
||||
emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
|
||||
}
|
||||
export declare class ReadStreamSync extends ReadStream {
|
||||
[_open](): void;
|
||||
[_read](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export type WriteStreamOptions = {
|
||||
fd?: number;
|
||||
autoClose?: boolean;
|
||||
mode?: number;
|
||||
captureRejections?: boolean;
|
||||
start?: number;
|
||||
flags?: string;
|
||||
};
|
||||
export declare class WriteStream extends EE {
|
||||
readable: false;
|
||||
writable: boolean;
|
||||
[_errored]: boolean;
|
||||
[_writing]: boolean;
|
||||
[_ended]: boolean;
|
||||
[_queue]: Buffer[];
|
||||
[_needDrain]: boolean;
|
||||
[_path]: string;
|
||||
[_mode]: number;
|
||||
[_autoClose]: boolean;
|
||||
[_fd]?: number;
|
||||
[_defaultFlag]: boolean;
|
||||
[_flags]: string;
|
||||
[_finished]: boolean;
|
||||
[_pos]?: number;
|
||||
constructor(path: string, opt: WriteStreamOptions);
|
||||
emit(ev: string, ...args: any[]): boolean;
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
|
||||
end(buf: string, enc?: BufferEncoding): this;
|
||||
end(buf?: Buffer, enc?: undefined): this;
|
||||
write(buf: string, enc?: BufferEncoding): boolean;
|
||||
write(buf: Buffer, enc?: undefined): boolean;
|
||||
[_write](buf: Buffer): void;
|
||||
[_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
|
||||
[_flush](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export declare class WriteStreamSync extends WriteStream {
|
||||
[_open](): void;
|
||||
[_close](): void;
|
||||
[_write](buf: Buffer): void;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map
generated
vendored
Normal file
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAInC,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,SAAS,eAAsB,CAAA;AACrC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB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IAMP,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAoBxD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI;IAC5C,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI;IAoBxC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO;IACjD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO;IAsB5C,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;IAWpB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAwBzD,CAAC,MAAM,CAAC;IAgBR,CAAC,MAAM,CAAC;CAST;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,CAAC,KAAK,CAAC,IAAI,IAAI;IAsBf,CAAC,MAAM,CAAC;IASR,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;CAmBrB"}
|
||||
420
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.js
generated
vendored
Normal file
420
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
import EE from 'events';
|
||||
import fs from 'fs';
|
||||
import { Minipass } from 'minipass';
|
||||
const writev = fs.writev;
|
||||
const _autoClose = Symbol('_autoClose');
|
||||
const _close = Symbol('_close');
|
||||
const _ended = Symbol('_ended');
|
||||
const _fd = Symbol('_fd');
|
||||
const _finished = Symbol('_finished');
|
||||
const _flags = Symbol('_flags');
|
||||
const _flush = Symbol('_flush');
|
||||
const _handleChunk = Symbol('_handleChunk');
|
||||
const _makeBuf = Symbol('_makeBuf');
|
||||
const _mode = Symbol('_mode');
|
||||
const _needDrain = Symbol('_needDrain');
|
||||
const _onerror = Symbol('_onerror');
|
||||
const _onopen = Symbol('_onopen');
|
||||
const _onread = Symbol('_onread');
|
||||
const _onwrite = Symbol('_onwrite');
|
||||
const _open = Symbol('_open');
|
||||
const _path = Symbol('_path');
|
||||
const _pos = Symbol('_pos');
|
||||
const _queue = Symbol('_queue');
|
||||
const _read = Symbol('_read');
|
||||
const _readSize = Symbol('_readSize');
|
||||
const _reading = Symbol('_reading');
|
||||
const _remain = Symbol('_remain');
|
||||
const _size = Symbol('_size');
|
||||
const _write = Symbol('_write');
|
||||
const _writing = Symbol('_writing');
|
||||
const _defaultFlag = Symbol('_defaultFlag');
|
||||
const _errored = Symbol('_errored');
|
||||
export class ReadStream extends Minipass {
|
||||
[_errored] = false;
|
||||
[_fd];
|
||||
[_path];
|
||||
[_readSize];
|
||||
[_reading] = false;
|
||||
[_size];
|
||||
[_remain];
|
||||
[_autoClose];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this.readable = true;
|
||||
this.writable = false;
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('path must be a string');
|
||||
}
|
||||
this[_errored] = false;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_path] = path;
|
||||
this[_readSize] = opt.readSize || 16 * 1024 * 1024;
|
||||
this[_reading] = false;
|
||||
this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
|
||||
this[_remain] = this[_size];
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
else {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
//@ts-ignore
|
||||
write() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
//@ts-ignore
|
||||
end() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
[_open]() {
|
||||
fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_makeBuf]() {
|
||||
return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
|
||||
}
|
||||
[_read]() {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
if (buf.length === 0) {
|
||||
return process.nextTick(() => this[_onread](null, 0, buf));
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
|
||||
}
|
||||
}
|
||||
[_onread](er, br, buf) {
|
||||
this[_reading] = false;
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else if (this[_handleChunk](br, buf)) {
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_reading] = true;
|
||||
this[_close]();
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_handleChunk](br, buf) {
|
||||
let ret = false;
|
||||
// no effect if infinite
|
||||
this[_remain] -= br;
|
||||
if (br > 0) {
|
||||
ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
|
||||
}
|
||||
if (br === 0 || this[_remain] <= 0) {
|
||||
ret = false;
|
||||
this[_close]();
|
||||
super.end();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
switch (ev) {
|
||||
case 'prefinish':
|
||||
case 'finish':
|
||||
return false;
|
||||
case 'drain':
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
return false;
|
||||
case 'error':
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
return super.emit(ev, ...args);
|
||||
default:
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
export class ReadStreamSync extends ReadStream {
|
||||
[_open]() {
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onopen](null, fs.openSync(this[_path], 'r'));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_read]() {
|
||||
let threw = true;
|
||||
try {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
do {
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
const br = buf.length === 0
|
||||
? 0
|
||||
: fs.readSync(this[_fd], buf, 0, buf.length, null);
|
||||
/* c8 ignore stop */
|
||||
if (!this[_handleChunk](br, buf)) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
this[_reading] = false;
|
||||
}
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
export class WriteStream extends EE {
|
||||
readable = false;
|
||||
writable = true;
|
||||
[_errored] = false;
|
||||
[_writing] = false;
|
||||
[_ended] = false;
|
||||
[_queue] = [];
|
||||
[_needDrain] = false;
|
||||
[_path];
|
||||
[_mode];
|
||||
[_autoClose];
|
||||
[_fd];
|
||||
[_defaultFlag];
|
||||
[_flags];
|
||||
[_finished] = false;
|
||||
[_pos];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this[_path] = path;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
|
||||
this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
// truncating makes no sense when writing into the middle
|
||||
const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
|
||||
this[_defaultFlag] = opt.flags === undefined;
|
||||
this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
|
||||
if (this[_fd] === undefined) {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
if (ev === 'error') {
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
}
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_close]();
|
||||
this[_writing] = true;
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_open]() {
|
||||
fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (this[_defaultFlag] &&
|
||||
this[_flags] === 'r+' &&
|
||||
er &&
|
||||
er.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
this[_open]();
|
||||
}
|
||||
else if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
if (!this[_writing]) {
|
||||
this[_flush]();
|
||||
}
|
||||
}
|
||||
}
|
||||
end(buf, enc) {
|
||||
if (buf) {
|
||||
//@ts-ignore
|
||||
this.write(buf, enc);
|
||||
}
|
||||
this[_ended] = true;
|
||||
// synthetic after-write logic, where drain/finish live
|
||||
if (!this[_writing] &&
|
||||
!this[_queue].length &&
|
||||
typeof this[_fd] === 'number') {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
write(buf, enc) {
|
||||
if (typeof buf === 'string') {
|
||||
buf = Buffer.from(buf, enc);
|
||||
}
|
||||
if (this[_ended]) {
|
||||
this.emit('error', new Error('write() after end()'));
|
||||
return false;
|
||||
}
|
||||
if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
|
||||
this[_queue].push(buf);
|
||||
this[_needDrain] = true;
|
||||
return false;
|
||||
}
|
||||
this[_writing] = true;
|
||||
this[_write](buf);
|
||||
return true;
|
||||
}
|
||||
[_write](buf) {
|
||||
fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
[_onwrite](er, bw) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
if (this[_pos] !== undefined && typeof bw === 'number') {
|
||||
this[_pos] += bw;
|
||||
}
|
||||
if (this[_queue].length) {
|
||||
this[_flush]();
|
||||
}
|
||||
else {
|
||||
this[_writing] = false;
|
||||
if (this[_ended] && !this[_finished]) {
|
||||
this[_finished] = true;
|
||||
this[_close]();
|
||||
this.emit('finish');
|
||||
}
|
||||
else if (this[_needDrain]) {
|
||||
this[_needDrain] = false;
|
||||
this.emit('drain');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[_flush]() {
|
||||
if (this[_queue].length === 0) {
|
||||
if (this[_ended]) {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
}
|
||||
else if (this[_queue].length === 1) {
|
||||
this[_write](this[_queue].pop());
|
||||
}
|
||||
else {
|
||||
const iovec = this[_queue];
|
||||
this[_queue] = [];
|
||||
writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
}
|
||||
export class WriteStreamSync extends WriteStream {
|
||||
[_open]() {
|
||||
let fd;
|
||||
// only wrap in a try{} block if we know we'll retry, to avoid
|
||||
// the rethrow obscuring the error's source frame in most cases.
|
||||
if (this[_defaultFlag] && this[_flags] === 'r+') {
|
||||
try {
|
||||
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
return this[_open]();
|
||||
}
|
||||
else {
|
||||
throw er;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
this[_onopen](null, fd);
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
[_write](buf) {
|
||||
// throw the original, but try to close if it fails
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
try {
|
||||
this[_close]();
|
||||
}
|
||||
catch {
|
||||
// ok error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map
generated
vendored
Normal file
1
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/package.json
generated
vendored
Normal file
3
Frontend-Learner/node_modules/@isaacs/fs-minipass/dist/esm/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
||||
72
Frontend-Learner/node_modules/@isaacs/fs-minipass/package.json
generated
vendored
Normal file
72
Frontend-Learner/node_modules/@isaacs/fs-minipass/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"name": "@isaacs/fs-minipass",
|
||||
"version": "4.0.1",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tshy",
|
||||
"pretest": "npm run prepare",
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"format": "prettier --write . --loglevel warn",
|
||||
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Isaac Z. Schlueter",
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/fs-minipass.git"
|
||||
},
|
||||
"description": "fs read and write streams based on minipass",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.30",
|
||||
"mutate-fs": "^2.1.1",
|
||||
"prettier": "^3.2.5",
|
||||
"tap": "^18.7.1",
|
||||
"tshy": "^1.12.0",
|
||||
"typedoc": "^0.25.12"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"type": "module",
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue