Skip to content

Commit 54e0924

Browse files
committed
Continue convert to ESModule
1 parent 3034216 commit 54e0924

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

commands/dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import path from 'path'
8-
import rollup from 'rollup'
8+
import * as rollup from 'rollup'
99
import onExit from '../utils/onExit.js'
1010
import displayError from '../utils/displayError.js'
1111

commands/serve.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path'
22
import http from 'http'
33
import { execSync } from 'child_process'
44
import handler from 'serve-handler'
5-
import getPort from '../utils/getPort.js'
5+
import getPort, { portNumbers } from '../utils/getPort.js'
66

77
export default async function serve({ config }) {
88
const { rootDir, isDev } = config
@@ -43,7 +43,7 @@ export default async function serve({ config }) {
4343
* @see https://github.com/remy/nodemon/blob/main/doc/requireable.md
4444
*/
4545

46-
const nodemon = await import('nodemon')
46+
const nodemon = (await import('nodemon')).default
4747

4848
nodemon({
4949
script: scriptPath,
@@ -86,7 +86,7 @@ export default async function serve({ config }) {
8686
)
8787

8888
const availablePort = await getPort({
89-
port: getPort.portNumbers(port, port + 100),
89+
port: portNumbers(port, port + 100),
9090
})
9191

9292
if (serveOptions.port && parseInt(serveOptions.port) !== availablePort) {

lib/reloader/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'path'
22
import fs from 'fs/promises'
33
import { fileURLToPath } from 'url'
4-
import getPort from '../../utils/getPort.js'
4+
import getPort, { portNumbers } from '../../utils/getPort.js'
55

66
const __dirname = path.dirname(fileURLToPath(import.meta.url))
77

@@ -29,7 +29,7 @@ export default async function createReloader({ commandName, config, tasks }) {
2929
const port = !active
3030
? defaultPort
3131
: await getPort({
32-
port: getPort.portNumbers(defaultPort, defaultPort + 100),
32+
port: portNumbers(defaultPort, defaultPort + 100),
3333
})
3434
const clientScript = !active
3535
? ''

lib/reloader/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path'
2-
import ws from 'ws'
2+
import { WebSocketServer } from 'ws'
33
import getPort from '../../utils/getPort.js'
44

55
export default async function liveReloadServer(options = {}) {
@@ -14,9 +14,9 @@ export default async function liveReloadServer(options = {}) {
1414

1515
const availablePort = reloader.port
1616
// Already found open port when reloader was created
17-
// await getPort({ port: getPort.portNumbers(port, port + 100) })
17+
// await getPort({ port: portNumbers(port, port + 100) })
1818

19-
const server = new ws.Server({ port: availablePort })
19+
const server = new WebSocketServer({ port: availablePort })
2020

2121
let firstTime = true
2222
server.on('connection', () => {

task/js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import injectProcessEnv from 'rollup-plugin-inject-process-env'
1717
* https://github.com/plumelo/rollup-plugin-styler
1818
* See [Support for Rollup v3](https://github.com/Anidetrix/rollup-plugin-styles/issues/224)
1919
*/
20-
import styles from 'rollup-plugin-styler'
20+
import styles from '../lib/rollup-plugin-styler/index.js'
2121
import postcssUrl from 'postcss-url'
2222
import kebabToCamel from '../utils/kebabToCamel.js'
2323
import raw from '../utils/rollupPluginRaw.js'

task/sass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import del from 'rollup-plugin-delete'
77
* Using fork of rollup-plugin-styles with updated dependencies
88
* See [Support for Rollup v3](https://github.com/Anidetrix/rollup-plugin-styles/issues/224)
99
*/
10-
import styles from 'rollup-plugin-styler'
10+
import styles from '../lib/rollup-plugin-styler/index.js'
1111

1212
export default async function createOptionsForTaskType(config, task) {
1313
const {

0 commit comments

Comments
 (0)