diff options
Diffstat (limited to 'node_modules/convert-source-map')
-rw-r--r-- | node_modules/convert-source-map/LICENSE | 23 | ||||
-rw-r--r-- | node_modules/convert-source-map/README.md | 125 | ||||
-rw-r--r-- | node_modules/convert-source-map/index.js | 136 | ||||
-rw-r--r-- | node_modules/convert-source-map/package.json | 72 |
4 files changed, 0 insertions, 356 deletions
diff --git a/node_modules/convert-source-map/LICENSE b/node_modules/convert-source-map/LICENSE deleted file mode 100644 index 41702c5..0000000 --- a/node_modules/convert-source-map/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2013 Thorsten Lorenz. -All rights reserved. - -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/convert-source-map/README.md b/node_modules/convert-source-map/README.md deleted file mode 100644 index 86b218e..0000000 --- a/node_modules/convert-source-map/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# convert-source-map [](http://travis-ci.org/thlorenz/convert-source-map) - -<a href="https://www.patreon.com/bePatron?u=8663953"><img alt="become a patron" src="https://c5.patreon.com/external/logo/become_a_patron_button.png" height="35px"></a> - -Converts a source-map from/to different formats and allows adding/changing properties. - -```js -var convert = require('convert-source-map'); - -var json = convert - .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .toJSON(); - -var modified = convert - .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .setProperty('sources', [ 'SRC/FOO.JS' ]) - .toJSON(); - -console.log(json); -console.log(modified); -``` - -```json -{"version":3,"file":"build/foo.min.js","sources":["src/foo.js"],"names":[],"mappings":"AAAA","sourceRoot":"/"} -{"version":3,"file":"build/foo.min.js","sources":["SRC/FOO.JS"],"names":[],"mappings":"AAAA","sourceRoot":"/"} -``` - -## API - -### fromObject(obj) - -Returns source map converter from given object. - -### fromJSON(json) - -Returns source map converter from given json string. - -### fromBase64(base64) - -Returns source map converter from given base64 encoded json string. - -### fromComment(comment) - -Returns source map converter from given base64 encoded json string prefixed with `//# sourceMappingURL=...`. - -### fromMapFileComment(comment, mapFileDir) - -Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`. - -`filename` must point to a file that is found inside the `mapFileDir`. Most tools store this file right next to the -generated file, i.e. the one containing the source map. - -### fromSource(source) - -Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. - -### fromMapFileSource(source, mapFileDir) - -Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was -found. - -The sourcemap will be read from the map file found by parsing `# sourceMappingURL=file` comment. For more info see -fromMapFileComment. - -### toObject() - -Returns a copy of the underlying source map. - -### toJSON([space]) - -Converts source map to json string. If `space` is given (optional), this will be passed to -[JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the -JSON string is generated. - -### toBase64() - -Converts source map to base64 encoded json string. - -### toComment([options]) - -Converts source map to an inline comment that can be appended to the source-file. - -By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would -normally see in a JS source file. - -When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file. - -### addProperty(key, value) - -Adds given property to the source map. Throws an error if property already exists. - -### setProperty(key, value) - -Sets given property to the source map. If property doesn't exist it is added, otherwise its value is updated. - -### getProperty(key) - -Gets given property of the source map. - -### removeComments(src) - -Returns `src` with all source map comments removed - -### removeMapFileComments(src) - -Returns `src` with all source map comments pointing to map files removed. - -### commentRegex - -Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments. - -### mapFileCommentRegex - -Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments pointing to map files. - -### generateMapFileComment(file, [options]) - -Returns a comment that links to an external source map via `file`. - -By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would normally see in a JS source file. - -When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file. - - -[](https://bitdeli.com/free "Bitdeli Badge") diff --git a/node_modules/convert-source-map/index.js b/node_modules/convert-source-map/index.js deleted file mode 100644 index 3aeae10..0000000 --- a/node_modules/convert-source-map/index.js +++ /dev/null @@ -1,136 +0,0 @@ -'use strict'; -var fs = require('fs'); -var path = require('path'); -var SafeBuffer = require('safe-buffer'); - -Object.defineProperty(exports, 'commentRegex', { - get: function getCommentRegex () { - return /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg; - } -}); - -Object.defineProperty(exports, 'mapFileCommentRegex', { - get: function getMapFileCommentRegex () { - // Matches sourceMappingURL in either // or /* comment styles. - return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg; - } -}); - - -function decodeBase64(base64) { - return SafeBuffer.Buffer.from(base64, 'base64').toString(); -} - -function stripComment(sm) { - return sm.split(',').pop(); -} - -function readFromFileMap(sm, dir) { - // NOTE: this will only work on the server since it attempts to read the map file - - var r = exports.mapFileCommentRegex.exec(sm); - - // for some odd reason //# .. captures in 1 and /* .. */ in 2 - var filename = r[1] || r[2]; - var filepath = path.resolve(dir, filename); - - try { - return fs.readFileSync(filepath, 'utf8'); - } catch (e) { - throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e); - } -} - -function Converter (sm, opts) { - opts = opts || {}; - - if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir); - if (opts.hasComment) sm = stripComment(sm); - if (opts.isEncoded) sm = decodeBase64(sm); - if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm); - - this.sourcemap = sm; -} - -Converter.prototype.toJSON = function (space) { - return JSON.stringify(this.sourcemap, null, space); -}; - -Converter.prototype.toBase64 = function () { - var json = this.toJSON(); - return SafeBuffer.Buffer.from(json, 'utf8').toString('base64'); -}; - -Converter.prototype.toComment = function (options) { - var base64 = this.toBase64(); - var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; - return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; -}; - -// returns copy instead of original -Converter.prototype.toObject = function () { - return JSON.parse(this.toJSON()); -}; - -Converter.prototype.addProperty = function (key, value) { - if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead'); - return this.setProperty(key, value); -}; - -Converter.prototype.setProperty = function (key, value) { - this.sourcemap[key] = value; - return this; -}; - -Converter.prototype.getProperty = function (key) { - return this.sourcemap[key]; -}; - -exports.fromObject = function (obj) { - return new Converter(obj); -}; - -exports.fromJSON = function (json) { - return new Converter(json, { isJSON: true }); -}; - -exports.fromBase64 = function (base64) { - return new Converter(base64, { isEncoded: true }); -}; - -exports.fromComment = function (comment) { - comment = comment - .replace(/^\/\*/g, '//') - .replace(/\*\/$/g, ''); - - return new Converter(comment, { isEncoded: true, hasComment: true }); -}; - -exports.fromMapFileComment = function (comment, dir) { - return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true }); -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromSource = function (content) { - var m = content.match(exports.commentRegex); - return m ? exports.fromComment(m.pop()) : null; -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromMapFileSource = function (content, dir) { - var m = content.match(exports.mapFileCommentRegex); - return m ? exports.fromMapFileComment(m.pop(), dir) : null; -}; - -exports.removeComments = function (src) { - return src.replace(exports.commentRegex, ''); -}; - -exports.removeMapFileComments = function (src) { - return src.replace(exports.mapFileCommentRegex, ''); -}; - -exports.generateMapFileComment = function (file, options) { - var data = 'sourceMappingURL=' + file; - return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; -}; diff --git a/node_modules/convert-source-map/package.json b/node_modules/convert-source-map/package.json deleted file mode 100644 index e57cc8a..0000000 --- a/node_modules/convert-source-map/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "convert-source-map@^1.5.1", - "_id": "convert-source-map@1.7.0", - "_inBundle": false, - "_integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "_location": "/convert-source-map", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "convert-source-map@^1.5.1", - "name": "convert-source-map", - "escapedName": "convert-source-map", - "rawSpec": "^1.5.1", - "saveSpec": null, - "fetchSpec": "^1.5.1" - }, - "_requiredBy": [ - "/babel-core" - ], - "_resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "_shasum": "17a2cb882d7f77d3490585e2ce6c524424a3a442", - "_spec": "convert-source-map@^1.5.1", - "_where": "/home/pruss/Dev/3-minute-website/node_modules/babel-core", - "author": { - "name": "Thorsten Lorenz", - "email": "thlorenz@gmx.de", - "url": "http://thlorenz.com" - }, - "browser": { - "fs": false - }, - "bugs": { - "url": "https://github.com/thlorenz/convert-source-map/issues" - }, - "bundleDependencies": false, - "dependencies": { - "safe-buffer": "~5.1.1" - }, - "deprecated": false, - "description": "Converts a source-map from/to different formats and allows adding/changing properties.", - "devDependencies": { - "inline-source-map": "~0.6.2", - "tap": "~9.0.0" - }, - "engine": { - "node": ">=0.6" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/thlorenz/convert-source-map", - "keywords": [ - "convert", - "sourcemap", - "source", - "map", - "browser", - "debug" - ], - "license": "MIT", - "main": "index.js", - "name": "convert-source-map", - "repository": { - "type": "git", - "url": "git://github.com/thlorenz/convert-source-map.git" - }, - "scripts": { - "test": "tap test/*.js --color" - }, - "version": "1.7.0" -} |