Skip to content

Commit 5b4eac3

Browse files
authored
[synapse] - Ignore known rollup warnings (Azure#15948)
## What - Adds warning filter to ignore known rollup warnings that are safe to ignore - Ignore `this has been rewritten to undefined` in synapse - Ignore circular dependencies in synapse ## Why These are both known warnings, are safe to ignore, and add noise to the build output unnecessarily. The first is totally safe to ignore: ``` var __spreadArray = (this && this.__spreadArray) || function (to, from) { ``` Is emitted from TypeScript in the OTel ESM and is safe to use. The second is a known issue in OTel 1.0.0 that is not harmful at runtime. Finally, we have precedent for doing the exact same thing in other packages like service-bus.
1 parent df68c3e commit 5b4eac3

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

sdk/synapse/synapse-access-control/rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,30 @@ import sourcemaps from "rollup-plugin-sourcemaps";
44
import cjs from "@rollup/plugin-commonjs";
55
import { openTelemetryCommonJs } from "@azure/dev-tool/shared-config/rollup";
66

7+
8+
const ignoreKnownWarnings = (warning) => {
9+
if (warning.code === "THIS_IS_UNDEFINED") {
10+
// This error happens frequently due to TypeScript emitting `this` at the
11+
// top-level of a module. In this case its fine if it gets rewritten to
12+
// undefined, so ignore this error.
13+
return;
14+
}
15+
16+
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.importer.indexOf("@opentelemetry/api") >= 0) {
17+
// OpenTelemetry contains circular references as of 1.0.0, but they are not fatal and can be ignored.
18+
return;
19+
}
20+
21+
console.error(`(!) ${warning.message}`);
22+
}
23+
724
/**
825
* @type {rollup.RollupFileOptions}
926
*/
1027
const config = {
1128
input: "./dist-esm/accessControlClient.js",
1229
external: ["@azure/core-http", "@azure/core-arm"],
30+
onwarn: ignoreKnownWarnings,
1331
output: {
1432
file: "./dist/index.js",
1533
format: "cjs",

sdk/synapse/synapse-managed-private-endpoints/rollup.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,29 @@ import sourcemaps from "rollup-plugin-sourcemaps";
44
import cjs from "@rollup/plugin-commonjs";
55
import { openTelemetryCommonJs } from "@azure/dev-tool/shared-config/rollup";
66

7+
const ignoreKnownWarnings = (warning) => {
8+
if (warning.code === "THIS_IS_UNDEFINED") {
9+
// This error happens frequently due to TypeScript emitting `this` at the
10+
// top-level of a module. In this case its fine if it gets rewritten to
11+
// undefined, so ignore this error.
12+
return;
13+
}
14+
15+
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.importer.indexOf("@opentelemetry/api") >= 0) {
16+
// OpenTelemetry contains circular references as of 1.0.0, but they are not fatal and can be ignored.
17+
return;
18+
}
19+
20+
console.error(`(!) ${warning.message}`);
21+
}
22+
723
/**
824
* @type {rollup.RollupFileOptions}
925
*/
1026
const config = {
1127
input: "./dist-esm/managedPrivateEndpointsClient.js",
1228
external: ["@azure/core-http", "@azure/core-arm"],
29+
onwarn: ignoreKnownWarnings,
1330
output: {
1431
file: "./dist/index.js",
1532
format: "cjs",

sdk/synapse/synapse-monitoring/rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,30 @@ import sourcemaps from "rollup-plugin-sourcemaps";
44
import cjs from "@rollup/plugin-commonjs";
55
import { openTelemetryCommonJs } from "@azure/dev-tool/shared-config/rollup";
66

7+
8+
const ignoreKnownWarnings = (warning) => {
9+
if (warning.code === "THIS_IS_UNDEFINED") {
10+
// This error happens frequently due to TypeScript emitting `this` at the
11+
// top-level of a module. In this case its fine if it gets rewritten to
12+
// undefined, so ignore this error.
13+
return;
14+
}
15+
16+
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.importer.indexOf("@opentelemetry/api") >= 0) {
17+
// OpenTelemetry contains circular references as of 1.0.0, but they are not fatal and can be ignored.
18+
return;
19+
}
20+
21+
console.error(`(!) ${warning.message}`);
22+
}
23+
724
/**
825
* @type {rollup.RollupFileOptions}
926
*/
1027
const config = {
1128
input: "./dist-esm/monitoringClient.js",
1229
external: ["@azure/core-http", "@azure/core-arm"],
30+
onwarn: ignoreKnownWarnings,
1331
output: {
1432
file: "./dist/index.js",
1533
format: "cjs",

sdk/synapse/synapse-spark/rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,30 @@ import sourcemaps from "rollup-plugin-sourcemaps";
44
import cjs from "@rollup/plugin-commonjs";
55
import { openTelemetryCommonJs } from "@azure/dev-tool/shared-config/rollup";
66

7+
8+
const ignoreKnownWarnings = (warning) => {
9+
if (warning.code === "THIS_IS_UNDEFINED") {
10+
// This error happens frequently due to TypeScript emitting `this` at the
11+
// top-level of a module. In this case its fine if it gets rewritten to
12+
// undefined, so ignore this error.
13+
return;
14+
}
15+
16+
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.importer.indexOf("@opentelemetry/api") >= 0) {
17+
// OpenTelemetry contains circular references as of 1.0.0, but they are not fatal and can be ignored.
18+
return;
19+
}
20+
21+
console.error(`(!) ${warning.message}`);
22+
}
23+
724
/**
825
* @type {rollup.RollupFileOptions}
926
*/
1027
const config = {
1128
input: "./dist-esm/sparkClient.js",
1229
external: ["@azure/core-http", "@azure/core-arm"],
30+
onwarn: ignoreKnownWarnings,
1331
output: {
1432
file: "./dist/index.js",
1533
format: "cjs",

0 commit comments

Comments
 (0)