
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Transpiles JavaScript modules from one format to another.
It supports from:
to
Currently, it can not transpile to ES6 module syntax.
> npm install transpile --save-dev
transpile.to
transpiles from one format to another format. transpile.able
lets you know if a transpile is possible.
Formats are specified by strings like:
import Point from "math";
var _ = require('underscore');
define(['jquery'],function($){});
steal('jquery', function($){})
transpile.to(load, format, options) -> transpiledResult
Transpiles from the load
's format to the specified format. If
the load
does not specify a format, "es6"
modules are assumed. Returns
an object containing the transpiled source and sourceMap (if sourceMap option provided).
Example:
var transpile = require('transpile');
var res = transpile.to({
name: "my/module",
source: "var foo = require('foo')",
metadata: {format: "cjs"}
}, "amd")
res.code //-> "define("my/module", function(require, exports, module) { ... "
A load is an object in the shape of an ES6 Load Record like:
{
name: "moduleName",
source: "source code",
metadata: {format: "formatName"}
}
Previously transpile.to
returned a string containing the transpiled source. To accomodate Source Maps support the API has changed and now returns an object that looks like:
{
code: "define(...", // The transpiled source,
map: {}, // A source map, if sourceMaps option is provided.
ast: {} // A Mozilla Parser API compatible AST, created by Esprima
}
Object<moduleName,moduleName>
- A mapping module names that will
be used to replace dependency names in the transpiled result.function(name, currentName, address) -> String
- A function
that can be used to change moduleNames that are written in the transpiled result.Boolean=false
- Set to true to insert named defines.String=traceur
- Set which ES6 transpiler to use. Valid options are traceur
or 6to5
with traceur
being the default.function(source, compileOptions, options) -> Object
- If you want to handle tranpiling yourself and not use the built-in options, this is a function that will be given the source and is expected to return an object containing a code
string.Boolean=false
- Set to true to return a map
and ast
object along with the result.Boolean=false
- If sourceMaps
is set to true, this option will include the original source contents with the source maps.transpile.able(fromFormat, toFormat) -> transpiledPath
Returns the path used to transpile
from fromFormat
to toFormat
. If transpiling is not possible, null
will be
returned.
Example:
var res = transpile.able("steal","cjs");
res //-> ["steal","amd"];
This means that a module will be converted from "steal" to "amd" and then to "cjs".
> npm test
FAQs
Transpiles JavaScript modules from one format to another.
We found that transpile demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.