node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
'use strict';
const StreamBase = require('./StreamBase');
const withParser = require('../utils/withParser');
class StreamArray extends StreamBase {
static make(options) {
return new StreamArray(options);
}
static withParser(options) {
return withParser(StreamArray.make, options);
}
constructor(options) {
super(options);
this._level = 1;
this._counter = 0;
}
_wait(chunk, _, callback) {
// first chunk should open an array
if (chunk.name !== 'startArray') {
return callback(new Error('Top-level object should be an array.'));
}
this._transform = this._filter;
return this._transform(chunk, _, callback);
}
_push(discard) {
if (this._assembler.current.length) {
if (discard) {
++this._counter;
this._assembler.current.pop();
} else {
this.push({key: this._counter++, value: this._assembler.current.pop()});
}
}
}
}
StreamArray.streamArray = StreamArray.make;
StreamArray.make.Constructor = StreamArray;
module.exports = StreamArray;

101
server/node_modules/stream-json/streamers/StreamBase.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
'use strict';
const {Transform} = require('stream');
const Assembler = require('../Assembler');
class Counter {
constructor(initialDepth) {
this.depth = initialDepth;
}
startObject() {
++this.depth;
}
endObject() {
--this.depth;
}
startArray() {
++this.depth;
}
endArray() {
--this.depth;
}
}
class StreamBase extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
if (options) {
this.objectFilter = options.objectFilter;
this.includeUndecided = options.includeUndecided;
}
if (typeof this.objectFilter != 'function') {
this._filter = this._transform;
}
this._transform = this._wait || this._filter;
this._assembler = new Assembler(options);
}
_transform(chunk, encoding, callback) {
if (this._assembler[chunk.name]) {
this._assembler[chunk.name](chunk.value);
if (this._assembler.depth === this._level) {
this._push();
}
}
callback(null);
}
_filter(chunk, encoding, callback) {
if (this._assembler[chunk.name]) {
this._assembler[chunk.name](chunk.value);
const result = this.objectFilter(this._assembler);
if (result) {
if (this._assembler.depth === this._level) {
this._push();
this._transform = this._filter;
}
this._transform = this._accept;
return callback(null);
}
if (result === false) {
this._saved_assembler = this._assembler;
this._assembler = new Counter(this._saved_assembler.depth);
this._saved_assembler.dropToLevel(this._level);
if (this._assembler.depth === this._level) {
this._assembler = this._saved_assembler;
this._transform = this._filter;
}
this._transform = this._reject;
return callback(null);
}
if (this._assembler.depth === this._level) {
this._push(!this.includeUndecided);
}
}
callback(null);
}
_accept(chunk, encoding, callback) {
if (this._assembler[chunk.name]) {
this._assembler[chunk.name](chunk.value);
if (this._assembler.depth === this._level) {
this._push();
this._transform = this._filter;
}
}
callback(null);
}
_reject(chunk, encoding, callback) {
if (this._assembler[chunk.name]) {
this._assembler[chunk.name](chunk.value);
if (this._assembler.depth === this._level) {
this._assembler = this._saved_assembler;
this._transform = this._filter;
}
}
callback(null);
}
}
module.exports = StreamBase;

View File

@@ -0,0 +1,43 @@
'use strict';
const StreamBase = require('./StreamBase');
const withParser = require('../utils/withParser');
class StreamObject extends StreamBase {
static make(options) {
return new StreamObject(options);
}
static withParser(options) {
return withParser(StreamObject.make, options);
}
constructor(options) {
super(options);
this._level = 1;
this._lastKey = null;
}
_wait(chunk, _, callback) {
// first chunk should open an array
if (chunk.name !== 'startObject') {
return callback(new Error('Top-level object should be an object.'));
}
this._transform = this._filter;
return this._transform(chunk, _, callback);
}
_push(discard) {
if (this._lastKey === null) {
this._lastKey = this._assembler.key;
} else {
!discard && this.push({key: this._lastKey, value: this._assembler.current[this._lastKey]});
this._assembler.current = {};
this._lastKey = null;
}
}
}
StreamObject.streamObject = StreamObject.make;
StreamObject.make.Constructor = StreamObject;
module.exports = StreamObject;

View File

@@ -0,0 +1,33 @@
'use strict';
const StreamBase = require('./StreamBase');
const withParser = require('../utils/withParser');
class StreamValues extends StreamBase {
static make(options) {
return new StreamValues(options);
}
static withParser(options) {
return withParser(StreamValues.make, Object.assign({}, options, {jsonStreaming: true}));
}
constructor(options) {
super(options);
this._counter = 0;
this._level = 0;
}
_push(discard) {
if (discard) {
++this._counter;
} else {
this.push({key: this._counter++, value: this._assembler.current});
}
this._assembler.current = this._assembler.key = null;
}
}
StreamValues.streamValues = StreamValues.make;
StreamValues.make.Constructor = StreamValues;
module.exports = StreamValues;