GithubHelp home page GithubHelp logo

convert-source-map's Issues

Braking typescript/nyc coverage report

Came here while debugging my setup.
I get Error: ENAMETOOLONG: name too long, open '/Users/test/D.../data:application/json;charset=utf-8;base64,eyJ2ZX

Using MACOS

Found out that regex does not match the source map. When removing start of line character it worked.

Example end with this..

(backbone_1["default"].Collection));cov_lp6smvaoa.s[21]++;exports.Collection=Collection;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiL1VzZXJzL3Rlc3QvRGVza3RvcC9tYXBseXRpY3MvYXRvbS9MYXllckJhc2UvQ29sbGVjdGlvbi50cyIsInNvdXJjZXMiOlsiL1VzZXJzL3Rlc3QvRGVza3RvcC9tYXBseXRpY3MvYXRvbS9MYXllckJhc2UvQ29sbGVjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQ0Esc0RBQWdDO0FBRWhDO0lBQWdDLDhCQUFrQztJQUFsRTs7SUFBcUUsQ0FBQztJQUFELGlCQUFDO0FBQUQsQ0FBQyxBQUF0RSxDQUFnQyxxQkFBUSxDQUFDLFVBQVUsR0FBbUI7QUFBekQsZ0NBQVUiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBNb2RlbCwgSU1vZGVsIH0gZnJvbSBcIi4vTW9kZWxcIjtcbmltcG9ydCBCYWNrYm9uZSBmcm9tIFwiYmFja2JvbmVcIjtcblxuZXhwb3J0IGNsYXNzIENvbGxlY3Rpb24gZXh0ZW5kcyBCYWNrYm9uZS5Db2xsZWN0aW9uPE1vZGVsPElNb2RlbD4+IHsgfVxuIl19

CSS support?

Starting to mess around with source-maps for duo, and while using this lib I couldn't find any way to support CSS source-maps. In particular, the comment format is slightly different:

/*# sourceMappingURL=... */

vs

//# sourceMappingURL=...

VM6510:1 Uncaught SyntaxError: Unexpected token u

I hate opening issues when I really don't know what to do next, but what else could I do.

I spent about 4 hours trying to research, debug, and dig through the source code, but I came up nil.

I have a simple .xlsx file that I want to grab the data from and convert it to JSON or and object or something that I can use.

I believe I am able to grab the base64 of the file from the FileList API, but when I try to convert it, it just gives

VM6510:1 Uncaught SyntaxError: Unexpected token u

I have tracked it to this part of the code and managed to eek out a bit of info on what is happening.
It reaches the line if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm); but then flakes out instead of returning with a JSON version. I notice two things:

  1. sm = encoded wingdings lookin things, which is no help to me as I don't read wingdings.
  2. opts.isEncoded = true
 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;
 }

The entirety of my code is pretty simple and perhaps I am missing something.

      const file = document.querySelector('input[type=file]').files[0]; //TODO more specific?
      const reader = new FileReader();

      reader.addEventListener("load", function() {
        preview.src = reader.result;
        const json = convert.fromBase64(preview.src).toJSON();
        return json;
      }, false);

      if (file) { //nessecito else no work
        reader.readAsDataURL(file);
      }

My Base64, as I believe it is the Base64 anyways, is:

data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBBQABgAIAAAAIQBIZhxhaAEAABAFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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3dvcmtzaGVldHMvc2hlZXQxLnhtbFBLAQItABQABgAIAAAAIQAmmqIkRwEAAG0CAAARAAAAAAAAAAAAAAAAADwiAABkb2NQcm9wcy9jb3JlLnhtbFBLAQItABQABgAIAAAAIQB3zyV/lwMAALoXAAAQAAAAAAAAAAAAAAAAALokAAB4bC9jYWxjQ2hhaW4ueG1sUEsBAi0AFAAGAAgAAAAhAJK2SaqUAQAAIgMAABAAAAAAAAAAAAAAAAAAfygAAGRvY1Byb3BzL2FwcC54bWxQSwUGAAAAAAsACwC+AgAASSsAAAAA

Support non-base64 encoded json?

convert-source-map currently supports comments like these:

