1
0
mirror of https://github.com/titanscouting/tra-analysis.git synced 2025-07-26 12:48:50 +00:00
Files
.github
apps
data analysis
website
functions
node_modules
.bin
@firebase
@google-cloud
@grpc
@mrmlnc
@nodelib
@protobufjs
@types
accepts
acorn
acorn-es7-plugin
ajv
ansi-regex
arr-diff
arr-flatten
arr-union
array-filter
array-flatten
array-union
array-uniq
array-unique
arrify
ascli
asn1
assert-plus
assign-symbols
async
asynckit
atob
aws-sign2
aws4
axios
balanced-match
base
bcrypt-pbkdf
body-parser
brace-expansion
braces
buffer-equal-constant-time
buffer-from
bun
bytebuffer
bytes
cache-base
call-me-maybe
call-signature
camelcase
capture-stack-trace
caseless
class-utils
cliui
code-point-at
collection-visit
colour
combined-stream
component-emitter
compressible
concat-map
concat-stream
configstore
content-disposition
content-type
cookie
cookie-signature
copy-descriptor
core-js
core-util-is
cors
create-error-class
crypto-random-string
dashdash
debug
decamelize
decode-uri-component
deep-equal
define-properties
define-property
delayed-stream
depd
destroy
diff-match-patch
dir-glob
dom-storage
dot-prop
duplexify
eastasianwidth
ecc-jsbn
ecdsa-sig-formatter
ee-first
empower
empower-core
encodeurl
end-of-stream
ent
escape-html
espurify
estraverse
etag
expand-brackets
express
extend
extend-shallow
extglob
extsprintf
fast-deep-equal
fast-glob
fast-json-stable-stringify
faye-websocket
fill-range
finalhandler
firebase-admin
firebase-functions
follow-redirects
for-in
forever-agent
form-data
forwarded
fragment-cache
fresh
fs.realpath
functional-red-black-tree
gcp-metadata
gcs-resumable-upload
get-value
getpass
glob
glob-parent
glob-to-regexp
globby
google-auth-library
google-auto-auth
google-gax
google-p12-pem
google-proto-files
graceful-fs
grpc
gtoken
har-schema
har-validator
has-value
has-values
hash-stream-validation
http-errors
http-parser-js
http-signature
iconv-lite
ignore
imurmurhash
indexof
inflight
inherits
invert-kv
ipaddr.js
is
is-accessor-descriptor
is-buffer
is-data-descriptor
is-descriptor
is-extendable
is-extglob
is-fullwidth-code-point
is-glob
is-number
is-obj
is-plain-object
is-stream-ended
is-typedarray
is-windows
isarray
isobject
isstream
jsbn
json-schema
json-schema-traverse
json-stringify-safe
jsonwebtoken
jsprim
jwa
jws
kind-of
lcid
lodash
lodash.camelcase
lodash.clone
lodash.includes
lodash.isboolean
lodash.isinteger
lodash.isnumber
lodash.isplainobject
lodash.isstring
lodash.merge
lodash.once
log-driver
long
lru-cache
make-dir
map-cache
map-visit
media-typer
merge-descriptors
merge2
methmeth
methods
micromatch
mime
mime-db
mime-types
minimatch
mixin-deep
modelo
ms
nan
nanomatch
negotiator
node-forge
number-is-nan
oauth-sign
object-assign
object-copy
object-keys
object-visit
object.pick
on-finished
once
optjs
os-locale
parseurl
pascalcase
path-dirname
path-is-absolute
path-to-regexp
path-type
performance-now
pify
posix-character-classes
power-assert
power-assert-context-formatter
power-assert-context-reducer-ast
power-assert-context-traversal
power-assert-formatter
power-assert-renderer-assertion
power-assert-renderer-base
power-assert-renderer-comparison
power-assert-renderer-diagram
power-assert-renderer-file
power-assert-util-string-width
process-nextick-args
protobufjs
proxy-addr
pseudomap
psl
pump
pumpify
punycode
qs
range-parser
raw-body
readable-stream
regex-not
repeat-element
repeat-string
request
resolve-url
ret
retry-axios
retry-request
safe-buffer
safe-regex
safer-buffer
send
serve-static
set-value
setprototypeof
signal-exit
slash
snakeize
snapdragon
snapdragon-node
snapdragon-util
source-map
source-map-resolve
lib
test
.jshintrc
.travis.yml
LICENSE
bower.json
changelog.md
component.json
generate-source-map-resolve.js
package.json
readme.md
source-map-resolve.js
source-map-resolve.js.template
x-package.json5
source-map-url
split-array-stream
split-string
sshpk
static-extend
statuses
stream-events
stream-shift
string-format-obj
string-width
string_decoder
stringifier
strip-ansi
stubs
through2
to-object-path
to-regex
to-regex-range
tough-cookie
traverse
tslib
tunnel-agent
tweetnacl
type-is
type-name
typedarray
union-value
unique-string
universal-deep-strict-equal
unpipe
unset-value
uri-js
urix
use
util-deprecate
utils-merge
uuid
vary
verror
websocket-driver
websocket-extensions
window-size
wrap-ansi
wrappy
write-file-atomic
xdg-basedir
xmlhttprequest
xtend
y18n
yallist
yargs
index.js
package-lock.json
package.json
node_modules
public
.firebaserc
.gitignore
.runtimeconfig.json
firebase.json
firestore.indexes.json
firestore.rules
package-lock.json
.gitattributes
.gitignore
CONTRIBUTING.md
LICENSE
README.md
tra-analysis/website/functions/node_modules/source-map-resolve
2019-01-06 13:14:45 -06:00
..
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00
2019-01-06 13:14:45 -06:00

