UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

113 lines (112 loc) 5.94 kB
{ "_args": [ [ { "raw": "get-source@^1.0.24", "scope": null, "escapedName": "get-source", "name": "get-source", "rawSpec": "^1.0.24", "spec": ">=1.0.24 <2.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/stacktracey" ] ], "_from": "get-source@>=1.0.24 <2.0.0", "_id": "get-source@1.0.27", "_inCache": true, "_location": "/get-source", "_nodeVersion": "4.9.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/get-source_1.0.27_1531778873347_0.7507801663959512" }, "_npmUser": { "name": "xpl", "email": "rocket.mind@gmail.com" }, "_npmVersion": "2.15.11", "_phantomChildren": {}, "_requested": { "raw": "get-source@^1.0.24", "scope": null, "escapedName": "get-source", "name": "get-source", "rawSpec": "^1.0.24", "spec": ">=1.0.24 <2.0.0", "type": "range" }, "_requiredBy": [ "/stacktracey" ], "_resolved": "https://registry.npmjs.org/get-source/-/get-source-1.0.27.tgz", "_shasum": "b92f8b5d61607ab81826eb22edd7dea1f48708d9", "_shrinkwrap": null, "_spec": "get-source@^1.0.24", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/stacktracey", "author": { "name": "Vitaly Gordon", "email": "rocket.mind@gmail.com" }, "bugs": { "url": "https://github.com/xpl/get-source/issues" }, "dependencies": { "data-uri-to-buffer": "^2.0.0", "source-map": "^0.6.0" }, "description": "Platform-agnostic source code inspection, with sourcemaps support", "devDependencies": { "chai": "^3.5.0", "chromedriver": "^2.32.3", "coveralls": "^2.13.1", "istanbul": "^0.4.5", "memory-fs": "^0.3.0", "mocha": "^3.5.3", "nyc": "^11.2.1", "selenium-webdriver": "^2.53.3", "webpack": "^3.6.0" }, "directories": {}, "dist": { "shasum": "b92f8b5d61607ab81826eb22edd7dea1f48708d9", "tarball": "https://registry.npmjs.org/get-source/-/get-source-1.0.27.tgz", "fileCount": 22, "unpackedSize": 208832 }, "gitHead": "766d136d009e352811075528d048a42d2c66b451", "homepage": "https://github.com/xpl/get-source", "keywords": [ "sources", "sourcemap", "read source", "cached sources" ], "license": "Unlicense", "main": "get-source", "maintainers": [ { "name": "x84", "email": "igor.kroitor@gmail.com" }, { "name": "xpl", "email": "rocket.mind@gmail.com" } ], "name": "get-source", "optionalDependencies": {}, "readme": "# get-source\n\n[![Build Status](https://travis-ci.org/xpl/get-source.svg?branch=master)](https://travis-ci.org/xpl/get-source) [![Coverage Status](https://coveralls.io/repos/github/xpl/get-source/badge.svg)](https://coveralls.io/github/xpl/get-source) [![npm](https://img.shields.io/npm/v/get-source.svg)](https://npmjs.com/package/get-source) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/xpl/get-source.svg)](https://scrutinizer-ci.com/g/xpl/get-source/?branch=master) [![dependencies Status](https://david-dm.org/xpl/get-source/status.svg)](https://david-dm.org/xpl/get-source)\n\nPlatform-agnostic source code inspection, with sourcemaps support.\n\n```bash\nnpm install get-source\n```\n\n## Features\n\n- [x] Allows to read source code files in Node and browsers\n- [x] Full sourcemap support (path resolving, external/embedded/inline linking, and long chains)\n- [x] **Synchronous** API — which is good when you implement a debugging tool (e.g. [logging](https://github.com/xpl/ololog))\n- [x] Built-in cache\n\n## What for\n\n- [x] Call stacks enhanced with source code information (see the [StackTracey](https://github.com/xpl/stacktracey) library)\n- [x] [Advanced logging](https://github.com/xpl/ololog) / assertion printing\n\n## Usage\n\n```javascript\ngetSource = require ('get-source')\n```\n```javascript\nfile = getSource ('./scripts/index.min.js')\n```\n\nWill read the file synchronously (either via XHR or by filesystem API, depending on the environment) and return it's cached representation. Result will contain the following fields:\n\n```javascript\nfile.path // normalized file path\nfile.text // text contents\nfile.lines // array of lines\n```\n\nAnd the `resolve` method:\n\n```javascript\nfile.resolve ({ line: 1, column: 8 }) // indexes here start from 1 (by widely accepted convention). Zero indexes are invalid.\n```\n\nIt will look through the sourcemap chain, returning following:\n\n```javascript\n{\n line: <original line number>,\n column: <original column number>,\n sourceFile: <original source file object>,\n sourceLine: <original source line text>\n}\n```\n\nIn that returned object, `sourceFile` is the same kind of object that `getSource` returns. So you can access its `text`, `lines` and `path` fields to obtain the full information. And the `sourceLine` is returned just for the convenience, as a shortcut.\n\n## Error handling\n\n```javascript\nnonsense = getSource ('/some/nonexistent/file')\n\nnonsense.text // should be '' (so it's safe to access without checking)\nnonsense.error // should be an Error object, representing an actual error thrown during reading/parsing\n```\n```javascript\nresolved = nonsense.resolve ({ line: 5, column: 0 })\n\nresolved.sourceLine // empty string (so it's safe to access without checking)\nresolved.error // should be an Error object, representing an actual error thrown during reading/parsing\n```\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/xpl/get-source.git" }, "scripts": { "coveralls": "nyc report --reporter=text-lcov | coveralls", "test": "nyc --reporter=html --reporter=text mocha test/test.path test/test.node --reporter spec", "test-browser": "mocha test/test.browser --reporter spec" }, "version": "1.0.27" }