Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ecmaVersion: 8
}
},
es2020: {
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
parserOptions: {
ecmaVersion: 11
}
},
// Platforms
browser: {
globals: globals.browser
},
node: {
globals: globals.node,
parserOptions: {
ecmaFeatures: {
globalReturn: true
}
}
},
"shared-node-browser": {
globals: globals["shared-node-browser"]
},
worker: {
globals: globals.worker
},
serviceworker: {
globals: globals.serviceworker
},
// Requirements
//------------------------------------------------------------------------------
var globals = require("globals");
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = {
builtin: globals.builtin,
browser: {
globals: globals.browser
},
node: {
globals: globals.node,
ecmaFeatures: {
globalReturn: true
}
},
commonjs: {
globals: globals.commonjs,
ecmaFeatures: {
globalReturn: true
}
},
worker: {
globals: globals.worker
},
amd: {
globals: globals.amd
},
return cached;
} else {
path.setData("scope", this);
}
this.parent = parent;
this.file = parent ? parent.file : file;
this.parentBlock = path.parent;
this.block = path.node;
this.path = path;
this.crawl();
}
static globals = flatten([globals.builtin, globals.browser, globals.node].map(Object.keys));
static contextVariables = ["this", "arguments", "super"];
/**
* Description
*/
traverse(node: Object, opts: Object, state?) {
traverse(node, opts, this, state, this.path);
}
/**
* Description
*/
generateTemp(name: string = "temp") {
var id = this.generateUidIdentifier(name);
const t = require('@babel/types');
const globals = require('globals');
const { difference } = require('lodash');
const browserGlobals = difference(
Object.keys(globals.browser),
Object.keys(globals.node)
);
const customGlobals = ['docElement'];
function shouldHandleEnvironmentForPath(path, globalReferenceVariable) {
/*
* Handle only if
* * is not inside function or is inside IIFE
* * is not variable declarator for browser check
* * doesn’t already have check for browser
* * is not inside `try` statement
* * is not default import specifier and identifier is not inside custom globals
* * is not part of Modernizr object
* * is not property of object which is considered browser global
*/
if (
(Boolean(
globalScope.through.forEach(ref => {
const identifier = ref.identifier;
if (!considerTypeOf && hasTypeOfOperator(identifier)) {
return;
}
const env = lookupEnv(identifier);
if (env === IS_BROWSER) {
if (globals.browser.hasOwnProperty(identifier.name)) {
return;
}
} else if (env === IS_NODEJS) {
if (globals.node.hasOwnProperty(identifier.name)) {
return;
}
}
context.report({
node: identifier,
message: "'{{name}}' is not defined.",
data: identifier,
});
});
},
XPathException: false,
XPathNamespace: false,
XPathNSResolver: false
},
globals.browser
)
},
node: {
/*
* For backward compatibility.
* Remove those on the next major release.
*/
globals: Object.assign(
{ arguments: false, GLOBAL: false, root: false },
globals.node
),
parserOptions: {
ecmaFeatures: {
globalReturn: true
}
}
},
commonjs: {
globals: globals.commonjs,
parserOptions: {
ecmaFeatures: {
globalReturn: true
}
}
},
"shared-node-browser": {