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

@hpcc-js/bundle

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hpcc-js/bundle - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

lib/bundle.d.ts

97

lib/rollup.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const rollup = require("rollup");
const alias = require("rollup-plugin-alias");
const commonjs = require("rollup-plugin-commonjs");
const resolve = require("rollup-plugin-node-resolve");
const postcss = require("rollup-plugin-postcss");
const sourcemaps = require("rollup-plugin-sourcemaps");
const uglify = require("rollup-plugin-uglify");
const program = require("commander");
const fs = require("fs");
const path = require("path");
const process = require("process");
program
.version("0.0.1")
.option("-m, --min", "Minimize")
.parse(process.argv);
const aliases = {};
const externals = [];
const globals = {};
const deps = {};
const webpackShims = ["@hpcc-js/dgrid-shim", "@hpcc-js/ddl-shim", "@hpcc-js/c3-shim"];
function walkDependencies(folder, depth = 0) {
const pkg = require(path.join(folder, "package.json"));
pkg.__folder = folder;
for (const key in pkg.dependencies) {
if (webpackShims.indexOf(key) >= 0 || (key !== "@hpcc-js/d3-bullet" && key.indexOf("@hpcc-js") === 0 && key.indexOf("-shim") < 0)) {
const depPkg = walkDependencies(path.join(folder, "node_modules", key), depth + 1);
deps[key] = depPkg;
if (depth === 0) {
console.log("Excluding: " + key);
externals.push(key);
globals[key] = key;
}
}
}
return pkg;
}
const myPackage = walkDependencies(process.cwd());
const leafID = myPackage.name.split("/")[1];
for (const key in myPackage.dependencies) {
if (key.indexOf("@hpcc-js") !== 0) {
for (const depKey in deps) {
if (deps[depKey].dependencies[key]) {
const depPckg = deps[depKey];
console.log(`Optimized: ${key} in ${depPckg.name}`);
aliases[key] = depKey;
const indexSrc = fs.readFileSync(path.join(depPckg.__folder, "src", "index.ts"), "utf8");
if (indexSrc.indexOf(key) < 0) {
console.log(`Error: ${key} not exported by ${depPckg.name}`);
}
const mySrc = fs.readFileSync(path.join(myPackage.__folder, "src", "index.ts"), "utf8");
if (mySrc.indexOf(key) >= 0) {
console.log(`Error: ${key} shoud not be exported by ${myPackage.name}`);
}
break;
}
}
}
}
function bundle(min = false) {
const plugins = [
alias(aliases),
resolve({
preferBuiltins: true,
jsnext: true,
main: true
}),
commonjs({
namedExports: {}
}),
postcss({
extensions: [".css"]
}),
sourcemaps()
];
if (min) {
plugins.push(uglify({}));
}
return rollup.rollup({
input: "lib-es6/index.js",
external: externals,
plugins
}).then(function (bundle) {
return bundle.write({
file: `dist/${leafID}${min ? ".min" : ""}.js`,
format: "umd",
name: myPackage.name,
globals,
sourcemap: true
});
});
}
exports.default = bundle;
const bundle_1 = require("./bundle");
Promise.all([
bundle(),
bundle(true)
bundle_1.bundle(),
bundle_1.bundle(true)
]).catch(console.log);
{
"name": "@hpcc-js/bundle",
"version": "0.0.14",
"version": "0.0.15",
"description": "hpcc-js - bundle",

@@ -32,3 +32,3 @@ "main": "lib/index.js",

"devDependencies": {
"@types/node": "8.0.10",
"@types/node": "6.0.90",
"rimraf": "2.6.1",

@@ -35,0 +35,0 @@ "typescript": "2.5.2"

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