Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
sourcemap-validator
Advanced tools
Mapped all the things? Now validate all the maps.
validate(minifiedCode, [sourceMap], [sourceContent]);
minifiedCode
is your minified code as a stringsourceMap
is your sourcemap as a JSON string
minifiedCode
will be usedsourceContent
is a map to the raw source files
sourceContent
in sourceMap
will be usedIf your sourceMap
has inline sourceContent
, those files will take precedence over the first argument to validate
, so you can pass an empty object in.
var validate('sourcemap-validator')
, fs = require('fs')
, assert = require('assert')
, raw = fs.readFileSync('jquery.js')
, min = fs.readFileSync('jquery.min.js')
, map = fs.readFileSync('jquery.min.map');
assert.doesNotThrow(function () {
validate({'jquery.js': raw}, min, map);
}, 'The sourcemap is not valid');
var validate('sourcemap-validator')
, fs = require('fs')
, assert = require('assert')
, min = fs.readFileSync('bundle.min.js')
, map = fs.readFileSync('bundle.min.map');
// Browserify bundles have inline sourceContent in their maps
// so pass an emtpy object as the first argument.
assert.doesNotThrow(function () {
validate({}, min, map);
}, 'The sourcemap is not valid');
The sourcemap spec isn't exactly very mature, so this module only aims to give you a Pretty Good™ idea of whether or not your sourcemap is correct.
If a sourcemap maps "literal" without the quotes to column 3, we will consider that valid.
Example
var v = {
literal: true
//^-- ok to map {name: literal, column: 3} here
};
var t = {
"literal": true
//^-- ok to map {name: literal, column: 3} here, even though the token actually appears in column 4
};
See the discussion here
However, mapping something totally wrong like "cookie"
to that index will throw an exception.
There is no way for the validator to know if you are missing mappings. It can only ensure that the ones you made are sensible. The validator will consider a sourcemap with zero mappings invalid as a sanity check, but if your map at least one sensisble mapping, it is a valid map.
The MIT License (MIT)
Copyright (c) 2013 Ben Ng
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.
FAQs
Map all the things, check all the maps
The npm package sourcemap-validator receives a total of 81,776 weekly downloads. As such, sourcemap-validator popularity was classified as popular.
We found that sourcemap-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.