diff options
Diffstat (limited to 'node_modules/espower-location-detector')
7 files changed, 0 insertions, 276 deletions
diff --git a/node_modules/espower-location-detector/CHANGELOG.md b/node_modules/espower-location-detector/CHANGELOG.md deleted file mode 100644 index d442f8eb7..000000000 --- a/node_modules/espower-location-detector/CHANGELOG.md +++ /dev/null @@ -1,30 +0,0 @@ -## [1.0.0](https://github.com/twada/espower-location-detector/releases/tag/v1.0.0) (2016-12-31) - - -#### Chores - - * The first stable release - - -### [0.1.2](https://github.com/twada/espower-location-detector/releases/tag/v0.1.2) (2016-02-10) - - -#### Bug Fixes - - * dealing with incoming empty SourceMap ([6f45640f](https://github.com/twada/espower-location-detector/commit/6f45640fbf4db23e327b087df8671f3d9203fb09)) - - -### [0.1.1](https://github.com/twada/espower-location-detector/releases/tag/v0.1.1) (2015-12-31) - - -#### Bug Fixes - - * mark lib dir to be distributed ([ca23cce1](https://github.com/twada/espower-location-detector/commit/ca23cce1a3458658cba1623cb853635822b107bb)) - - -## [0.1.0](https://github.com/twada/espower-location-detector/releases/tag/v0.1.0) (2015-12-31) - - -#### Features - - * initial release (extract espower-location-detector from espower) diff --git a/node_modules/espower-location-detector/LICENSE b/node_modules/espower-location-detector/LICENSE deleted file mode 100644 index 401d3a186..000000000 --- a/node_modules/espower-location-detector/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2015-2016 Takuto Wada, https://github.com/twada/espower-location-detector - -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. diff --git a/node_modules/espower-location-detector/README.md b/node_modules/espower-location-detector/README.md deleted file mode 100644 index 21059ac8a..000000000 --- a/node_modules/espower-location-detector/README.md +++ /dev/null @@ -1,53 +0,0 @@ -espower-location-detector -================================ - -AST source location detection helper for power-assert - -[![Build Status][travis-image]][travis-url] -[![NPM version][npm-image]][npm-url] -[![Dependency Status][depstat-image]][depstat-url] -[![License][license-image]][license-url] - - -DESCRIPTION ---------------------------------------- - -`espower-location-detector` is a AST source location detection helper for [power-assert](https://github.com/power-assert-js/power-assert), intended to be used by [espower](https://github.com/power-assert-js/espower) and [babel-plugin-espower](https://github.com/power-assert-js/babel-plugin-espower). - - -INSTALL ---------------------------------------- - -``` -$ npm install espower-location-detector -``` - - -AUTHOR ---------------------------------------- -* [Takuto Wada](https://github.com/twada) - - -SUPPORT POLICY ---------------------------------------- - -[Node under maintenance](https://github.com/nodejs/LTS) is supported. - -NOTE: If espower-location-detector works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk. - - -LICENSE ---------------------------------------- -Licensed under the [MIT](https://github.com/twada/espower-location-detector/blob/master/LICENSE) license. - -[npm-url]: https://npmjs.org/package/espower-location-detector -[npm-image]: https://badge.fury.io/js/espower-location-detector.svg - -[travis-url]: https://travis-ci.org/twada/espower-location-detector -[travis-image]: https://secure.travis-ci.org/twada/espower-location-detector.svg?branch=master - -[depstat-url]: https://gemnasium.com/twada/espower-location-detector -[depstat-image]: https://gemnasium.com/twada/espower-location-detector.svg - -[license-url]: https://github.com/twada/espower-location-detector/blob/master/LICENSE -[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg diff --git a/node_modules/espower-location-detector/index.js b/node_modules/espower-location-detector/index.js deleted file mode 100644 index 16f4a4115..000000000 --- a/node_modules/espower-location-detector/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * espower-location-detector: - * AST source location detection helper for power-assert - * - * https://github.com/twada/espower-location-detector - * - * Copyright (c) 2015-2016 Takuto Wada - * Licensed under the MIT license. - * https://github.com/twada/espower-location-detector/blob/master/LICENSE - */ -'use strict'; - -var PositionDetector = require('./lib/position-detector'); -var SourceAdjuster = require('./lib/source-adjuster'); - -function EspowerLocationDetector (options) { - this.positionDetector = new PositionDetector(options.sourceMap); - this.sourceAdjuster = new SourceAdjuster(options.sourceRoot, options.path, options.sourceMap); -} - -EspowerLocationDetector.prototype.locationFor = function (currentNode) { - var pos = this.positionDetector.positionFor(currentNode); - return { - source: this.sourceAdjuster.relativize(pos.source, pos.mapped), - line: pos.line, - column: pos.column - }; -}; - -module.exports = EspowerLocationDetector; diff --git a/node_modules/espower-location-detector/lib/position-detector.js b/node_modules/espower-location-detector/lib/position-detector.js deleted file mode 100644 index a9ef278ab..000000000 --- a/node_modules/espower-location-detector/lib/position-detector.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var SourceMapConsumer = require('source-map').SourceMapConsumer; -var extend = require('xtend'); - -function isEmptyMapping (pos) { - return ['source', 'line', 'column', 'name'].every(function (prop) { - return pos[prop] === null; - }); -} - -function PositionDetector (sourceMap) { - if (sourceMap) { - this.sourceMapConsumer = new SourceMapConsumer(sourceMap); - } -} -PositionDetector.prototype.positionFor = function (currentNode) { - var currentPosition = { - source: currentNode.loc.source, - line: currentNode.loc.start.line, - column: currentNode.loc.start.column - }; - if (this.sourceMapConsumer) { - var found = this.sourceMapConsumer.originalPositionFor(currentPosition); - if (found && !isEmptyMapping(found)) { - return extend({ mapped: true }, found); - } - } - return extend({ mapped: false }, currentPosition); -}; - -module.exports = PositionDetector; diff --git a/node_modules/espower-location-detector/lib/source-adjuster.js b/node_modules/espower-location-detector/lib/source-adjuster.js deleted file mode 100644 index 973b32a0f..000000000 --- a/node_modules/espower-location-detector/lib/source-adjuster.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -var _path = require('path'); -var isAbsolute = require('path-is-absolute'); -var isUrl = require('is-url'); - -function SourceAdjuster (sourceRoot, path, sourceMap) { - this.path = path; - this.sourceRoot = sourceRoot; - if (typeof sourceMap === 'string') { - this.sourceMap = JSON.parse(sourceMap.replace(/^\)\]\}'/, '')); - } else { - this.sourceMap = sourceMap; - } -} -SourceAdjuster.prototype.relativize = function (filepathOrUrl, mappedWithSourceMap) { - var filepath; - if (mappedWithSourceMap && filepathOrUrl && this.sourceMap) { - filepath = this.relativizeWithSourceMap(filepathOrUrl); - } else { - filepath = this.relativizeWithoutSourceMap(filepathOrUrl); - } - return fallbackOnBasename(filepath); -}; -SourceAdjuster.prototype.relativizeWithSourceMap = function (filepathOrUrl) { - var sourceMapRoot = this.sourceMap.sourceRoot; - if (sourceMapRoot && isUrl(sourceMapRoot)) { - return _path.relative(sourceMapRoot, filepathOrUrl); - } - if (this.sourceRoot && isAbsolute(this.sourceRoot) && isAbsolute(filepathOrUrl)) { - return _path.relative(this.sourceRoot, filepathOrUrl); - } - if (sourceMapRoot && isAbsolute(sourceMapRoot) && isAbsolute(filepathOrUrl)) { - return _path.relative(sourceMapRoot, filepathOrUrl); - } - if (isUrl(filepathOrUrl)) { - return _path.basename(filepathOrUrl); - } - return filepathOrUrl; -}; -SourceAdjuster.prototype.relativizeWithoutSourceMap = function (filepathOrUrl) { - var tmpPath = this.path || filepathOrUrl; - if (this.sourceRoot && isAbsolute(this.sourceRoot) && isAbsolute(tmpPath)) { - return _path.relative(this.sourceRoot, tmpPath); - } else { - return this.path; - } -}; - -function fallbackOnBasename (filepath) { - if (filepath) { - if (filepath.split(_path.sep).indexOf('..') !== -1) { - return _path.basename(filepath); - } else if (isUrl(filepath)) { - return _path.basename(filepath); - } else if (isAbsolute(filepath)) { - return _path.basename(filepath); - } - } - return filepath; -} - -module.exports = SourceAdjuster; diff --git a/node_modules/espower-location-detector/package.json b/node_modules/espower-location-detector/package.json deleted file mode 100644 index 92817f659..000000000 --- a/node_modules/espower-location-detector/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "espower-location-detector", - "description": "AST source location detection helper for power-assert", - "version": "1.0.0", - "author": { - "name": "Takuto Wada", - "email": "takuto.wada@gmail.com", - "url": "https://github.com/twada" - }, - "bugs": "https://github.com/twada/espower-location-detector/issues", - "dependencies": { - "is-url": "^1.2.1", - "path-is-absolute": "^1.0.0", - "source-map": "^0.5.0", - "xtend": "^4.0.0" - }, - "devDependencies": { - "acorn": "^3.3.0", - "escallmatch": "^1.5.0", - "escodegen": "^1.8.1", - "estraverse": "^4.2.0", - "jshint": "^2.9.3", - "mocha": "^3.0.2" - }, - "files": [ - "CHANGELOG.md", - "LICENSE", - "README.md", - "index.js", - "lib" - ], - "homepage": "https://github.com/twada/espower-location-detector", - "keywords": [ - "ast", - "estree", - "sourcemaps" - ], - "license": "MIT", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/twada/espower-location-detector.git" - }, - "scripts": { - "lint": "jshint index.js lib", - "test": "npm run lint && mocha test" - } -} |
