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

babel-plugin-inline-replace-variables

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-inline-replace-variables - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

package.json
{
"name": "babel-plugin-inline-replace-variables",
"version": "1.2.0",
"version": "1.2.1",
"description": "babel plugin to inline replace variables",

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

@@ -13,5 +13,11 @@ /**

}
if (path.parent.type === 'ClassMethod') {
return;
}
if (path.isPure()) {
return;
}
if (!state.opts.hasOwnProperty(path.node.name)) {
return;
}
const replacement = state.opts[path.node.name]

@@ -18,0 +24,0 @@ if (replacement !== undefined) {

@@ -84,1 +84,51 @@ /**

});
describe('ignore class methods', () => {
describe(`transform`, () => {
it(`__SERVER__ should NOT be replaced`, () => {
babel.transform(`
export default class Hello {
__SERVER__(foo) {
this.foo = foo;
}
}
`, {
plugins: [[plugin, {
__SERVER__: true,
__VERSION__: "v1.2.3"
}]]
}).code
.should.be.equal(`
export default class Hello {
__SERVER__(foo) {
this.foo = foo;
}
}`)
});
});
});
describe('object own properties', () => {
describe(`transform`, () => {
it(`only own properties should be replaced`, () => {
babel.transform(`
var foo = constructor;
var bar = isPrototypeOf;
var baz = __SERVER__;
`, {
plugins: [[plugin, {
__SERVER__: true,
__VERSION__: "v1.2.3"
}]]
}).code
.should.be.equal(`
var foo = constructor;
var bar = isPrototypeOf;
var baz = true;`)
});
});
});
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