Hyperline / hyperline

✨ Status line plugin for Hyper ✨
MIT License
619 stars 120 forks source link

Hyperline will not load in 2.0.0-canary.14 #150

Closed mwdiers closed 6 years ago

mwdiers commented 6 years ago

On 2.0.0-canary.14 (latest beta at present), other plugins load fine, but Hyperline will not load.

Attempted to delete ~/.hyper_plugins and restart, but that did not resolve the problem. If I revert to 1.4.8 using the same config, Hyperline loads correctly.

Platform is macOS 10.13.3

Developer Tools console shows:

bundle.js:1 (re)loading renderer plugins
bundle.js:1 Plugin hyper-quit (1.0.2) loaded.
bundle.js:1 Plugin hyperterm-paste (1.1.2) loaded.
index.html:35 total init time 205.63
mwdiers commented 6 years ago

Config as follows:

module.exports = {
  config: {
    fontSize: 16,
    fontFamily: '"iosevka-term-medium", "Inconsolata for Powerline", "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
    fontWeight: 'normal',
    fontWeightBold: 'normal',
    cursorColor: 'rgba(248,28,229,0.8)',
    cursorShape: 'BLOCK',
    cursorBlink: false,
    foregroundColor: '#ccc',
    backgroundColor: '#000',
    borderColor: '#a70',
    css: '',
    termCSS: '',
    showHamburgerMenu: '',
    showWindowControls: '',
    padding: '12px 14px',

    colors: {
      black: '#000000',
      red: '#ff0000',
      green: '#33ff00',
      yellow: '#ffff00',
      blue: '#0066ff',
      magenta: '#cc00ff',
      cyan: '#00ffff',
      white: '#d0d0d0',
      lightBlack: '#808080',
      lightRed: '#ff0000',
      lightGreen: '#33ff00',
      lightYellow: '#ffff00',
      lightBlue: '#0066ff',
      lightMagenta: '#cc00ff',
      lightCyan: '#00ffff',
      lightWhite: '#ffffff'
    },

    shell: '/opt/homebrew/bin/zsh',
    shellArgs: ['-i'],
    env: {},
    bell: 'SOUND',
    copyOnSelect: false,
    // quickEdit: true
    // bellSoundURL: 'http://example.com/bell.mp3',

    updateChannel: 'canary',

    //Hyperline config
    hyperline: {
        plugins: [
            "hostname",
            "ip",
            "cpu",
            "memory",
            "network",
            "battery"
        ]
    }
  },

  plugins: [
    "hyper-quit",
    "hyperline",
    "hyperterm-paste"
  ],

  localPlugins: []
};
chabou commented 6 years ago

@timneutkens @NickTikhonov @timothyis More information about this.

From my debug, I think that hyperline has never worked with our canary releases. It is broken from a long time. Even in v1.4.8, we have an error:

{ Error: Cannot find module 'hyper/component'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (/Users/chabou/Documents/Projets/hyper/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/chabou/Documents/Projets/hyper/.hyper_plugins/local/hyperline/dist/hyperline.js:79:18)
    at __webpack_require__ (/Users/chabou/Documents/Projets/hyper/.hyper_plugins/local/hyperline/dist/hyperline.js:20:30)
    at Object.<anonymous> (/Users/chabou/Documents/Projets/hyper/.hyper_plugins/local/hyperline/dist/hyperline.js:146:74)
    at __webpack_require__ (/Users/chabou/Documents/Projets/hyper/.hyper_plugins/local/hyperline/dist/hyperline.js:20:30)
    at Object.<anonymous> (/Users/chabou/Documents/Projets/hyper/.hyper_plugins/local/hyperline/dist/hyperline.js:1389:78) code: 'MODULE_NOT_FOUND' }
[Notification] Plugin error!: Plugin "hyperline" failed to load (Cannot find module 'hyper/component')

In our v1.X, plugin with error was loaded anyway but not anymore.

This error is due to some hyper internals import: https://github.com/Hyperline/hyperline/blob/246c676c7e29e560dcb513d97fe83cf1166c1737/src/lib/core/hyperline.js#L3-L4 Declared as externals: https://github.com/Hyperline/hyperline/blob/246c676c7e29e560dcb513d97fe83cf1166c1737/webpack.config.js#L13

I have no idea how it can works lool

Btw, in our next canary (and upcoming v2), aphrodite as been replaced by styled-jsx. There is no Component superclass anymore in Hyper.

tjwelde commented 6 years ago

I don't know about canary, but in 1.4.8 the module loading seems to be successfully hijacked: https://github.com/zeit/hyper/blob/1.4.8/lib/utils/plugins.js#L21, but an error is still thrown, which is just a bug, I think.

chabou commented 6 years ago

@goldquest thank you to have pointed this out.

The only reason to expose some internals was https://github.com/zeit/hyper/issues/764 But this is not necessary anymore (Component class doesn't exist anymore due to styled-jsx migration).

I will try to see if other plugins would be impacted by this removal.

chabou commented 6 years ago

@NickTikhonov Any chance to fix this issue soon? Our upcoming v2 is imminent.

dakshshah96 commented 6 years ago

Doesn't work in 2.0 stable release as well.

oshalygin commented 6 years ago

ditto doesn't work in 2.0 stable either.

tjwelde commented 6 years ago

I'm working on it currently. I replaced aphrodite with styled-jsx, but I still have an issue with the dependence to hyper exposing/hijacking modules. Either I make a PR for hyper, or we include react and hyper/component (which is now just React.PureComponent) to this module ourself.

oshalygin commented 6 years ago

@goldquest thanks! let me know if you want a hand!

tjwelde commented 6 years ago

So, I have a working PR. Unfortunately it relies on a fix for hyper itself. Maybe someone can look into that PR, too. https://github.com/Hyperline/hyperline/pull/156 https://github.com/zeit/hyper/pull/2866