-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Miscellaneous improvements.
- Loading branch information
Showing
7 changed files
with
84 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const DEFAULT_TINI_VERSION = '0.18.0'; | ||
|
||
export const DEFAULT_UBUNTU_VERSION = '22.04'; | ||
|
||
export const DOCKER_IMAGE_PATTERN = /^(?:([^/]+)\/)?(?:([^/]+)\/)?([^/:@]+)(?:[:@](.+))?$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import _ow, { type Ow } from 'ow'; | ||
|
||
|
||
/** | ||
* This is needed because while we transpile to ESM, we still transpile to CJS | ||
* for testing in Jest, and certain modules will import different values based | ||
* on these strategies, so we have to "find" the package's true default export | ||
* at runtime in a way that works in both ESM and CJS. | ||
* | ||
* This is essentially a replacement for Babel's _interopRequireDefault helper | ||
* which is not used / added to transpiled code when transpiling to ESM. | ||
* | ||
* TODO: Move to separate package. | ||
*/ | ||
export function getDefaultExport<T extends object>(value: T) { | ||
try { | ||
let result = value; | ||
|
||
while (Reflect.has(result, 'default')) { | ||
result = Reflect.get(result, 'default'); | ||
} | ||
|
||
return result; | ||
} catch { | ||
return value; | ||
} | ||
} | ||
|
||
const ow: Ow = getDefaultExport(_ow); | ||
|
||
export default ow; |