codefresh-io / node-docker-reference

A node.js package to parse a docker image reference
3 stars 2 forks source link

Make re2 optional #11

Open JamieMagee opened 2 years ago

JamieMagee commented 2 years ago

Right now re2 is always imported. Regardless of if it's used or not:

https://github.com/codefresh-io/node-docker-reference/blob/957b11b9d54a1583f6c4b78da7ef0c28fe19b37f/lib/parsers.js#L3

re2 is precompiled and not available for all architectures. node-docker-reference should attempt to load it, but fall back to RegExp if re2 is not available. For example, here's how it's handled in Renovate:

https://github.com/renovatebot/renovate/blob/48af4012e6d0b4d90a9aeb4df1471f452b677cd8/lib/util/regex.ts#L11-L20

adammfrank commented 2 years ago

Yes please, this is broken for ARM Macs.

adammfrank commented 1 year ago

@JamieMagee I implemented your suggestion here

https://github.com/swimlane/node-docker-reference