Overview Build Status

Resolve the source map and/or sources for a generated file.

var sourceMapResolve = require("source-map-resolve")
var sourceMap        = require("source-map")

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

sourceMapResolve.resolveSourceMap(code, "/js/foo.js", fs.readFile, function(error, result) {
  if (error) {
    return notifyFailure(error)
  }
  result
  // {
  //   map: {file: "foo.js", mappings: "...", sources: ["/coffee/foo.coffee"], names: []},
  //   url: "/js/foo.js.map",
  //   sourcesRelativeTo: "/js/foo.js.map",
  //   sourceMappingURL: "foo.js.map"
  // }

  sourceMapResolve.resolveSources(result.map, result.sourcesRelativeTo, fs.readFile, function(error, result) {
    if (error) {
      return notifyFailure(error)
    }
    result
    // {
    //   sourcesResolved: ["/coffee/foo.coffee"],
    //   sourcesContent: ["<contents of /coffee/foo.coffee>"]
    // }
  })
})

sourceMapResolve.resolve(code, "/js/foo.js", fs.readFile, function(error, result) {
  if (error) {
    return notifyFailure(error)
  }
  result
  // {
  //   map: {file: "foo.js", mappings: "...", sources: ["/coffee/foo.coffee"], names: []},
  //   url: "/js/foo.js.map",
  //   sourcesRelativeTo: "/js/foo.js.map",
  //   sourceMappingURL: "foo.js.map",
  //   sourcesResolved: ["/coffee/foo.coffee"],
  //   sourcesContent: ["<contents of /coffee/foo.coffee>"]
  // }
  result.map.sourcesContent = result.sourcesContent
  var map = new sourceMap.sourceMapConsumer(result.map)
  map.sourceContentFor("/coffee/foo.coffee")
  // "<contents of /coffee/foo.coffee>"
})

Installation

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

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

Note: This module requires setImmediate and atob. Use polyfills if needed, such as:

Usage

sourceMapResolve.resolveSourceMap(code, codeUrl, read, callback)

  • code is a string of code that may or may not contain a sourceMappingURL comment. Such a comment is used to resolve the source map.
  • codeUrl is the url to the file containing code. If the sourceMappingURL is relative, it is resolved against codeUrl.
  • read(url, callback) is a function that reads url and responds using callback(error, content). In Node.js you might want to use fs.readFile, while in the browser you might want to use an asynchronus XMLHttpRequest.
  • callback(error, result) is a function that is invoked with either an error or null and the result.

