Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
get rid of fsevents dependency
Browse files Browse the repository at this point in the history
luckily fsevents is only a dependecy of babel-plugin-add-module-exports.
This plugin transforms default exports into something that is easier to
consume within nodejs.
The fix is rather easy: "just" get rid of default exports.
Unfortunately this was tricker than initially thought because several
files did not use flowtype and the main file did not type check
properly.
  • Loading branch information
lloiser committed Jan 15, 2019
1 parent 4700d7e commit a9ad6ac
Show file tree
Hide file tree
Showing 82 changed files with 4,342 additions and 1,943 deletions.
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sourceMap": "inline",
"plugins": [
["add-module-exports", {}],
["transform-class-properties", {}],
["transform-es2015-modules-commonjs", {"strictMode": false}],
["transform-object-rest-spread", {}],
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ os:
- linux
- osx

osx_image: xcode8.3

env:
global:
- GO111MODULE=off
- APM_TEST_PACKAGES="go-signature-statusbar go-debug"
- FSEVENTS_BUILD_FROM_SOURCE=true
matrix:
- ATOM_CHANNEL=beta
- ATOM_CHANNEL=stable
Expand Down
8 changes: 8 additions & 0 deletions flow-libs/atom.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ declare class atom$Decoration {
}

declare class atom$DisplayMarkerLayer {
id: number,
destroy(): void,
clear(): void,
isDestroyed(): boolean,
Expand Down Expand Up @@ -789,6 +790,12 @@ type DecorateMarkerParams = {
onlyHead?: boolean,
onlyEmpty?: boolean,
onlyNonEmpty?: boolean,
} | {
type: 'line-number',
class: string,
onlyHead?: boolean,
onlyEmpty?: boolean,
onlyNonEmpty?: boolean,
} | {
type: 'gutter',
item?: HTMLElement,
Expand Down Expand Up @@ -950,6 +957,7 @@ declare class atom$TextEditor extends atom$Model {
// Markers
addMarkerLayer(): atom$DisplayMarkerLayer,
getDefaultMarkerLayer(): atom$DisplayMarkerLayer,
getMarkerLayer(id: number): atom$DisplayMarkerLayer,
markBufferPosition(position: atom$PointLike, options?: MarkerOptions): atom$Marker,
markBufferRange(range: atom$RangeLike, options?: MarkerOptions): atom$Marker,
markScreenRange(range: atom$RangeLike, options?: MarkerOptions): atom$Marker,
Expand Down
4 changes: 2 additions & 2 deletions lib/ansi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* eslint-disable react/display-name */

import etch from 'etch' // eslint-disable-line
import EtchComponent from './etch-component'
import { EtchComponent } from './etch-component'
import parser from 'ansi-style-parser'

export default class AnsiStyle extends EtchComponent {
export class AnsiStyle extends EtchComponent {
props: { text?: string, mapText?: string => any }

constructor(props: Object) {
Expand Down
5 changes: 0 additions & 5 deletions lib/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class Bootstrap {
}

subscribeToEvents() {
global.jasmineLog && global.jasmineLog('bootstrap - subscribeToEvents')
const activationHook = (hookName, fn) => {
const hooks: any = (atom.packages: any).triggeredActivationHooks
if (hooks && hooks.has(hookName)) {
Expand Down Expand Up @@ -88,19 +87,16 @@ class Bootstrap {
}

setEnvironmentLoaded() {
global.jasmineLog && global.jasmineLog('bootstrap - setEnvironmentLoaded')
this.environmentLoaded = true
this.check()
}

setGrammarUsed() {
global.jasmineLog && global.jasmineLog('bootstrap - setGrammarUsed')
this.grammarUsed = true
this.check()
}

setCommandUsed() {
global.jasmineLog && global.jasmineLog('bootstrap - setCommandUsed')
this.commandUsed = true
this.check()
}
Expand All @@ -111,7 +107,6 @@ class Bootstrap {
}

if (this.environmentLoaded && (this.grammarUsed || this.commandUsed)) {
global.jasmineLog && global.jasmineLog('bootstrap - activated')
this.activated = true
this.subscriptions.dispose()
if (this.onActivated) {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import pathhelper from './pathhelper'
import * as pathhelper from './pathhelper'
import path from 'path'

const getenvironment = (): { [string]: ?string } => {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/locator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { CompositeDisposable } from 'atom'
import { getenvironment, getgopath } from './environment'
import pathhelper from './pathhelper'
import * as pathhelper from './pathhelper'
import fs from 'fs'
import os from 'os'
import path from 'path'
Expand Down
8 changes: 3 additions & 5 deletions lib/config/pathhelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import path from 'path'
import os from 'os'

function expand(env: { [string]: ?string }, thepath: string): string {
export function expand(env: { [string]: ?string }, thepath: string): string {
if (!thepath || thepath.trim() === '') {
return ''
}
Expand Down Expand Up @@ -53,16 +53,14 @@ function expand(env: { [string]: ?string }, thepath: string): string {
return result
}

function resolveAndNormalize(pathitem: string): string {
export function resolveAndNormalize(pathitem: string): string {
if (!pathitem || pathitem.trim() === '') {
return ''
}
const result = path.resolve(path.normalize(pathitem))
return result
}

function home() {
export function home() {
return os.homedir()
}

export default { expand, resolveAndNormalize, home }
5 changes: 3 additions & 2 deletions lib/doc/godoc-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import type { Tab, PanelModel } from './../panel/tab'
import type { GogetdocResult } from './godoc'
import type GodocView from './godoc-view'
import type { GodocView } from './godoc-view'

export default class GodocPanel implements PanelModel {
export class GodocPanel implements PanelModel {
key: string
tab: Tab
keymap: string
Expand All @@ -16,6 +16,7 @@ export default class GodocPanel implements PanelModel {
constructor() {
this.key = 'reference'
this.tab = {
key: 'reference',
name: 'Reference',
packageName: 'go-plus',
icon: 'book',
Expand Down
7 changes: 3 additions & 4 deletions lib/doc/godoc-view.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// @flow
/** @babel */
/** @jsx etch.dom */

import etch from 'etch'
import EtchComponent from './../etch-component'
import { EtchComponent } from './../etch-component'

import type GodocPanel from './godoc-panel'
import type { GodocPanel } from './godoc-panel'

export default class GodocView extends EtchComponent {
export class GodocView extends EtchComponent {
props: { model: GodocPanel }

constructor(props: { model: GodocPanel }) {
Expand Down
2 changes: 1 addition & 1 deletion lib/doc/godoc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import { CompositeDisposable, Point, Range } from 'atom'
import GodocPanel from './godoc-panel'
import { GodocPanel } from './godoc-panel'
import { utf8OffsetForBufferPosition } from '../utils'
import { buildGuruArchive } from '../guru-utils'
import os from 'os'
Expand Down
6 changes: 5 additions & 1 deletion lib/etch-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

import etch from 'etch'

export interface Renderable {
render(): any;
}

/*
Public: Abstract class for handling the initialization
boilerplate of an Etch component.
*/
export default class EtchComponent {
export class EtchComponent implements Renderable {
props: any
refs: Object
element: HTMLElement
Expand Down
6 changes: 3 additions & 3 deletions lib/get/get-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os from 'os'
import { CompositeDisposable, Disposable } from 'atom'
import SimpleDialog from './../simple-dialog'
import { SimpleDialog } from './../simple-dialog'
import { promiseWaterfall } from './../promise'
import type { GoConfig } from './../config/service'
import type { ExecResult } from './../config/executor'
Expand Down Expand Up @@ -31,15 +31,15 @@ export type InteractiveGetOptions = {
class GetManager {
goconfig: GoConfig
outputFunc: () => OutputManager
busySignal: () => BusySignalService
busySignal: () => ?BusySignalService
packages: Map<string, number>
onDidUpdateTools: Set<(MultiGetResult, Array<string>) => void>
subscriptions: CompositeDisposable

constructor(
goconfig: GoConfig,
outputFunc: () => OutputManager,
busySignal: () => BusySignalService
busySignal: () => ?BusySignalService
) {
this.goconfig = goconfig
this.outputFunc = outputFunc
Expand Down
2 changes: 1 addition & 1 deletion lib/get/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GetService {
constructor(
goconfig: GoConfig,
getOutput: Function,
busySignal: () => BusySignalService
busySignal: () => ?BusySignalService
) {
this.getmanager = new GetManager(goconfig, getOutput, busySignal)
}
Expand Down
3 changes: 1 addition & 2 deletions lib/implements/implements-view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// @flow
/** @babel */
/** @jsx etch.dom */
/* eslint-disable react/no-unknown-property */
/* eslint-disable react/jsx-key */

import etch from 'etch'
import EtchComponent from './../etch-component'
import { EtchComponent } from './../etch-component'
import { parseGoPosition, openFile } from './../utils'

import type { Implements } from './implements'
Expand Down
1 change: 1 addition & 0 deletions lib/implements/implements.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Implements implements PanelModel {

this.key = 'implements'
this.tab = {
key: 'implements',
name: 'Implements',
packageName: 'go-plus',
icon: 'tasklist',
Expand Down
2 changes: 1 addition & 1 deletion lib/import/importer-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import SelectListView from 'atom-select-list'

export default class ImporterView {
export class ImporterView {
modalPanel: any
selectListView: SelectListView
previouslyFocusedElement: ?HTMLElement
Expand Down
2 changes: 1 addition & 1 deletion lib/import/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { CompositeDisposable } from 'atom'
import path from 'path'
import ImporterView from './importer-view'
import { ImporterView } from './importer-view'
import { getEditor } from './../utils'
import { allPackages } from './../go'
import * as gcph from './../autocomplete/gocodeprovider-helper'
Expand Down
5 changes: 2 additions & 3 deletions lib/info/information-view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// @flow
/** @babel */
/** @jsx etch.dom */
/* eslint-disable react/no-unknown-property */
/* eslint-disable react/no-string-refs */

import etch from 'etch'
import EtchComponent from './../etch-component'
import { EtchComponent } from './../etch-component'

import type { Information } from './information'

Expand All @@ -15,7 +14,7 @@ type Props = {
content: string
}

export default class InformationView extends EtchComponent {
export class InformationView extends EtchComponent {
props: Props

constructor(props: Props) {
Expand Down
3 changes: 2 additions & 1 deletion lib/info/information.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os from 'os'

import type { GoConfig } from './../config/service'
import type { PanelModel, Tab } from './../panel/tab'
import type InformationView from './information-view'
import type { InformationView } from './information-view'

class Information implements PanelModel {
goconfig: GoConfig
Expand All @@ -17,6 +17,7 @@ class Information implements PanelModel {
this.goconfig = goconfig
this.key = 'go'
this.tab = {
key: 'go',
name: 'Go',
packageName: 'go-plus',
icon: 'info',
Expand Down
Loading

0 comments on commit a9ad6ac

Please sign in to comment.