{"id":13724837,"url":"https://github.com/mattdesl/esmify","last_synced_at":"2025-04-06T09:10:12.121Z","repository":{"id":32698414,"uuid":"140324235","full_name":"mattdesl/esmify","owner":"mattdesl","description":"parse and handle import/export for browserify","archived":false,"fork":false,"pushed_at":"2024-08-14T12:56:21.000Z","size":514,"stargazers_count":118,"open_issues_count":23,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:50:29.386Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattdesl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-09T18:08:31.000Z","updated_at":"2025-01-04T10:53:37.000Z","dependencies_parsed_at":"2024-08-29T13:07:57.673Z","dependency_job_id":"3b0fd58c-c0d7-4e5a-8000-3b5e324f42b0","html_url":"https://github.com/mattdesl/esmify","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"6d9af52d3b42eead0660567636c2d7d02cc8132e"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Fesmify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Fesmify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Fesmify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Fesmify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattdesl","download_url":"https://codeload.github.com/mattdesl/esmify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457803,"owners_count":20941906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:02:04.267Z","updated_at":"2025-04-06T09:10:12.100Z","avatar_url":"https://github.com/mattdesl.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# esmify\n\nA dead-simple tool to add `import` / `export` ES Module syntax to your [browserify](https://www.npmjs.com/package/browserify) builds.\n\nThe plugin makes the following changes to your bundler:\n\n- Adds `.mjs` extension to module resolution (which take precedence over `.js` files)\n- Resolves to `\"module\"` field in `package.json` when a `\"browser\"` field is not specified\n- Transforms ES Module syntax (static `import` / `export` statements) into CommonJS\n\nUse it with the `--plugin` or `-p` flags in browserify:\n\n```js\nbrowserify index.js -p esmify \u003e bundle.js\n```\n\nAlso works with [budo](https://www.npmjs.com/package/budo) and similar tools, for example:\n\n```js\nbudo index.js --live -- -p esmify\n```\n\nFiles that don't contain `import` / `export` syntax are ignored, as are dynamic import expressions. The plugin runs across your bundle (including `node_modules`) in order to support ESM-authored modules on npm.\n\n## Install\n\nUse [npm](https://npmjs.com/) to install.\n\n```sh\nnpm install esmify --save-dev\n```\n\nAlso can be used via API like so:\n\n```js\nbrowserify({\n  plugin: [\n    [ require('esmify'), { /* ... options ... */ } ]\n  ]\n});\n```\n\n## Usage\n\n#### `plugin = esmify(bundler, opt = {})`\n\nReturns a browswerify plugin function that operates on `bundler` with the given options:\n\n- `mainFields` which describes the order of importance of fields in package.json resolution, defaults to `[ 'browser', 'module', 'main' ]`\n- `nodeModules` (default `true`) to disable the transform on your `node_modules` tree, set this to `false`. This will speed up bundling but you may run into issues when trying to import ESM-published code from npm.\n- `plainImports` (Experimental) this feature will map named imports *directly* to their CommonJS counterparts, without going through Babel's inter-op functions. This is generally needed for static analysis of `fs`, `path` and other tools like `glslify` in browserify. Defaults to `[ 'fs', 'path', 'glslify' ]`.\n\nUnder the hood, this uses Babel and `plugin-transform-modules-commonjs` to provide robust inter-op that handles a variety of use cases.\n\n#### `require('esmify/resolve')(id, opts, cb)`\n\nResolve the given `id` using the module resolution algorithm from `esmify`, accepting `{ mainFields }` array to opts as well as other options passed to [resolve](https://www.npmjs.com/package/resolve) and [browser-resolve](https://www.npmjs.com/package/browser-resolve).\n\nWorks like so:\n\n- If mainFields includes a `\"browser\"` field, use `browser-resolve`, otherwise use `resolve`\n- Look for package.json fields in order of `mainFields`, the first field that exists will be used\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/esmify/blob/master/LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdesl%2Fesmify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattdesl%2Fesmify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdesl%2Fesmify/lists"}