Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: esm suport
Browse files Browse the repository at this point in the history
xiaoxiangmoe committed Dec 25, 2024
1 parent 90afa28 commit a5a9655
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -14,24 +14,29 @@
* limitations under the License.
*/
import * as process from 'process';

import { getMachineId as getMachineIdDarwin } from './getMachineId-darwin';
import { getMachineId as getMachineIdLinux } from './getMachineId-linux';
import { getMachineId as getMachineIdWin } from './getMachineId-win';
import { getMachineId as getMachineIdBsd } from './getMachineId-bsd';
import { getMachineId as getMachineIdUnsupported } from './getMachineId-unsupported';
let getMachineId: () => Promise<string>;

switch (process.platform) {
case 'darwin':
({ getMachineId } = require('./getMachineId-darwin'));
getMachineId = getMachineIdDarwin;

Check warning on line 26 in packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts

Codecov / codecov/patch

packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts#L26

Added line #L26 was not covered by tests
break;
case 'linux':
({ getMachineId } = require('./getMachineId-linux'));
getMachineId = getMachineIdLinux;
break;
case 'freebsd':
({ getMachineId } = require('./getMachineId-bsd'));
getMachineId = getMachineIdBsd;

Check warning on line 32 in packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts

Codecov / codecov/patch

packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts#L32

Added line #L32 was not covered by tests
break;
case 'win32':
({ getMachineId } = require('./getMachineId-win'));
getMachineId = getMachineIdWin;

Check warning on line 35 in packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts

Codecov / codecov/patch

packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts#L35

Added line #L35 was not covered by tests
break;
default:
({ getMachineId } = require('./getMachineId-unsupported'));
getMachineId = getMachineIdUnsupported;
break;

Check warning on line 39 in packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts

Codecov / codecov/patch

packages/opentelemetry-resources/src/detectors/platform/node/machine-id/getMachineId.ts#L38-L39

Added lines #L38 - L39 were not covered by tests
}

export { getMachineId };

0 comments on commit a5a9655

Please sign in to comment.