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

babel-plugin-ember-modules-api-polyfill

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-ember-modules-api-polyfill - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

2

package.json
{
"name": "babel-plugin-ember-modules-api-polyfill",
"version": "1.5.1",
"version": "1.6.0",
"description": "Polyfill for Ember JS API.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -24,4 +24,4 @@ # babel-plugin-ember-modules-api-polyfill

This plugin provides an API polyfill to allow ember addon authors to adopt the new
[Javscript modules API](https://github.com/emberjs/rfcs/blob/master/text/0176-javascript-module-api.md) whilst still maintaining backwards
This plugin provides an API polyfill to allow ember addon authors to adopt the new
[JavaScript modules API](https://github.com/emberjs/rfcs/blob/master/text/0176-javascript-module-api.md) whilst still maintaining backwards
compatibility with older versions of Ember that do not support the new modules API.

@@ -28,0 +28,0 @@

@@ -42,2 +42,3 @@ 'use strict';

let blacklist = (state.opts && state.opts.blacklist) || [];
let polyfillEmberString = state.opts.polyfillEmberString === undefined ? true : state.opts.polyfillEmberString;
let node = path.node;

@@ -75,2 +76,8 @@ let replacements = [];

if (!polyfillEmberString && importPath === '@ember/string') {
// `@ember/string` is present in the project
// so imports should not be transformed
return;
}
// This is the mapping to use for the import statement

@@ -77,0 +84,0 @@ const mapping = reverseMapping[importPath];

@@ -105,27 +105,49 @@ 'use strict';

describe('options', () => {
it(`allows blacklisting import paths`, assert => {
let input = `import { assert } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: ['@ember/debug'] }],
]);
describe('blacklist', () => {
it(`allows blacklisting import paths`, assert => {
let input = `import { assert } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: ['@ember/debug'] }],
]);
assert.equal(actual, input);
});
assert.equal(actual, input);
});
it(`allows blacklisting specific named imports`, assert => {
let input = `import { assert, inspect } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: { '@ember/debug': ['assert', 'warn', 'deprecate'] } }],
]);
it(`allows blacklisting specific named imports`, assert => {
let input = `import { assert, inspect } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: { '@ember/debug': ['assert', 'warn', 'deprecate'] } }],
]);
assert.equal(actual, `import { assert } from '@ember/debug';\nvar inspect = Ember.inspect;`);
assert.equal(actual, `import { assert } from '@ember/debug';\nvar inspect = Ember.inspect;`);
});
it('does not error when a blacklist is not present', assert => {
let input = `import { assert, inspect } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: { } }],
]);
assert.equal(actual, `var assert = Ember.assert;\nvar inspect = Ember.inspect;`);
});
});
it('does not error when a blacklist is not present', assert => {
let input = `import { assert, inspect } from '@ember/debug';`;
let actual = transform(input, [
[Plugin, { blacklist: { } }],
]);
describe('polyfillEmberString', () => {
it('converts `@ember/string` by default', assert => {
let input = `import { dasherize } from '@ember/string';`;
let actual = transform(input, [
[Plugin],
]);
assert.equal(actual, `var assert = Ember.assert;\nvar inspect = Ember.inspect;`);
assert.equal(actual, `var dasherize = Ember.String.dasherize;`);
});
it('allows not polyfilling `@ember/string`', assert => {
let input = `import { dasherize } from '@ember/string';`;
let actual = transform(input, [
[Plugin, { polyfillEmberString: false }],
]);
assert.equal(actual, input);
});
});

@@ -132,0 +154,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