Socket
Socket
Sign inDemoInstall

rollup-plugin-alias

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-alias - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

6

CHANGELOG.md
# rollup-plugin-alias changelog
## 1.5.0
* Update dependencies and tests for rollup@1.0 compatibility ([#48](https://github.com/rollup/rollup-plugin-alias/pull/48))
## 1.4.0

@@ -11,2 +15,2 @@

* Start maintaining a changelog
* Fix `isFilePath` on Windows ([#3](https://github.com/rollup/rollup-plugin-alias/issues/3))
* Fix `isFilePath` on Windows ([#3](https://github.com/rollup/rollup-plugin-alias/issues/3))

18

dist/rollup-plugin-alias.es2015.js

@@ -0,4 +1,4 @@

import fs from 'fs';
import { platform } from 'os';
import path, { posix } from 'path';
import { platform } from 'os';
import fs from 'fs';
import slash from 'slash';

@@ -24,3 +24,3 @@

const isFilePath = id => /^\.?\//.test(id);
const exists = uri => {
const exists = (uri) => {
try {

@@ -33,3 +33,3 @@ return fs.statSync(uri).isFile();

const normalizeId = id => {
const normalizeId = (id) => {
if ((IS_WINDOWS && typeof id === 'string') || VOLUME.test(id)) {

@@ -45,4 +45,4 @@ return slash(id.replace(VOLUME, ''));

const resolve = hasResolve ? options.resolve : ['.js'];
const aliasKeys = hasResolve ?
Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);
const aliasKeys = hasResolve
? Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);

@@ -78,8 +78,8 @@ // No aliases?

const match = resolve.map(ext => (endsWith(ext, filePath) ? filePath : `${filePath}${ext}`))
.find(exists);
.find(exists);
if (match) {
updatedId = match;
// To keep the previous behaviour we simply return the file path
// with extension
// To keep the previous behaviour we simply return the file path
// with extension
} else if (endsWith('.js', filePath)) {

@@ -86,0 +86,0 @@ updatedId = filePath;

@@ -5,6 +5,6 @@ 'use strict';

var fs = _interopDefault(require('fs'));
var os = require('os');
var path = require('path');
var path__default = _interopDefault(path);
var os = require('os');
var fs = _interopDefault(require('fs'));
var slash = _interopDefault(require('slash'));

@@ -30,3 +30,3 @@

const isFilePath = id => /^\.?\//.test(id);
const exists = uri => {
const exists = (uri) => {
try {

@@ -39,3 +39,3 @@ return fs.statSync(uri).isFile();

const normalizeId = id => {
const normalizeId = (id) => {
if ((IS_WINDOWS && typeof id === 'string') || VOLUME.test(id)) {

@@ -51,4 +51,4 @@ return slash(id.replace(VOLUME, ''));

const resolve = hasResolve ? options.resolve : ['.js'];
const aliasKeys = hasResolve ?
Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);
const aliasKeys = hasResolve
? Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);

@@ -84,8 +84,8 @@ // No aliases?

const match = resolve.map(ext => (endsWith(ext, filePath) ? filePath : `${filePath}${ext}`))
.find(exists);
.find(exists);
if (match) {
updatedId = match;
// To keep the previous behaviour we simply return the file path
// with extension
// To keep the previous behaviour we simply return the file path
// with extension
} else if (endsWith('.js', filePath)) {

@@ -92,0 +92,0 @@ updatedId = filePath;

{
"name": "rollup-plugin-alias",
"version": "1.4.0",
"version": "1.5.0",
"description": "Resolves aliases with Rollup",

@@ -12,3 +12,3 @@ "main": "dist/rollup-plugin-alias.js",

"prepublish": "npm run build",
"lint": "eslint .",
"lint": "eslint . --fix",
"pretest": "npm-run-all -p build lint",

@@ -37,16 +37,16 @@ "test": "ava test/index.js",

},
"homepage": "https://github.com/frostney/rollup-plugin-aliar#readme",
"homepage": "https://github.com/frostney/rollup-plugin-alias#readme",
"devDependencies": {
"ava": "^0.12.0",
"coveralls": "^2.11.8",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"npm-run-all": "^1.5.1",
"nyc": "^5.6.0",
"ava": "^0.25.0",
"coveralls": "^3.0.2",
"eslint": "^5.10.0",
"eslint-plugin-import": "^2.14.0",
"npm-run-all": "^4.1.5",
"nyc": "^13.1.0",
"rimraf": "^2.5.2",
"rollup": "^0.50.0"
"rollup": "^0.67.4"
},
"dependencies": {
"slash": "^1.0.0"
"slash": "^2.0.0"
}
}
# rollup-plugin-alias
Define aliases when bundling packages with Rollup.
[![Build Status](https://travis-ci.org/frostney/rollup-plugin-alias.svg?branch=master)](https://travis-ci.org/frostney/rollup-plugin-alias) [![Dependency Status](https://david-dm.org/frostney/rollup-plugin-alias.svg)](https://david-dm.org/frostney/rollup-plugin-alias) [![devDependency Status](https://david-dm.org/frostney/rollup-plugin-alias/dev-status.svg)](https://david-dm.org/frostney/rollup-plugin-alias#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/github/frostney/rollup-plugin-alias/badge.svg?branch=master)](https://coveralls.io/github/frostney/rollup-plugin-alias?branch=master)
[![Build Status](https://travis-ci.org/rollup/rollup-plugin-alias.svg?branch=master)](https://travis-ci.org/rollup/rollup-plugin-alias) [![Dependency Status](https://david-dm.org/frostney/rollup-plugin-alias.svg)](https://david-dm.org/frostney/rollup-plugin-alias) [![devDependency Status](https://david-dm.org/frostney/rollup-plugin-alias/dev-status.svg)](https://david-dm.org/frostney/rollup-plugin-alias#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/github/frostney/rollup-plugin-alias/badge.svg?branch=master)](https://coveralls.io/github/frostney/rollup-plugin-alias?branch=master)

@@ -33,11 +33,11 @@ Let's take a simple import as an example:

```javascript
import { rollup } from 'rollup';
// rollup.config.js
import alias from 'rollup-plugin-alias';
rollup({
entry: './src/index.js',
export default {
input: './src/index.js',
plugins: [alias({
somelibrary: './mylocallibrary'
})],
});
};
```

@@ -49,7 +49,7 @@

```javascript
import { rollup } from 'rollup';
// rollup.config.js
import alias from 'rollup-plugin-alias';
rollup({
entry: './src/index.js',
export default {
input: './src/index.js',
plugins: [alias({

@@ -59,3 +59,3 @@ resolve: ['.jsx', '.js'],

})],
});
};
```

@@ -62,0 +62,0 @@ If not given local aliases will be resolved with a `.js` extension.

@@ -0,4 +1,4 @@

import fs from 'fs';
import { platform } from 'os';
import path, { posix } from 'path';
import { platform } from 'os';
import fs from 'fs';

@@ -25,3 +25,3 @@ import slash from 'slash';

const isFilePath = id => /^\.?\//.test(id);
const exists = uri => {
const exists = (uri) => {
try {

@@ -34,3 +34,3 @@ return fs.statSync(uri).isFile();

const normalizeId = id => {
const normalizeId = (id) => {
if ((IS_WINDOWS && typeof id === 'string') || VOLUME.test(id)) {

@@ -46,4 +46,4 @@ return slash(id.replace(VOLUME, ''));

const resolve = hasResolve ? options.resolve : ['.js'];
const aliasKeys = hasResolve ?
Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);
const aliasKeys = hasResolve
? Object.keys(options).filter(k => k !== 'resolve') : Object.keys(options);

@@ -79,8 +79,8 @@ // No aliases?

const match = resolve.map(ext => (endsWith(ext, filePath) ? filePath : `${filePath}${ext}`))
.find(exists);
.find(exists);
if (match) {
updatedId = match;
// To keep the previous behaviour we simply return the file path
// with extension
// To keep the previous behaviour we simply return the file path
// with extension
} else if (endsWith('.js', filePath)) {

@@ -87,0 +87,0 @@ updatedId = filePath;

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