/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VzIjpbInN1Y2Nlc3MuY3NzIl0sIm5hbWVzIjpbXX0= */

However, those don’t have to be base64 encoded!

/*# sourceMappingURL=data:application/json,{"version":3,"mappings":"AAAA","sources":["success.css"],"names":[]} */

Here is the above example again, after running encodeURIComponent on it:

/*# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22mappings%22%3A%22AAAA%22%2C%22sources%22%3A%5B%22success.css%22%5D%2C%22names%22%3A%5B%5D%7D */

Do any browsers support this?

I created a test to find out: https://gist.github.com/lydell/3c3375e7a9dc1265fe71474a9e098077

encoding Firefox Chrome Safari Edge
base64 yes yes yes yes
encodeURIComponent yes yes yes no
nothing yes no no no

Do any tools support this?

Do any tools output this?

I don’t know. Perhaps @ai does, since he added support for consuming it in PostCSS. (I added consumption support in source-map-resolve because I noticed that PostCSS had.)

Should convert-source-map support it?

Well, it’s not hard.

  • data:mime-type;parameters;base64,... → base64
  • data:mime-type;parameters,... (not ending with ;base64) → decodeURIComponent

I just don’t know how it fits into the API.

Thanks for reading :)

sourceMappingURL inside string literal

Hi 👋
We have been using this package mostly succesfully in Babel for a long time (thank you for maintaining it!), but we have received some bug reports about "fake" source map comments being removed from strings.

For example,

const comment = `
//# sourceMappingURL=${path.basename(
  sourceMapFilename
)}`

is removed by the removeMapFileComments method.

