{"push_id":762706096,"size":6,"distinct_size":6,"ref":"refs/heads/master","head":"f64c15b294689c74e6cd9eca622bc19b32c1fb76","before":"85ab308d670d3ec0e4b9f039a03d78ddc4b8c310","commits":[{"sha":"93ee1560614bd15fd591ac3d2dc6dee5051dca27","author":{"email":"781b0706163b25314981dcc0768997c2fe62a441@users.noreply.github.com","name":"K. Adam White"},"message":"Pass generated browserify bundle through derequire\n\n**`--standalone` isn't**\n\nBrowserify's \"Standalone\" option is poorly named, as `--standalone`-\ngenerated bundles cannot be consumed within any other project that is\nbuild using browserify. The reason this is the case is that Browserify\ntries to parse any \"require\" calls that it finds in the source.\n\nHowever, once Browserify has been used to build p5, those are not\nNode's `require` method anymore: they are an internal method defined\nwithin the bundled code. Browserify trips over itself by\nmisinterpreting the purpose of the `require`s that it generated when\nwe created the bundle.\n\n[derequire](https://github.com/calvinmetcalf/derequire) is designed\nto solve this problem: it re-writes the generated bundle code to\nchange all instances of \"require\" into \"_dereq_\". This \"hides\" them\nfrom subsequent runs of Browserify, and permits the library to be\nloaded as intended.\n\n[Browserify issue 1151](https://github.com/substack/node-browserify/issues/1151)\nhas more discussion of this issue, including a movement to implement\nthe \"derequire\" behavior by default when using `--standalone`, which\nwould (subjectively) make the flag function more predictably.\n\n**Grunt changes**\n\nBecause `derequire` is designed either to function fully by use of its\nprogrammatic API, or fully from the command line, we were not able to\nget it integrated into the existing Grunt-Browserify task. Instead,\nI have written a new, bespoke Grunt task that will\n\n- Read the source code into Browserify (with appropriate transforms)\n- Run the bundled code through `derequire` to re-write the \"require\"s\n- Prepend the same code comment banner we have been using\n- Save the processed code to a file as `lib/p5.js`\n\nThis task lives in `build/tasks/browserify.js`, using the (that is to\nsay, my) recommended approach of splitting more complex grunt tasks\nout into individual files for easier readability and maintenance.\n\nThis task runs slightly slower than the older `grunt-browserify` task,\nwhich I believe to be unavoidable due to the additional code\nprocessing that is required to make the build browserifiable.\n\nA note on Webpack: I investigated using Webpack to create the bundle,\nas Webpack's UMD build target does not seem to share Browserify's\n`--standalone` quirks. For now we believe that adding Webpack would\nintroduce more complexity and maintenance overhead than it removed,\nhowever, so I opted for the custom Grunt task approach.\n\n**Unresolved Issues**\n\nThis does nothing to address #785: we will likely need to adapt the\nbrowserify task to generate separate source builds for `p5.js` and\n`p5.min.js` before we can conditionally stub out behavior.\n\n**Resolved Issues**\n\nThis fixes #818: I have copied the generated code into the\n[example repository](https://github.com/geekydatamonkey/test-p5-browserify)\nprovided by @geekydatamonkey, and `browserify main.js -o bundle.js`\nworked as expected.\n\n**Review Requested**\n\nPinging @tbranyen for feedback on this implementation","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/93ee1560614bd15fd591ac3d2dc6dee5051dca27"},{"sha":"7a4d8c7defda70d010f4ed9c6a1f40b96ff9c9e0","author":{"email":"781b0706163b25314981dcc0768997c2fe62a441@users.noreply.github.com","name":"K. Adam White"},"message":"Remove obsolete Gruntfile config for old browserify plugin","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/7a4d8c7defda70d010f4ed9c6a1f40b96ff9c9e0"},{"sha":"ce344beec6cc846dc6c415c6dff93d9a0ca59e51","author":{"email":"781b0706163b25314981dcc0768997c2fe62a441@users.noreply.github.com","name":"K. Adam White"},"message":"Address PR comments in custom browserify task","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/ce344beec6cc846dc6c415c6dff93d9a0ca59e51"},{"sha":"4496014014601a32e941d48d888d9618e7530839","author":{"email":"c673632003159f2792195e42169b6c0086c2b878@gmail.com","name":"Lauren McCarthy"},"message":"Merge pull request #847 from kadamwhite/build/fix-browserify-woes\n\nPass generated browserify bundle through derequire","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/4496014014601a32e941d48d888d9618e7530839"},{"sha":"d8480bbc07ee198c8eae6b11f525334b0e535d80","author":{"email":"c673632003159f2792195e42169b6c0086c2b878@gmail.com","name":"Lauren McCarthy"},"message":"v0.4.8","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/d8480bbc07ee198c8eae6b11f525334b0e535d80"},{"sha":"f64c15b294689c74e6cd9eca622bc19b32c1fb76","author":{"email":"9227c30d5c1eed63c55b5dd96dd0b8d4e5f21c1b@gmail.com","name":"Karen"},"message":"merge upstream","distinct":true,"url":"https://api.github.com/repos/karenpeng/p5.js/commits/f64c15b294689c74e6cd9eca622bc19b32c1fb76"}]}