Skip to content

Commit

Permalink
remove onwarn handler, update with context="null"
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshaNalluru committed May 13, 2019
1 parent 10b71ee commit 2d2c526
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 106 deletions.
50 changes: 6 additions & 44 deletions sdk/storage/storage-blob/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ const depNames = Object.keys(pkg.dependencies);
const production = process.env.NODE_ENV === "production";

export function nodeConfig(test = false) {
const externalNodeBuiltins = [
"@azure/ms-rest-js",
"crypto",
"fs",
"events",
"os",
"stream"
];
const externalNodeBuiltins = ["@azure/ms-rest-js", "crypto", "fs", "events", "os", "stream"];
const baseConfig = {
input: "dist-esm/src/index.js",
external: depNames.concat(externalNodeBuiltins),
Expand All @@ -57,10 +50,7 @@ export function nodeConfig(test = false) {

if (test) {
// entry point is every test file
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/node/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));

// different output file
Expand All @@ -69,16 +59,7 @@ export function nodeConfig(test = false) {
// mark assert as external
baseConfig.external.push("assert", "fs", "path");

baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.plugins.push(uglify());
}
Expand Down Expand Up @@ -124,36 +105,17 @@ export function browserConfig(test = false, production = false) {
cjs({
namedExports: {
events: ["EventEmitter"],
assert: [
"ok",
"deepEqual",
"equal",
"fail",
"deepStrictEqual",
"notDeepEqual"
]
assert: ["ok", "deepEqual", "equal", "fail", "deepStrictEqual", "notDeepEqual"]
}
})
]
};

if (test) {
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/browser/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/browser/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));
baseConfig.output.file = "dist-test/index.browser.js";
baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.output.file = "browser/azure-storage-blob.min.js";
baseConfig.plugins.push(
Expand Down
40 changes: 5 additions & 35 deletions sdk/storage/storage-file/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ const depNames = Object.keys(pkg.dependencies);
const production = process.env.NODE_ENV === "production";

export function nodeConfig(test = false) {
const externalNodeBuiltins = [
"@azure/ms-rest-js",
"crypto",
"fs",
"events",
"os",
"stream"
];
const externalNodeBuiltins = ["@azure/ms-rest-js", "crypto", "fs", "events", "os", "stream"];
const baseConfig = {
input: "dist-esm/src/index.js",
external: depNames.concat(externalNodeBuiltins),
Expand All @@ -57,10 +50,7 @@ export function nodeConfig(test = false) {

if (test) {
// entry point is every test file
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/node/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));

// different output file
Expand All @@ -69,16 +59,7 @@ export function nodeConfig(test = false) {
// mark assert as external
baseConfig.external.push("assert", "fs", "path");

baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.plugins.push(uglify());
}
Expand Down Expand Up @@ -140,22 +121,11 @@ export function browserConfig(test = false, production = false) {
};

if (test) {
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/browser/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/browser/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));
baseConfig.output.file = "dist-test/index.browser.js";
baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.output.file = "browser/azure-storage-file.min.js";
baseConfig.plugins.push(
Expand Down
31 changes: 4 additions & 27 deletions sdk/storage/storage-queue/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ export function nodeConfig(test = false) {

if (test) {
// entry point is every test file
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/node/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));

// different output file
Expand All @@ -62,16 +59,7 @@ export function nodeConfig(test = false) {
// mark assert as external
baseConfig.external.push("assert", "fs", "path");

baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.plugins.push(uglify());
}
Expand Down Expand Up @@ -122,22 +110,11 @@ export function browserConfig(test = false, production = false) {
};

if (test) {
baseConfig.input = [
"dist-esm/test/*.spec.js",
"dist-esm/test/browser/*.spec.js"
];
baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/browser/*.spec.js"];
baseConfig.plugins.unshift(multiEntry({ exports: false }));
baseConfig.output.file = "dist-test/index.browser.js";
baseConfig.onwarn = warning => {
if (warning.code === "THIS_IS_UNDEFINED") {
// This error happens frequently due to TypeScript emitting `this` at the
// top-level of a module. In this case its fine if it gets rewritten to
// undefined, so ignore this error.
return;
}

console.error(`(!) ${warning.message}`);
};
baseConfig.context = "null";
} else if (production) {
baseConfig.output.file = "browser/azure-storage-queue.min.js";
baseConfig.plugins.push(
Expand Down

0 comments on commit 2d2c526

Please sign in to comment.