Skip to content

Commit 071ba6c

Browse files
committed
chore: revert esm changes
1 parent 544f461 commit 071ba6c

File tree

8 files changed

+4
-524
lines changed

8 files changed

+4
-524
lines changed

README.md

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ TypeScript is supported for TypeScript version 2.9 and above.
3838

3939
To make sure the installation was successful, try sending yourself an SMS message, like this:
4040

41-
**CommonJS:**
4241
```js
4342
// Your AccountSID and Auth Token from console.twilio.com
4443
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
@@ -55,25 +54,6 @@ client.messages
5554
.then((message) => console.log(message.sid));
5655
```
5756

58-
**ESM/ES6 Modules:**
59-
```js
60-
// Your AccountSID and Auth Token from console.twilio.com
61-
import twilio from 'twilio';
62-
63-
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
64-
const authToken = 'your_auth_token';
65-
66-
const client = twilio(accountSid, authToken);
67-
68-
client.messages
69-
.create({
70-
body: 'Hello from twilio-node',
71-
to: '+12345678901', // Text your number
72-
from: '+12345678901', // From a valid Twilio number
73-
})
74-
.then((message) => console.log(message.sid));
75-
```
76-
7757
After a brief delay, you will receive the text message on your phone.
7858

7959
> **Warning**
@@ -112,48 +92,10 @@ const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specifi
11292
const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
11393
```
11494

115-
**ESM/ES6 Modules:**
116-
```javascript
117-
// Your Account SID, Subaccount SID Auth Token from console.twilio.com
118-
import twilio from 'twilio';
119-
120-
const accountSid = process.env.TWILIO_ACCOUNT_SID;
121-
const authToken = process.env.TWILIO_AUTH_TOKEN;
122-
const subaccountSid = process.env.TWILIO_ACCOUNT_SUBACCOUNT_SID;
123-
124-
const client = twilio(accountSid, authToken);
125-
const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specified, so defaults to accountSid
126-
const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
127-
```
128-
12995
### Lazy Loading
13096

13197
`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
13298

133-
**CommonJS:**
134-
```javascript
135-
// Your Account SID and Auth Token from console.twilio.com
136-
const accountSid = process.env.TWILIO_ACCOUNT_SID;
137-
const authToken = process.env.TWILIO_AUTH_TOKEN;
138-
139-
const client = require('twilio')(accountSid, authToken, {
140-
lazyLoading: false,
141-
});
142-
```
143-
144-
**ESM/ES6 Modules:**
145-
```javascript
146-
// Your Account SID and Auth Token from console.twilio.com
147-
import twilio from 'twilio';
148-
149-
const accountSid = process.env.TWILIO_ACCOUNT_SID;
150-
const authToken = process.env.TWILIO_AUTH_TOKEN;
151-
152-
const client = twilio(accountSid, authToken, {
153-
lazyLoading: false,
154-
});
155-
```
156-
15799
### Enable Auto-Retry with Exponential Backoff
158100

159101
`twilio-node` supports automatic retry with exponential backoff when API requests receive an [Error 429 response](https://support.twilio.com/hc/en-us/articles/360044308153-Twilio-API-response-Error-429-Too-Many-Requests-). This retry with exponential backoff feature is disabled by default. To enable this feature, instantiate the Twilio client with the `autoRetry` flag set to `true`.

examples/example-esm.mjs

Lines changed: 0 additions & 109 deletions
This file was deleted.

lib-esm/index.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

lib-esm/package.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,14 @@
4949
"typedoc": "^0.28.11"
5050
},
5151
"scripts": {
52-
"test": "npm run test:javascript && npm run test:typescript && npm run test:esm",
52+
"test": "npm run test:javascript && npm run test:typescript",
5353
"test:javascript": "jest spec --coverage --detectOpenHandles --testPathIgnorePatterns=spec/cluster",
5454
"test:typescript": "tsc --noEmit",
5555
"test:esm": "node scripts/verify-esm.js",
5656
"jshint": "jshint src/rest/** src/base/** src/http/**",
5757
"jscs": "eslint src/base/**/**.js src/http/**/**.js --fix",
5858
"prepublish": "npm run build",
59-
"build": "npm run build:cjs && npm run build:esm && npm run prettier",
60-
"build:cjs": "tsc",
61-
"build:esm": "node scripts/build-esm.js",
59+
"build": "tsc",
6260
"check": "npm run jshint && npm run jscs",
6361
"ci": "npm run test && npm run nsp && npm run prettier-check",
6462
"nsp": "npm audit --production",
@@ -73,14 +71,7 @@
7371
"index.d.ts"
7472
],
7573
"main": "./lib",
76-
"module": "./lib-esm/index.js",
7774
"types": "./index.d.ts",
78-
"exports": {
79-
".": {
80-
"import": "./lib-esm/index.js",
81-
"require": "./lib/index.js"
82-
}
83-
},
8475
"engines": {
8576
"node": ">=14.0"
8677
},

scripts/build-esm.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)