Skip to content

Instantly share code, notes, and snippets.

View Cvmcosta's full-sized avatar
:octocat:
Open source developer

CVM Costa Cvmcosta

:octocat:
Open source developer
View GitHub Profile
@stebunovd
stebunovd / sns.py
Last active August 27, 2024 17:09
SNS webhook signature verification
import base64
import re
from urllib.parse import urlparse
import requests
from M2Crypto import X509
_signing_cert_cache = {}
_cert_url_re = re.compile(
@whoisryosuke
whoisryosuke / package.json
Created March 11, 2021 16:30
Babel/Typescript/NPM - How to build CJS, ESM, and Types using Babel and Typescript
"scripts": {
"build": "concurrently yarn:build:*",
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
"dev": "tsc --watch"
},
@sindresorhus
sindresorhus / esm-package.md
Last active March 16, 2026 04:38
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.