Socket
Socket
Sign inDemoInstall

@ampproject/remapping

Package Overview
Dependencies
3
Maintainers
16
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.1.2

8

dist/remapping.umd.js

@@ -198,3 +198,3 @@ (function (global, factory) {

}
let tree = build(map, '', loader);
let tree = build(map, loader, '', 0);
for (let i = maps.length - 1; i >= 0; i--) {

@@ -205,4 +205,5 @@ tree = new SourceMapTree(maps[i], [tree]);

}
function build(map, importer, loader) {
function build(map, loader, importer, importerDepth) {
const { resolvedSources, sourcesContent } = map;
const depth = importerDepth + 1;
const children = resolvedSources.map((sourceFile, i) => {

@@ -215,2 +216,3 @@ // The loading context gives the loader more information about why this file is being loaded

importer,
depth,
source: sourceFile || '',

@@ -233,3 +235,3 @@ content: undefined,

// source files.
return build(new traceMapping.TraceMap(sourceMap, source), source, loader);
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
});

@@ -236,0 +238,0 @@ return new SourceMapTree(map, children);

@@ -31,2 +31,3 @@ interface SourceMapV3 {

readonly importer: string;
readonly depth: number;
source: string;

@@ -33,0 +34,0 @@ content: string | null | undefined;

{
"name": "@ampproject/remapping",
"version": "2.1.1",
"version": "2.1.2",
"description": "Remap sequential sourcemaps through transformations to point at the original source code",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,5 +5,5 @@ # @ampproject/remapping

Remapping allows you to take the sourcemaps generated through transforming your code and
"remap" them to the original source locations. Think "my minified code, transformed with babel and
bundled with webpack", all pointing to the correct location in your original source code.
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
them to the original source locations. Think "my minified code, transformed with babel and bundled
with webpack", all pointing to the correct location in your original source code.

@@ -29,8 +29,9 @@ With remapping, none of your source code transformations need to be aware of the input's sourcemap,

// LoaderContext gives the loader the importing sourcemap, and the ability to override the "source"
// location (where nested sources are resolved relative to, and where an original source exists),
// and the ability to override the "content" of an original sourcemap for inclusion in the output
// sourcemap.
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
// "source" location (where child sources are resolved relative to, or the location of original
// source), and the ability to override the "content" of an original source for inclusion in the
// output sourcemap.
type LoaderContext = {
readonly importer: string;
readonly depth: number;
source: string;

@@ -76,2 +77,5 @@ content: string | null | undefined;

console.assert(ctx.importer === '');
// The depth in the sourcemap tree we're currently loading.
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
console.assert(ctx.depth === 1);

@@ -85,2 +89,4 @@ return transformedMap;

console.assert(ctx.importer === 'transformed.js');
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
console.assert(ctx.depth === 2);
return null;

@@ -114,4 +120,5 @@ }

As a convenience, if you have multiple single-source transformations of a file, you may pass an
array of sourcemap files in the order of most-recent transformation sourcemap first. So our above
example could have been writen as:
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
changes the `importer` and `depth` of each call to our loader. So our above example could have been
written as:

@@ -138,5 +145,5 @@ ```js

The `source` property can overridden to any value to change the location of the current load. Eg,
for an original source file, it allows us to change the filepath to the original source regardless
for an original source file, it allows us to change the location to the original source regardless
of what the sourcemap source entry says. And for transformed files, it allows us to change the
resolving location for nested sources files of the loaded sourcemap.
relative resolving location for child sources of the loaded sourcemap.

@@ -174,4 +181,5 @@ ```js

The `content` property can be overridden when we encounter an original source file. Eg, this allows
you to manually provide the source content of the file regardless of whether the `sourcesContent`
field is present in the parent sourcemap. Or, it can be set to `null` to remove the source content.
you to manually provide the source content of the original file regardless of whether the
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
the source content.

@@ -209,11 +217,10 @@ ```js

By default, `excludeContent` is `false`. Passing `{ excludeContent: true }`
will exclude the `sourcesContent` field from the returned sourcemap. This is
mainly useful when you want to reduce the size out the sourcemap.
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
the size out the sourcemap.
#### decodedMappings
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }`
will leave the `mappings` field in a [decoded
state](https://github.com/rich-harris/sourcemap-codec) instead of encoding
into a VLQ string.
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
encoding into a VLQ string.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc