diff --git a/packages/csv-stringify/dist/cjs/index.cjs b/packages/csv-stringify/dist/cjs/index.cjs index 4963a2c1..663671cd 100644 --- a/packages/csv-stringify/dist/cjs/index.cjs +++ b/packages/csv-stringify/dist/cjs/index.cjs @@ -627,7 +627,16 @@ const stringify = function(){ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv-stringify/dist/esm/index.js b/packages/csv-stringify/dist/esm/index.js index 2764244d..89412096 100644 --- a/packages/csv-stringify/dist/esm/index.js +++ b/packages/csv-stringify/dist/esm/index.js @@ -5685,7 +5685,16 @@ const stringify = function(){ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv-stringify/dist/iife/index.js b/packages/csv-stringify/dist/iife/index.js index ff9f636f..bd39e58e 100644 --- a/packages/csv-stringify/dist/iife/index.js +++ b/packages/csv-stringify/dist/iife/index.js @@ -5688,7 +5688,16 @@ var csv_stringify = (function (exports) { callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv-stringify/dist/umd/index.js b/packages/csv-stringify/dist/umd/index.js index c112dd9f..61840d98 100644 --- a/packages/csv-stringify/dist/umd/index.js +++ b/packages/csv-stringify/dist/umd/index.js @@ -5691,7 +5691,16 @@ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv-stringify/lib/index.js b/packages/csv-stringify/lib/index.js index d6546a5f..949e9549 100644 --- a/packages/csv-stringify/lib/index.js +++ b/packages/csv-stringify/lib/index.js @@ -88,7 +88,16 @@ const stringify = function(){ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv/dist/cjs/index.cjs b/packages/csv/dist/cjs/index.cjs index bfae7015..43f015ed 100644 --- a/packages/csv/dist/cjs/index.cjs +++ b/packages/csv/dist/cjs/index.cjs @@ -267,7 +267,7 @@ let CsvError$1 = class CsvError extends Error { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ @@ -2423,7 +2423,16 @@ const stringify = function(){ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv/dist/cjs/sync.cjs b/packages/csv/dist/cjs/sync.cjs index a753325c..ab358cf4 100644 --- a/packages/csv/dist/cjs/sync.cjs +++ b/packages/csv/dist/cjs/sync.cjs @@ -260,7 +260,7 @@ let CsvError$1 = class CsvError extends Error { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ diff --git a/packages/csv/dist/esm/index.js b/packages/csv/dist/esm/index.js index dea91f9f..7c3332c0 100644 --- a/packages/csv/dist/esm/index.js +++ b/packages/csv/dist/esm/index.js @@ -5394,7 +5394,7 @@ let CsvError$1 = class CsvError extends Error { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ @@ -7550,7 +7550,16 @@ const stringify = function(){ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv/dist/esm/sync.js b/packages/csv/dist/esm/sync.js index 66114126..f36c4bf1 100644 --- a/packages/csv/dist/esm/sync.js +++ b/packages/csv/dist/esm/sync.js @@ -5387,7 +5387,7 @@ let CsvError$1 = class CsvError extends Error { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ diff --git a/packages/csv/dist/iife/index.js b/packages/csv/dist/iife/index.js index cbbb31dc..34cc709a 100644 --- a/packages/csv/dist/iife/index.js +++ b/packages/csv/dist/iife/index.js @@ -5397,7 +5397,7 @@ var csv = (function (exports) { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ @@ -7553,7 +7553,16 @@ var csv = (function (exports) { callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv/dist/iife/sync.js b/packages/csv/dist/iife/sync.js index 9e2c4dd6..5718c67f 100644 --- a/packages/csv/dist/iife/sync.js +++ b/packages/csv/dist/iife/sync.js @@ -5390,7 +5390,7 @@ var csv_sync = (function (exports) { if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ diff --git a/packages/csv/dist/umd/index.js b/packages/csv/dist/umd/index.js index ac33f79b..6f315301 100644 --- a/packages/csv/dist/umd/index.js +++ b/packages/csv/dist/umd/index.js @@ -5400,7 +5400,7 @@ if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){ @@ -7556,7 +7556,16 @@ callback(err); }); stringifier.on('end', function(){ - callback(undefined, chunks.join('')); + let result; + try { + result = chunks.join(''); + } catch (err) { + // This can happen if the result is extremely long; it may throw + // "Cannot create a string longer than 0x1fffffe8 characters" + callback(err); + return; + } + callback(undefined, result); }); } if(data !== undefined){ diff --git a/packages/csv/dist/umd/sync.js b/packages/csv/dist/umd/sync.js index 6dc300fc..51b9584d 100644 --- a/packages/csv/dist/umd/sync.js +++ b/packages/csv/dist/umd/sync.js @@ -5393,7 +5393,7 @@ if(Array.isArray(message)) message = message.join(' ').trim(); super(message); if(Error.captureStackTrace !== undefined){ - Error.captureStackTrace(this, CsvError$1); + Error.captureStackTrace(this, CsvError); } this.code = code; for(const context of contexts){