Initial import with skill sheet working
This commit is contained in:
23
node_modules/convert-source-map/LICENSE
generated
vendored
Normal file
23
node_modules/convert-source-map/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
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.
|
206
node_modules/convert-source-map/README.md
generated
vendored
Normal file
206
node_modules/convert-source-map/README.md
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
# convert-source-map [![Build Status][ci-image]][ci-url]
|
||||
|
||||
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":"/"}
|
||||
```
|
||||
|
||||
## Upgrading
|
||||
|
||||
Prior to v2.0.0, the `fromMapFileComment` and `fromMapFileSource` functions took a String directory path and used that to resolve & read the source map file from the filesystem. However, this made the library limited to nodejs environments and broke on sources with querystrings.
|
||||
|
||||
In v2.0.0, you now need to pass a function that does the file reading. It will receive the source filename as a String that you can resolve to a filesystem path, URL, or anything else.
|
||||
|
||||
If you are using `convert-source-map` in nodejs and want the previous behavior, you'll use a function like such:
|
||||
|
||||
```diff
|
||||
+ var fs = require('fs'); // Import the fs module to read a file
|
||||
+ var path = require('path'); // Import the path module to resolve a path against your directory
|
||||
- var conv = convert.fromMapFileSource(css, '../my-dir');
|
||||
+ var conv = convert.fromMapFileSource(css, function (filename) {
|
||||
+ return fs.readFileSync(path.resolve('../my-dir', filename), 'utf-8');
|
||||
+ });
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### fromObject(obj)
|
||||
|
||||
Returns source map converter from given object.
|
||||
|
||||
### fromJSON(json)
|
||||
|
||||
Returns source map converter from given json string.
|
||||
|
||||
### fromURI(uri)
|
||||
|
||||
Returns source map converter from given uri encoded json string.
|
||||
|
||||
### fromBase64(base64)
|
||||
|
||||
Returns source map converter from given base64 encoded json string.
|
||||
|
||||
### fromComment(comment)
|
||||
|
||||
Returns source map converter from given base64 or uri encoded json string prefixed with `//# sourceMappingURL=...`.
|
||||
|
||||
### fromMapFileComment(comment, readMap)
|
||||
|
||||
Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`.
|
||||
|
||||
`readMap` must be a function which receives the source map filename and returns either a String or Buffer of the source map (if read synchronously), or a `Promise` containing a String or Buffer of the source map (if read asynchronously).
|
||||
|
||||
If `readMap` doesn't return a `Promise`, `fromMapFileComment` will return a source map converter synchronously.
|
||||
|
||||
If `readMap` returns a `Promise`, `fromMapFileComment` will also return `Promise`. The `Promise` will be either resolved with the source map converter or rejected with an error.
|
||||
|
||||
#### Examples
|
||||
|
||||
**Synchronous read in Node.js:**
|
||||
|
||||
```js
|
||||
var convert = require('convert-source-map');
|
||||
var fs = require('fs');
|
||||
|
||||
function readMap(filename) {
|
||||
return fs.readFileSync(filename, 'utf8');
|
||||
}
|
||||
|
||||
var json = convert
|
||||
.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
|
||||
.toJSON();
|
||||
console.log(json);
|
||||
```
|
||||
|
||||
|
||||
**Asynchronous read in Node.js:**
|
||||
|
||||
```js
|
||||
var convert = require('convert-source-map');
|
||||
var { promises: fs } = require('fs'); // Notice the `promises` import
|
||||
|
||||
function readMap(filename) {
|
||||
return fs.readFile(filename, 'utf8');
|
||||
}
|
||||
|
||||
var converter = await convert.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
|
||||
var json = converter.toJSON();
|
||||
console.log(json);
|
||||
```
|
||||
|
||||
**Asynchronous read in the browser:**
|
||||
|
||||
```js
|
||||
var convert = require('convert-source-map');
|
||||
|
||||
async function readMap(url) {
|
||||
const res = await fetch(url);
|
||||
return res.text();
|
||||
}
|
||||
|
||||
const converter = await convert.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
|
||||
var json = converter.toJSON();
|
||||
console.log(json);
|
||||
```
|
||||
|
||||
### 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, readMap)
|
||||
|
||||
Finds last sourcemap comment in file and returns source map converter or returns `null` if no source map comment was found.
|
||||
|
||||
`readMap` must be a function which receives the source map filename and returns either a String or Buffer of the source map (if read synchronously), or a `Promise` containing a String or Buffer of the source map (if read asynchronously).
|
||||
|
||||
If `readMap` doesn't return a `Promise`, `fromMapFileSource` will return a source map converter synchronously.
|
||||
|
||||
If `readMap` returns a `Promise`, `fromMapFileSource` will also return `Promise`. The `Promise` will be either resolved with the source map converter or rejected with an error.
|
||||
|
||||
### 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.
|
||||
|
||||
### toURI()
|
||||
|
||||
Converts source map to uri encoded json string.
|
||||
|
||||
### 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.encoding == 'uri'`, the data will be uri encoded, otherwise they will be base64 encoded.
|
||||
|
||||
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.
|
||||
|
||||
Breaks down a source map comment into groups: Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
|
||||
|
||||
### 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.
|
||||
|
||||
[ci-url]: https://github.com/thlorenz/convert-source-map/actions?query=workflow:ci
|
||||
[ci-image]: https://img.shields.io/github/workflow/status/thlorenz/convert-source-map/CI?style=flat-square
|
233
node_modules/convert-source-map/index.js
generated
vendored
Normal file
233
node_modules/convert-source-map/index.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, 'commentRegex', {
|
||||
get: function getCommentRegex () {
|
||||
// Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
|
||||
return /^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(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;
|
||||
}
|
||||
});
|
||||
|
||||
var decodeBase64;
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
if (typeof Buffer.from === 'function') {
|
||||
decodeBase64 = decodeBase64WithBufferFrom;
|
||||
} else {
|
||||
decodeBase64 = decodeBase64WithNewBuffer;
|
||||
}
|
||||
} else {
|
||||
decodeBase64 = decodeBase64WithAtob;
|
||||
}
|
||||
|
||||
function decodeBase64WithBufferFrom(base64) {
|
||||
return Buffer.from(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function decodeBase64WithNewBuffer(base64) {
|
||||
if (typeof value === 'number') {
|
||||
throw new TypeError('The value to decode must not be of type number.');
|
||||
}
|
||||
return new Buffer(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function decodeBase64WithAtob(base64) {
|
||||
return decodeURIComponent(escape(atob(base64)));
|
||||
}
|
||||
|
||||
function stripComment(sm) {
|
||||
return sm.split(',').pop();
|
||||
}
|
||||
|
||||
function readFromFileMap(sm, read) {
|
||||
var r = exports.mapFileCommentRegex.exec(sm);
|
||||
// for some odd reason //# .. captures in 1 and /* .. */ in 2
|
||||
var filename = r[1] || r[2];
|
||||
|
||||
try {
|
||||
var sm = read(filename);
|
||||
if (sm != null && typeof sm.catch === 'function') {
|
||||
return sm.catch(throwError);
|
||||
} else {
|
||||
return sm;
|
||||
}
|
||||
} catch (e) {
|
||||
throwError(e);
|
||||
}
|
||||
|
||||
function throwError(e) {
|
||||
throw new Error('An error occurred while trying to read the map file at ' + filename + '\n' + e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
function Converter (sm, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
if (opts.hasComment) {
|
||||
sm = stripComment(sm);
|
||||
}
|
||||
|
||||
if (opts.encoding === 'base64') {
|
||||
sm = decodeBase64(sm);
|
||||
} else if (opts.encoding === 'uri') {
|
||||
sm = decodeURIComponent(sm);
|
||||
}
|
||||
|
||||
if (opts.isJSON || opts.encoding) {
|
||||
sm = JSON.parse(sm);
|
||||
}
|
||||
|
||||
this.sourcemap = sm;
|
||||
}
|
||||
|
||||
Converter.prototype.toJSON = function (space) {
|
||||
return JSON.stringify(this.sourcemap, null, space);
|
||||
};
|
||||
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
if (typeof Buffer.from === 'function') {
|
||||
Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
|
||||
} else {
|
||||
Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
|
||||
}
|
||||
} else {
|
||||
Converter.prototype.toBase64 = encodeBase64WithBtoa;
|
||||
}
|
||||
|
||||
function encodeBase64WithBufferFrom() {
|
||||
var json = this.toJSON();
|
||||
return Buffer.from(json, 'utf8').toString('base64');
|
||||
}
|
||||
|
||||
function encodeBase64WithNewBuffer() {
|
||||
var json = this.toJSON();
|
||||
if (typeof json === 'number') {
|
||||
throw new TypeError('The json to encode must not be of type number.');
|
||||
}
|
||||
return new Buffer(json, 'utf8').toString('base64');
|
||||
}
|
||||
|
||||
function encodeBase64WithBtoa() {
|
||||
var json = this.toJSON();
|
||||
return btoa(unescape(encodeURIComponent(json)));
|
||||
}
|
||||
|
||||
Converter.prototype.toURI = function () {
|
||||
var json = this.toJSON();
|
||||
return encodeURIComponent(json);
|
||||
};
|
||||
|
||||
Converter.prototype.toComment = function (options) {
|
||||
var encoding, content, data;
|
||||
if (options != null && options.encoding === 'uri') {
|
||||
encoding = '';
|
||||
content = this.toURI();
|
||||
} else {
|
||||
encoding = ';base64';
|
||||
content = this.toBase64();
|
||||
}
|
||||
data = 'sourceMappingURL=data:application/json;charset=utf-8' + encoding + ',' + content;
|
||||
return options != null && 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.fromURI = function (uri) {
|
||||
return new Converter(uri, { encoding: 'uri' });
|
||||
};
|
||||
|
||||
exports.fromBase64 = function (base64) {
|
||||
return new Converter(base64, { encoding: 'base64' });
|
||||
};
|
||||
|
||||
exports.fromComment = function (comment) {
|
||||
var m, encoding;
|
||||
comment = comment
|
||||
.replace(/^\/\*/g, '//')
|
||||
.replace(/\*\/$/g, '');
|
||||
m = exports.commentRegex.exec(comment);
|
||||
encoding = m && m[4] || 'uri';
|
||||
return new Converter(comment, { encoding: encoding, hasComment: true });
|
||||
};
|
||||
|
||||
function makeConverter(sm) {
|
||||
return new Converter(sm, { isJSON: true });
|
||||
}
|
||||
|
||||
exports.fromMapFileComment = function (comment, read) {
|
||||
if (typeof read === 'string') {
|
||||
throw new Error(
|
||||
'String directory paths are no longer supported with `fromMapFileComment`\n' +
|
||||
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
||||
)
|
||||
}
|
||||
|
||||
var sm = readFromFileMap(comment, read);
|
||||
if (sm != null && typeof sm.then === 'function') {
|
||||
return sm.then(makeConverter);
|
||||
} else {
|
||||
return makeConverter(sm);
|
||||
}
|
||||
};
|
||||
|
||||
// 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, read) {
|
||||
if (typeof read === 'string') {
|
||||
throw new Error(
|
||||
'String directory paths are no longer supported with `fromMapFileSource`\n' +
|
||||
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
||||
)
|
||||
}
|
||||
var m = content.match(exports.mapFileCommentRegex);
|
||||
return m ? exports.fromMapFileComment(m.pop(), read) : 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;
|
||||
};
|
38
node_modules/convert-source-map/package.json
generated
vendored
Normal file
38
node_modules/convert-source-map/package.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "convert-source-map",
|
||||
"version": "2.0.0",
|
||||
"description": "Converts a source-map from/to different formats and allows adding/changing properties.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --color"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/thlorenz/convert-source-map.git"
|
||||
},
|
||||
"homepage": "https://github.com/thlorenz/convert-source-map",
|
||||
"devDependencies": {
|
||||
"inline-source-map": "~0.6.2",
|
||||
"tap": "~9.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"convert",
|
||||
"sourcemap",
|
||||
"source",
|
||||
"map",
|
||||
"browser",
|
||||
"debug"
|
||||
],
|
||||
"author": {
|
||||
"name": "Thorsten Lorenz",
|
||||
"email": "thlorenz@gmx.de",
|
||||
"url": "http://thlorenz.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engine": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user