JXA Runner runs JavaScript and TypeScript code using the JXA runtime. It's intended to be used for testing JXA code rather than running JXA in production.
MIT License
JXA Runner runs JavaScript and TypeScript code using the JXA runtime. It's intended to be used for testing JXA code rather than running JXA in production.
This package is available on npm as jxa-runner
.
npm install jxa-runner
import { run } from 'jxa-runner';
// returns "Hello, world!"
await run(() => 'Hello, world!');
// returns "Hello, John!"
await run((name: string) => `Hello, ${name}!`, {
args: ['John'],
});
import { run } from 'jxa-runner';
import z from 'zod';
// returns { name: "John", age: 37 }
const result = await run(
() => {
const PersonSchema = z.object({
name: z.string(),
age: z.number(),
});
return PersonSchema.parse({ name: 'John', age: 37 });
},
{
imports: {
zod: 'z',
},
},
);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
JXA Runner is licensed under the MIT License.