caseywatts / ember-cli-mirage-faker-codemod

2 stars 2 forks source link

SyntaxError: Unexpected token export #6

Open samselikoff opened 5 years ago

samselikoff commented 5 years ago

Hey Casey!

I'm getting ready to drop Faker from Mirage, and I wrote up some upgrade notes. I reference this awesome library so folks can find it 👍

I wanted to try this out on our codebase and I'm getting this error:

(function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) {
                                                              ^^^^^^

Any ideas on what's wrong?

Full stack trace ``` ➜ ember-map-frontend git:(upgrade-mirage) jscodeshift -t https://raw.githubusercontent.com/caseywatts/ember-cli-mirage-faker-codemod/master/transform.js ./tests Processing 67 files... Spawning 7 workers... Sending 10 files to free worker... Sending 10 files to free worker... Sending 10 files to free worker... Sending 10 files to free worker... Sending 10 files to free worker... Sending 10 files to free worker... Sending 7 files to free worker... /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) /private/var/folders/v5/5bs4trnx5v7bly3f0cg4_sc40000gn/T/jscodeshift119121-52723-r6x1hd.9wcx:1 (function (exports, require, module, __filename, __dirname) { export default function transformer (file, api) { ^^^^^^ SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .js] (/Users/samselikoff/.config/yarn/global/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) All done. ```
samselikoff commented 5 years ago

Figured out the problem, bug in jscodeshift. Waiting on PR here: https://github.com/facebook/jscodeshift/pull/317