Socket
Socket
Sign inDemoInstall

@web/browser-logs

Package Overview
Dependencies
Maintainers
7
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web/browser-logs - npm Package Compare versions

Comparing version 0.0.0-canary-20230420104136 to 0.0.0-canary-20231122093600

28

dist/browserScript.js

@@ -1,16 +0,14 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserScript = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
import fs from 'fs';
import path from 'path';
import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const REGEXP_SOURCE_MAP = /\/\/# sourceMappingURL=.*/;
const serializeScript = fs_1.default
.readFileSync(path_1.default.resolve(__dirname, 'serialize.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '');
const logUncaughtErrorsScript = fs_1.default
.readFileSync(path_1.default.resolve(__dirname, 'logUncaughtErrors.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '');
const serializeScript = fs
.readFileSync(path.resolve(__dirname, '../dist/serialize.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '')
.replaceAll(/export /g, '');
const logUncaughtErrorsScript = fs
.readFileSync(path.resolve(__dirname, '../dist/logUncaughtErrors.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '')
.replaceAll(/export /g, '');
/**

@@ -22,5 +20,5 @@ * Create the browser script. This project is compiled as CJS because it also needs to run in node, so

*/
exports.browserScript = '(function () { var module={};var exports={};\n' +
export const browserScript = '(function () { var module={};var exports={};\n' +
`${serializeScript}\n${logUncaughtErrorsScript}\n` +
'\nwindow.__wtr_browser_logs__ = { serialize }; })();';
//# sourceMappingURL=browserScript.js.map

@@ -1,2 +0,2 @@

import { ParseStackTraceOptions } from './parseStackTrace';
import { ParseStackTraceOptions } from './parseStackTrace.js';
interface DeserializeOptions extends ParseStackTraceOptions {

@@ -3,0 +3,0 @@ }

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserialize = void 0;
const parseStackTrace_1 = require("./parseStackTrace");
import { parseStackTrace } from './parseStackTrace.js';
const KEY_WTR_TYPE = '__WTR_TYPE__';

@@ -54,3 +51,3 @@ const KEY_CONSTRUCTOR_NAME = '__WTR_CONSTRUCTOR_NAME__';

if (value.stack) {
const parsePromise = parseStackTrace_1.parseStackTrace(value.message, value.stack, options)
const parsePromise = parseStackTrace(value.message, value.stack, options)
.then(parsedStack => {

@@ -101,3 +98,3 @@ if (parsedStack) {

const { hasOwnProperty } = Object.prototype;
async function deserialize(value, options) {
export async function deserialize(value, options) {
try {

@@ -121,3 +118,2 @@ const promises = [];

}
exports.deserialize = deserialize;
//# sourceMappingURL=deserialize.js.map

@@ -1,4 +0,4 @@

export { deserialize } from './deserialize';
export { browserScript } from './browserScript';
export { parseStackTrace, StackLocation, MapStackLocation } from './parseStackTrace';
export { deserialize } from './deserialize.js';
export { browserScript } from './browserScript.js';
export { MapBrowserUrl, parseStackTrace, StackLocation, MapStackLocation, } from './parseStackTrace.js';
//# sourceMappingURL=index.d.ts.map

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStackTrace = exports.browserScript = exports.deserialize = void 0;
var deserialize_1 = require("./deserialize");
Object.defineProperty(exports, "deserialize", { enumerable: true, get: function () { return deserialize_1.deserialize; } });
var browserScript_1 = require("./browserScript");
Object.defineProperty(exports, "browserScript", { enumerable: true, get: function () { return browserScript_1.browserScript; } });
var parseStackTrace_1 = require("./parseStackTrace");
Object.defineProperty(exports, "parseStackTrace", { enumerable: true, get: function () { return parseStackTrace_1.parseStackTrace; } });
export { deserialize } from './deserialize.js';
export { browserScript } from './browserScript.js';
export { parseStackTrace, } from './parseStackTrace.js';
//# sourceMappingURL=index.js.map

@@ -9,4 +9,4 @@ interface Location {

}
export declare type MapStackLocation = (location: StackLocation) => StackLocation | Promise<StackLocation>;
export declare type MapBrowserUrl = (url: URL) => string;
export type MapStackLocation = (location: StackLocation) => StackLocation | Promise<StackLocation>;
export type MapBrowserUrl = (url: URL) => string;
export interface ParseStackTraceOptions {

@@ -13,0 +13,0 @@ browserRootDir?: string;

@@ -1,28 +0,5 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStackTrace = void 0;
const errorStacks = __importStar(require("errorstacks"));
const path_1 = __importDefault(require("path"));
// We're using this fork of errorstacks until
// https://github.com/marvinhagemeister/errorstacks/pull/22#issuecomment-1775961444 is fixed
import * as errorStacks from '@koddsson/errorstacks';
import path from 'path';
// regexp to match a stack track that is only a full address

@@ -57,3 +34,3 @@ const REGEXP_ADDRESS = /^(http(s)?:\/\/.*)(:\d+)(:\d+)$/;

}
catch (_a) {
catch {
return undefined;

@@ -72,4 +49,4 @@ }

}
const relativeFileName = path_1.default.relative(cwd, mappedLocation.filePath);
return Object.assign(Object.assign({}, mappedLocation), { filePath: relativeFileName });
const relativeFileName = path.relative(cwd, mappedLocation.filePath);
return { ...mappedLocation, filePath: relativeFileName };
}

@@ -95,3 +72,3 @@ async function formatFrame(f, cwd, mapBrowserUrl, mapStackLocation) {

}
async function parseStackTrace(errorMsg, rawStack, options = {}) {
export async function parseStackTrace(errorMsg, rawStack, options = {}) {
if (rawStack === '' || (rawStack.split('\n').length === 1 && rawStack.includes(errorMsg))) {

@@ -102,3 +79,3 @@ // there is no track trace, or it's only an error message

const defaultCwd = process.cwd();
const { browserRootDir = defaultCwd, cwd = defaultCwd, mapStackLocation = l => l, mapBrowserUrl = p => path_1.default.join(browserRootDir, p.pathname.split('/').join(path_1.default.sep)), } = options;
const { browserRootDir = defaultCwd, cwd = defaultCwd, mapStackLocation = l => l, mapBrowserUrl = p => path.join(browserRootDir, p.pathname.split('/').join(path.sep)), } = options;
const allFrames = errorStacks.parseStackTrace(rawStack);

@@ -120,3 +97,2 @@ const frames = filterStackFrames(allFrames);

}
exports.parseStackTrace = parseStackTrace;
//# sourceMappingURL=parseStackTrace.js.map

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serialize = void 0;
/* eslint-disable no-var */

@@ -12,3 +9,3 @@ var KEY_WTR_TYPE = '__WTR_TYPE__';

}
catch (_a) {
catch {
return fallback;

@@ -60,3 +57,3 @@ }

}
catch (_a) {
catch {
// some objects don't allow being written to

@@ -112,3 +109,3 @@ }

}
function serialize(value) {
export function serialize(value) {
try {

@@ -123,3 +120,2 @@ return JSON.stringify(value, createReplacer());

}
exports.serialize = serialize;
//# sourceMappingURL=serialize.js.map
// this file is autogenerated with the generate-mjs-dts-entrypoints script
export * from './dist/index';
export * from './dist/index.js';
{
"name": "@web/browser-logs",
"version": "0.0.0-canary-20230420104136",
"version": "0.0.0-canary-20231122093600",
"publishConfig": {

@@ -16,5 +16,6 @@ "access": "public"

"homepage": "https://github.com/modernweb-dev/web/tree/master/packages/browser-logs",
"main": "dist/index.js",
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.mjs",

@@ -25,3 +26,3 @@ "require": "./dist/index.js"

"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},

@@ -51,8 +52,8 @@ "scripts": {

"dependencies": {
"errorstacks": "^2.2.0"
"@koddsson/errorstacks": "^2.4.1"
},
"devDependencies": {
"@esm-bundle/chai": "^4.1.5",
"puppeteer": "^19.8.2"
"puppeteer": "^21.5.0"
}
}
import fs from 'fs';
import path from 'path';
import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const REGEXP_SOURCE_MAP = /\/\/# sourceMappingURL=.*/;
const serializeScript = fs
.readFileSync(path.resolve(__dirname, 'serialize.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '');
.readFileSync(path.resolve(__dirname, '../dist/serialize.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '')
.replaceAll(/export /g, '');
const logUncaughtErrorsScript = fs
.readFileSync(path.resolve(__dirname, 'logUncaughtErrors.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '');
.readFileSync(path.resolve(__dirname, '../dist/logUncaughtErrors.js'), 'utf-8')
.replace(REGEXP_SOURCE_MAP, '')
.replaceAll(/export /g, '');

@@ -13,0 +18,0 @@ /**

@@ -1,2 +0,2 @@

import { ParseStackTraceOptions, parseStackTrace } from './parseStackTrace';
import { ParseStackTraceOptions, parseStackTrace } from './parseStackTrace.js';

@@ -3,0 +3,0 @@ const KEY_WTR_TYPE = '__WTR_TYPE__';

@@ -1,3 +0,8 @@

export { deserialize } from './deserialize';
export { browserScript } from './browserScript';
export { parseStackTrace, StackLocation, MapStackLocation } from './parseStackTrace';
export { deserialize } from './deserialize.js';
export { browserScript } from './browserScript.js';
export {
MapBrowserUrl,
parseStackTrace,
StackLocation,
MapStackLocation,
} from './parseStackTrace.js';

@@ -1,2 +0,4 @@

import * as errorStacks from 'errorstacks';
// We're using this fork of errorstacks until
// https://github.com/marvinhagemeister/errorstacks/pull/22#issuecomment-1775961444 is fixed
import * as errorStacks from '@koddsson/errorstacks';
import path from 'path';

@@ -3,0 +5,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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