Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN npm run build

RUN npm pack --verbose packages/core/
RUN npm pack --verbose packages/node/
RUN npm pack --verbose packages/path-normalizer/
RUN npm pack --verbose packages/plugin-express/
RUN npm pack --verbose packages/plugin-koa/
RUN npm pack --verbose packages/plugin-restify/
Expand Down
113 changes: 95 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"default": "./dist/index.cjs"
},
"./lib/es-utils/assign": "./src/lib/es-utils/assign.js",
"./lib/es-utils/includes": "./src/lib/es-utils/includes.js",
"./lib/path-normalizer": "./src/lib/path-normalizer.js"
"./lib/es-utils/includes": "./src/lib/es-utils/includes.js"
},
"description": "Core classes and utilities for Bugsnag notifiers",
"homepage": "https://www.bugsnag.com/",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { default as extractObject } from './lib/extract-object'
export { default as intRange } from './lib/validators/int-range'
export { default as isError } from './lib/iserror'
export { default as listOfFunctions } from './lib/validators/list-of-functions'
export { default as runCallbacks } from "./lib/callback-runner";
export { default as runCallbacks } from './lib/callback-runner'
export { default as runSyncCallbacks } from './lib/sync-callback-runner'
export { default as stringWithLength } from './lib/validators/string-with-length'

Expand Down
1 change: 1 addition & 0 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@bugsnag/delivery-electron": "^8.4.0",
"@bugsnag/electron-filestore": "^8.0.0",
"@bugsnag/electron-network-status": "^8.4.0",
"@bugsnag/path-normalizer": "^8.4.0",
"@bugsnag/plugin-console-breadcrumbs": "^8.4.0",
"@bugsnag/plugin-electron-app": "^8.4.0",
"@bugsnag/plugin-electron-app-breadcrumbs": "^8.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron/src/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const createMainClient = (opts) => {
// Normalise the project root upfront so renderers have a fully resolved path
// The renderers can't do this themselves as they cannot access the 'path' module
if (opts.projectRoot) {
const normalizePath = require('@bugsnag/core/lib/path-normalizer')
const normalizePath = require('@bugsnag/path-normalizer')
opts.projectRoot = normalizePath(opts.projectRoot)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/electron/src/config/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { schema } = require('./common')
const { listOfFunctions, stringWithLength } = require('@bugsnag/core')
const { inspect } = require('util')
const { app } = require('electron')
const normalizePath = require('@bugsnag/core/lib/path-normalizer')
const normalizePath = require('@bugsnag/path-normalizer')

module.exports.schema = {
...schema,
Expand Down
21 changes: 21 additions & 0 deletions packages/path-normalizer/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Bugsnag

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions packages/path-normalizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# @bugsnag/path-normalizer

A utility for normalizing file paths by making them absolute and adding trailing slashes for directories.

## Installation

```bash
npm install @bugsnag/path-normalizer
```

## Usage

```javascript
const normalizePath = require('@bugsnag/path-normalizer')

// Normalize a path
const normalizedPath = normalizePath('./some/relative/path')
// Returns: '/absolute/path/to/some/relative/path/'
```

## License

MIT
38 changes: 38 additions & 0 deletions packages/path-normalizer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@bugsnag/path-normalizer",
"version": "8.4.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"default": "./dist/index.js"
}
},
"description": "Path normalization utility for Bugsnag",
"homepage": "https://www.bugsnag.com/",
"repository": {
"type": "git",
"url": "git@github.com:bugsnag/bugsnag-js.git"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist"
],
"scripts": {
"build": "rollup --config rollup.config.js",
"test:types": "tsc -p tsconfig.json"
},
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"rollup": "^4.24.0",
"typescript": "^5.7.2"
}
}
47 changes: 47 additions & 0 deletions packages/path-normalizer/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-env node */
/* global require, module */
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const typescript = require('@rollup/plugin-typescript')

module.exports = [
// CommonJS build
{
input: 'src/index.ts',
output: {
file: 'dist/index.js',
format: 'cjs',
exports: 'default'
},
plugins: [
nodeResolve({
preferBuiltins: true
}),
commonjs(),
typescript({
declaration: true,
declarationDir: 'dist',
rootDir: 'src'
})
],
external: ['path']
},
// ES Module build
{
input: 'src/index.ts',
output: {
file: 'dist/index.mjs',
format: 'es'
},
plugins: [
nodeResolve({
preferBuiltins: true
}),
commonjs(),
typescript({
declaration: false
})
],
external: ['path']
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { join, resolve } = require('path')
import { join, resolve } from 'path'

// normalise a path to a directory, adding a trailing slash if it doesn't already
// have one and resolve it to make it absolute (e.g. get rid of any ".."s)
module.exports = p => join(resolve(p), '/')
const normalizePath = (p: string) => join(resolve(p), '/')

export default normalizePath
8 changes: 8 additions & 0 deletions packages/path-normalizer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"include": ["."],
"compilerOptions": {
"lib": ["es2017"],
"types": ["node"]
}
}
Loading