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

@angular-devkit/build-optimizer

Package Overview
Dependencies
Maintainers
2
Versions
481
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-devkit/build-optimizer - npm Package Compare versions

Comparing version 0.7.0-beta.0 to 0.7.0-beta.1

2

package.json
{
"name": "@angular-devkit/build-optimizer",
"version": "0.7.0-beta.0",
"version": "0.7.0-beta.1",
"description": "Angular Build Optimizer",

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

@@ -35,14 +35,3 @@ "use strict";

];
// TODO: this code is very fragile and should be reworked.
// See: https://github.com/angular/devkit/issues/523
const es5AngularModules = [
// Angular 4 packaging format has .es5.js as the extension.
/\.es5\.js$/,
// Angular 5 has esm5 folders.
// Angular 6 has fesm5 folders.
/[\\/]node_modules[\\/]@angular[\\/][^\\/]+[\\/]f?esm5[\\/]/,
// All Angular versions have UMD with es5.
/\.umd\.js$/,
];
// Factories created by AOT are known to have no side effects and contain es5 code.
// Factories created by AOT are known to have no side effects.
// In Angular 2/4 the file path for factories can be `.ts`, but in Angular 5 it is `.js`.

@@ -54,4 +43,4 @@ const ngFactories = [

function isKnownSideEffectFree(filePath) {
return ngFactories.some((re) => re.test(filePath)) || (whitelistedAngularModules.some((re) => re.test(filePath))
&& es5AngularModules.some((re) => re.test(filePath)));
return ngFactories.some((re) => re.test(filePath)) ||
whitelistedAngularModules.some((re) => re.test(filePath));
}

@@ -121,2 +110,2 @@ function buildOptimizer(options) {

exports.buildOptimizer = buildOptimizer;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQtb3B0aW1pemVyLmpzIiwic291cmNlUm9vdCI6Ii4vIiwic291cmNlcyI6WyJwYWNrYWdlcy9hbmd1bGFyX2RldmtpdC9idWlsZF9vcHRpbWl6ZXIvc3JjL2J1aWxkLW9wdGltaXplci9idWlsZC1vcHRpbW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tSmF2YXNjcmlwdCh0cmFuc2Zvcm1KYXZhc2NyaXB0T3B0cyk7XG59XG4iXX0=

@@ -43,4 +43,12 @@ "use strict";

function cb(node) {
// Stop recursing into this branch if it's a function expression or declaration
if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node)) {
// Stop recursing into this branch if it's a definition construct.
// These are function expression, function declaration, class, or arrow function (lambda).
// The body of these constructs will not execute when loading the module, so we don't
// need to mark function calls inside them as pure.
// Class static initializers in ES2015 are an exception we don't cover. They would need similar
// processing as enums to prevent property setting from causing the class to be retained.
if (ts.isFunctionDeclaration(node)
|| ts.isFunctionExpression(node)
|| ts.isClassDeclaration(node)
|| ts.isArrowFunction(node)) {
return;

@@ -111,2 +119,2 @@ }

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlZml4LWZ1bmN0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIuLyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy90cmFuc2Zvcm1zL3ByZWZpeC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0dBTUc7QUFDSCxpQ0FBaUM7QUFHakMsTUFBTSxtQkFBbUIsR0FBRyxXQUFXLENBQUM7QUFFeEM7SUFDRSxNQUFNLENBQUMsQ0FBQyxPQUFpQyxFQUFpQyxFQUFFO1FBQzFFLE1BQU0sV0FBVyxHQUFrQyxDQUFDLEVBQWlCLEVBQUUsRUFBRTtZQUV2RSxNQUFNLGlCQUFpQixHQUFHLHFCQUFxQixDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ3BELE1BQU0sV0FBVyxHQUFHLGVBQWUsQ0FBQyxFQUFFLENBQUMsQ0FBQztZQUN4QyxNQUFNLGtCQUFrQixHQUFHLHdCQUF3QixXQUFXLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FB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zO1xufVxuXG5mdW5jdGlvbiBoYXNQdXJlQ29tbWVudChub2RlOiB0cy5Ob2RlKSB7XG4gIGlmICghbm9kZSkge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuICBjb25zdCBsZWFkaW5nQ29tbWVudCA9IHRzLmdldFN5bnRoZXRpY0xlYWRpbmdDb21tZW50cyhub2RlKTtcblxuICByZXR1cm4gbGVhZGluZ0NvbW1lbnQgJiYgbGVhZGluZ0NvbW1lbnQuc29tZSgoY29tbWVudCkgPT4gY29tbWVudC50ZXh0ID09PSBwdXJlRnVuY3Rpb25Db21tZW50KTtcbn1cbiJdfQ==
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