Skip to main content

Assess, plan, evolve.

Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.

5 packages

Sort by
Ttechflare641 avatar
commonjs-to-esm

Migrates Node.js CommonJS (.js, .cjs) to ES modules

commonjsesm+13
v1.3.3
techflare641
60
4 months ago
M
playcanvas-esm-scripts

### Updates legacy PlayCanvas scripts to the newer ESM Scripts format This codemod transforms legacy PlayCanvas Scripts into their newer modern equivalents. You can open this codemod and run it over your existing scripts in vscode using the link to the side. The codemod fully supports all syntax transformations apart from 'json' type attributes.. To run this codemod use ```sh npx codemod playcanvas-esm-scripts -i "./your-file.js" ``` This will translate the following older Script ```javascript var Rotator = pc.createScript('rotator'); Rotator.attributes.add('speed', { type: 'number', default: 10, min: 0, max: 10 }); Rotator.prototype.update = function (dt) { this.entity.rotateLocal(0, this.speed, 0); }; ``` transforms it into the modern ESM Scripts format ```javascript import { Script } from 'playcanvas' export class Rotator extends Script { /** * @attribute * @type {number} * @range [0, 10] */ speed = 10; update(dt) { this.entity.rotateLocal(0, this.speed, 0); } } ``` It will map any attribute properties to their relevant jsdocs tags [according to the spec](https://github.com/playcanvas/editor/issues/1148), and export all classes in the correct format. It will also handle enums correctly.

playcanvasesm+2
v1.0.9
marklundin
11
a year ago
C
npm-esm-first-in-exports

Sort package.json export order to prefer ESM over CJS ```json "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs", // <-- this would cause platforms to prefer CJS over ESM "import": "./dist/index.js" }, } ``` ## Example ### Before ```json "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs", "import": "./dist/index.js" }, } ``` ### After ```ts "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" }, } ```

npmexport+1
v1.0.1
Codemod
0
a year ago
Mmohebifar avatar
javascript-eslint-import-order

Normalize the top static ESM import block to eslint-plugin-import import/order grouping, blank-line, and alphabetical ordering conventions.

importseslint+3
v0.1.0
mohebifar
0
4 months ago
D
node/22.8.0/enable-compile-cache-in-start-server

This release adds a new API module.enableCompileCache() that can be used to enable on-disk code caching of all modules loaded after this API is called. Previously this could only be enabled by the NODE_COMPILE_CACHE environment variable, so it could only set by end-users. This API allows tooling and library authors to enable caching of their own code. This is a built-in alternative to the v8-compile-cache/v8-compile-cache-lib packages, but have better performance and supports ESM. ### Before ```ts const http = require('http'); function startServer() { // Create an HTTP server const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello, Node.js!\n'); }); server.listen(3000, () => { console.log('Server is running at http://localhost:3000/'); }); } startServer(); ``` ### After ```ts const http = require('http'); function startServer() { // Enable compile cache for all modules loaded after this point const result = module.enableCompileCache(); // Create an HTTP server const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello, Node.js!\n'); }); server.listen(3000, () => { console.log('Server is running at http://localhost:3000/'); }); } startServer(); ```

node22.8.0+2
v1.0.0
dfordp
0
a year ago

Build your own codemod!

Describe the migration you need and Wish will create a codemod for you.

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.