Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

source-map-loader

Package Overview
Dependencies
Maintainers
8
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-loader - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

dist/parse-data-url.js

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## [1.1.0](https://github.com/webpack-contrib/source-map-loader/compare/v1.0.2...v1.1.0) (2020-08-29)
### Features
* filter source mapping url ([5cc3dfd](https://github.com/webpack-contrib/source-map-loader/commit/5cc3dfde50e9f1df95e21a8fdbc697ae36cd6897))
### Bug Fixes
* update anchor ([#126](https://github.com/webpack-contrib/source-map-loader/issues/126)) ([78effee](https://github.com/webpack-contrib/source-map-loader/commit/78effeee8eead75081d3ebc71567f408aa2f6ce2))
### [1.0.2](https://github.com/webpack-contrib/source-map-loader/compare/v1.0.1...v1.0.2) (2020-08-19)

@@ -7,0 +19,0 @@

@@ -41,2 +41,23 @@ "use strict";

let behaviourSourceMappingUrl;
try {
behaviourSourceMappingUrl = typeof options.filterSourceMappingUrl !== 'undefined' ? options.filterSourceMappingUrl(sourceMappingURL, this.resourcePath) : 'consume';
} catch (error) {
callback(error);
return;
} // eslint-disable-next-line default-case
switch (behaviourSourceMappingUrl) {
case 'skip':
callback(null, input, inputMap);
return;
case false:
case 'remove':
callback(null, input.replace(replacementString, ''), inputMap);
return;
}
let sourceURL;

@@ -43,0 +64,0 @@ let sourceContent;

2

dist/labels-to-names.js

@@ -8,3 +8,3 @@ "use strict";

const labelToNames = {
'866': 'IBM866',
866: 'IBM866',
'unicode-1-1-utf-8': 'UTF-8',

@@ -11,0 +11,0 @@ 'utf-8': 'UTF-8',

{
"type": "object",
"additionalProperties": false
"additionalProperties": false,
"properties": {
"filterSourceMappingUrl": {
"instanceof": "Function"
}
}
}

@@ -16,4 +16,2 @@ "use strict";

var _dataUrls = _interopRequireDefault(require("data-urls"));
var _iconvLite = require("iconv-lite");

@@ -23,2 +21,4 @@

var _parseDataUrl = _interopRequireDefault(require("./parse-data-url"));
var _labelsToNames = _interopRequireDefault(require("./labels-to-names"));

@@ -108,3 +108,3 @@

function fetchFromDataURL(loaderContext, sourceURL) {
const dataURL = (0, _dataUrls.default)(sourceURL);
const dataURL = (0, _parseDataUrl.default)(sourceURL);

@@ -111,0 +111,0 @@ if (dataURL) {

{
"name": "source-map-loader",
"version": "1.0.2",
"version": "1.1.0",
"description": "extracts inlined source map and offers it to webpack",

@@ -44,11 +44,12 @@ "license": "MIT",

"dependencies": {
"data-urls": "^2.0.0",
"abab": "^2.0.4",
"iconv-lite": "^0.6.2",
"loader-utils": "^2.0.0",
"schema-utils": "^2.7.0",
"source-map": "^0.6.1"
"source-map": "^0.6.1",
"whatwg-mimetype": "^2.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/core": "^7.11.4",
"@babel/preset-env": "^7.11.0",

@@ -67,7 +68,7 @@ "@commitlint/cli": "^10.0.0",

"husky": "^4.2.5",
"jest": "^26.4.0",
"lint-staged": "^10.2.11",
"jest": "^26.4.2",
"lint-staged": "^10.2.13",
"memfs": "^3.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"prettier": "^2.1.1",
"standard-version": "^9.0.0",

@@ -74,0 +75,0 @@ "webpack": "^4.44.1"

@@ -51,3 +51,3 @@ <div align="center">

`source-map-loader` extracts existing source maps from all JavaScript entries.
The `source-map-loader` extracts existing source maps from all JavaScript entries.
This includes both inline source maps as well as those linked via URL.

@@ -57,3 +57,3 @@ All source map data is passed to webpack for processing as per a chosen [source map style](https://webpack.js.org/configuration/devtool/) specified by the `devtool` option in [webpack.config.js](https://webpack.js.org/configuration/).

If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data. `source-map-loader` allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved.
`source-map-loader` will extract from any JavaScript file, including those in the `node_modules` directory.
The `source-map-loader` will extract from any JavaScript file, including those in the `node_modules` directory.
Be mindful in setting [include](https://webpack.js.org/configuration/module/#rule-include) and [exclude](https://webpack.js.org/configuration/module/#rule-exclude) rule conditions to maximize bundling performance.

@@ -63,2 +63,56 @@

## Options
| Name | Type | Default | Description |
| :-----------------------------------------------------: | :----------: | :---------: | :--------------------------------------------- |
| **[`filterSourceMappingUrl`](#filtersourcemappingurl)** | `{Function}` | `undefined` | Allows to control `SourceMappingURL` behaviour |
### filterSourceMappingUrl
Type: `Function`
Default: `undefined`
Allows you to specify the behavior of the loader for `SourceMappingURL` comment.
The function must return one of the values:
- `true` or `'consume'` - consume the source map and remove `SourceMappingURL` comment (default behavior)
- `false` or `'remove'` - do not consume the source map and remove `SourceMappingURL` comment
- `skip` - do not consume the source map and do not remove `SourceMappingURL` comment
Example configuration:
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: [
{
loader: 'source-map-loader',
options: {
filterSourceMappingUrl: (url, resourcePath) => {
if (/broker-source-map-url\.js$/i.test(url)) {
return false;
}
if (/keep-source-mapping-url\.js$/i.test(resourcePath)) {
return 'skip';
}
return true;
},
},
},
],
},
],
},
};
```
## Examples

@@ -65,0 +119,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc