Socket
Socket
Sign inDemoInstall

@tapjs/stack

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/stack - npm Package Compare versions

Comparing version 0.0.0-1 to 0.0.0-2

dist/cjs/require-resolve.d.ts

6

dist/cjs/index.d.ts

@@ -40,2 +40,6 @@ import { CallSiteLike } from './call-site-like.js';

/**
* exported for testing, no real purpose, but also no harm in looking
*/
export declare const getIgnoredPackagesRE: () => RegExp | undefined;
/**
* Set whether or not the list of ignored packages should

@@ -61,3 +65,3 @@ * be excluded from stack traces.

* if a capture() is triggered in any of the methods used by the
* CallSiteLike constructor (for example, if @tapjs/intercept is used to
* CallSiteLike constructor (for example, if `@tapjs/intercept` is used to
* capture the process.cwd() method, which is used by path.resolve()),

@@ -64,0 +68,0 @@ * then that will cause problems. To work around this, if a re-entry is

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStack = exports.captureErrorString = exports.captureError = exports.captureString = exports.at = exports.capture = exports.getFilterIgnoredPackages = exports.setFilterIgnoredPackages = exports.getIgnoredPackages = exports.removeIgnoredPackage = exports.addIgnoredPackage = exports.setFilterNodeInternals = exports.getFilterNodeInternals = exports.getCwd = exports.setCwd = exports.CallSiteLike = void 0;
const module_1 = require("module");
exports.parseStack = exports.captureErrorString = exports.captureError = exports.captureString = exports.at = exports.capture = exports.getFilterIgnoredPackages = exports.setFilterIgnoredPackages = exports.getIgnoredPackagesRE = exports.getIgnoredPackages = exports.removeIgnoredPackage = exports.addIgnoredPackage = exports.setFilterNodeInternals = exports.getFilterNodeInternals = exports.getCwd = exports.setCwd = exports.CallSiteLike = void 0;
const node_module_1 = require("node:module");
const node_path_1 = require("node:path");
const call_site_like_js_1 = require("./call-site-like.js");
const require_resolve_js_1 = require("./require-resolve.js");
var call_site_like_js_2 = require("./call-site-like.js");

@@ -42,3 +44,3 @@ Object.defineProperty(exports, "CallSiteLike", { enumerable: true, get: function () { return call_site_like_js_2.CallSiteLike; } });

// these are packages that function somewhat like node internals,
// for tap's purposes, and @tapjs packages themselves, when loaded
// for tap's purposes, and `@tapjs` packages themselves, when loaded
// from node_modules.

@@ -85,2 +87,11 @@ const ignoredPackages = [

exports.getIgnoredPackages = getIgnoredPackages;
const getTestBuiltPath = () => {
const p = (0, require_resolve_js_1.requireResolve)('@tapjs/test');
// we'll always find the test class in this project
/* c8 ignore start */
if (!p)
return '';
/* c8 ignore stop */
return (0, node_path_1.resolve)(p, '../../../test-built');
};
const buildIgnoredPackages = () => {

@@ -92,5 +103,23 @@ // just a safety precaution, no reason to ever do this

/* c8 ignore stop */
const p = ignoredPackages.map(s => regExpEscape(s));
return new RegExp(`[/\\\\]node_modules[/\\\\](?:${p.join('|')})([/\\\\]|$)`);
const p = ignoredPackages.map(s => regExpEscape(s)).join('|');
const nm = `[/\\\\]node_modules[/\\\\](?:${p})([/\\\\]|$)`;
// if we are ignoring @tapjs/test, then also ignore its built
// plugged-in implementation. This is only relevant when developing
// this project, or other cases where @tapjs/test may be linked,
// because when it's loaded from node_modules, it'll be excluded
// by virtue of being in that folder anyhow.
const built = ignoredPackages.includes('@tapjs') ||
ignoredPackages.includes('@tapjs/test')
? getTestBuiltPath()
: '';
const re = built ? `${built}([/\\\\].*|$)|${nm}` : nm;
return new RegExp(re);
};
/**
* exported for testing, no real purpose, but also no harm in looking
*/
const getIgnoredPackagesRE = () => !dirty
? ignoredPackagesRE
: (ignoredPackagesRE = buildIgnoredPackages());
exports.getIgnoredPackagesRE = getIgnoredPackagesRE;
let ignoredPackagesRE = buildIgnoredPackages();

@@ -137,3 +166,3 @@ let filterIgnoredPackages = true;

return ((!filterNodeInternals ||
!(s.startsWith('node:') || module_1.builtinModules.includes(s))) &&
!(s.startsWith('node:') || node_module_1.builtinModules.includes(s))) &&
(!filterIgnoredPackages || !ignoredPackagesRE?.test(s)));

@@ -140,0 +169,0 @@ };

@@ -40,2 +40,6 @@ import { CallSiteLike } from './call-site-like.js';

/**
* exported for testing, no real purpose, but also no harm in looking
*/
export declare const getIgnoredPackagesRE: () => RegExp | undefined;
/**
* Set whether or not the list of ignored packages should

@@ -61,3 +65,3 @@ * be excluded from stack traces.

* if a capture() is triggered in any of the methods used by the
* CallSiteLike constructor (for example, if @tapjs/intercept is used to
* CallSiteLike constructor (for example, if `@tapjs/intercept` is used to
* capture the process.cwd() method, which is used by path.resolve()),

@@ -64,0 +68,0 @@ * then that will cause problems. To work around this, if a re-entry is

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

import { builtinModules } from 'module';
import { builtinModules } from 'node:module';
import { resolve } from 'node:path';
import { CallSiteLike } from './call-site-like.js';
import { requireResolve } from './require-resolve.js';
export { CallSiteLike } from './call-site-like.js';

@@ -34,3 +36,3 @@ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');

// these are packages that function somewhat like node internals,
// for tap's purposes, and @tapjs packages themselves, when loaded
// for tap's purposes, and `@tapjs` packages themselves, when loaded
// from node_modules.

@@ -74,2 +76,11 @@ const ignoredPackages = [

export const getIgnoredPackages = () => Object.freeze(ignoredPackages.slice(0));
const getTestBuiltPath = () => {
const p = requireResolve('@tapjs/test');
// we'll always find the test class in this project
/* c8 ignore start */
if (!p)
return '';
/* c8 ignore stop */
return resolve(p, '../../../test-built');
};
const buildIgnoredPackages = () => {

@@ -81,5 +92,22 @@ // just a safety precaution, no reason to ever do this

/* c8 ignore stop */
const p = ignoredPackages.map(s => regExpEscape(s));
return new RegExp(`[/\\\\]node_modules[/\\\\](?:${p.join('|')})([/\\\\]|$)`);
const p = ignoredPackages.map(s => regExpEscape(s)).join('|');
const nm = `[/\\\\]node_modules[/\\\\](?:${p})([/\\\\]|$)`;
// if we are ignoring @tapjs/test, then also ignore its built
// plugged-in implementation. This is only relevant when developing
// this project, or other cases where @tapjs/test may be linked,
// because when it's loaded from node_modules, it'll be excluded
// by virtue of being in that folder anyhow.
const built = ignoredPackages.includes('@tapjs') ||
ignoredPackages.includes('@tapjs/test')
? getTestBuiltPath()
: '';
const re = built ? `${built}([/\\\\].*|$)|${nm}` : nm;
return new RegExp(re);
};
/**
* exported for testing, no real purpose, but also no harm in looking
*/
export const getIgnoredPackagesRE = () => !dirty
? ignoredPackagesRE
: (ignoredPackagesRE = buildIgnoredPackages());
let ignoredPackagesRE = buildIgnoredPackages();

@@ -86,0 +114,0 @@ let filterIgnoredPackages = true;

2

package.json
{
"name": "@tapjs/stack",
"version": "0.0.0-1",
"version": "0.0.0-2",
"description": "Utility for working with stack traces",

@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",

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