GithubHelp home page GithubHelp logo

Comments (5)

xmlking avatar xmlking commented on July 28, 2024

same issue with all gulp plugins that depends on this module. del , gulp-filter etc.
this looks like happening when traceur is used in node env to write gulp tasks in ES6.
e.g: karma-traceur-preprocessor etc.

my gulpfile.js contains following ES6 setup

'use strict';
require('traceur').require.makeDefault(function(filename) {
    // don't transpile our dependencies, just our app
    return filename.indexOf('node_modules') === -1;
}, { experimental:true});

require('./tasks/index');

sothat I can write gulp tasks like this..

import {ErrorHandler} from './errors';
let jshint      = require('gulp-jshint'),
    gif         = require('gulp-if'),
    preprocess  = require('gulp-preprocess'),
    traceur     = require('gulp-traceur'),
    sourcemaps  = require('gulp-sourcemaps'),

    gulp.task('transpile', () => {
        return gulp.src('app/scripts/**/*.js')
            .pipe(gif(/app\/scripts\/index.js/, preprocess({context: {env}})))
            .pipe(gif(env === 'DEV', sourcemaps.init()))
                .pipe(traceur(traceurOptions))
                .on('error', ErrorHandler.onError)
            .pipe(gif(env === 'DEV', sourcemaps.write('.', {includeContent: false, sourceRoot: '/app/scripts'})))
            .pipe(gulp.dest('.tmp/scripts'));
    });

error:

[17:01:27] Starting 'clean'...
undefined:1824
      for (var $__25 = iterable[Symbol.iterator](),
                                                ^
TypeError: undefined is not a function
  at new Set (<anonymous>:1824:49)
  at uniqSetWithForEach (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/array-union/node_modules/array-uniq/index.js:33:3)
  at module.exports (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/array-union/index.js:5:9)
  at /Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/index.js:38:15
  at f (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/node_modules/once/once.js:16:25)
  at Glob.<anonymous> (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:100:7)
  at Glob.EventEmitter.emit (events.js:107:17)
  at Glob.next (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:357:10)
  at Glob._processEmitQueue (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:322:12)
  at Glob.emitMatch (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:302:8)
  at Glob._finish (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:242:8)
  at Glob.<anonymous> (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:195:27)
  at Glob.cb (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:380:11)
  at Glob.<anonymous> (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:420:16)
  at Glob._afterStat (/Developer/Work/spa-starter-kit/node_modules/del/node_modules/globby/node_modules/glob/glob.js:634:6)
  at Object.oncomplete (evalmachine.<anonymous>:97:15)

from array-uniq.

sindresorhus avatar sindresorhus commented on July 28, 2024

Not really relevant to this module. I'm doing feature testing

array-uniq/index.js

Lines 41 to 42 in a49548d

if ('Set' in global) {
if (typeof Set.prototype.forEach === 'function') {
I can't really control other modules mocking with built-ins.

from array-uniq.

xmlking avatar xmlking commented on July 28, 2024

thanks @sindresorhus
looks like traceur polyfill for Set is causing this error. It expect Symbol.iterator defined.
will let you know if I found a workarround

line 1824 in traceur.js for (var $__25 = iterable[Symbol.iterator](),

test case:

    gulp.task('clean', (cb) => {
        //del(['.tmp', 'dist'], cb);

        var a = new Set();
        console.log('Set' in global);
        console.log(typeof Set.prototype.forEach === 'function');
        console.log(a);
        console.log(Set.prototype.forEach);
        console.log(new Set([1,1])); // this throw the error in traceur.js code // arr[Symbol.iterator]() undefined...
    });
true
true
{ map_: 
   { entries_: [],
     objectIndex_: {},
     stringIndex_: {},
     primitiveIndex_: {},
     deletedCount_: 0 } }
[Function]
[09:05:11] 'clean' errored after 2.68 ms
[09:05:11] TypeError: undefined is not a function
    at new Set (eval at <anonymous> (/Developer/Work/spa-starter-kit/node_modules/traceur/src/node/traceur.js:1:0), <anonymous>:1824:49)
    at Gulp.<anonymous> (/Developer/Work/spa-starter-kit/tasks/build.js:42:17)
    at module.exports (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:121:20
    at process._tickDomainCallback (node.js:372:11)
    at Function.Module.runMain (module.js:492:11)
    at startup (node.js:124:16)

from array-uniq.

sindresorhus avatar sindresorhus commented on July 28, 2024

You should report it on the Traceur issue tracker ;)

from array-uniq.

xmlking avatar xmlking commented on July 28, 2024

looks like there is an open issue on it.
google/traceur-compiler#563

just reported an issue for Traceur
google/traceur-compiler#1228

from array-uniq.

Related Issues (7)

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.