Giter VIP home page Giter VIP logo

jp-babel's People

Contributors

announcement avatar antimatter15 avatar buzz avatar gnestor avatar minrk avatar n-riesco avatar westurner avatar willwhitney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jp-babel's Issues

Unhandled 'error' event on launch

When I run jp-babel I get the following error. The '/usr/local/lib/node_modules/jp-babel/' directory exists, but there is obviously no 'images' subdirectory...not sure why it's looking one...

$ jp-babel
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/jp-babel/images/logo-32x32.png'
    at Error (native)

jupyter console: syntax errors are impossible to recover from

Consider a typo like the following:

% jupyter console --kernel=babel
KERNEL: SHELL_SOCKET: Unhandled message type: history_request
Jupyter console 5.1.0

jp-babel v0.2.0
https://github.com/n-riesco/jp-babel



In [1]: if (3 == 4) ( console.log('wow'); }
SyntaxError: unknown: Unexpected token, expected , (1:32)
> 1 | if (3 == 4) ( console.log('wow'); }
    |                                 ^

and then you can hit Ctrl-C all you like, but nothing works and you basically have to kill the process.

This issue is not present in IJavascript:

% jupyter console --kernel=javascript
KERNEL: SHELL_SOCKET: Unhandled message type: history_request
Jupyter console 5.1.0

IJavascript v5.0.17
https://github.com/n-riesco/ijavascript



In [1]: if (3 == 4) ( console.log('wow'); }
SyntaxError: Unexpected token ;
    at Object.exports.runInThisContext (vm.js:53:16)
    at run ([eval]:613:19)
    at onRunRequest ([eval]:384:22)
    at onMessage ([eval]:352:17)
    at emitTwo (events.js:87:13)
    at process.emit (events.js:172:7)
    at handleMessage (internal/child_process.js:695:10)
    at Pipe.channel.onread (internal/child_process.js:440:11)

In [2]:                                                                                                                                                                                                                                       

where you get back the shell prompt and can fix your typo and continue to work.

Adding plugins via .babelrc (and transpiling recursively for referenced modules)?

I've been using this for a few weeks now with the Hydrogen plugin for Atom and it's working great, but when trying to add a babel plugin in .babelrc jp-babel doesn't seem to find it:

{ "plugins": ["syntax-flow"] }

I tried both project local and global plugin installation, as well as putting .babelrc in the project root and $HOME, doesn't make a difference.

Am I missing something here, any way to make this work?

Switch to jupyter lab?

Jupyter lab seems to be cool kid on the block with the intention to "eventually replace the classic Jupyter Notebook."

From what I checked switching over to lab is literally as easy as replacing "notebook" with "lab" in "bin/rc.js"

Thoughts?

Error: Couldn't find preset "es2015"

See #1 for an initial report.

This bug is triggered when babel-preset-es2015 is installed as a nested dependency.

To work around this issue, install jp-babel along with babel-preset-es2015:

npm install jp-babel babel-preset-es2015

Conflicts between babel dependency versions and Node versions break jp-babel

Follow up from #9 (comment)

I upgraded the babel dependencies when working on #9 and encountered You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type when trying to use async/await in a cell. Doing a git clean -xfd && npm install resolved it for me.

Another issue that is somewhat related is the Error: Module version mismatch. Expected 48, got 47. error that occurs when jp-babel is installed with one version of Node and used with another without rebuilding. There is an open issue on ijavascript: n-riesco/ijavascript#76

Atom Hydrogen can't find jp-babel kernel for Babel ES6 Javascript

Sorry @n-riesco for spamming... One last issue I promise.

I installed jp-babel without any issue, but I just can't get hydrogen to run on Babel ES6 Javascript (powered by language-babel package in Atom), and the kernel is properly registered. Since jp-babel use babel-preset-2015 and ES6=ES2015, I thought I don't have to do any setting. It should just work after installation, right?

image

DOC: Which paths for .babelrc are supported?

Where all can I place a .babelrc?

I'm assuming that ~/.babelrc works; but I generally don't want to set even user globals.

  • README: describe how to cat >> $path/.babelrc << EOF

See also: #24

jp-babel slow on first eval after kernel start

jp-babel seems to take about 10-15 seconds on the first eval with a fresh kernel (even on something simple as 1+2) as opposed to ijavascript's almost immediate evaluation.

Any way to speed this up?

`.babelrc` for TypeScript + React

In case it is helpful to others, here is the .babelrc file that I am using with this kernel to get TypeScript and React working:

{
  "presets": [
    "@babel/react",
    [
      "@babel/typescript",
      {
        "isTSX": true,
        "allExtensions": true,
        "allowNamespaces": true
      }
    ]
  ]
}

Error: EACCES: permission denied, scandir

Just installed jp-babel kernel, started a new notebook. Then the kernel died:

Error: EACCES: permission denied, scandir '/store/mycomputer/datastore'
    at Object.fs.readdirSync (fs.js:904:18)
    at findFile (/store/mycomputer/datastore/myusername/programs/jupyter/node_modules/jp-babel/lib/kernel.js:100:21)
    at findFile (/store/mycomputer/datastore/myusername/programs/jupyter/node_modules/jp-babel/lib/kernel.js:110:12)
    at findFile (/store/mycomputer/datastore/myusername/programs/jupyter/node_modules/jp-babel/lib/kernel.js:110:12)
    at Object.<anonymous> (/store/mycomputer/datastore/myusername/programs/jupyter/node_modules/jp-babel/lib/kernel.js:84:19)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)

It looks like jp-babel traverses up the directories in order to find a .babelrc.

$ ls -l /store/mycomputer/datastore
ls: cannot open directory '/store/mycomputer/datastore': Permission denied
$ ls -ld /store/mycomputer/datastore
drwx--x--x 9 root root 4096 Jan  4 15:41 /store/mycomputer/datastore

This is how things are on the computer I'm currently at. I guess we can't assume all parent dirs are accessible.

Versions

$ jp-babel --version
1.1.3

$ npx npm --version
5.6.0

$ npx ipython --version
6.2.1

$ lsb_release -sd
"openSUSE Leap 42.3"

`import` statements scoped to cell

If imported modules are referenced outside of the cells where they're imported, they're undefined:

// In[1]
import infer from 'json-schema-generator';

// In[2]
infer

// ReferenceError: infer is not defined
//     at evalmachine.<anonymous>:3:1
//     at ContextifyScript.Script.runInThisContext (vm.js:25:33)
//     at Object.exports.runInThisContext (vm.js:77:17)
//     at run ([eval]:608:19)
//     at onRunRequest ([eval]:379:22)
//     at onMessage ([eval]:347:17)
//     at emitTwo (events.js:106:13)
//     at process.emit (events.js:191:7)
//     at process.nextTick (internal/child_process.js:744:12)
//     at _combinedTickCallback (internal/process/next_tick.js:67:7)

kernel errors on some es6 features in required submodules

Hello!
Thanks for your work thus far on this. The error I'm encountering happens when requiring an es6 sub module inside a jp-babel notebook session.

For example, if I have a file called my-module.js which contains a destructured assignment:

const {a} = {a: 'val'};
module.exports = a;

and I require it in the notebook with this statement: const m = require('my-module');

it will generate the following error:

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at loader (/usr/local/lib/node_modules/jp-babel/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/jp-babel/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at evalmachine.<anonymous>:3:17
    at Object.exports.runInThisContext (vm.js:54:17)

however, if I change my-module.js to:

const b = {a: 'val'}, a = b.a;
module.exports = a;

I can require it successfully in the notebook. For some reason the const variable declaration is fine, but the destructered assignment isn't. However, destructured assignment works fine if I do it within the notebook.

I'm confused as to why all es6 features will work in the notebook, but the only es6 feature that seems to work in a submodule required within the notebook is const. If the required submodules weren't being babel compiled I would expect the supported es6 features to be all or nothing.

Also, default variables (such as function test(a='value'){}) work within the notebook, but throws this error when they're included in a submodule:

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at loader (/usr/local/lib/node_modules/jp-babel/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/jp-babel/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at evalmachine.<anonymous>:3:17
    at Object.exports.runInThisContext (vm.js:54:17)

hopefully this is easily reproducible. Once again, thank you for your work on this thus far, it's been really useful for me in my work.

babel7 support

hi,
My current project requires babel7 but it seems to be not supported by jp-babel. Is there is any solution to make it works with babel 7?
I really appreciate this package, it saves a lot of my time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.