-
Notifications
You must be signed in to change notification settings - Fork 305
Expand file tree
/
Copy pathindex.mjs
More file actions
23 lines (21 loc) · 828 Bytes
/
index.mjs
File metadata and controls
23 lines (21 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import createServer from './lib/create-server.mjs'
import ldnode from './lib/create-app.mjs'
import startCli from './bin/lib/cli.mjs'
// Preserve the CommonJS-style shape where the default export has
// `createServer` and `startCli` attached as properties so existing
// tests that call `ldnode.createServer()` continue to work.
let exported
const canAttach = (ldnode && (typeof ldnode === 'object' || typeof ldnode === 'function'))
if (canAttach) {
try {
if (!ldnode.createServer) ldnode.createServer = createServer
if (!ldnode.startCli) ldnode.startCli = startCli
exported = ldnode
} catch (e) {
exported = { default: ldnode, createServer, startCli }
}
} else {
exported = { default: ldnode, createServer, startCli }
}
export default exported
export { createServer, startCli }