source-map-url

WebJar for source-map-url

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

source-map-url
Last Version

Last Version

0.4.1
Release Date

Release Date

Type

Type

jar
Description

Description

source-map-url
WebJar for source-map-url
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/lydell/source-map-url

Download source-map-url

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/source-map-url/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>source-map-url</artifactId>
    <version>0.4.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/source-map-url/
implementation 'org.webjars.npm:source-map-url:0.4.1'
// https://jarcasting.com/artifacts/org.webjars.npm/source-map-url/
implementation ("org.webjars.npm:source-map-url:0.4.1")
'org.webjars.npm:source-map-url:jar:0.4.1'
<dependency org="org.webjars.npm" name="source-map-url" rev="0.4.1">
  <artifact name="source-map-url" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='source-map-url', version='0.4.1')
)
libraryDependencies += "org.webjars.npm" % "source-map-url" % "0.4.1"
[org.webjars.npm/source-map-url "0.4.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Overview Build Status

browser support

Tools for working with sourceMappingURL comments.

var sourceMappingURL = require("source-map-url")

var code = [
  "!function(){...}();",
  "/*# sourceMappingURL=foo.js.map */"
].join("\n")

sourceMappingURL.existsIn(code)
// true

sourceMappingURL.getFrom(code)
// foo.js.map

code = sourceMappingURL.insertBefore(code, "// License: MIT\n")
// !function(){...}();
// // License: MIT
// /*# sourceMappingURL=foo.js.map */

code = sourceMappingURL.removeFrom(code)
// !function(){...}();
// // License: MIT

sourceMappingURL.existsIn(code)
// false

sourceMappingURL.getFrom(code)
// null

code += "//# sourceMappingURL=/other/file.js.map"
// !function(){...}();
// // License: MIT
// //# sourceMappingURL=/other/file.js.map

Installation

  • npm install source-map-url
  • bower install source-map-url
  • component install lydell/source-map-url

Works with CommonJS, AMD and browser globals, through UMD.

Usage

sourceMappingURL.getFrom(code)

Returns the url of the sourceMappingURL comment in code. Returns null if there is no such comment.

sourceMappingURL.existsIn(code)

Returns true if there is a sourceMappingURL comment in code, or false otherwise.

sourceMappingURL.removeFrom(code)

Removes the sourceMappingURL comment in code. Does nothing if there is no such comment. Returns the updated code.

sourceMappingURL.insertBefore(code, string)

Inserts string before the sourceMappingURL comment in code. Appends string to code if there is no such comment.

Lets you append something to a file without worrying about burying the sourceMappingURL comment (by keeping it at the end of the file).

sourceMappingURL.regex

The regex that is used to match sourceMappingURL comments. It matches both // and /**/ comments, thus supporting both JavaScript and CSS.

Tests

Start by running npm test, which lints the code and runs the test suite in Node.js.

To run the tests in a browser, run testling (npm install -g testling) or testling -u.

License

The X11 (“MIT”) License.

Versions

Version
0.4.1
0.4.0
0.3.0