I tried to fix this problem by implementing some logic to skip strings and template literals (you can find it at https://github.com/nicolo-ribaudo/convert-source-map/tree/comments-strings). Then, I realized that regular expressions make it impossible to know if something is a comment or not without fully parsing the whole JavaScript file.

For example, this file has a source map comment:

function* f() {
  yield /a`/g //
}

//#sourceMappingURL=file.map

// ` } /*
/*/ // */

While this one doesn't: (I only replaced function* with function)

function f() {
  yield /a`/g //
}

//#sourceMappingURL=file.map

// ` } /*
/*/ // */

(Don't trust GitHub's syntax highlighter; it's wrong)

For this reasons, I don't think that this problem can be fixed in this package, but I'm opening this issue to let you know about this limitation (maybe you could write in the readme that "fake" comments inside strings don't work?).

I'm working around this problem in Babel by first parsing the file with @babel/parser, and then analyzing the comments and using fromComment/fromMapFileComment to convert them.


Babel issues: babel/babel#9790, babel/babel#9956, babel/website@d24c80e

sourceMappingURL with non-base64 data URI not supported.

convert
  .fromComment('//# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sources%22:%5B%22/Users/user/Development/node_modules/xyz/index.js%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAAA%22%7D')
  .toJSON()

Will throw:

SyntaxError: Unexpected token � in JSON at position 0

The map is:

{"version":3,"sources":["/Users/user/Development/node_modules/xyz/index.js"],"names":[],"mappings":"AAAA"}

This effects microsoft/vscode#35978.

Unclosed block error in map-file-comment-double-slash.css

grunt-babel/node_modules/babel-core/node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css:14:1: Unclosed block Use --force to continue.

Version: 1.3.0

├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   └─┬ [email protected]
│ │ │     └── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └─┬ [email protected]
│ │ │   ├── [email protected]
│ │ │   └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └─┬ [email protected]
│ │     ├── [email protected]
│ │     └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   └─┬ [email protected]
│ │     └── [email protected]
│ └─┬ [email protected]
│   ├─┬ [email protected]
│   │ ├── [email protected]
│   │ └── [email protected]
│   └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   ├── [email protected]
│ │ │   └── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └─┬ [email protected]
│ │     └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├── [email protected] extraneous
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   └── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ ├─┬ [email protected]
│ │ │ │ │ │ └── [email protected]
│ │ │ │ │ ├─┬ [email protected]
│ │ │ │ │ │ └── [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ ├─┬ [email protected]
│ │ │ │ │ │ └── [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │   └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   └── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│   ├── [email protected]
│   ├─┬ [email protected]
│   │ └── [email protected]
│   ├── [email protected]
│   └─┬ [email protected]
│     ├── [email protected]
│     ├── [email protected]
│     ├── [email protected]
│     └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├─┬ [email protected]
│ │   │ ├── [email protected]
│ │   │ └── [email protected]
│ │   ├── [email protected]
│ │   └─┬ [email protected]
│ │     ├── [email protected]
│ │     └── [email protected]
│ └─┬ [email protected]
│   ├── [email protected]
│   ├── [email protected]
│   ├─┬ [email protected]
│   │ └── [email protected]
│   └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   ├── [email protected]
│ │ │   └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ ├─┬ [email protected]
│ │   │ │ ├─┬ [email protected]
│ │   │ │ │ ├─┬ [email protected]
│ │   │ │ │ │ └── [email protected]
│ │   │ │ │ ├── [email protected]
│ │   │ │ │ └── [email protected]
│ │   │ │ └── [email protected]
│ │   │ ├─┬ [email protected]
│ │   │ │ └─┬ [email protected]
│ │   │ │   ├─┬ [email protected]
│ │   │ │   │ └── [email protected]
│ │   │ │   ├── [email protected]
│ │   │ │   └── [email protected]
│ │   │ └── [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ ├─┬ [email protected]
│ │ │ │   │ │ └─┬ [email protected]
│ │ │ │   │ │   ├── [email protected]
│ │ │ │   │ │   ├─┬ [email protected]
│ │ │ │   │ │   │ └── [email protected]
│ │ │ │   │ │   ├── [email protected]
│ │ │ │   │ │   └── [email protected]
│ │ │ │   │ ├── [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ ├─┬ [email protected]
│ │ │ │   │ │ └── [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   ├─┬ [email protected]
│ │ │ │   │ ├── [email protected]
│ │ │ │   │ └── [email protected]
│ │ │ │   └─┬ [email protected]
│ │ │ │     ├── [email protected]
│ │ │ │     └── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   ├─┬ [email protected]
│ │ │   │ └─┬ [email protected]
│ │ │   │   ├── [email protected]
│ │ │   │   └── [email protected]
│ │ │   ├─┬ [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ └── [email protected]
│ │ │   └── [email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│   ├── [email protected]
│   └─┬ [email protected]
│     └── [email protected]
└─┬ [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ ├─┬ [email protected]
  │ │ │ └── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ ├─┬ [email protected]
  │ │ │ └── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ ├─┬ [email protected]
  │ │ │ ├── [email protected]
  │ │ │ └── [email protected]
  │ │ ├── [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └─┬ [email protected]
  │ │   └── [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ └─┬ [email protected]
  │   ├─┬ [email protected]
  │   │ └── [email protected]
  │   ├── [email protected]
  │   ├─┬ [email protected]
  │   │ ├─┬ [email protected]
  │   │ │ └─┬ [email protected]
  │   │ │   ├── [email protected]
  │   │ │   ├─┬ [email protected]
  │   │ │   │ └── [email protected]
  │   │ │   ├── [email protected]
  │   │ │   └── [email protected]
  │   │ ├── [email protected]
  │   │ └── [email protected]
  │   ├─┬ [email protected]
  │   │ └── [email protected]
  │   ├── [email protected]
  │   ├── [email protected]
  │   ├── [email protected]
  │   ├── [email protected]
  │   ├─┬ [email protected]
  │   │ └── [email protected]
  │   ├── [email protected]
  │   ├─┬ [email protected]
  │   │ ├─┬ [email protected]
  │   │ │ └── [email protected]
  │   │ └── [email protected]
  │   ├─┬ [email protected]
  │   │ ├─┬ [email protected]
  │   │ │ └── [email protected]
  │   │ └── [email protected]
  │   └─┬ [email protected]
  │     ├── [email protected]
  │     └── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ └─┬ [email protected]
  │ │   └── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ └─┬ [email protected]
  │ │   └─┬ [email protected]
  │ │     ├── [email protected]
  │ │     └── [email protected]
  │ ├─┬ [email protected]
  │ │ └─┬ [email protected]
  │ │   └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ └─┬ [email protected]
  │   ├── [email protected]
  │   └── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  └─┬ [email protected]
    ├─┬ [email protected]
    │ ├─┬ [email protected]
    │ │ └── [email protected]
    │ └─┬ [email protected]
    │   ├── [email protected]
    │   ├── [email protected]
    │   ├── [email protected]
    │   ├── [email protected]
    │   ├── [email protected]
    │   ├── [email protected]
    │   └── [email protected]
    ├── [email protected]
    ├── [email protected]
    └── [email protected]

Error when running angular2-seed build process??

Error: /home/liorm/devcode/servo-admin/src/client/node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css:14:1: Unknown word

//# sourceMappingURL=map-file-comment.css.map
^
any ideas, anyone ?

:-o

CommentRegex Doesn't Find Comments on Same Line as Code

I'm not sure if the source map spec says source map comments must be on new lines or not. If that's the case this is a bug in Less and I can post it there.

I'm using Less with the inline source map and compression options and my code and an inline source map end up on one line at the end of the file.

The commentRegex is set to only look for comments on their own line, and there are 4 tests (4, 5, 10, 11 in comment-regex.js) that fail if you remove that piece of the regex. Those tests seem specifically designed to fail if the comment isn't on it's own line so that makes sense. The tests fail but the captured parts remain the same throughout, so it seems like it would still be safe.

Thoughts on this? Is this a bug in Less's compression for allowing source maps to be stuck on the same line as code?

memory consumption for 1.9.0

I am a maintainer of opentelemetry-js-contrib repo.
Recently, our browser tests started failing due to "JavaScript heap out of memory" when running webpack.

After doing some digging, I found that we are using this webpack loader @jsdevtools/coverage-istanbul-loader and it is causing the memory issues.

When I examined its dependencies, I see that it has a caret dependency on this package:

    "convert-source-map": "^1.7.0",

Which now automatically picks up version 1.9.0. It was released to npm on October 10 which is just when our CI started failing due to out of memory.

By comparing version 1.8.0 and 1.9.0, I found that it did some changes in decoding base64 which might be related.

I can see that you already published a new major version 2.0.0, but we cannot use it as this package is not a direct dependency for our project.

We will probably just increase our node memory in CI to work around this issue, but I wanted to document it here for anyone who might have the same issue and end up here.

Wondering if the change in #74 might have a memory leak or now consumes more memory than it used to?

Reduce package size

Now after npm i convert-source-map i get these extra unnecessary directories: example and test, also .travis.yml file. I can do PR 😄

Module not found: Error: Can't resolve 'fs'

Hi.

So when I include the following polyfills in my entry file
import '@babel/plugin-proposal-private-methods' import '@babel/plugin-proposal-class-properties'

I get an error when running npm build:

ERROR in ./node_modules/convert-source-map/index.js
Module not found: Error: Can't resolve 'fs' in '/home/dllz/Documents/iron.js/node_modules/convert-source-map'
@ ./node_modules/convert-source-map/index.js 2:9-22
@ ./node_modules/@babel/core/lib/transformation/normalize-file.js
@ ./node_modules/@babel/core/lib/parse.js
@ ./node_modules/@babel/core/lib/index.js
@ ./node_modules/@babel/helper-create-class-features-plugin/lib/misc.js
@ ./node_modules/@babel/helper-create-class-features-plugin/lib/index.js
@ ./node_modules/@babel/plugin-proposal-class-properties/lib/index.js
@ ./src/index.js

When I remove both those polyfils the issue goes away but I need to have those there in the entry file

Extract string methods, browser support

It would be great if the methods/regexps for extracting the sourcemap from e.g. an inline comment in a CSS file could be separated into a separate file/module. I want to use your library in browser to extract the inline sourcemap (base64-encoded dataURI). Currently I have to use some regexp, I want to use a tested, existing library instead.

Tests failing

Before going too far down the rabbit hole on #5 & #6, I can't get the test suite to pass from master. Travis is also failing, so I don't think it's just me.

Running a fresh checkout in a clean nodeenv, under node v0.10.29:

$ npm install
$ npm test

I get

    1..30
    # tests 30
    # pass  24
    # fail  6

ok test/map-file-comment.js ........................... 10/10
total ................................................. 71/77

Seems like these should pass before tacking the one-line map problem. @tybruffy

Does not match latest browserify version sourcemaps

So I ran into a particularly nasty bug with pulling sourcemaps when I upgraded browserify from 9.x to 10.x. It turns out between these two versions browserify added a small piece to their sourcemap comment, which makes the commentRx no longer match it correctly.

Specifically, while it used to look something like this at the beginning of the source mapping comment:

//# sourceMappingURL=data:application/json;base64

...it now looks like this:

//# sourceMappingURL=data:application/json;charset:utf-8;base64

They simply added in a charset declaration. Honestly, I'm not nearly well-educated enough in the technicalities of source mapping syntax to be able to tell you whether this is a legitimate addition or not, but I presume that it is, and they added it for a good reason.

I'd be happy to send in a pull request that modifies the regex to optionally also accept this "charset" piece in the middle -- just want to make sure you are on board!

Store map file path in Converter

For further processing of the source map, it is important to know the original source map file path (since all paths within the source map are relative to that). Could you therefore store the map file directory as a property of the Converter? In case of an inline source map, this is the directory of the source file. Otherwise, it is the path of the map file comment URL, relative to the directory of the source file.

Safe to remove safe-buffer

bet many have updated their node version already.
Willing to change lowest supported node version to something like LTS and use native Buffer.from instead to reduce the size?

Can help you with a PR if you like.

Tests fail due to charset issue

I'm running the self-tests as part of an effort to get this module packaged as an RPM for Fedora, but three tests are failing due to charset issues.

From a very brief analysis, it seems that the fromComment() function is ignoring the character set on the comment, and that the toComment() function isn't adding the charset back in.

Here's a very simple program to explain:

generator = require('inline-source-map')
convert = require('convert-source-map')

var gen = generator()
    .addMappings('foo.js', [{ original: { line: 2, column: 3 } , generated: { line: 5, column: 10 } }], { line: 5 })
    .addGeneratedMappings('bar.js', 'var a = 2;\nconsole.log(a)', { line: 23, column: 22 })

  , comment = gen.inlineMappingUrl()

console.log('comment: %s',comment);
console.log('converted: %s',convert.fromComment(comment).toComment());

The output is as follows:

comment: //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZvby5qcyIsImJhci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7VUFDRzs7Ozs7Ozs7Ozs7Ozs7c0JDREg7c0JBQ0EiLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiJ9
converted: //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZvby5qcyIsImJhci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7VUFDRzs7Ozs7Ozs7Ozs7Ozs7c0JDREg7c0JBQ0EiLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiJ9

As you can see, the initial comment contains the string "charset=utf-8", but after the conversion the charset is missing from the resulting comment.

Fail toComment with included content.

I use mozilla/source-map for generating source maps. Then i add source content, convert to comment fails.

    var output = node.toStringWithSourceMap();
    output.map.setSourceContent(file, data); // If this

    var map = convert.fromJSON(output.map.toString());
    callback(null, output.code + '\n' + map.toComment()); // Fails here

If i comment this line output.map.setSourceContent(file, data); all ok. (but no source maps in browser).

Can you help me with this? Thanks.

Rogue sourceMappingURL comment trips up devtools

See https://github.com/thlorenz/convert-source-map/blob/master/index.js#L8

  //Example (Extra space between slashes added to solve Safari bug. Exclude space in production):
  //     / /# sourceMappingURL=foo.js.map           /*# sourceMappingURL=foo.js.map */
  /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg

The comment is generating a 404 in devtool and it is shutting down immediately when trying to debug.

It would be great if you change the comment so it doesn't match the regex and make the debugger thing there is a foo.js.map file :)

Thanks!

See also evanw/node-source-map-support#156 for the same report

SourceMappingURL causing failure on Safari

I've been all over the interwebz trying to track down what's going on here.
It appears that there is an issue that only crops up on Safari where the sourceMappingURL is telling Safari to get a map file that doesn't exist.
References:

The troubled line is on ln 7.

var mapFileCommentRx =
  // //# sourceMappingURL=foo.js.map                       
  /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg

That // //# sourceMappingURL=foo.js.map is what's killing Safari. Everything works fine if that line is removed, and that seems to be what people are having to do in order to get up and running.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.