Skip to content

Commit

Permalink
Fix prettier issues and update read me
Browse files Browse the repository at this point in the history
  • Loading branch information
bomsy committed Apr 4, 2023
1 parent 6e207bf commit 9beca30
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ following attributes:

- `file`: Optional. The generated filename this source map is associated with.

- `x_google_ignoreList`: Optional. An additional extension field which is an array
of indices refering to urls in the sources array. This is used to identify third-party
sources, that the developer might want to avoid when debugging.

The promise of the constructed souce map consumer is returned.

When the `SourceMapConsumer` will no longer be used anymore, you must call its
Expand Down
6 changes: 5 additions & 1 deletion lib/source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ class BasicSourceMapConsumer extends SourceMapConsumer {
const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
const mappings = util.getArg(sourceMap, "mappings");
const file = util.getArg(sourceMap, "file", null);
const x_google_ignoreList = util.getArg(sourceMap, "x_google_ignoreList", null);
const x_google_ignoreList = util.getArg(
sourceMap,
"x_google_ignoreList",
null
);

// Once again, Sass deviates from the spec and supplies the version as a
// string rather than a number, so we use loose equality checking here.
Expand Down
7 changes: 4 additions & 3 deletions test/test-source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ exports["test that the `sources` field has the original sources"] =
map.destroy();
};

exports["test that the SourceMapConsumer supports the ignoreList"] = async function (assert) {
exports["test that the SourceMapConsumer supports the ignoreList"] =
async function (assert) {
const map = await new SourceMapConsumer(util.testMapWithIgnoreList);
const sources = map.sources;
const ignoreList = map.x_google_ignoreList;
assert.equal(ignoreList.length, 1);
assert.equal(ignoreList[0], 0);
assert.equal(sources[ignoreList[0]], "/the/root/one.js");
assert.equal(ignoreList.length, 1);
map.destroy();
}
};

exports["test that the source root is reflected in a mapping's source field"] =
async function (assert) {
Expand Down

0 comments on commit 9beca30

Please sign in to comment.