/
index.ts
25 lines (22 loc) · 1001 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// spell-checker:ignore maint rivy
import { default as OSPathsWithAdaption } from './lib/OSPaths';
import adapter from './platform-shims/node';
// export * from './lib/OSPaths';
const default_ = OSPathsWithAdaption(adapter);
export default default_;
const haveModuleExports_ = typeof module === 'object' && module.exports;
// ## maint ~ [2020-12-23; rivy] `else` clause *is* tested, but coverage is not visible via `nyc` (currently unable to instrument ESM/.mjs correctly)
/* istanbul ignore else */
if (haveModuleExports_) {
// enables direct require from CJS (eg, `const module = require('...');`), but generally disables any other exports
// * skipped for ESM (missing `module.exports`)
// * added non-enumerable '_esm!' property (as a hack) to allow full access to all exports (for testing, etc)
// eslint-disable-next-line functional/immutable-data
module.exports = default_;
Object.defineProperty(module.exports, '_esm!', {
get() {
return exports;
},
enumerable: false,
});
}