New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@autoplay/utils

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@autoplay/utils - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

13

dist/internal/devStringify.js

@@ -41,3 +41,3 @@ import { DevString } from "./DevString";

});
return display ? cleanNewlinesAndStacks(json.replace(/\\?"([^"]+)\\?":/g, "$1:")) : json;
return display ? cleanNewlinesAndStacks(json.replace(/(\\?")([^"]+)\1:/g, "$2:")) : json;
}

@@ -55,5 +55,12 @@ }

// replace escaped newlines in strings
.replace(/(.+?)"(.*\\n(.(?!\\"))+|\\")*"/gm, (_fullMatch, beforeQuote, inside) => {
return beforeQuote + (inside ? `"${inside.split(/\\n/g).join("\n" + " ".repeat(beforeQuote.length))}"` : '""');
// .replace(/^(.+?)"(.*\\n(.(?!\\"))+|\\")*"$/gm, (_fullMatch, beforeQuote, inside) => {
.replace(/([^"]+?)"((?:\\.|[^\"])*)"/g, (_fullMatch, beforeQuote, inside) => {
return (beforeQuote +
(inside
? `"${inside
.split(/\\n/g)
// .map((line) => line.replace(/\\"/g, '"'))
.join("\n" + " ".repeat(beforeQuote.length))}"`
: '""'));
}));
}
{
"name": "@autoplay/utils",
"version": "0.0.18",
"version": "0.0.19",
"description": "Utilities designed for error management, parsing, and TypeScript domain modeling.",

@@ -28,3 +28,3 @@ "keywords": [],

"tslib": "^2.4",
"zod": "^3.17.3"
"zod": "^3"
},

@@ -31,0 +31,0 @@ "devDependencies": {

import { dev } from "./DevString";
import { devStringify } from "./devStringify";
import { tightJsonStringify } from "./tightJsonStringify";
import { describe, expect, it, jest } from "@jest/globals";

@@ -22,8 +23,7 @@

expectStringWithPaths(devStringify(reason)).toMatchInlineSnapshot(`
"[ "Error resulting from ",
{ error: "TypeError: Unknown type\\"
\\"",
stack: "TypeError: Unknown type\\"
"Error resulting from { error: "TypeError: Unknown type\\"
\\"",
stack: "TypeError: Unknown type\\"
\\"
at Object.<anonymous> (🙈/src/internal/devStringify.test.ts:17:45)
at Object.<anonymous> (🙈/src/internal/devStringify.test.ts:18:47)
at Promise.then.completed (node_modules/jest-circus/build/utils.js:333:28)

@@ -37,27 +37,33 @@ at new Promise (<anonymous>)

at _runTestsForDescribeBlock (node_modules/jest-circus/build/run.js:91:9)
at run (node_modules/jest-circus/build/run.js:31:3)" },
". This might have been caused by ",
"https://example.com/" ]"
at run (node_modules/jest-circus/build/run.js:31:3)" }. This might have been caused by "https://example.com/""
`);
expectStringWithPaths(devStringify(reason.causedA`failed to log in`)).toMatchInlineSnapshot(`
const input = dev`the user saw an error`.because(reason);
expectStringWithPaths(
tightJsonStringify(input, (key, err) => (err instanceof Error ? { error: err.message, stack: err.stack } : err)),
).toMatchInlineSnapshot(`
"[ "the user saw an error",
{ cause: [
{ "cause": [
"Error resulting from ",
{ error: "TypeError: Unknown type\\"
\\"",
stack: "TypeError: Unknown type\\"
\\"
at Object.<anonymous> (🙈/src/internal/devStringify.test.ts:17:45)
at Promise.then.completed (node_modules/jest-circus/build/utils.js:333:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (node_modules/jest-circus/build/utils.js:259:10)
at _callCircusTest (node_modules/jest-circus/build/run.js:277:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (node_modules/jest-circus/build/run.js:209:3)
at _runTestsForDescribeBlock (node_modules/jest-circus/build/run.js:97:9)
at _runTestsForDescribeBlock (node_modules/jest-circus/build/run.js:91:9)
at run (node_modules/jest-circus/build/run.js:31:3)" },
{ "error": "Unknown type\\"\\n\\"",
"stack": "TypeError: Unknown type\\"\\n\\"\\n at Object.<anonymous> (🙈/src/internal/devStringify.test.ts:18:47)\\n at Promise.then.completed (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/utils.js:333:28)\\n at new Promise (<anonymous>)\\n at callAsyncCircusFn (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/utils.js:259:10)\\n at _callCircusTest (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/run.js:277:40)\\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\\n at _runTest (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/run.js:209:3)\\n at _runTestsForDescribeBlock (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/run.js:97:9)\\n at _runTestsForDescribeBlock (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/run.js:91:9)\\n at run (/Users/cole/autoplay/artprompt-app/node_modules/.pnpm/jest-circus@28.1.3/node_modules/jest-circus/build/run.js:31:3)" },
". This might have been caused by ",
"https://example.com/" ] } ]"
`);
expectStringWithPaths(input.toDisplay()).toMatchInlineSnapshot(`
"the user saw an error
because: Error resulting from { error: "TypeError: Unknown type\\"
\\"",
stack: "TypeError: Unknown type\\"
\\"
at Object.<anonymous> (🙈/src/internal/devStringify.test.ts:18:47)
at Promise.then.completed (node_modules/jest-circus/build/utils.js:333:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (node_modules/jest-circus/build/utils.js:259:10)
at _callCircusTest (node_modules/jest-circus/build/run.js:277:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (node_modules/jest-circus/build/run.js:209:3)
at _runTestsForDescribeBlock (node_modules/jest-circus/build/run.js:97:9)
at _runTestsForDescribeBlock (node_modules/jest-circus/build/run.js:91:9)
at run (node_modules/jest-circus/build/run.js:31:3)" }. This might have been caused by "https://example.com/""
`);
// expect(devStringify(dev1)).toMatchInlineSnapshot();

@@ -64,0 +70,0 @@ });

@@ -39,3 +39,3 @@ import { DevString } from "./DevString";

});
return display ? cleanNewlinesAndStacks(json.replace(/\\?"([^"]+)\\?":/g, "$1:")) : json;
return display ? cleanNewlinesAndStacks(json.replace(/(\\?")([^"]+)\1:/g, "$2:")) : json;
}

@@ -54,6 +54,15 @@ } catch (err) {

// replace escaped newlines in strings
.replace(/(.+?)"(.*\\n(.(?!\\"))+|\\")*"/gm, (_fullMatch, beforeQuote, inside) => {
return beforeQuote + (inside ? `"${inside.split(/\\n/g).join("\n" + " ".repeat(beforeQuote.length))}"` : '""');
// .replace(/^(.+?)"(.*\\n(.(?!\\"))+|\\")*"$/gm, (_fullMatch, beforeQuote, inside) => {
.replace(/([^"]+?)"((?:\\.|[^\"])*)"/g, (_fullMatch, beforeQuote, inside: string | undefined) => {
return (
beforeQuote +
(inside
? `"${inside
.split(/\\n/g)
// .map((line) => line.replace(/\\"/g, '"'))
.join("\n" + " ".repeat(beforeQuote.length))}"`
: '""')
);
})
);
}

@@ -72,3 +72,3 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

if (p === OTH) return found === empty ? (cb: (val: unknown) => unknown) => cb(value) : () => found;
if (found === empty && value && p in value) {
if (found === empty && value && p in (value as object)) {
const inner = (value as $IntentionalAny)[p];

@@ -75,0 +75,0 @@ return (cb: (inner: unknown) => unknown) => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc