GithubHelp home page GithubHelp logo

broccoli-babel-transpiler's Issues

update version + republish

it looks like the option was just added for browserPolyfill a few days ago. When I try to build I get the trace:

ReferenceError: [BABEL] csv_read.js: Unknown option: browserPolyfill
    at Logger.error (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/logger.js:45:11)
    at File.normaliseOptions (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/index.js:174:29)
    at new File (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/index.js:152:10)
    at Pipeline.transform (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/pipeline.js:127:16)
    at Babel.transform (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/index.js:60:21)
    at Babel.processString (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/index.js:72:25)
    at Babel.processFile (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/filter.js:166:31)
    at asyncProcessFile (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/filter.js:101:21)
    at lib$rsvp$$internal$$tryCatch (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/node_modules/rsvp/dist/rsvp.js:501:17)
    at /Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/node_modules/rsvp/dist/rsvp.js:1095:13
    at lib$rsvp$asap$$flush (/Users/Nicholas/mozilla/caltrain/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/node_modules/rsvp/dist/rsvp.js:1290:9)
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

Build failed

I have "broccoli-babel-transpiler": "^5.2.3" installed and my Brocfile.js looks like:

module.exports = require('broccoli-babel-transpiler')('src', {
  browserPolyfill: true,
});

If I remove that option, everything builds just fine, but doesn't run in the browser (require is undefined).

Confusing error message for non-parallelizable plugin

Babel accepts plugins as (among other things) either a string denoting a module to require, or a tuple containing that string and optionally some configuration for that plugin. It will also accept a singleton array with just the module path as a sort of degenerate version of the second case, i.e.

plugins: [
  '/path/to/some/plugin.js',
  ['/path/to/some/plugin.js', { config: true }],
  ['/path/to/some/plugin.js']
]

For the third entry, the parallelization logic interprets that plugin as ['/path/to/some/plugin.js', undefined], and since undefined isn't JSON-serializable, the plugin is considered unparallelizable. That's easy enough to work around, but the error message we got with throwUnlessParallelizable turned on looked like:

[broccoli-persistent-filter:Babel > [Babel: ember-data]: Babel: ember-data] was configured to `throwUnlessParallelizable` and was unable to parallelize a plugin.
plugins:
1: name: unknown, location: unknown

If the relevant plugin path had been included in that output, it would have helped with tracking down the source of the problem.

Can't supply sourcemap source file name

It looks like the plugin is setting the sourcemap source file name to the relative path, with no ability to customize that.

It would be nice if we could supply our own function in the options hash that would return the sourcemap source file name. In my use case, I've got several nodes that were funneled down to some subtree of the original source, and then compiled, but I can reconstruct the correct source file prefix at design-time.

Happy to submit a PR, but wanted to test the waters in case I was missing something first.

Unknown option: direct.browserPolyfill

I'm getting an error when using browserPolyfill option in my Brocfile.js.
Is this still supported?

ReferenceError: [BABEL] index.js: Unknown option: direct.browserPolyfill
    at Logger.error (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
    at OptionManager.mergeOptions (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:124:29)
    at OptionManager.init (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:216:10)
    at File.initOptions (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:146:75)
    at new File (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:133:22)
    at Pipeline.transform (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at Babel.transform (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/index.js:61:21)
    at Babel.processString (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/index.js:73:25)
    at Babel.processFile (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/filter.js:166:31)
    at asyncProcessFile (/Users/Joshua/Projects/kurento-room-js/node_modules/broccoli-babel-transpiler/node_modules/cauliflower-filter/filter.js:101:21)

dependency on broccoli-persistent-filter causes problems

I tried to fork and bump to babel-6

...
"babel-core": "^6.4.0",
...

I got the following problem:

  1) options "before all" hook:
     Cannot find module 'babel-runtime/' from '/Volumes/Macintosh_HD/Users/shauncutts/src/broccoli-babel-transpiler/node_modules/babel-code-frame/'
  Error: Cannot find module 'babel-runtime/' from 'node_modules/babel-code-frame/'
      at Function.module.exports (node_modules/resolve/lib/sync.js:33:11)
      at resolvePkg (node_modules/hash-for-dep/lib/resolve-pkg.js:20:18)
      at pkg (node_modules/hash-for-dep/lib/pkg.js:17:20)
      at again (node_modules/hash-for-dep/lib/deps-for.js:19:22)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at depsFor (node_modules/hash-for-dep/lib/deps-for.js:30:4)
      at statPathsFor (node_modules/hash-for-dep/lib/stat-paths-for.js:14:15)
      at hashForDep (node_modules/hash-for-dep/index.js:15:21)
      at Babel.Filter.cacheKey (node_modules/broccoli-persistent-filter/index.js:118:10)
      at Object.module.exports.cacheKey (node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:22:16)
      at Object.module.exports.init (node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:12:50)
      at Processor.init (node_modules/broccoli-persistent-filter/lib/processor.js:16:18)
      at Babel.Filter (node_modules/broccoli-persistent-filter/index.js:56:18)
      at new Babel (index.js:34:10)
      at Context.<anonymous> (test.js:38:13)

Drilling down, the problem is caused by babel-runtime not having a "main" key in its package.json. In "babel-code-frame/lib/index.js" we have:

var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];

... so we shouldn't have to have the "main" key. This seems like a weakness in hash-for-dep depending on node-resolve which requires a "main" file. This seems to have nothing to do with babel-6 per se. I'll look into reporting and patching downstream (it would seem that resolve takes a filter... hash-for-dep is just using the "main" file to hash it and not actually load it, so we could insert a fake main if package.json is read but is missing "main").

I thought I'd report here in case someone who actually understands the code has a better idea. This seems like something that would break quite often actually, so I'm wondering if I'm overlooking something.

Question: alpha state?

Hey ๐Ÿ‘‹

The last alpha was released on the 5th of Jan.
I am waiting for an update of babel core, because of a vulnerability.
Could you give me an update please?

Thanks ๐Ÿ™‚
Kate

Inline source map issue

Hi. Sorry if this is a dumb question, but how do I get the sourcemaps to appear? Currently I have:

var appJs = esTranspiler(appTree, {
  sourceMap: 'inline'
});

but this doesn't work even though sourcemap is the only valid option name I've found. sourceMap: true doesn't work either. It's doing everything else fine.

Virus threat detected in one of babel-core files

Hi,

I am running an ubuntu machine with COMODO Antivirus installed. I have working on a project written in EmberJS using ember-cli and facing an issue: the antivirus program has detected 2 threats in following files:
EMBER_PROJECT/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/node_modules/core-js/modules/core.log.js

EMBER_PROJECT/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/node_modules/core-js/library/modules/core.log.js

Further description I am getting is: "Heur.Dual.Extensions"

Any idea what is going on here?
Thanks in advance
Pavol

Unknown option: direct.presets

I'm attempting to use it like so:

const babel = require('broccoli-babel-transpiler');
const apps = babel('src', {
    presets: [ 'react', 'es2015' ]
});

And am seeing the following error:

ReferenceError: [BABEL] Foo.js: Unknown option: direct.presets
    at Logger.error (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\file\logger.js:58:11)
    at OptionManager.mergeOptions (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\file\options\option-manager.js:126:29)
    at OptionManager.init (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\file\options\option-manager.js:216:10)
    at File.initOptions (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\file\index.js:147:75)
    at new File (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\file\index.js:137:22)
    at Pipeline.transform (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\node_modules\babel-core\lib\transformation\pipeline.js:164:16)
    at Babel.transform (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\index.js:105:21)
    at Babel.processString (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-babel-transpiler\index.js:204:25)
    at Promise.then.result.output (C:\inetpub\wwwroot\MyProject\node_modules\broccoli-persistent-filter\lib\strategies\persistent.js:41:23)
    at initializePromise (C:\inetpub\wwwroot\MyProject\node_modules\rsvp\dist\rsvp.js:588:5)

Ideally, I'd like to reuse my .babelrc file which happens to contain presets information, but this plugin fails on that as well (with a similar error, Unknown option: .babelrc.presets). So this seems like a reasonable step in that direction.

Warning in fresh ember install when no `ie 9` target

ember-cli: 2.15.1
http_parser: 2.7.0
node: 6.11.3
v8: 5.1.281.107
uv: 1.11.0
zlib: 1.2.11
ares: 1.10.1-DEV
icu: 58.2
modules: 48
openssl: 1.0.2l
os: darwin x64
3.10.10
0.27.5

Steps to reproduce:

  • In a new directory: ember init
  • In config/targets.js: remove ie 9
  • ember build

Results in the following warnings:

broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function () {
  return {
    visitor: {
      VariableDeclaration: function VariableDeclaration(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        if (!isBlockScoped(node)) return;
        convertBlockScopedToVar(path, null, parent, scope, true);

        if (node._tdzThis) {
          var nodes = [node];

          for (var i = 0; i < node.declarations.length; i++) {
            var decl = node.declarations[i];
            if (decl.init) {
              var assign = t.assignmentExpression("=", decl.id, decl.init);
              assign._ignoreBlockScopingTDZ = true;
              nodes.push(t.expressionStatement(assign));
            }
            decl.init = file.addHelper("temporalUndefined");
          }

          node._blockHoist = 2;

          if (path.isCompletionRecord()) {
            nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
          }

          path.replaceWithMultiple(nodes);
        }
      },
      Loop: function Loop(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        t.ensureBlock(node);
        var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
        var replace = blockScoping.run();
        if (replace) path.replaceWith(replace);
      },
      CatchClause: function CatchClause(path, file) {
        var parent = path.parent,
            scope = path.scope;

        var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file);
        blockScoping.run();
      },
      "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) {
        if (!ignoreBlock(path)) {
          var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
          blockScoping.run();
        }
      }
    }
  };
}`.

TypeError: Cannot read property '_parallelBabel' of null

TypeError: Cannot read property '_parallelBabel' of null
    at implementsParallelAPI (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:40:12)
    at serialize (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:202:11)
    at Object.keys.forEach.key (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:224:15)
    at Array.forEach (<anonymous>)
    at serialize (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:216:24)
    at Object.keys.forEach.key (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:224:15)
    at Array.forEach (<anonymous>)
    at serialize (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:216:24)
    at Object.keys.forEach.key (/Users/tbieniek/Code/ember.js/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:224:15)
    at Array.forEach (<anonymous>)

typeof null == 'object' is true which mistakenly sets hasProperties to true even though null does not have properties

  • version: 6.5.0

Improve parallel errors further

fix: a plugin of the form: [serializable, nonSerializable] will incorrectly display serializable as the problem, not nonSerializable

tests fail on recent versions of babel -

causing my PR to fail travis build - I'll look into what the issue is - placeholder for now

1) transpile ES6 to ES5 basic:
     TypeError: expected-inline-source-maps.js: Cannot read property 'sources' of null
      at File.mergeSourceMap (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:475:10)
      at File.<anonymous> (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:527:23)
      at File.generate (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:493:24)
      at /Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:401:20
      at module.exports (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/helpers/parse.js:35:14)
      at File.<anonymous> (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:399:12)
      at File.parse (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file.js:381:21)
      at Object.transform (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/index.js:19:15)
      at Babel.transform (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/index.js:23:21)
      at Babel.processString (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/index.js:31:15)
      at Babel.Filter.processFile (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/index.js:139:31)
      at /Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/index.js:85:21
      at lib$rsvp$$internal$$tryCatch (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:489:16)
      at lib$rsvp$$internal$$invokeCallback (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:501:17)
      at /Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:1095:13
      at lib$rsvp$asap$$flush (/Users/jschilling/dev/extern/active/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:1290:9)
      at process._tickCallback (node.js:355:11)

fails without options.filename

Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
    at replaceExtensions (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-babel-transpiler/index.js:15:16)
    at Babel.processString (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-babel-transpiler/index.js:46:24)
    at Babel.Filter.processFile (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/index.js:136:31)
    at /Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/index.js:85:21
    at lib$rsvp$$internal$$tryCatch (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:501:17)
    at /Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:1095:13
    at lib$rsvp$asap$$flush (/Users/stefanpenner/src/emberjs-build/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:1290:9)
    at doNTCallback0 (node.js:408:9)
    at process._tickCallback (node.js:337:13)

Plugin undefined didn't export default a Transformer instance

Hey there,

After cloning a copy of an ember app I have, running npm install and bower install and then running ember s, I'm getting the following error:

[john:~/Public/customerQ/frontend] master(+1/-1)* ยฑ ember s         
version: 1.13.0
Deprecation warning: sassOptions should be moved to your Brocfile
Livereload server on http://localhost:35729
Serving on http://localhost:4200/
File: frontend/adapters/application.js
Plugin undefined didn't export default a Transformer instance
TypeError: Plugin undefined didn't export default a Transformer instance
    at File.addPlugin (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/index.js:283:13)
    at File.buildTransformers (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/index.js:215:12)
    at new File (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/file/index.js:89:10)
    at Object.transform (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/babel/transformation/index.js:18:14)
    at Babel.transform (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/index.js:24:21)
    at Babel.processString (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/index.js:32:15)
    at Babel.Filter.processFile (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/broccoli-filter/index.js:139:31)
    at /home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/broccoli-filter/index.js:85:21
    at lib$rsvp$$internal$$tryCatch (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/home/john/Public/customerQ/frontend/node_modules/broccoli-babel-transpiler/node_modules/broccoli-filter/node_modules/rsvp/dist/rsvp.js:501:17

I've not been able to figure out where I've gone wrong - but this error seems to be coming from within broccoli-babel-transpiler. My package.json:

{
  "name": "frontend",
  "version": "0.0.0",
  "description": "Small description for frontend goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.0.2",
    "ember-cli": "1.13.0",
    "ember-cli-app-version": "0.4.0",
    "ember-cli-babel": "^5.0.0",
    "ember-cli-chartist": "^0.2.9",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.0",
    "ember-cli-divshot": "^0.1.7",
    "ember-cli-document-title": "0.1.0",
    "ember-cli-flash": "^1.3.2",
    "ember-cli-foundation-sass": "^1.1.1",
    "ember-cli-htmlbars": "0.7.9",
    "ember-cli-htmlbars-inline-precompile": "^0.1.1",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-qunit": "0.3.15",
    "ember-cli-release": "0.2.3",
    "ember-cli-sass": "^4.0.1",
    "ember-cli-selectize": "^0.3.6",
    "ember-cli-simple-auth": "0.8.0",
    "ember-cli-simple-auth-devise": "0.8.0",
    "ember-cli-spinkit": "1.0.0",
    "ember-cli-uglify": "^1.0.1",
    "ember-cli-zero-clipboard": "1.0.2",
    "ember-data": "1.13.5",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.2",
    "ember-remarkable": "1.3.0",
    "ember-watson": "^0.5.9",
    "express": "^4.12.3",
    "glob": "^5.0.13",
    "initials-avatar": "0.0.8",
    "morgan": "^1.5.2",
    "ui-expanding-textarea": "0.0.12"
  }
}

browserPolyfill option does not work

I was trying the option browserPolyfill option but it does not work but when i write my own logic in my Brocfile.js to merge the browser-polyfill.js file it works as expected.

Picked the logic to copy file from here: https://hacks.mozilla.org/2015/06/es6-in-depth-babel-and-broccoli/

code:

babelCorePath = require.resolve('broccoli-babel-transpiler');

babelCorePath = babelCorePath.replace('index.js', 'node_modules/babel-core/');

var projFiles = babel('src', {
    filterExtensions: [ 'es6'],
    browserPolyfill: true
});

var babelCoreTree = funnel(babelCorePath, {
    files: ['browser-polyfill.js']
});

projFiles = mergeTrees([projFiles, babelCoreTree]);

Polyfill missing in output due to bad path handling

In the lines quoted here, the plugin constructs a path to @babel/core in order to fetch the browser polyfill into the broccoli pipeline:

var babelCorePath = require.resolve('@babel/core');
babelCorePath = babelCorePath.replace(/\/babel-core\/.*$/, '/babel-core');

On one of my development systems, this fails because npm installs @babel/core into ./node_modules/@babel/core; as a result, the path returned by require.resolve() no longer matches /\/babel-core\/.*$/ -- and my other development system is a Windows 10 machine, where require.resolve() returns a path separated with backslashes.

Option to turn off extension stripping on the moduleId

The latest versions of es6-module-loader and SystemJS ave stopped adding .js on to module names and paths without extensions. The Broccoli plugin does this:

if (options.moduleId === true) {
    options.moduleId = replaceExtensions(this.extensionsRegex, options.filename);
  }

Which strips the extension from the filename. An option to turn off that stripping might be handy given the current state of popular loaders.

There is a way of fixing it if you only have one known extension to deal with via Babel's getModuleId function which broccoli-babel-transpiler will pass through to Babel's transform function if set This worked for me, but is only useable when you are not transpiling a tree with a mix of extensions.

var moduleTree = babelTranspiler(es6Tree, {
    sourceMap: 'inline'
    ,modules: 'system'
    ,moduleIds: true
    ,moduleId: true
    ,getModuleId: function (name) {
        return name+".js";
    }
});

6.0

placeholder to document what needs to be done ...

Example Project

hey,

I've been having a hard time getting a workflow for getting my code to incrementally transpile from es6 to es5. I can get gulp or grunt to work but not very cleanly, I can't find any example projects that work as is.

For example on this homepage you have this example code:

var esTranspiler = require('broccoli-babel-transpiler');
var scriptTree = esTranspiler(inputTree, options);

What does inputTree have to be? I'm finding broccoli documentation in general obtuse or when not to be geared more towards front end devs. I'm building a purely atom-shell (now electron) app.

Could someone point me to an example app that does takes a src folder and transpiles it using this module to a lib folder. Ideally with it rebuilding things as I change them. I assume that's how broccoli serve is supposed to work.

Any help would be appreciated,
Francois

Module names "unknown"

This compiles es6 files fine, but I can't figure out how to actually use the files in an app. My thought was to require the main module manually, as an entry point into the compiled code. However I couldn't figure out what it was named. I thought it would be the relative file path of the file, but it did not seem to be that.

Also I noticed that if I enable the amdModuleIds option in 6to5, it says "unknown" for all of the module IDs.

define("unknown", ["exports"], function (exports) {
    // etc.
});

Importing relative modules

Hi,
I currently have a simple setup to transpile multiple files into a single file inside a folder (pretty common ๐Ÿ’ƒ ). Everything works well, except when I try to import a file into another one, and the compiled file get's messed up since it is still referencing to the relative path instead of having it imported and transpiled.

Someone knows a way to fix this?
Thanks!

.babelrc changes do not bust cache

When using a .babelrc (or similar) config file for babel, changes to this file to not bust the persistent cache, causing compiled outputs to not change.

Not sure the best way to handle this as https://babeljs.io/docs/en/config-files lists various techniques babel goes through to find config file, but it could be as simple as including their hash in the cache key.

Parallelization Does Not Interop Between Babel 6 and 7

If you are trying to parallelize and you have some plugin instances that are running 6 and some that are 7, you will error out with an error that looks like this.

ERROR Summary:

  - broccoliBuilderErrorStack: ReferenceError: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
    at throwUnknownError (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:123:11)
    at Object.keys.forEach.key (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:107:5)
    at Array.forEach (<anonymous>)
    at validateNested (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:83:21)
    at validate (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:74:10)
    at loadPrivatePartialConfig (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/partial.js:66:50)
    at loadFullConfig (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/full.js:43:39)
    at transformSync (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/transform.js:41:38)
    at Object.transform (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/transform.js:22:38)
    at resolve (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/lib/worker.js:11:29)
  - codeFrame: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
  - errorMessage: @linkedin/ember-cli-pemberly-lix/client.js: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
        in /var/folders/qs/ztg_n78d1xvgc2cjcs0gx4ww0008c7/T/broccoli-63768zsIEp42L8w10/out-102-broccoli_persistent_filter_babel_babel_linkedin_ember_c
        at broccoli-persistent-filter:Babel
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: @linkedin/ember-cli-pemberly-lix/client.js
    - line: [undefined]
    - treeDir: /var/folders/qs/ztg_n78d1xvgc2cjcs0gx4ww0008c7/T/broccoli-63768zsIEp42L8w10/out-102-broccoli_persistent_filter_babel_babel_linkedin_ember_c
  - message: @linkedin/ember-cli-pemberly-lix/client.js: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
        in /var/folders/qs/ztg_n78d1xvgc2cjcs0gx4ww0008c7/T/broccoli-63768zsIEp42L8w10/out-102-broccoli_persistent_filter_babel_babel_linkedin_ember_c
        at broccoli-persistent-filter:Babel
  - name: BuildError
  - nodeAnnotation: [undefined]
  - nodeName: broccoli-persistent-filter:Babel
  - originalErrorMessage: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
  - stack: ReferenceError: Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
    at throwUnknownError (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:123:11)
    at Object.keys.forEach.key (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:107:5)
    at Array.forEach (<anonymous>)
    at validateNested (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:83:21)
    at validate (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/validation/options.js:74:10)
    at loadPrivatePartialConfig (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/partial.js:66:50)
    at loadFullConfig (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/config/full.js:43:39)
    at transformSync (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/transform.js:41:38)
    at Object.transform (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/@babel/core/lib/transform.js:22:38)
    at resolve (/Users/chietala/Code/ember-cli-pemberly-lix_trunk/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/lib/worker.js:11:29)

This is likely due to the fact that Babel 7's options validate before running. The workers needed to be pooled based on Babel version.

Is Node 0.12 still supported in v5.x?

If yes, then broccoli-persistent-filter -> async-disk-cache ^1.2.1 -> username ^2.3.0 breaks Node 0.12 compatibility.

See:
sindresorhus/username#7
stefanpenner/async-disk-cache#43

  1) build plugin build hook builds the app and resolves with distDir and distFiles:
     /home/travis/build/ember-cli-deploy/ember-cli-deploy-build/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/node_modules/async-disk-cache/node_modules/username/index.js:2
const os = require('os');
^^^^^
Use of const in strict mode.
  /home/travis/build/ember-cli-deploy/ember-cli-deploy-build/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/node_modules/async-disk-cache/node_modules/username/index.js:2
  const os = require('os');
  ^^^^^
  SyntaxError: Use of const in strict mode.
      at exports.runInThisContext (vm.js:73:16)
      at Object.<anonymous> (node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/node_modules/async-disk-cache/index.js:24:16)

Use absolute path while importing own modules

So we can use import config from 'config' in every file in every directory inside app/webroot/es6/.

// ember-cli-build.js
var browserify = require('broccoli-browserify')
var babelTranspiler = require('broccoli-babel-transpiler')

module.exports = function() {

  // Watch the tree with babel
  var js = babelTranspiler('app', {
    filterExtensions: ['js']
  });

  // Convert it to ES5
  js = browserify(js, {
    entries: [
      './webroot/es6/main.js'
    ],
    outputFile: 'js/app.js'
  });

  ...

}

cache not documented (or disable-able)?

I was having an issue with imports in index.js

givanse/broccoli-babel-examples#4

and found that resolveModuleSource wasn't being called. When I upgraded this package from 5.4.5 to 5.5.0, I found that resolveModuleSource was called... once. However, before I could do any debugging it stopped working again. Incidentally, I fiddled with another option and got resolveModuleSource to run again. I am guessing that it is caching values in global location (hmm... perhaps ~/.babel.json?)

However, this isn't documented anywhere I can find, nor can I find out how to turn off global cache so I can debug resolveModuleSource. Probably I will be able to continue flipping irrelevant switches to invalidate cache and debug enough to fix my problem, but this seems a suboptimal solution.

Imports conflict with local variables

I'm using Ember CLI, with ember-cli-babel which in turn uses this addon. This may want to be opened as an issue in babel itself?

I have the following in my app:

import {
  updateMeeting
} from 'minutebase/use-cases/meeting';

export function setupAgenda(meeting) {
  return updateMeeting(meeting);
};

Which appears to be being transpiled to:

define('minutebase/use-cases/agenda', ['exports', 'ember', 'minutebase/use-cases/meeting'], function (exports, Ember, meeting) {
  'use strict';

  exports.setupAgenda = setupAgenda;

  function setupAgenda(meeting) {
    return meeting.updateMeeting(meeting);
  }
});

Notice that there's an imported meeting and a local meeting which tramples on it so meeting.updateMeeting is undefined.

Version 6.1.4 not tagged "latest" on npm

Perhaps this is intentional, in which case please close this, but I just ran "npm install --save broccoli-babel-transpiler" and ended up being surprised that it installed version 5.7.4, rather than 6.1.4.

$ npm dist-tag ls broccoli-babel-transpiler
latest: 5.7.4
next: 7.0.0-beta.2
old: 5.5.1

Update to latest babel

So according to the npm message, 5.3.0 is much faster, so if we can could we use that here?

save usedHelpers meta

Save the babel meta to a json file so that a babel helpers module can be compiled later. Maybe even add an import babelHelpers from 'babel-helpers'; in a source map friendly way so that a helpers module can be built when the app is packaged.

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.