{"id":13807022,"url":"https://github.com/rwjblue/ember-cli-cjs-transform","last_synced_at":"2025-05-07T16:10:38.331Z","repository":{"id":57223134,"uuid":"111159466","full_name":"rwjblue/ember-cli-cjs-transform","owner":"rwjblue","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-04T08:49:29.000Z","size":1228,"stargazers_count":48,"open_issues_count":20,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T05:35:07.650Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rwjblue.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-17T23:14:04.000Z","updated_at":"2024-04-10T08:50:21.000Z","dependencies_parsed_at":"2022-08-25T12:22:26.396Z","dependency_job_id":null,"html_url":"https://github.com/rwjblue/ember-cli-cjs-transform","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwjblue%2Fember-cli-cjs-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwjblue%2Fember-cli-cjs-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwjblue%2Fember-cli-cjs-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwjblue%2Fember-cli-cjs-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwjblue","download_url":"https://codeload.github.com/rwjblue/ember-cli-cjs-transform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912996,"owners_count":21824066,"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-04T01:01:19.607Z","updated_at":"2025-05-07T16:10:38.308Z","avatar_url":"https://github.com/rwjblue.png","language":"JavaScript","readme":"# ember-cli-cjs-transform\n\nThis addon allows importing files that are in the CommonJS format via the\nstandard `app.import` functionality added in ember-cli 2.16.\n\n## Installing\n\n```\nember install ember-cli-cjs-transform\n```\n\n## Usage\n\nIn your `ember-cli-build.js` file just like the `amd` transform!\n\nFor example, add the following to import `some-name`'s `index.js` into your build:\n\n```js\napp.import('node_modules/some-name/index.js', {\n  using: [\n    { transformation: 'cjs', as: 'some-name' }\n  ]\n});\n```\n\nAt build time we automatically follow all dependencies (e.g. internal `require`\ncalls) in the source file, and includes their contents in the final build\noutput.\n\nThis means that even for reasonably complicated things, we can `app.import` the\n\"entry point\" files and everything \"just\" works.\n\nExamples (used while testing functionality):\n\nBringing in `showdown` and `showdown-highlight` for usage (without extra \"shim\" addon packages!):\n\n```js\napp.import('node_modules/showdown/dist/showdown.js', {\n  using: [{ transformation: 'cjs', as: 'showdown' }]\n});\napp.import('node_modules/showdown-highlight/lib/index.js', {\n  using: [{ transformation: 'cjs', as: 'showdown-highlight' }]\n});\napp.import('node_modules/highlight.js/styles/tomorrow-night.css');\n```\n\nThere may be cases where you need additional rollup plugins in order to import your CommonJs files. For example, you may need to handle builtin node require statements, i.e.\n\n```\nvar path = require('path');\n```\n\nFor this, you may want to import the rollup plugin `rollup-plugin-node-builtins`. In order to do this, include the plugin in your `package.json` and use the following syntax in your `ember-cli-build.js` or `index.js`:\n\n```js\nconst nodeBuiltins = require('rollup-plugin-node-builtins');\n\napp.import('node_modules/some-name/index.js', {\n  using: [\n    { transformation: 'cjs', as: 'some-name', plugins: [ nodeBuiltins() ]}\n  ]\n});\n```\n\nYou can include multiple rollup plugins in the array and pass in options via the arguments to your plugin creation function.\n\n```js\napp.import('node_modules/some-name/index.js', {\n  using: [\n    {\n      transformation: 'cjs',\n      as: 'some-name',\n      plugins: [\n        plugin1(),\n        plugin2({ option1: \"value\" })\n      ]\n    }\n  ]\n});\n```\n\n## Contributing\n\n### Installation\n\n* `git clone \u003crepository-url\u003e` this repository\n* `cd ember-cli-cjs-transform`\n* `yarn install`\n\n### Running\n\n* `ember serve`\n* Visit your app at [http://localhost:4200](http://localhost:4200).\n\n### Running Tests\n\n* `yarn test` (Runs `ember try:each` to test your addon against multiple Ember versions)\n* `ember test`\n* `ember test --server`\n\n### Building\n\n* `ember build`\n\nFor more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).\n","funding_links":[],"categories":["Packages"],"sub_categories":["Include external JS code"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwjblue%2Fember-cli-cjs-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwjblue%2Fember-cli-cjs-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwjblue%2Fember-cli-cjs-transform/lists"}