![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Build a KISSY package, for KISSY 1.3+.
This module is installed via npm:
$ npm install node-kpc
var kpc = require('node-kpc');
// build a package
kpc.build({
pkg: {
name: 'xcake',
path: 'sample/src'
},
dest: 'sample/build', // where the package is build to
depFile: 'sample/build/map.js'
});
Before | After |
---|---|
sample/src ├── app │ ├── cjs-full.js │ ├── cjs.js │ ├── fac-config.js │ ├── name-fac-config.js │ ├── no-kissy.js │ ├── object.js │ └── string.js └── pages └── home ├── index.js └── mod.js |
sample/build ├── app │ ├── cjs-full.js │ ├── cjs.js │ ├── fac-config.js │ ├── name-fac-config.js │ ├── no-kissy.js │ ├── object.js │ └── string.js ├── map.js └── pages └── home ├── index.js └── mod.js |
var kpc = require('node-kpc');
// build a package
kpc.build({
pkg: {
name: 'xcake',
path: 'sample/src'
},
dest: 'sample/build', // where the package is build to
depFile: 'sample/build/map.js' //
}, ['sample/src/app/*.js']);
After build:
src | dest |
---|---|
sample/src ├── app │ ├── cjs-full.js │ ├── cjs.js │ ├── fac-config.js │ ├── name-fac-config.js │ ├── no-kissy.js │ ├── object.js │ └── string.js └── pages └── home ├── index.js └── mod.js |
sample/build ├── app │ ├── cjs-full.js │ ├── cjs.js │ ├── fac-config.js │ ├── name-fac-config.js │ ├── no-kissy.js │ ├── object.js │ └── string.js └─ map.js |
var kpc = require('node-kpc');
var pkg = kpc.compile({
name: 'xcake',
path: 'sample/src'
});
console.log(pkg);
```
the pkg look like this
```json
{
"files": [
{
"srcCode": "/**\n * @fi...",
"isKISSY": true,
"modules": [
{
"name": "xcake/app/cjs",
"requires": [
"node",
"../components/header/",
"./mod/",
"./example.css"
]
}
],
"genCode": "/**\n * @fi...",
"filename": "app/cjs.js",
"srcFile": "sample/src/app/cjs.js"
}
],
"ignoredFiles": [],
"modules": {
"xcake/app/cjs": {
"requires": [
"node",
"../components/header/",
"./mod/",
"./example.css"
]
}
}
}
```
#### Case5. Specify files to compile
````js
var kpc = require('node-kpc');
var pkg = kpc.compile({
name: 'xcake',
path: 'sample/src'
}, ['sample/src/app/*']);
console.log(pkg);
```
FAQs
build KISSY packages
The npm package node-kpc receives a total of 0 weekly downloads. As such, node-kpc popularity was classified as not popular.
We found that node-kpc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.