Skip to content

Commit

Permalink
Replace import and export keywords with require and module.exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Scandurra committed Jan 19, 2018
1 parent 86c3712 commit e68a2b1
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 87 deletions.
21 changes: 10 additions & 11 deletions exports/atom.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/** @babel */

import TextBuffer, {Point, Range} from 'text-buffer'
import {File, Directory} from 'pathwatcher'
import {Emitter, Disposable, CompositeDisposable} from 'event-kit'
import BufferedNodeProcess from '../src/buffered-node-process'
import BufferedProcess from '../src/buffered-process'
import GitRepository from '../src/git-repository'
import Notification from '../src/notification'
import {watchPath} from '../src/path-watcher'
const TextBuffer = require('text-buffer')
const {Point, Range} = TextBuffer
const {File, Directory} = require('pathwatcher')
const {Emitter, Disposable, CompositeDisposable} = require('event-kit')
const BufferedNodeProcess = require('../src/buffered-node-process')
const BufferedProcess = require('../src/buffered-process')
const GitRepository = require('../src/git-repository')
const Notification = require('../src/notification')
const {watchPath} = require('../src/path-watcher')

const atomExport = {
BufferedNodeProcess,
Expand Down Expand Up @@ -42,4 +41,4 @@ if (process.type === 'renderer') {
atomExport.TextEditor = require('../src/text-editor')
}

export default atomExport
module.exports = atomExport
2 changes: 0 additions & 2 deletions src/atom-paths.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @babel */

const fs = require('fs-plus')
const path = require('path')

Expand Down
7 changes: 3 additions & 4 deletions src/auto-update-manager.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use babel'
const {Emitter, CompositeDisposable} = require('event-kit')

import {Emitter, CompositeDisposable} from 'event-kit'

export default class AutoUpdateManager {
module.exports =
class AutoUpdateManager {
constructor ({applicationDelegate}) {
this.applicationDelegate = applicationDelegate
this.subscriptions = new CompositeDisposable()
Expand Down
7 changes: 3 additions & 4 deletions src/buffered-node-process.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/** @babel */

import BufferedProcess from './buffered-process'
const BufferedProcess = require('./buffered-process')

// Extended: Like {BufferedProcess}, but accepts a Node script as the command
// to run.
Expand All @@ -12,7 +10,8 @@ import BufferedProcess from './buffered-process'
// ```js
// const {BufferedNodeProcess} = require('atom')
// ```
export default class BufferedNodeProcess extends BufferedProcess {
module.exports =
class BufferedNodeProcess extends BufferedProcess {

// Public: Runs the given Node script by spawning a new child process.
//
Expand Down
13 changes: 6 additions & 7 deletions src/buffered-process.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @babel */

import _ from 'underscore-plus'
import ChildProcess from 'child_process'
import {Emitter} from 'event-kit'
import path from 'path'
const _ = require('underscore-plus')
const ChildProcess = require('child_process')
const {Emitter} = require('event-kit')
const path = require('path')

// Extended: A wrapper which provides standard error/output line buffering for
// Node's ChildProcess.
Expand All @@ -19,7 +17,8 @@ import path from 'path'
// const exit = (code) => console.log("ps -ef exited with #{code}")
// const process = new BufferedProcess({command, args, stdout, exit})
// ```
export default class BufferedProcess {
module.exports =
class BufferedProcess {
/*
Section: Construction
*/
Expand Down
9 changes: 4 additions & 5 deletions src/clipboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @babel */

import crypto from 'crypto'
import clipboard from './safe-clipboard'
const crypto = require('crypto')
const clipboard = require('./safe-clipboard')

// Extended: Represents the clipboard used for copying and pasting in Atom.
//
Expand All @@ -14,7 +12,8 @@ import clipboard from './safe-clipboard'
//
// console.log(atom.clipboard.read()) # 'hello'
// ```
export default class Clipboard {
module.exports =
class Clipboard {
constructor () {
this.reset()
}
Expand Down
5 changes: 2 additions & 3 deletions src/color.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/** @babel */

let ParsedColor = null

// Essential: A simple color class returned from {Config::get} when the value
// at the key path is of type 'color'.
export default class Color {
module.exports =
class Color {
// Essential: Parse a {String} or {Object} into a {Color}.
//
// * `value` A {String} such as `'white'`, `#ff00ff`, or
Expand Down
7 changes: 3 additions & 4 deletions src/deserializer-manager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/** @babel */

import {Disposable} from 'event-kit'
const {Disposable} = require('event-kit')

// Extended: Manages the deserializers used for serialized state
//
Expand All @@ -21,7 +19,8 @@ import {Disposable} from 'event-kit'
// serialize: ->
// @state
// ```
export default class DeserializerManager {
module.exports =
class DeserializerManager {
constructor (atomEnvironment) {
this.atomEnvironment = atomEnvironment
this.deserializers = {}
Expand Down
10 changes: 5 additions & 5 deletions src/history-manager.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/** @babel */

import {Emitter, CompositeDisposable} from 'event-kit'
const {Emitter, CompositeDisposable} = require('event-kit')

// Extended: History manager for remembering which projects have been opened.
//
// An instance of this class is always available as the `atom.history` global.
//
// The project history is used to enable the 'Reopen Project' menu.
export class HistoryManager {
class HistoryManager {
constructor ({project, commands, stateStore}) {
this.stateStore = stateStore
this.emitter = new Emitter()
Expand Down Expand Up @@ -116,7 +114,7 @@ function arrayEquivalent (a, b) {
return true
}

export class HistoryProject {
class HistoryProject {
constructor (paths, lastOpened) {
this.paths = paths
this.lastOpened = lastOpened || new Date()
Expand All @@ -128,3 +126,5 @@ export class HistoryProject {
set lastOpened (lastOpened) { this._lastOpened = lastOpened }
get lastOpened () { return this._lastOpened }
}

module.exports = {HistoryManager, HistoryProject}
12 changes: 5 additions & 7 deletions src/initialize-benchmark-window.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/** @babel */
const {remote} = require('electron')
const path = require('path')
const ipcHelpers = require('./ipc-helpers')
const util = require('util')

import {remote} from 'electron'
import path from 'path'
import ipcHelpers from './ipc-helpers'
import util from 'util'

export default async function () {
module.exports = async function () {
const getWindowLoadSettings = require('./get-window-load-settings')
const {test, headless, resourcePath, benchmarkPaths} = getWindowLoadSettings()
try {
Expand Down
13 changes: 6 additions & 7 deletions src/main-process/file-recovery-service.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use babel'
const {dialog} = require('electron')
const crypto = require('crypto')
const Path = require('path')
const fs = require('fs-plus')

import {dialog} from 'electron'
import crypto from 'crypto'
import Path from 'path'
import fs from 'fs-plus'

export default class FileRecoveryService {
module.exports =
class FileRecoveryService {
constructor (recoveryDirectory) {
this.recoveryDirectory = recoveryDirectory
this.recoveryFilesByFilePath = new Map()
Expand Down
6 changes: 2 additions & 4 deletions src/main-process/win-shell.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use babel'

import Registry from 'winreg'
import Path from 'path'
const Registry = require('winreg')
const Path = require('path')

let exeName = Path.basename(process.execPath)
let appPath = `\"${process.execPath}\"`
Expand Down
2 changes: 0 additions & 2 deletions src/native-watcher-registry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @babel */

const path = require('path')

// Private: re-join the segments split from an absolute path to form another absolute path.
Expand Down
6 changes: 2 additions & 4 deletions src/null-grammar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @babel */
const {Disposable} = require('event-kit')

import {Disposable} from 'event-kit'

export default {
module.exports = {
name: 'Null Grammar',
scopeName: 'text.plain.null-grammar',
scopeForId (id) {
Expand Down
2 changes: 0 additions & 2 deletions src/path-watcher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @babel */

const fs = require('fs')
const path = require('path')

Expand Down
7 changes: 3 additions & 4 deletions src/reopen-project-list-view.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** @babel */
const SelectListView = require('atom-select-list')

import SelectListView from 'atom-select-list'

export default class ReopenProjectListView {
module.exports =
class ReopenProjectListView {
constructor (callback) {
this.callback = callback
this.selectListView = new SelectListView({
Expand Down
9 changes: 4 additions & 5 deletions src/reopen-project-menu-manager.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/** @babel */
const {CompositeDisposable} = require('event-kit')
const path = require('path')

import {CompositeDisposable} from 'event-kit'
import path from 'path'

export default class ReopenProjectMenuManager {
module.exports =
class ReopenProjectMenuManager {
constructor ({menu, commands, history, config, open}) {
this.menuManager = menu
this.historyManager = history
Expand Down
8 changes: 3 additions & 5 deletions src/update-process-env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @babel */

import fs from 'fs'
import childProcess from 'child_process'
const fs = require('fs')
const childProcess = require('child_process')

const ENVIRONMENT_VARIABLES_TO_PRESERVE = new Set([
'NODE_ENV',
Expand Down Expand Up @@ -120,4 +118,4 @@ async function getEnvFromShell (env) {
return result
}

export default { updateProcessEnv, shouldGetEnvFromShell }
module.exports = {updateProcessEnv, shouldGetEnvFromShell}
2 changes: 0 additions & 2 deletions src/workspace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use babel'

const _ = require('underscore-plus')
const url = require('url')
const path = require('path')
Expand Down

0 comments on commit e68a2b1

Please sign in to comment.