rollup-plugin-sourcemaps
Advanced tools
Comparing version 0.3.7 to 0.4.0
# Changelog | ||
## 0.4.0 | ||
* Remove async functions, since they require `babel-runtime` on Node 4 | ||
## 0.3.7 | ||
* Switch to `babel-preset-latest` | ||
## 0.3.6 | ||
* Switch to `babel-preset-es2015` | ||
## 0.3.5 | ||
* Upgrade internal build process | ||
## 0.3.4 | ||
* Add `name` property to plugin object | ||
## 0.3.3 | ||
* Change incorrect package.json property `js:main` to `jsnext:main` | ||
## 0.3.2 | ||
* Include sourcesContent in source map | ||
* Include `sourcesContent` in source map | ||
@@ -18,3 +42,3 @@ ## 0.3.1 | ||
* Use source-map-resolve for extracting source maps | ||
* Use `source-map-resolve` for extracting source maps | ||
@@ -21,0 +45,0 @@ ## 0.1.1 |
@@ -1,31 +0,5 @@ | ||
import _regeneratorRuntime from 'babel-runtime/regenerator'; | ||
import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator'; | ||
import { createFilter } from 'rollup-pluginutils'; | ||
import { resolve } from 'source-map-resolve'; | ||
import { readFile } from 'fs'; | ||
import _Promise from 'babel-runtime/core-js/promise'; | ||
/* eslint-disable import/prefer-default-export */ | ||
function promisify(nodeFn) { | ||
return function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return new _Promise(function (resolve, reject) { | ||
nodeFn.apply(undefined, args.concat([function (error, result) { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(result); | ||
} | ||
}])); | ||
}); | ||
}; | ||
} | ||
/* eslint-disable no-console */ | ||
var readFileAsync = promisify(fs.readFile); | ||
var resolveSourceMapAsync = promisify(sourceMapResolve.resolve); | ||
function sourcemaps() { | ||
@@ -37,3 +11,3 @@ var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var filter = rollupPluginutils.createFilter(include, exclude); | ||
var filter = createFilter(include, exclude); | ||
@@ -44,77 +18,27 @@ return { | ||
load: function load(id) { | ||
var _this = this; | ||
if (!filter(id)) { | ||
return null; | ||
} | ||
return _asyncToGenerator(_regeneratorRuntime.mark(function _callee() { | ||
var code, sourceMap, _sourceMap, map, sourcesContent; | ||
return new Promise(function (resolve$$1) { | ||
readFile(id, 'utf8', function (err, code) { | ||
if (err) { | ||
// Failed reading file, let the next plugin deal with it | ||
resolve$$1(null); | ||
} else { | ||
resolve(code, id, readFile, function (err, sourceMap) { | ||
if (err || sourceMap === null) { | ||
// Either something went wrong, or there was no source map | ||
resolve$$1(code); | ||
} else { | ||
var map = sourceMap.map; | ||
var sourcesContent = sourceMap.sourcesContent; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (filter(id)) { | ||
_context.next = 2; | ||
break; | ||
} | ||
return _context.abrupt('return', null); | ||
case 2: | ||
code = void 0; | ||
_context.prev = 3; | ||
_context.next = 6; | ||
return readFileAsync(id, 'utf8'); | ||
case 6: | ||
code = _context.sent; | ||
_context.next = 12; | ||
break; | ||
case 9: | ||
_context.prev = 9; | ||
_context.t0 = _context['catch'](3); | ||
return _context.abrupt('return', null); | ||
case 12: | ||
sourceMap = void 0; | ||
_context.prev = 13; | ||
_context.next = 16; | ||
return resolveSourceMapAsync(code, id, fs.readFile); | ||
case 16: | ||
sourceMap = _context.sent; | ||
_context.next = 23; | ||
break; | ||
case 19: | ||
_context.prev = 19; | ||
_context.t1 = _context['catch'](13); | ||
console.error('rollup-plugin-sourcemaps: Failed resolving source map from ' + id + ': ' + _context.t1); | ||
return _context.abrupt('return', code); | ||
case 23: | ||
if (!(sourceMap === null)) { | ||
_context.next = 25; | ||
break; | ||
} | ||
return _context.abrupt('return', code); | ||
case 25: | ||
_sourceMap = sourceMap; | ||
map = _sourceMap.map; | ||
sourcesContent = _sourceMap.sourcesContent; | ||
map.sourcesContent = sourcesContent; | ||
return _context.abrupt('return', { code: code, map: map }); | ||
case 30: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
resolve$$1({ code: code, map: map }); | ||
} | ||
}); | ||
} | ||
}, _callee, _this, [[3, 9], [13, 19]]); | ||
}))(); | ||
}); | ||
}); | ||
} | ||
@@ -121,0 +45,0 @@ }; |
'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var _regeneratorRuntime = _interopDefault(require('babel-runtime/regenerator')); | ||
var _asyncToGenerator = _interopDefault(require('babel-runtime/helpers/asyncToGenerator')); | ||
var rollupPluginutils = require('rollup-pluginutils'); | ||
var sourceMapResolve = require('source-map-resolve'); | ||
var fs = require('fs'); | ||
var _Promise = _interopDefault(require('babel-runtime/core-js/promise')); | ||
/* eslint-disable import/prefer-default-export */ | ||
function promisify(nodeFn) { | ||
return function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return new _Promise(function (resolve, reject) { | ||
nodeFn.apply(undefined, args.concat([function (error, result) { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(result); | ||
} | ||
}])); | ||
}); | ||
}; | ||
} | ||
/* eslint-disable no-console */ | ||
var readFileAsync = promisify(fs.readFile); | ||
var resolveSourceMapAsync = promisify(sourceMapResolve.resolve); | ||
function sourcemaps() { | ||
@@ -47,77 +19,27 @@ var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
load: function load(id) { | ||
var _this = this; | ||
if (!filter(id)) { | ||
return null; | ||
} | ||
return _asyncToGenerator(_regeneratorRuntime.mark(function _callee() { | ||
var code, sourceMap, _sourceMap, map, sourcesContent; | ||
return new Promise(function (resolve$$1) { | ||
fs.readFile(id, 'utf8', function (err, code) { | ||
if (err) { | ||
// Failed reading file, let the next plugin deal with it | ||
resolve$$1(null); | ||
} else { | ||
sourceMapResolve.resolve(code, id, fs.readFile, function (err, sourceMap) { | ||
if (err || sourceMap === null) { | ||
// Either something went wrong, or there was no source map | ||
resolve$$1(code); | ||
} else { | ||
var map = sourceMap.map; | ||
var sourcesContent = sourceMap.sourcesContent; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (filter(id)) { | ||
_context.next = 2; | ||
break; | ||
} | ||
return _context.abrupt('return', null); | ||
case 2: | ||
code = void 0; | ||
_context.prev = 3; | ||
_context.next = 6; | ||
return readFileAsync(id, 'utf8'); | ||
case 6: | ||
code = _context.sent; | ||
_context.next = 12; | ||
break; | ||
case 9: | ||
_context.prev = 9; | ||
_context.t0 = _context['catch'](3); | ||
return _context.abrupt('return', null); | ||
case 12: | ||
sourceMap = void 0; | ||
_context.prev = 13; | ||
_context.next = 16; | ||
return resolveSourceMapAsync(code, id, fs.readFile); | ||
case 16: | ||
sourceMap = _context.sent; | ||
_context.next = 23; | ||
break; | ||
case 19: | ||
_context.prev = 19; | ||
_context.t1 = _context['catch'](13); | ||
console.error('rollup-plugin-sourcemaps: Failed resolving source map from ' + id + ': ' + _context.t1); | ||
return _context.abrupt('return', code); | ||
case 23: | ||
if (!(sourceMap === null)) { | ||
_context.next = 25; | ||
break; | ||
} | ||
return _context.abrupt('return', code); | ||
case 25: | ||
_sourceMap = sourceMap; | ||
map = _sourceMap.map; | ||
sourcesContent = _sourceMap.sourcesContent; | ||
map.sourcesContent = sourcesContent; | ||
return _context.abrupt('return', { code: code, map: map }); | ||
case 30: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
resolve$$1({ code: code, map: map }); | ||
} | ||
}); | ||
} | ||
}, _callee, _this, [[3, 9], [13, 19]]); | ||
}))(); | ||
}); | ||
}); | ||
} | ||
@@ -124,0 +46,0 @@ }; |
{ | ||
"name": "rollup-plugin-sourcemaps", | ||
"version": "0.3.7", | ||
"version": "0.4.0", | ||
"description": "Rollup plugin for grabbing source maps from sourceMappingURLs", | ||
@@ -14,4 +14,4 @@ "author": "Max Davidson <davidsonmax@gmail.com>", | ||
"engines": { | ||
"node": ">=4.0.0", | ||
"npm": ">=2.14.2" | ||
"node": ">=4.5.0", | ||
"npm": ">=2.15.9" | ||
}, | ||
@@ -23,3 +23,2 @@ "scripts": { | ||
"test": "nyc ava", | ||
"test:watch": "npm run clean && nyc ava --watch & cross-env NODE_ENV=test rollup -w -c", | ||
"test:coverage": "nyc report -r text-lcov | coveralls", | ||
@@ -49,3 +48,2 @@ "prebuild": "npm run clean", | ||
"dependencies": { | ||
"babel-runtime": "^6.9.2", | ||
"rollup-pluginutils": "^1.5.0", | ||
@@ -60,3 +58,2 @@ "source-map-resolve": "^0.5.0" | ||
"babel-plugin-istanbul": "^2.0.0", | ||
"babel-plugin-transform-runtime": "^6.9.0", | ||
"babel-preset-latest": "^6.14.0", | ||
@@ -66,9 +63,8 @@ "coveralls": "^2.11.9", | ||
"eslint": "^3.0.1", | ||
"eslint-config-airbnb-base": "^5.0.0", | ||
"eslint-config-airbnb-base": "^7.0.0", | ||
"eslint-plugin-import": "^1.8.1", | ||
"nyc": "^8.0.0", | ||
"rimraf": "^2.5.2", | ||
"rollup": "^0.34.0", | ||
"rollup-plugin-babel": "^2.5.1", | ||
"rollup-watch": "^2.4.0" | ||
"rollup": "^0.35.7", | ||
"rollup-plugin-babel": "^2.5.1" | ||
}, | ||
@@ -75,0 +71,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
15
11679
79
1
- Removedbabel-runtime@^6.9.2
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.11.1(transitive)