Package Exports
- @ima/plugin-cli
- @ima/plugin-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ima/plugin-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@ima/plugin-cli
@ima/plugin-cli takes care of building, linking and watching IMA.js plugins.
Small CLI wrapper around swc with few other plugins (typescript support), which takes care of building, watching and linking IMA.js plugins.
Installation
npm install @ima/plugin-cli --save-devUsage
npx ima-plugin dev
npx ima-plugin build
npx ima-plugin link [target-project]
npx ima-plugin --helpCreate ima-plugin.config.js
Create ima-plugin.config.js file in the root of your plugin directory and export some configuration:
// ima-plugin.config.js
const { swcTransformer, typescriptDeclarationsPlugin } = require('@ima/plugin-cli');
module.exports = {
input: './src',
output: './dist',
transforms: [
[
swcTransformer({
module: {
type: 'es6',
},
jsc: {
target: 'es2022',
parser: {
syntax: 'ecmascript',
jsx: true
},
},
}),
{
test: /\.(js|jsx)$/
}
]
],
plugins: [
typescriptDeclarationsPlugin({
additionalArgs: ['--skipLibCheck'],
}),
],
};Pre-configured configurations
This package also exports 3 pre-configured ima-plugin.config.js configurations, which you can use in your plugins without a need to create your own.
const { createConfig } = require('@ima/plugin-cli');
module.exports = createConfig();createConfig(type = 'es6')- Creates basic configuration that exports only one bundle (used at server and client)createClientServerConfig(type = 'es6')- Creates configuration which exports client and server specific bundles. Supports JSX/TSX, preprocess pragma comments.
Note: You can override module
typeusing the first argument and export other types of module syntax. For example usecommonjsfor Node-specific packages.
This package is part of the IMA.js application stack, see imajs.io for more info about the whole project.