The result is an object with the following properties:

  • map: The source map for code, as an object (not a string).
  • url: The url to the source map. If the source map came from a data uri, this property is null, since then there is no url to it.
  • sourcesRelativeTo: The url that the sources of the source map are relative to. Since the sources are relative to the source map, and the url to the source map is provided as the url property, this property might seem superfluos. However, remember that the url property can be null if the source map came from a data uri. If so, the sources are relative to the file containing the data uri—codeUrl. This property will be identical to the url property or codeUrl, whichever is appropriate. This way you can conveniently resolve the sources without having to think about where the source map came from.
  • sourceMappingURL: The url of the sourceMappingURL comment in code.

If code contains no sourceMappingURL, the result is null.

sourceMapResolve.resolveSources(map, mapUrl, read, [options], callback)

  • map is a source map, as an object (not a string).
  • mapUrl is the url to the file containing map. Relative sources in the source map, if any, are resolved against mapUrl.
  • read(url, callback) is a function that reads url and responds using callback(error, content). In Node.js you might want to use fs.readFile, while in the browser you might want to use an asynchronus XMLHttpRequest.
  • options is an optional object with any of the following properties:
    • sourceRoot: Override the sourceRoot property of the source map, which might only be relevant when resolving sources in the browser. This lets you bypass it when using the module outside of a browser, if needed. Pass a string to replace the sourceRoot property with, or false to ignore it. Defaults to undefined.
  • callback(error, result) is a function that is invoked with either an error or null and the result.

The result is an object with the following properties:

  • sourcesResolved: The same as map.sources, except all the sources are fully resolved.
  • sourcesContent: An array with the contents of all sources in map.sources, in the same order as map.sources. If getting the contents of a source fails, an error object is put into the array instead.

sourceMapResolve.resolve(code, codeUrl, read, [options], callback)

The arguments are identical to sourceMapResolve.resolveSourceMap, except that you may also provide the same options as in sourceMapResolve.resolveSources.

This is a convenience method that first resolves the source map and then its sources. You could also do this by first calling sourceMapResolve.resolveSourceMap and then sourceMapResolve.resolveSources.

The result is identical to sourceMapResolve.resolveSourceMap, with the properties from sourceMapResolve.resolveSources merged into it.

There is one extra feature available, though. If code is null, codeUrl is treated as a url to the source map instead of to code, and will be read. This is handy if you sometimes get the source map url from the SourceMap: <url> header (see the Notes section). In this case, the sourceMappingURL property of the result is null.

sourceMapResolve.*Sync()

There are also sync versions of the three previous functions. They are identical to the async versions, except:

  • They expect a sync reading function. In Node.js you might want to use fs.readFileSync, while in the browser you might want to use a synchronus XMLHttpRequest.
  • They throw errors and return the result instead of using a callback.

sourceMapResolve.resolveSourcesSync also accepts null as the read parameter. The result is the same as when passing a function as the read parameter, except that the sourcesContent property of the result will be an empty array. In other words, the sources arent read. You only get the sourcesResolved property. (This only supported in the synchronus version, since there is no point doing it asynchronusly.)

sourceMapResolve.parseMapToJSON(string, [data])

The spec says that if a source map (as a string) starts with )]}', it should be stripped off. This is to prevent XSSI attacks. This function does that and returns the result of JSON.parseing whats left.

If this function throws error, error.sourceMapData === data.

Errors

All errors passed to callbacks or thrown by this module have a sourceMapData property that contain as much as possible of the intended result of the function up until the error occurred.

Note that while the map property of result objects always is an object, error.sourceMapData.map will be a string if parsing that string fails.

Note

This module resolves the source map for a given generated file by looking for a sourceMappingURL comment. The spec defines yet a way to provide the URL to the source map: By sending the SourceMap: <url> header along with the generated file. Since this module doesnt retrive the generated code for you (instead you give the generated code to the module), its up to you to look for such a header when you retrieve the file (should the need arise).

Development

Tests

First off, run npm install to install testing modules and browser polyfills.

npm test lints the code and runs the test suite in Node.js.

x-package.json5

package.json, component.json and bower.json are all generated from x-package.json5 by using xpkg. Only edit x-package.json5, and remember to run xpkg before commiting!

Generating the browser version

source-map-resolve.js is generated from source-map-resolve-node.js and source-map-resolve-template.js. Only edit the two latter files, not source-map-resolve.js! To generate it, run npm run build.

License

The X11 (“MIT”) License.