Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

source-map-dummy

lydell896MITdeprecated1.0.0

Bad package.

Creates “dummy” source maps.

source map, source-map, source, map, dummy, concatenate, concat

readme

Overview Build Status

Creates “dummy” source maps.

var createDummySourceMap = require("source-map-dummy")

createDummySourceMap(
  ["Hello", ",", " ", "World", "!"],
  {source: "path/to/helloWorld.txt"}
)
// {
//   file: "helloWorld.txt",
//   version: 3,
//   mappings: "...",
//   sources: ["path/to/helloWorld.txt"],
//   names: []
// }

createDummySourceMap(
  "var foo = bar;",
  {source: "path/to/foo.js", type: "js"}
)
// {
//   file: "foo.js",
//   version: 3,
//   mappings: "...",
//   sources: ["path/to/foo.js"],
//   names: []
// }

Installation

npm install source-map-dummy

var createDummySourceMap = require("source-map-dummy")

Usage

createDummySourceMap(tokens, options)

Creates a “dummy” source map for tokens, which is an array of strings. One mapping will be added per token, except blank ones. Each mapping maps back to itself.

First tokenize your source code into an array. Then pass that array to createDummySourceMap. This way it works with any type of source code.

In reality, source maps are only used for JavaScript and CSS. Therefore you may also pass a string of either JavaScript or CSS, that will be tokenized for you.

options:

  • source: Required. The path to the file containing code. All mappings will point to this source.
  • type: Required if tokens is a string. Set it to js if tokens is a string of JavaScript, and to css if it is CSS.

License

The X11 (“MIT”) License.

changelog

Version 1.0.0 (2015-02-26)

  • Update css-tokens to 1.0.0 and js-tokens to 1.0.0 which means slightly different CSS and JS tokenization, which means slightly different mappings. (Backwards-incompatible change.)

Version 0.3.0 (2014-06-19)

  • Update css-tokens to 0.3.0 and js-tokens to 0.2.0, which means slightly different CSS and JS tokenization, which means slightly different mappings. (Backwards-incompatible change.)

Version 0.2.0 (2014-03-11)

  • Update css-tokens to 0.2.0, which means slightly different CSS tokenization, which means slightly different mappings. (Backwards-incompatible change.)

Version 0.1.0 (2014-03-09)

  • Initial release.