├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github └── ISSUE_TEMPLATE.md ├── .gitignore ├── .lintstagedrc ├── .npmignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .travis.yml ├── CHANGELOG.md ├── README.md ├── lib ├── __snapshots__ │ └── index.test.js.snap ├── index.js └── index.test.js ├── package.json └── test └── fixtures ├── bundle-error └── src │ └── index.js ├── empty-entries └── src │ └── .gitkeep ├── file-does-not-exist-error ├── lib │ └── something.js └── src │ └── index.js ├── malformed-entries └── src │ └── .gitkeep ├── multiple-entries ├── expected │ ├── index.js │ └── other.js ├── lib │ ├── something.js │ └── that.js └── src │ ├── index.js │ └── other.js ├── nested-entry ├── expected │ └── nested │ │ └── index.js ├── lib │ └── something.js └── src │ └── nested │ └── index.js ├── no-entries └── src │ └── .gitkeep ├── no-options └── src │ └── .gitkeep ├── options ├── expected │ └── index.js ├── lib │ └── something.js └── src │ └── index.js ├── single-entry ├── expected │ └── index.js ├── lib │ └── something.js └── src │ └── index.js └── suppress-not-found-error ├── expected └── index.js ├── lib └── something.js └── src └── index.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # For more information about the properties used in 2 | # this file, please see the EditorConfig documentation: 3 | # http://editorconfig.org/ 4 | 5 | root = true 6 | 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 2 11 | indent_style = space 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | 18 | [Makefile] 19 | indent_style = tab 20 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /test 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["airbnb-base", "prettier"], 3 | "env": { 4 | "node": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Automatically normalize line endings for all text-based files 2 | # http://git-scm.com/docs/gitattributes#_end_of_line_conversion 3 | * text=auto 4 | 5 | # For the following file types, normalize line endings to LF on 6 | # checkin and prevent conversion to CRLF when they are checked out 7 | # (this is required in order to prevent newline related issues like, 8 | # for example, after the build script is run) 9 | .* text eol=lf 10 | *.css text eol=lf 11 | *.html text eol=lf 12 | *.js text eol=lf 13 | *.json text eol=lf 14 | *.md text eol=lf 15 | *.sh text eol=lf 16 | *.txt text eol=lf 17 | *.xml text eol=lf 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Before opening an issue 2 | 3 | * The issues aren't meant for support requests but for reporting bugs and feature requests. If you 4 | have a support request then please use: http://metalsmith-slack.herokuapp.com/ or http://stackoverflow.com/questions/tagged/metalsmith 5 | 6 | * If you're reporting a bug, please open either a pull request with a failing test demonstrating the 7 | problem, or include a link to a repository with a reduced test case demonstrating the problem. 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Node 2 | node_modules 3 | npm-debug.log 4 | yarn-error.log 5 | package-lock.json 6 | 7 | # Test build results 8 | test/fixtures/*/build 9 | 10 | # Coverage reports 11 | /coverage 12 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "**/*.js": [ 3 | "prettier --write", 4 | "git add", 5 | "eslint" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | .editorconfig 3 | .eslintrc 4 | .gitattributes 5 | .gitignore 6 | .lintstagedrc 7 | .prettierrc 8 | .travis.yml 9 | 10 | # Tests 11 | /test 12 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | /test 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "useTabs": false, 4 | "singleQuote": true, 5 | "tabWidth": 2, 6 | "semi": true 7 | } 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: 3 | directories: 4 | - node_modules 5 | notifications: 6 | email: false 7 | node_js: 8 | - "6" 9 | - "8" 10 | - "10" 11 | jobs: 12 | include: 13 | - stage: coverage 14 | node_js: "10" 15 | script: 16 | - npm run test:coverage 17 | - stage: lint 18 | node_js: "10" 19 | script: 20 | - npm run lint:prettier 21 | - npm run lint:js 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 1.1.0 - June 8, 2019 2 | * feature: added suppressNotFoundError to enable use with metalsmith-watch 3 | 4 | ### 1.0.4 5 | ### 1.0.3 6 | * superseded by 1.1.0 7 | 8 | ### 1.0.2 - April 15, 2019 9 | * bugfix: reading files from the metalsmith files object now, instead of from disk 10 | 11 | ### 1.0.1 - April 14, 2019 12 | * not code related, move to metalsmith org. 13 | 14 | ### 1.0.0 - February 27, 2018 15 | * breaking change: new api (check readme) 16 | * breaking change: now updates the metalsmith files object so subsequent plugins have access to the build result 17 | * dropped CI tests for node 4 and iojs (currently testing with 6 and 8) 18 | 19 | ### Earlier versions not yet documented 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # metalsmith-browserify 2 | 3 | [![npm version][version-badge]][version-url] 4 | [![build status][build-badge]][build-url] 5 | [![coverage status][coverage-badge]][coverage-url] 6 | [![greenkeeper][greenkeeper-badge]][greenkeeper-url] 7 | [![downloads][downloads-badge]][downloads-url] 8 | 9 | > A metalsmith plugin to bundle javascript with browserify 10 | 11 | This plugin allows you to bundle your javascript with browserify. Pass it the entry points it should bundle, and it will replace those files with the resulting bundle on build. 12 | 13 | For support questions please use [stack overflow][stackoverflow-url] or our [slack channel][slack-url]. For browserify specific questions try [their documentation](https://github.com/browserify/browserify). 14 | 15 | ## Installation 16 | 17 | ```bash 18 | $ npm install metalsmith-browserify 19 | ``` 20 | 21 | ## Options 22 | 23 | You can pass options to `metalsmith-browserify` with the [Javascript API](https://github.com/segmentio/metalsmith#api) or [CLI](https://github.com/segmentio/metalsmith#cli). The options are: 24 | 25 | * [entries](#entries): required. The entry points that need to be browserified. Accepts an array of strings. 26 | * [browserifyOptions](#browserifyoptions): optional. These options will be passed on to browserify. See [this area of the browserify documentation](https://github.com/browserify/browserify#browserifyfiles--opts) for all available options. Note that it's possible to break stuff here, like overriding the entries or basedir, so use wisely. 27 | * [suppressNotFoundError](#suppressnotfounderror): optional. By default `metalsmith-browserify` will exit with an error if a file can't be found. Enabling this option will suppress that error. 28 | 29 | ### `entries` 30 | 31 | The entry points that should be browserified. So this `metalsmith.json`: 32 | 33 | ```json 34 | { 35 | "source": "src", 36 | "destination": "build", 37 | "plugins": { 38 | "metalsmith-browserify": { 39 | "entries": [ 40 | "index.js", 41 | "another.js" 42 | ] 43 | } 44 | } 45 | } 46 | ``` 47 | 48 | Would browserify both `./src/index.js` and `./src/another.js` and output them as `./build/index.js` and `./build/another.js` respectively. 49 | 50 | Note that if the entry path is nested, the paths may differ across operating systems. Make sure you're using the correct directory separators, or use node's [path.join](https://nodejs.org/api/path.html#path_path_join_paths) to make sure the path will work anywhere. 51 | 52 | ### `browserifyOptions` 53 | 54 | Use this to pass options to browserify. So this `metalsmith.json`: 55 | 56 | ```json 57 | { 58 | "source": "src", 59 | "destination": "build", 60 | "plugins": { 61 | "metalsmith-browserify": { 62 | "entries": ["index.js"], 63 | "browserifyOptions": { 64 | "debug": true 65 | } 66 | } 67 | } 68 | } 69 | ``` 70 | 71 | Would enable browserify's debug option and add a source map to the bundle. 72 | 73 | ### `suppressNotFoundError` 74 | 75 | `metalsmith-browserify` exits with an error if it can’t find an [entry file](#entries). If you’re doing any kind of incremental builds via something like `metalsmith-watch`, this is problematic as you’re likely only rebuilding files that have changed. This flag allows you to suppress that error: 76 | 77 | ```json 78 | { 79 | "source": "src", 80 | "destination": "build", 81 | "plugins": { 82 | "metalsmith-browserify": { 83 | "entries": ["index.js"], 84 | "suppressNotFoundError": true 85 | } 86 | } 87 | } 88 | ``` 89 | 90 | Note that when this option is turned on, if you're logging [debug](#errors-and-debugging) messages, you’ll still see a message denoting which files metalsmith-browserify cannot find. 91 | 92 | ## Errors and debugging 93 | 94 | If you're encountering problems you can use [debug](https://www.npmjs.com/package/debug) to enable verbose logging. To enable `debug` prefix your build command with `DEBUG=metalsmith-browserify`. So if you normally run `metalsmith` to build, use `DEBUG=metalsmith-browserify metalsmith` (on windows the syntax is [slightly different](https://www.npmjs.com/package/debug#windows-note)). 95 | 96 | ## License 97 | 98 | MIT 99 | 100 | [build-badge]: https://travis-ci.org/metalsmith/metalsmith-browserify.svg?branch=master 101 | [build-url]: https://travis-ci.org/metalsmith/metalsmith-browserify 102 | [downloads-badge]: https://img.shields.io/npm/dm/metalsmith-browserify.svg 103 | [downloads-url]: https://www.npmjs.com/package/metalsmith-browserify 104 | [version-badge]: https://img.shields.io/npm/v/metalsmith-browserify.svg 105 | [version-url]: https://www.npmjs.com/package/metalsmith-browserify 106 | [greenkeeper-badge]: https://badges.greenkeeper.io/metalsmith/metalsmith-browserify.svg 107 | [greenkeeper-url]: https://greenkeeper.io/ 108 | [coverage-badge]: https://coveralls.io/repos/github/metalsmith/metalsmith-browserify/badge.svg?branch=master 109 | [coverage-url]: https://coveralls.io/github/metalsmith/metalsmith-browserify?branch=master 110 | [slack-url]: http://metalsmith-slack.herokuapp.com/ 111 | [stackoverflow-url]: http://stackoverflow.com/questions/tagged/metalsmith 112 | -------------------------------------------------------------------------------- /lib/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`metalsmith-browserify should return an error when entries contains a file that does not exist 1`] = `"Can't find 'doesNotExist.js'. The file doesn't exist or the path is invalid"`; 4 | 5 | exports[`metalsmith-browserify should return an error when entries is empty 1`] = `"Need at least a single entry point to process"`; 6 | 7 | exports[`metalsmith-browserify should return an error when entries is not an array 1`] = `"The entries option must be an array of strings"`; 8 | 9 | exports[`metalsmith-browserify should return an error when there are no options 1`] = `"The entries option is required"`; 10 | 11 | exports[`metalsmith-browserify should return an error when there is an error while bundling 1`] = `"Cannot find module '../lib/missing.js' from"`; 12 | 13 | exports[`metalsmith-browserify should return an error when there is no entries option 1`] = `"The entries option is required"`; 14 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | const { Readable } = require('stream'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | const debug = require('debug')('metalsmith-browserify'); 5 | const browserify = require('browserify'); 6 | 7 | /** 8 | * Bundles a single entrypoint and updates the files object with the result 9 | */ 10 | 11 | const bundle = ({ file, options, source, files }) => { 12 | debug(`browserifying ${file}`); 13 | 14 | const readable = new Readable(); 15 | const filePath = path.join(source, file); 16 | const fileExists = fs.existsSync(filePath); 17 | 18 | if (!fileExists) { 19 | const message = `Can't find '${file}'. The file doesn't exist or the path is invalid`; 20 | 21 | if (options.suppressNotFoundError) { 22 | debug(message); 23 | 24 | return Promise.resolve(); 25 | } 26 | 27 | return Promise.reject(new Error(message)); 28 | } 29 | 30 | const fileDir = path.parse(filePath).dir; 31 | const browserifyOptions = Object.assign({}, options.browserifyOptions, { basedir: fileDir }); 32 | 33 | // Add the file to the stream 34 | readable.push(files[file].contents); 35 | 36 | // Signal the end of the stream 37 | readable.push(null); 38 | 39 | const bundler = browserify(readable, browserifyOptions); 40 | 41 | return new Promise((fulfill, reject) => { 42 | bundler.bundle((error, buffer) => { 43 | if (error) { 44 | return reject(error); 45 | } 46 | 47 | debug(`updating files object for ${file}`); 48 | 49 | // eslint-disable-next-line no-param-reassign 50 | files[file].contents = buffer; 51 | return fulfill(); 52 | }); 53 | }); 54 | }; 55 | 56 | /** 57 | * Plugin, the main plugin used by metalsmith 58 | */ 59 | 60 | module.exports = options => (files, metalsmith, done) => { 61 | if (!options || !options.entries) { 62 | return done(new Error('The entries option is required')); 63 | } 64 | 65 | if (!Array.isArray(options.entries)) { 66 | return done(new Error('The entries option must be an array of strings')); 67 | } 68 | 69 | if (options.entries.length === 0) { 70 | return done(new Error('Need at least a single entry point to process')); 71 | } 72 | 73 | const source = metalsmith.source(); 74 | const promises = options.entries.map(file => bundle({ file, options, source, files })); 75 | 76 | return Promise.all(promises) 77 | .then(() => done()) 78 | .catch(/* istanbul ignore next */ error => done(error)); 79 | }; 80 | -------------------------------------------------------------------------------- /lib/index.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | 3 | const Metalsmith = require('metalsmith'); 4 | const equal = require('assert-dir-equal'); 5 | const rimraf = require('rimraf'); 6 | const path = require('path'); 7 | const plugin = require('./index'); 8 | 9 | describe('metalsmith-browserify', () => { 10 | it('should process a single entry point', done => { 11 | const base = path.join(process.cwd(), 'test', 'fixtures', 'single-entry'); 12 | const actual = path.join(base, 'build'); 13 | const expected = path.join(base, 'expected'); 14 | const metalsmith = new Metalsmith(base); 15 | 16 | rimraf.sync(actual); 17 | expect.assertions(1); 18 | 19 | return metalsmith.use(plugin({ entries: ['index.js'] })).build(err => { 20 | if (err) { 21 | return done(err); 22 | } 23 | expect(() => equal(actual, expected)).not.toThrow(); 24 | return done(); 25 | }); 26 | }); 27 | 28 | it('should process a nested entry point', done => { 29 | const base = path.join(process.cwd(), 'test', 'fixtures', 'nested-entry'); 30 | const actual = path.join(base, 'build'); 31 | const expected = path.join(base, 'expected'); 32 | const metalsmith = new Metalsmith(base); 33 | 34 | const entry = path.join('nested', 'index.js'); 35 | 36 | rimraf.sync(actual); 37 | expect.assertions(1); 38 | 39 | return metalsmith.use(plugin({ entries: [entry] })).build(err => { 40 | if (err) { 41 | return done(err); 42 | } 43 | expect(() => equal(actual, expected)).not.toThrow(); 44 | return done(); 45 | }); 46 | }); 47 | 48 | it('should process multiple entry points', done => { 49 | const base = path.join(process.cwd(), 'test', 'fixtures', 'multiple-entries'); 50 | const actual = path.join(base, 'build'); 51 | const expected = path.join(base, 'expected'); 52 | const metalsmith = new Metalsmith(base); 53 | 54 | rimraf.sync(actual); 55 | expect.assertions(1); 56 | 57 | return metalsmith.use(plugin({ entries: ['index.js', 'other.js'] })).build(err => { 58 | if (err) { 59 | return done(err); 60 | } 61 | expect(() => equal(actual, expected)).not.toThrow(); 62 | return done(); 63 | }); 64 | }); 65 | 66 | it('should pass options to browserify', done => { 67 | const base = path.join(process.cwd(), 'test', 'fixtures', 'options'); 68 | const actual = path.join(base, 'build'); 69 | const expected = path.join(base, 'expected'); 70 | const metalsmith = new Metalsmith(base); 71 | 72 | rimraf.sync(actual); 73 | expect.assertions(1); 74 | 75 | return metalsmith 76 | .use(plugin({ entries: ['index.js'], browserifyOptions: { debug: true } })) 77 | .build(err => { 78 | if (err) { 79 | return done(err); 80 | } 81 | expect(() => equal(actual, expected)).not.toThrow(); 82 | return done(); 83 | }); 84 | }); 85 | 86 | it('should return an error when there is an error while bundling', done => { 87 | const base = path.join(process.cwd(), 'test', 'fixtures', 'bundle-error'); 88 | const metalsmith = new Metalsmith(base); 89 | 90 | expect.assertions(2); 91 | 92 | return metalsmith.use(plugin({ entries: ['index.js'] })).build(err => { 93 | expect(err).toBeInstanceOf(Error); 94 | 95 | // Removing path from the error since it is absolute and not always the same 96 | expect(err.message.substring(0, 43)).toMatchSnapshot(); 97 | done(); 98 | }); 99 | }); 100 | 101 | it('should return an error when there is no entries option', done => { 102 | const base = path.join(process.cwd(), 'test', 'fixtures', 'no-entries'); 103 | const metalsmith = new Metalsmith(base); 104 | 105 | expect.assertions(2); 106 | 107 | return metalsmith.use(plugin({})).build(err => { 108 | expect(err).toBeInstanceOf(Error); 109 | expect(err.message).toMatchSnapshot(); 110 | done(); 111 | }); 112 | }); 113 | 114 | it('should return an error when there are no options', done => { 115 | const base = path.join(process.cwd(), 'test', 'fixtures', 'no-options'); 116 | const metalsmith = new Metalsmith(base); 117 | 118 | expect.assertions(2); 119 | 120 | return metalsmith.use(plugin()).build(err => { 121 | expect(err).toBeInstanceOf(Error); 122 | expect(err.message).toMatchSnapshot(); 123 | done(); 124 | }); 125 | }); 126 | 127 | it('should return an error when entries is not an array', done => { 128 | const base = path.join(process.cwd(), 'test', 'fixtures', 'malformed-entries'); 129 | const metalsmith = new Metalsmith(base); 130 | 131 | expect.assertions(2); 132 | 133 | return metalsmith.use(plugin({ entries: 'wrong' })).build(err => { 134 | expect(err).toBeInstanceOf(Error); 135 | expect(err.message).toMatchSnapshot(); 136 | done(); 137 | }); 138 | }); 139 | 140 | it('should return an error when entries is empty', done => { 141 | const base = path.join(process.cwd(), 'test', 'fixtures', 'empty-entries'); 142 | const metalsmith = new Metalsmith(base); 143 | 144 | expect.assertions(2); 145 | 146 | return metalsmith.use(plugin({ entries: [] })).build(err => { 147 | expect(err).toBeInstanceOf(Error); 148 | expect(err.message).toMatchSnapshot(); 149 | done(); 150 | }); 151 | }); 152 | 153 | it('should return an error when entries contains a file that does not exist', done => { 154 | const base = path.join(process.cwd(), 'test', 'fixtures', 'file-does-not-exist-error'); 155 | const metalsmith = new Metalsmith(base); 156 | 157 | const correctEntry = 'index.js'; 158 | const incorrectEntry = 'doesNotExist.js'; 159 | 160 | expect.assertions(3); 161 | 162 | return metalsmith.use(plugin({ entries: [correctEntry, incorrectEntry] })).build(err => { 163 | expect(err).toBeInstanceOf(Error); 164 | expect(err.message).toMatchSnapshot(); 165 | expect(err.message).toContain(incorrectEntry); 166 | done(); 167 | }); 168 | }); 169 | 170 | it('should ignore non-existent entries when suppressNotFoundError is enabled', done => { 171 | const base = path.join(process.cwd(), 'test', 'fixtures', 'suppress-not-found-error'); 172 | const actual = path.join(base, 'build'); 173 | const expected = path.join(base, 'expected'); 174 | const metalsmith = new Metalsmith(base); 175 | 176 | rimraf.sync(actual); 177 | 178 | const correctEntry = 'index.js'; 179 | const incorrectEntry = 'doesNotExist.js'; 180 | const options = { entries: [correctEntry, incorrectEntry], suppressNotFoundError: true }; 181 | 182 | expect.assertions(1); 183 | 184 | return metalsmith.use(plugin(options)).build(err => { 185 | if (err) { 186 | return done(err); 187 | } 188 | 189 | expect(() => equal(actual, expected)).not.toThrow(); 190 | 191 | return done(); 192 | }); 193 | }); 194 | }); 195 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "metalsmith-browserify", 3 | "version": "1.1.0", 4 | "description": "Metalsmith plugin to bundle JS with browserify", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/metalsmith/metalsmith-browserify.git" 8 | }, 9 | "keywords": [ 10 | "metalsmith", 11 | "browserify", 12 | "kopa" 13 | ], 14 | "author": "Ondrej Brinkel ", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/metalsmith/metalsmith-browserify/issues" 18 | }, 19 | "homepage": "https://github.com/metalsmith/metalsmith-browserify#readme", 20 | "main": "lib/index.js", 21 | "scripts": { 22 | "precommit": "lint-staged", 23 | "lint:js": "eslint '**/*.js'", 24 | "lint:prettier": "prettier --list-different '**/*.js'", 25 | "test": "jest", 26 | "test:coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls" 27 | }, 28 | "jest": { 29 | "collectCoverageFrom": [ 30 | "lib/*.js" 31 | ] 32 | }, 33 | "greenkeeper": { 34 | "ignore": [ 35 | "husky", 36 | "coveralls", 37 | "assert-dir-equal", 38 | "eslint", 39 | "eslint-config-airbnb-base", 40 | "eslint-config-prettier", 41 | "eslint-plugin-import", 42 | "lint-staged", 43 | "jest", 44 | "metalsmith", 45 | "prettier", 46 | "rimraf" 47 | ] 48 | }, 49 | "dependencies": { 50 | "browserify": "^16.5.0", 51 | "debug": "^4.1.1" 52 | }, 53 | "devDependencies": { 54 | "assert-dir-equal": "^1.1.0", 55 | "coveralls": "^3.0.0", 56 | "eslint": "^4.18.1", 57 | "eslint-config-airbnb-base": "^12.1.0", 58 | "eslint-config-prettier": "^2.9.0", 59 | "eslint-plugin-import": "^2.9.0", 60 | "husky": "^1.3.1", 61 | "jest": "^24.7.1", 62 | "lint-staged": "^8.1.5", 63 | "metalsmith": "^2.3.0", 64 | "prettier": "^1.10.2", 65 | "rimraf": "^2.6.2" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /test/fixtures/bundle-error/src/index.js: -------------------------------------------------------------------------------- 1 | var missing = require('../lib/missing.js'); 2 | -------------------------------------------------------------------------------- /test/fixtures/empty-entries/src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/metalsmith/metalsmith-browserify/d3ab97b269d84c0f084ae1bd22c690695f12c58e/test/fixtures/empty-entries/src/.gitkeep -------------------------------------------------------------------------------- /test/fixtures/file-does-not-exist-error/lib/something.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | console.log('Something'); 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/file-does-not-exist-error/src/index.js: -------------------------------------------------------------------------------- 1 | var something = require('../lib/something.js'); 2 | -------------------------------------------------------------------------------- /test/fixtures/malformed-entries/src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/metalsmith/metalsmith-browserify/d3ab97b269d84c0f084ae1bd22c690695f12c58e/test/fixtures/malformed-entries/src/.gitkeep -------------------------------------------------------------------------------- /test/fixtures/multiple-entries/expected/index.js: -------------------------------------------------------------------------------- 1 | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i