mirror of https://github.com/atom/atom.git
Replace import and export keywords with `require` and `module.exports`
This commit is contained in:
parent
86c3712520
commit
e68a2b1eb9
|
@ -1,13 +1,12 @@
|
||||||
/** @babel */
|
const TextBuffer = require('text-buffer')
|
||||||
|
const {Point, Range} = TextBuffer
|
||||||
import TextBuffer, {Point, Range} from 'text-buffer'
|
const {File, Directory} = require('pathwatcher')
|
||||||
import {File, Directory} from 'pathwatcher'
|
const {Emitter, Disposable, CompositeDisposable} = require('event-kit')
|
||||||
import {Emitter, Disposable, CompositeDisposable} from 'event-kit'
|
const BufferedNodeProcess = require('../src/buffered-node-process')
|
||||||
import BufferedNodeProcess from '../src/buffered-node-process'
|
const BufferedProcess = require('../src/buffered-process')
|
||||||
import BufferedProcess from '../src/buffered-process'
|
const GitRepository = require('../src/git-repository')
|
||||||
import GitRepository from '../src/git-repository'
|
const Notification = require('../src/notification')
|
||||||
import Notification from '../src/notification'
|
const {watchPath} = require('../src/path-watcher')
|
||||||
import {watchPath} from '../src/path-watcher'
|
|
||||||
|
|
||||||
const atomExport = {
|
const atomExport = {
|
||||||
BufferedNodeProcess,
|
BufferedNodeProcess,
|
||||||
|
@ -42,4 +41,4 @@ if (process.type === 'renderer') {
|
||||||
atomExport.TextEditor = require('../src/text-editor')
|
atomExport.TextEditor = require('../src/text-editor')
|
||||||
}
|
}
|
||||||
|
|
||||||
export default atomExport
|
module.exports = atomExport
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/** @babel */
|
|
||||||
|
|
||||||
const fs = require('fs-plus')
|
const fs = require('fs-plus')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
'use babel'
|
const {Emitter, CompositeDisposable} = require('event-kit')
|
||||||
|
|
||||||
import {Emitter, CompositeDisposable} from 'event-kit'
|
module.exports =
|
||||||
|
class AutoUpdateManager {
|
||||||
export default class AutoUpdateManager {
|
|
||||||
constructor ({applicationDelegate}) {
|
constructor ({applicationDelegate}) {
|
||||||
this.applicationDelegate = applicationDelegate
|
this.applicationDelegate = applicationDelegate
|
||||||
this.subscriptions = new CompositeDisposable()
|
this.subscriptions = new CompositeDisposable()
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/** @babel */
|
const BufferedProcess = require('./buffered-process')
|
||||||
|
|
||||||
import BufferedProcess from './buffered-process'
|
|
||||||
|
|
||||||
// Extended: Like {BufferedProcess}, but accepts a Node script as the command
|
// Extended: Like {BufferedProcess}, but accepts a Node script as the command
|
||||||
// to run.
|
// to run.
|
||||||
|
@ -12,7 +10,8 @@ import BufferedProcess from './buffered-process'
|
||||||
// ```js
|
// ```js
|
||||||
// const {BufferedNodeProcess} = require('atom')
|
// 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.
|
// Public: Runs the given Node script by spawning a new child process.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
/** @babel */
|
const _ = require('underscore-plus')
|
||||||
|
const ChildProcess = require('child_process')
|
||||||
import _ from 'underscore-plus'
|
const {Emitter} = require('event-kit')
|
||||||
import ChildProcess from 'child_process'
|
const path = require('path')
|
||||||
import {Emitter} from 'event-kit'
|
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
// Extended: A wrapper which provides standard error/output line buffering for
|
// Extended: A wrapper which provides standard error/output line buffering for
|
||||||
// Node's ChildProcess.
|
// Node's ChildProcess.
|
||||||
|
@ -19,7 +17,8 @@ import path from 'path'
|
||||||
// const exit = (code) => console.log("ps -ef exited with #{code}")
|
// const exit = (code) => console.log("ps -ef exited with #{code}")
|
||||||
// const process = new BufferedProcess({command, args, stdout, exit})
|
// const process = new BufferedProcess({command, args, stdout, exit})
|
||||||
// ```
|
// ```
|
||||||
export default class BufferedProcess {
|
module.exports =
|
||||||
|
class BufferedProcess {
|
||||||
/*
|
/*
|
||||||
Section: Construction
|
Section: Construction
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/** @babel */
|
const crypto = require('crypto')
|
||||||
|
const clipboard = require('./safe-clipboard')
|
||||||
import crypto from 'crypto'
|
|
||||||
import clipboard from './safe-clipboard'
|
|
||||||
|
|
||||||
// Extended: Represents the clipboard used for copying and pasting in Atom.
|
// Extended: Represents the clipboard used for copying and pasting in Atom.
|
||||||
//
|
//
|
||||||
|
@ -14,7 +12,8 @@ import clipboard from './safe-clipboard'
|
||||||
//
|
//
|
||||||
// console.log(atom.clipboard.read()) # 'hello'
|
// console.log(atom.clipboard.read()) # 'hello'
|
||||||
// ```
|
// ```
|
||||||
export default class Clipboard {
|
module.exports =
|
||||||
|
class Clipboard {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.reset()
|
this.reset()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/** @babel */
|
|
||||||
|
|
||||||
let ParsedColor = null
|
let ParsedColor = null
|
||||||
|
|
||||||
// Essential: A simple color class returned from {Config::get} when the value
|
// Essential: A simple color class returned from {Config::get} when the value
|
||||||
// at the key path is of type 'color'.
|
// 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}.
|
// Essential: Parse a {String} or {Object} into a {Color}.
|
||||||
//
|
//
|
||||||
// * `value` A {String} such as `'white'`, `#ff00ff`, or
|
// * `value` A {String} such as `'white'`, `#ff00ff`, or
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/** @babel */
|
const {Disposable} = require('event-kit')
|
||||||
|
|
||||||
import {Disposable} from 'event-kit'
|
|
||||||
|
|
||||||
// Extended: Manages the deserializers used for serialized state
|
// Extended: Manages the deserializers used for serialized state
|
||||||
//
|
//
|
||||||
|
@ -21,7 +19,8 @@ import {Disposable} from 'event-kit'
|
||||||
// serialize: ->
|
// serialize: ->
|
||||||
// @state
|
// @state
|
||||||
// ```
|
// ```
|
||||||
export default class DeserializerManager {
|
module.exports =
|
||||||
|
class DeserializerManager {
|
||||||
constructor (atomEnvironment) {
|
constructor (atomEnvironment) {
|
||||||
this.atomEnvironment = atomEnvironment
|
this.atomEnvironment = atomEnvironment
|
||||||
this.deserializers = {}
|
this.deserializers = {}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
/** @babel */
|
const {Emitter, CompositeDisposable} = require('event-kit')
|
||||||
|
|
||||||
import {Emitter, CompositeDisposable} from 'event-kit'
|
|
||||||
|
|
||||||
// Extended: History manager for remembering which projects have been opened.
|
// Extended: History manager for remembering which projects have been opened.
|
||||||
//
|
//
|
||||||
// An instance of this class is always available as the `atom.history` global.
|
// An instance of this class is always available as the `atom.history` global.
|
||||||
//
|
//
|
||||||
// The project history is used to enable the 'Reopen Project' menu.
|
// The project history is used to enable the 'Reopen Project' menu.
|
||||||
export class HistoryManager {
|
class HistoryManager {
|
||||||
constructor ({project, commands, stateStore}) {
|
constructor ({project, commands, stateStore}) {
|
||||||
this.stateStore = stateStore
|
this.stateStore = stateStore
|
||||||
this.emitter = new Emitter()
|
this.emitter = new Emitter()
|
||||||
|
@ -116,7 +114,7 @@ function arrayEquivalent (a, b) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HistoryProject {
|
class HistoryProject {
|
||||||
constructor (paths, lastOpened) {
|
constructor (paths, lastOpened) {
|
||||||
this.paths = paths
|
this.paths = paths
|
||||||
this.lastOpened = lastOpened || new Date()
|
this.lastOpened = lastOpened || new Date()
|
||||||
|
@ -128,3 +126,5 @@ export class HistoryProject {
|
||||||
set lastOpened (lastOpened) { this._lastOpened = lastOpened }
|
set lastOpened (lastOpened) { this._lastOpened = lastOpened }
|
||||||
get lastOpened () { return this._lastOpened }
|
get lastOpened () { return this._lastOpened }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = {HistoryManager, HistoryProject}
|
||||||
|
|
|
@ -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'
|
module.exports = async function () {
|
||||||
import path from 'path'
|
|
||||||
import ipcHelpers from './ipc-helpers'
|
|
||||||
import util from 'util'
|
|
||||||
|
|
||||||
export default async function () {
|
|
||||||
const getWindowLoadSettings = require('./get-window-load-settings')
|
const getWindowLoadSettings = require('./get-window-load-settings')
|
||||||
const {test, headless, resourcePath, benchmarkPaths} = getWindowLoadSettings()
|
const {test, headless, resourcePath, benchmarkPaths} = getWindowLoadSettings()
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -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'
|
module.exports =
|
||||||
import crypto from 'crypto'
|
class FileRecoveryService {
|
||||||
import Path from 'path'
|
|
||||||
import fs from 'fs-plus'
|
|
||||||
|
|
||||||
export default class FileRecoveryService {
|
|
||||||
constructor (recoveryDirectory) {
|
constructor (recoveryDirectory) {
|
||||||
this.recoveryDirectory = recoveryDirectory
|
this.recoveryDirectory = recoveryDirectory
|
||||||
this.recoveryFilesByFilePath = new Map()
|
this.recoveryFilesByFilePath = new Map()
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
'use babel'
|
const Registry = require('winreg')
|
||||||
|
const Path = require('path')
|
||||||
import Registry from 'winreg'
|
|
||||||
import Path from 'path'
|
|
||||||
|
|
||||||
let exeName = Path.basename(process.execPath)
|
let exeName = Path.basename(process.execPath)
|
||||||
let appPath = `\"${process.execPath}\"`
|
let appPath = `\"${process.execPath}\"`
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/** @babel */
|
|
||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
// Private: re-join the segments split from an absolute path to form another absolute path.
|
// Private: re-join the segments split from an absolute path to form another absolute path.
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/** @babel */
|
const {Disposable} = require('event-kit')
|
||||||
|
|
||||||
import {Disposable} from 'event-kit'
|
module.exports = {
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Null Grammar',
|
name: 'Null Grammar',
|
||||||
scopeName: 'text.plain.null-grammar',
|
scopeName: 'text.plain.null-grammar',
|
||||||
scopeForId (id) {
|
scopeForId (id) {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/** @babel */
|
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/** @babel */
|
const SelectListView = require('atom-select-list')
|
||||||
|
|
||||||
import SelectListView from 'atom-select-list'
|
module.exports =
|
||||||
|
class ReopenProjectListView {
|
||||||
export default class ReopenProjectListView {
|
|
||||||
constructor (callback) {
|
constructor (callback) {
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
this.selectListView = new SelectListView({
|
this.selectListView = new SelectListView({
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/** @babel */
|
const {CompositeDisposable} = require('event-kit')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
import {CompositeDisposable} from 'event-kit'
|
module.exports =
|
||||||
import path from 'path'
|
class ReopenProjectMenuManager {
|
||||||
|
|
||||||
export default class ReopenProjectMenuManager {
|
|
||||||
constructor ({menu, commands, history, config, open}) {
|
constructor ({menu, commands, history, config, open}) {
|
||||||
this.menuManager = menu
|
this.menuManager = menu
|
||||||
this.historyManager = history
|
this.historyManager = history
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/** @babel */
|
const fs = require('fs')
|
||||||
|
const childProcess = require('child_process')
|
||||||
import fs from 'fs'
|
|
||||||
import childProcess from 'child_process'
|
|
||||||
|
|
||||||
const ENVIRONMENT_VARIABLES_TO_PRESERVE = new Set([
|
const ENVIRONMENT_VARIABLES_TO_PRESERVE = new Set([
|
||||||
'NODE_ENV',
|
'NODE_ENV',
|
||||||
|
@ -120,4 +118,4 @@ async function getEnvFromShell (env) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { updateProcessEnv, shouldGetEnvFromShell }
|
module.exports = {updateProcessEnv, shouldGetEnvFromShell}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
'use babel'
|
|
||||||
|
|
||||||
const _ = require('underscore-plus')
|
const _ = require('underscore-plus')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
Loading…
Reference in New Issue