
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
ember-cli-cjs-transform
Advanced tools
This addon allows importing files that are in the CommonJS format via the
standard app.import
functionality added in ember-cli 2.16.
ember install ember-cli-cjs-transform
In your ember-cli-build.js
file just like the amd
transform!
For example, add the following to import some-name
's index.js
into your build:
app.import('node_modules/some-name/index.js', {
using: [
{ transformation: 'cjs', as: 'some-name'}
]
});
At build time we automatically follow all dependencies (e.g. internal require
calls) in the source file, and includes their contents in the final build
output.
This means that even for reasonably complicated things, we can app.import
the
"entry point" files and everything "just" works.
Examples (used while testing functionality):
Bringing in showdown
and showdown-highlight
for usage (without extra "shim" addon packages!):
app.import('node_modules/showdown/dist/showdown.js', {
using: [{ transformation: 'cjs', as: 'showdown' }]
});
app.import('node_modules/showdown-highlight/lib/index.js', {
using: [{ transformation: 'cjs', as: 'showdown-highlight' }]
});
app.import('node_modules/highlight.js/styles/tomorrow-night.css');
There 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.
var path = require('path');
For 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
:
const nodeBuiltins = require('rollup-plugin-node-builtins');
app.import('node_modules/some-name/index.js', {
using: [
{ transformation: 'cjs', as: 'some-name', plugins: [ nodeBuiltins() ]}
]
});
You can include multiple rollup plugins in the array and pass in options via the arguments to your plugin creation function.
app.import('node_modules/some-name/index.js', {
using: [
{
transformation: 'cjs',
as: 'some-name',
plugins: [
plugin1(),
plugin2({ option1: "value" })
]
}
]
});
git clone <repository-url>
this repositorycd ember-cli-cjs-transform
yarn install
ember serve
yarn test
(Runs ember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.
FAQs
Add a CJS tranform for use with ember-cli's `app.import` API.
The npm package ember-cli-cjs-transform receives a total of 8,172 weekly downloads. As such, ember-cli-cjs-transform popularity was classified as popular.
We found that ember-cli-cjs-transform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.