Socket
Socket
Sign inDemoInstall

babel-plugin-namespace-amd-define

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-namespace-amd-define - npm Package Compare versions

Comparing version 2.18.5 to 2.18.6

23

lib/index.js

@@ -38,15 +38,7 @@ "use strict";

}
let scope;
// Find if 'define' is defined in any scope
for (scope = path.scope; scope != null; scope = scope.parent) {
if (scope.bindings.define || scope.globals.define) {
break;
}
if (path.parent.type !== 'CallExpression') {
return;
}
if (scope == null ||
(scope.parent == null && !scope.bindings.define)) {
// If 'define' is not defined in any scope namespace or
// defined in the root scope as global...
if (!firstDefineNamespaced) {
// ...and it's its first appearance, namespace it
if (!firstDefineNamespaced) {
if (path.scope.parent === null) {
const namespace = this.opts.namespace || 'Liferay.Loader';

@@ -56,7 +48,6 @@ path.node.name = `${namespace}.define`;

}
else {
// ...and appeared before, record a new extra appearance
extraNamespaceCount++;
}
}
else {
extraNamespaceCount++;
}
}

@@ -63,0 +54,0 @@ },

{
"name": "babel-plugin-namespace-amd-define",
"version": "2.18.5",
"version": "2.18.6",
"description": "A Babel plugin to namespace (prefix) AMD define() calls.",

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

"dependencies": {
"liferay-npm-build-tools-common": "2.18.5"
"liferay-npm-build-tools-common": "2.18.6"
},
"gitHead": "42b661cdef42808ef63cb684b4b59185bfa0325c"
"gitHead": "ceb4fedf4039b79ac776c6c70404ff5342c4baf9"
}

@@ -20,3 +20,3 @@ /**

it('logs results correctly', () => {
it('logs nothing when only one define appears', () => {
const source = `

@@ -34,2 +34,17 @@ define([], function(){})

expect(logger.messages).toEqual([]);
});
it('logs warnings when more than one global define appears', () => {
const source = `
define([], function(){
define("something");
})
`;
babel.transform(source, {
filename: __filename,
plugins: [plugin],
});
expect(logger.messages).toMatchSnapshot();

@@ -36,0 +51,0 @@ });

@@ -35,19 +35,8 @@ /**

let scope;
// Find if 'define' is defined in any scope
for (scope = path.scope; scope != null; scope = scope.parent) {
if (scope.bindings.define || scope.globals.define) {
break;
}
if (path.parent.type !== 'CallExpression') {
return;
}
if (
scope == null ||
(scope.parent == null && !scope.bindings.define)
) {
// If 'define' is not defined in any scope namespace or
// defined in the root scope as global...
if (!firstDefineNamespaced) {
// ...and it's its first appearance, namespace it
if (!firstDefineNamespaced) {
if (path.scope.parent === null) {
const namespace =

@@ -59,6 +48,5 @@ this.opts.namespace || 'Liferay.Loader';

firstDefineNamespaced = true;
} else {
// ...and appeared before, record a new extra appearance
extraNamespaceCount++;
}
} else {
extraNamespaceCount++;
}

@@ -65,0 +53,0 @@ }

Sorry, the diff of this file is not supported yet

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