John,
This turns to be one of that "bug reports that you like to hear" ;)
I've identified the culprit, it was .babelrc in my home dir. We were
totally wrong in that Babel ignores .babelrc in embedded mode. In fact,
it looks for it *everywhere*:
[mitya@localhost test]$ strace node ./compile-app-demo.js 2>&1 | grep
babelrc
access("/home/mitya/qxcompiler/testdata/qxt/source/class/qxt/.babelrc",
F_OK) = -1 ENOENT (No such file or directory)
access("/home/mitya/qxcompiler/testdata/qxt/source/class/.babelrc",
F_OK) = -1 ENOENT (No such file or directory)
access("/home/mitya/qxcompiler/testdata/qxt/source/.babelrc", F_OK) =
-1 ENOENT (No such file or directory)
access("/home/mitya/qxcompiler/testdata/qxt/.babelrc", F_OK) = -1
ENOENT (No such file or directory)
access("/home/mitya/qxcompiler/testdata/.babelrc", F_OK) = -1 ENOENT
(No such file or directory)
access("/home/mitya/qxcompiler/.babelrc", F_OK) = -1 ENOENT (No such
file or directory)
access("/home/mitya/.babelrc", F_OK) = 0
open("/home/mitya/.babelrc", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 11After the file
has been encountered, seems like it tries to resolve presets/plugins relative
to that file location.
With that file removed, everything finally worked with qxt! But then I tried to
build my own project, and got similar error:
/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:393
throw new Error("Couldn't find preset " + JSON.stringify(val) + "
relative to directory " + JSON.stringify(dirname));
^
Error: Couldn't find preset "es2015" relative to directory
"/home/mitya/Projects/foo/source/class/foo"
at
/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:393:17
at Array.map (native)
at OptionManager.resolvePresets
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:385:20)
at OptionManager.mergePresets
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:10)
at OptionManager.mergeOptions
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328:14)
at OptionManager.init
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:486:10)
at File.initOptions
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/index.js:211:75)
at new File
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/index.js:129:22)
at Pipeline.transform
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/pipeline.js:48:16)
at /home/mitya/qxcompiler/lib/qxcompiler/ClassFile.js:220:32
This time no .babelrc files anywhere in the project structure. Remember I
earlier did "npm link async" in the project dir so that build script would run.
To get rid of this, I removed foo/node_modules and symlinked
qxcompiler/node_modules to the project dir. Got yet another error, this time
with UploadMgr:
Error: Couldn't find preset "es2015" relative to directory
"/home/mitya/qooxdoo-contrib/UploadMgr/source/class/com/zenesis/qx/upload"
at
/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:393:17
at Array.map (native)
at OptionManager.resolvePresets
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:385:20)
at OptionManager.mergePresets
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:10)
at OptionManager.mergeOptions
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328:14)
at OptionManager.init
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:486:10)
at File.initOptions
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/index.js:211:75)
at new File
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/file/index.js:129:22)
at Pipeline.transform
(/home/mitya/qxcompiler/node_modules/babel-core/lib/transformation/pipeline.js:48:16)
at /home/mitya/qxcompiler/lib/qxcompiler/ClassFile.js:220:32
With node_modules symlinked to qooxdoo-contrib/UploadMgr, finally everything
worked. This is easily reproducible if you move qxt outside of QxCompiler dir,
place build script inside qxt and adjust paths accordingly (I used absolute
paths).
Transpiling and compression work just fine. Yet I've encountered a small bug
with translations. If a message is translated with this.tr*() set of functions,
everything works fine. If qx.locale.Manager.tr() is used, such a message simply
won't make it into the build.
I think we should unconditionally transfer all the *.po strings into the build,
since translation in the app could be done based on dynamic, computed values.
I think that as soon as the remaining issues are fixed, QxCompiler can be
considered fairly stable. I'm already integrating it into our build process.
Cheers!
Dimitri
> Hi Dimitri
>
> Sorry I realise now that was a rash suggestion, obviously it had to
> be in the test directory to work.
>
> I think there’s something odd with your installation because I’ve
> just switched to a Centos 6.5 VM that has never had node installed,
> installed Node 4, ImageMagick, cloned the QxCompiler repo, and run
> npm install. I discovered a problem with package.json where babel-
> types wasn’t listed, but once I fixed that with "npm install babel-
> types —save” I was able to “cd test ; ./compile-app-demo.js” and get
> a working app, with resources and Bable transpiling.
>
> I tried Node 5 too on the same machine (deleting my ~/.npm,
> node_modules, and testdata/qxt/source-output directories first) and
> that also works for me; also the ./compile-app-demo-build.js
>
> If I list installed plugins I get:
> $ npm list | grep 2015
> ├─┬ babel-preset-es2015@6.5.0
> │ ├─┬ babel-plugin-check-es2015-constants@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-arrow-functions@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-block-scoped-functions@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-block-scoping@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-classes@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-computed-properties@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-destructuring@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-for-of@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-function-name@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-literals@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-modules-commonjs@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-object-super@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-parameters@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-shorthand-properties@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-spread@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-sticky-regex@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-template-literals@6.5.2
> │ ├─┬ babel-plugin-transform-es2015-typeof-symbol@6.5.0
> │ ├─┬ babel-plugin-transform-es2015-unicode-regex@6.5.0
>
> The array of plugins that was in QxCompiler previously was the
> equivalent of the es2015 preset, albeit the list was slightly out of
> date so updating the code to use a preset instead of plugins should
> only improve support, but you had it working with the preset
> yesterday so I don’t understand why it is not working now.
>
> Is it possible that you have Babel installed globally and it’s
> conflicting somehow? I’ve updated the package.json at GitHub to
> explicitly reference babel-types, and rechecking out etc on my Centos
> 6 VM now runs without any complaints so it might be worth updating
> and trying again.
>
> Regards
> John
>
> From: Dimitri <mi...@cargosoft.ru>
> Reply-To: qooxdoo Development <qooxdoo-devel@lists.sourceforge.net>
> Date: Wednesday, 17 February 2016 at 23:02
> To: <qooxdoo-devel@lists.sourceforge.net>
> Subject: Re: [qooxdoo-devel] QxCompiler - add ES6, faster
> compilation, and 100% Javascript API to building applications
>
> [mitya@localhost qxcompiler]$ ./test/compile-app-demo.js
> Error: Error: ENOENT: no such file or directory, open
> '../testdata/qxt/Manifest.json'
>
>
> > Hmm - what happens if you change directory to the root of the
> > QxCompiler repo and run ./test/compile-app-demo.js?
> >
> > From: Dimitri <mi...@cargosoft.ru>
> > Reply-To: qooxdoo Development <qooxdoo-devel@lists.sourceforge.net>
> > Date: Wednesday, 17 February 2016 at 22:31
> > To: <qooxdoo-devel@lists.sourceforge.net>
> > Subject: Re: [qooxdoo-devel] QxCompiler - add ES6, faster
> > compilation, and 100% Javascript API to building applications
> >
> > No cigar this time :-\
> >
> > [mitya@localhost test]$ ./compile-app-demo.js
> > /home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:393
> > throw new Error("Couldn't find preset " +
> > JSON.stringify(val) + " relative to directory " +
> > JSON.stringify(dirname));
> > ^
> >
> > Error: Couldn't find preset "es2015" relative to directory
> > "/home/mitya"
> > at /home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:393:17
> > at Array.map (native)
> > at OptionManager.resolvePresets
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:385:20)
> > at OptionManager.mergePresets
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:369:10)
> > at OptionManager.mergeOptions
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:328:14)
> > at OptionManager.addConfig
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:234:10)
> > at OptionManager.findConfigs
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:434:16)
> > at OptionManager.init
> > (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/options/option-manager.js:482:12)
> > at File.initOptions (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/index.js:211:75)
> > at new File (/home/mitya/qxcompiler/node_modules/babel-
> > core/lib/transformation/file/index.js:129:22)
> >
> > Dunno why it looks for presets in my home dir. In my previous
> > experiment, everything went smooth (except that it didn't in fact
> > collect any qooxdoo deps, since I removed all plugins - but
> > transpiling itself went fine).
> >
> > As for uglify - ah, that was stupid. I used original uglify, not
> > uglify-js. Just tried the latter (2.6.1) - indeed, it takes ~10
> > secs for qxt. Not bad.
> >
> > В Ср, 17/02/2016 в 20:56 +0000, John Spackman пишет:
> > > Got it – it was a bug in my plugin I introduced a while ago, but
> > > Chrome obviously supports arrow functions natively so I didn’t
> > > pick up that the translation wasn’t happening any more. The
> > > .babelrc is not needed for this because we’re using it embedded,
> > > I think the .babelrc is only for the CLI
> > >
> > > That’s very a good point about the polypill BTW because it’s not
> > > being included and it should be, I’ll add that in tomorrow.
> > >
> > > The problem with translations is fixed now too, sorry about that
> > > I should have deleted the output directory before retesting
> > > :oops:
> > >
> > > What options are you running Uglify with, and what version are
> > > you running? I’m using "uglify boot.js -m -c”, I just timed it
> > > on mine and it’s mangled the qxt app in 11 seconds (I’m using
> > > uglify 2.6.1) Still not great but better than 30 secs :) I’ve
> > > nearly got Uglify done, but stopped for dinner and then saw your
> > > email so switched back.
> > >
> > > I’ve done the #! entries too
> > >
> > > I’ve pushed a new release, give it a go :)
> > >
> > > John
> > >
> > > From: Dimitri <mi...@cargosoft.ru>
> > > Reply-To: qooxdoo Development
> > > t>
> > > Date: Wednesday, 17 February 2016 at 19:33
> > > To: <qooxdoo-devel@lists.sourceforge.net>
> > > Subject: Re: [qooxdoo-devel] QxCompiler - add ES6, faster
> > > compilation, and 100% Javascript API to building applications
> > >
> > > Just a quick follow-up on Babel - I've rolled back to yesterday's
> > > version, edited lib/qxcompiler/ClassFile.js:218, replaced that
> > > plugins array with presets: [ "es2015" ]. Suddenly, it worked :)
> > > I'm still wondering why it doesn't try to look for any .babelrc
> > > file. It's clearly stated in the docs that the "babelrc" option
> > > is true by default. And it definitely would be good to have
> > > control over Babel via (optional) config file.
> > >
> > > Another issue to consider is that not every ES6 feature is
> > > implemented via code transformation. Some (ex., Promises) require
> > > babel-polyfill. (Mention in the docs? Integrate polyfill into
> > > build?)
> > >
> > > Dimitri
> > >
> > > > Hi John,
> > > >
> > > > That pace you're keeping, it's incredible :) Glad to hear
> > > > translations finally landed!
> > > >
> > > > Unfortunately, I couldn't make them work :(
> > > >
> > > > [mitya@localhost test]$ node compile-app-demo.js
> > > > [BABEL] Note: The code generator has deoptimised the styling of
> > > > "/home/mitya/qxcompiler/qooxdoo/framework/source/class/qx/ui/co
> > > > re/Widget.js" as it exceeds the max of "100KB".
> > > > 2016-02-17 21:30:13.229 [info ] makers Writing target
> > > > Source Target: ../testdata/qxt/source-output/
> > > > /home/mitya/qxcompiler/lib/qxcompiler/targets/Target.js:239
> > > > pkgdata.locales["C"] = db.cldr["en"];
> > > > ^
> > > >
> > > > TypeError: Cannot read property 'en' of undefined
> > > > at
> > > > /home/mitya/qxcompiler/lib/qxcompiler/targets/Target.js:239:45
> > > > at
> > > > /home/mitya/qxcompiler/node_modules/async/lib/async.js:718:13
> > > > at async.forEachOf.async.eachOf
> > > > (/home/mitya/qxcompiler/node_modules/async/lib/async.js:233:13)
> > > > at _parallel
> > > > (/home/mitya/qxcompiler/node_modules/async/lib/async.js:717:9)
> > > > at Object.async.parallel
> > > > (/home/mitya/qxcompiler/node_modules/async/lib/async.js:731:9)
> > > > at
> > > > /home/mitya/qxcompiler/lib/qxcompiler/targets/Target.js:236:15
> > > > at /home/mitya/qxcompiler/lib/util.js:321:9
> > > > at
> > > > /home/mitya/qxcompiler/node_modules/async/lib/async.js:52:16
> > > > at
> > > > /home/mitya/qxcompiler/node_modules/async/lib/async.js:269:32
> > > > at
> > > > /home/mitya/qxcompiler/node_modules/async/lib/async.js:44:16
> > > >
> > > > (removed qxcompiler dir & did clean checkout, didn't help
> > > > either)
> > > >
> > > > Re: Babel - sadly, didn't make it work either :( that arrow
> > > > function in qxt/Application.js goes unchanged first to
> > > > [source|build]-output/transpiled, then to [source|build]-
> > > > output/script. The same with string templates, etc. Note the
> > > > above [BABEL] message - that means, Babel is invoked, but
> > > > doesn't apply any actual transformations. I tried "strace -e
> > > > trace=open node compile-app-demo.js", and didn't see it open
> > > > .babelrc or any plugin and/or preset modules. Could you please
> > > > make sure it's indeed enabled? If it works for you, could you
> > > > please assist me in tracing/debugging (since I'm a newbie in a
> > > > Node world)?
> > > >
> > > > As for script compression, I played a bit with the standalone
> > > > uglify tool. Works pretty fine, but it takes ~30 seconds to
> > > > process a skeleton app. Do you think it can be sped up if
> > > > integrated into QxCompiler?
> > > >
> > > > Minor issue: test/*.js scripts could have a shebang string
> > > > (#!/usr/bin/node) and +x mode so that they could be run
> > > > directly, without typing "node ..." each time.
> > > >
> > > > Cheers!
> > > > Dimitri
> > > ---------------------------------------------------------------
> > > --------------- Site24x7 APM Insight: Get Deep Visibility into
> > > Application Performance APM + Mobile APM + RUM: Monitor 3 App
> > > instances at just $35/Month Monitor end-to-end web transactions
> > > and take corrective actions now Troubleshoot faster and improve
> > > end-user experience. Signup Now! http://pubads.g.doubleclick.net/
> > > gampad/clk?id=272487151&iu=/4140_________________________________
> > > ______________ qooxdoo-devel mailing list qooxdoo-
> > > devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/li
> > > stinfo/qooxdoo-devel
> > > ---------------------------------------------------------------
> > > ---------------
> > > Site24x7 APM Insight: Get Deep Visibility into Application
> > > Performance
> > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > > Monitor end-to-end web transactions and take corrective actions
> > > now
> > > Troubleshoot faster and improve end-user experience. Signup Now!
> > > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> > > _______________________________________________
> > > qooxdoo-devel mailing list
> > > qooxdoo-devel@lists.sourceforge.nethttps://lists.sourceforge.net/
> > > lists/listinfo/qooxdoo-devel
> > -----------------------------------------------------------------
> > ------------- Site24x7 APM Insight: Get Deep Visibility into
> > Application Performance APM + Mobile APM + RUM: Monitor 3 App
> > instances at just $35/Month Monitor end-to-end web transactions and
> > take corrective actions now Troubleshoot faster and improve end-
> > user experience. Signup Now! http://pubads.g.doubleclick.net/gampad
> > /clk?id=272487151&iu=/4140_________________________________________
> > ______ qooxdoo-devel mailing list qooxdoo-
> > devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/list
> > info/qooxdoo-devel
> > -----------------------------------------------------------------
> > -------------
> > Site24x7 APM Insight: Get Deep Visibility into Application
> > Performance
> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > Monitor end-to-end web transactions and take corrective actions now
> > Troubleshoot faster and improve end-user experience. Signup Now!
> > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> > _______________________________________________
> > qooxdoo-devel mailing list
> > qooxdoo-devel@lists.sourceforge.nethttps://lists.sourceforge.net/li
> > sts/listinfo/qooxdoo-devel
> -------------------------------------------------------------------
> ----------- Site24x7 APM Insight: Get Deep Visibility into
> Application Performance APM + Mobile APM + RUM: Monitor 3 App
> instances at just $35/Month Monitor end-to-end web transactions and
> take corrective actions now Troubleshoot faster and improve end-user
> experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id
> =272487151&iu=/4140_______________________________________________
> qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> -------------------------------------------------------------------
> -----------
> Site24x7 APM Insight: Get Deep Visibility into Application
> Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel