
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
@zeroc/slice2js
Advanced tools
The Slice-to-JavaScript compiler and build plugin for Ice.
This package provides:
slice2js compiler, which compiles Slice definitions (.ice files) into JavaScript and TypeScript.npm install --save-dev @zeroc/slice2js
The build plugin compiles .ice files automatically during your build. It supports glob patterns and watches .ice
files for changes in development mode.
// vite.config.js
import slice2js from "@zeroc/slice2js/unplugin/vite";
export default {
plugins: [
slice2js({
inputs: ["slice/*.ice"],
outputDir: "src/generated",
args: ["--typescript"],
}),
],
};
// rollup.config.js
import slice2js from "@zeroc/slice2js/unplugin/rollup";
export default {
plugins: [
slice2js({
inputs: ["slice/*.ice"],
outputDir: "src/generated",
args: ["--typescript"],
}),
],
};
// webpack.config.js
import slice2js from "@zeroc/slice2js/unplugin/webpack";
export default {
plugins: [
slice2js({
inputs: ["slice/*.ice"],
outputDir: "src/generated",
args: ["--typescript"],
}),
],
};
import esbuild from "esbuild";
import slice2js from "@zeroc/slice2js/unplugin/esbuild";
await esbuild.build({
plugins: [
slice2js({
inputs: ["slice/*.ice"],
outputDir: "src/generated",
args: ["--typescript"],
}),
],
});
| Option | Type | Description |
|---|---|---|
inputs | string | string[] | Slice files or glob patterns (e.g. "**/*.ice") |
outputDir | string | Output directory for generated .js and .d.ts files |
include | string | string[] | Additional Slice include directories (-I flags) |
args | string | string[] | Additional slice2js CLI arguments (e.g. --typescript) |
cwd | string | Base directory for resolving paths (defaults to process.cwd()) |
runSlice2js(options)Compiles Slice files with glob support and include directory resolution:
import { runSlice2js } from "@zeroc/slice2js/unplugin";
await runSlice2js({
inputs: ["slice/*.ice"],
outputDir: "src/generated",
args: ["--typescript"],
});
compile(args, options)Low-level function that spawns the slice2js compiler directly:
import { compile } from "@zeroc/slice2js";
const exitCode = await compile(["--typescript", "--output-dir", "src/generated", "slice/Hello.ice"]);
FAQs
Slice-to-JavaScript compiler and build plugin for Ice
The npm package @zeroc/slice2js receives a total of 22 weekly downloads. As such, @zeroc/slice2js popularity was classified as not popular.
We found that @zeroc/slice2js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.