First off I would like to point out that I am a new to node and inexperienced when it comes to ES6 and babel.
Attempting to execute as instructed in your Usage docs. My end goal is to return all upcoming shows for a given day, in JSON format.
Getting an error, regenerator-runtime is not defined. I went into dist/AustinShowlistScraper.js and noticed that regenerator runtime was not explicitly defined as far as I could tell. So I went ahead and required it, which returned the following:
/node_modules/austin-showlist-scraper/dist/AustinShowlistScraper.js:11
var iterateElements = regeneratorRuntime.mark(
^
TypeError: undefined is not a function
at Object.<anonymous> (/Users/BloomINC/Desktop/testing/node_modules/austin-showlist-scraper/dist/AustinShowlistScraper.js:11:42)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/BloomINC/Desktop/testing/app.js:5:29)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
I then required generator-runtime at the root of my build and loged the output, and when checking for differences I noticed that 'default:' supersedes .mark , so I edited dist/AustinShowlistScraper.js like so:
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var regeneratorRuntime = require("babel-runtime/regenerator");
var iterateElements = regeneratorRuntime.default.mark(
/**
* Convert a selector and cheerio context into iterable cheerio objects
*/
After running through the chain of logs erred and repeating includes accordingly. Logs checked out:
{ default:
{ wrap: [Function: wrap],
isGeneratorFunction: [Function],
mark: [Function],
awrap: [Function],
async: [Function],
keys: [Function],
values: [Function: values] },
__esModule: true }
[Function: iterateElements]
Questions:
Is this a bug or was I interfacing improperly?
I also cannot figure out how to mimic your babel configurations during batch transpilation. This however may be a gulp-babel issue but worth noting.
Is there a better way? Do I not need to transpile the script provided in your docs given my ES5 ENV?
What might you suggest given my end goal: to return all upcoming shows for a given day, in JSON format?