open-index/open-npm huggingface dataset:
npm package: @jxa/global-type
Description: JXA typing for global
Author: azu
Latest version: 1.4.0

# @jxa/global-type

JXA typing for global.

This typing enable auto-complete in your editor.

![auto complete example](./docs/example.gif)

- [TypeScript Editor Support · Microsoft/TypeScript Wiki](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support)

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @jxa/global-type

## Usage

Install and includes `@jxa/global-type` as typing.
Then, automatically inject `Application` to `global`

### via `import("@jxa/global-type")`

You can add JSX types to `global` by import `@jxa/global-type`:

```ts
import "@jxa/global-type";

// your JXA application
var userName = Application("System Events").currentUser().name();
```

### via tsconfig.json

- [ ] welcome PR

### Via reference comment

```ts
/// <reference path="./node_modules/@jxa/global-type/src/index.d.ts" />

// your JXA application
var userName = Application("System Events").currentUser().name();
```

## Changelog

See [Releases page](https://github.com/JXA-userland/JXA/releases).

## Running tests

    yarn test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/JXA-userland/JXA/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu
npm package: @jxa/repl
Description: REPL for JXA.
Author: azu
Latest version: 1.4.0

# @jxa/repl

REPL for JXA.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install -g @jxa/repl

**Requirement:**

- Node.js 10+

## Usage

    $ npx @jxa/repl
    # or
    $ npm install -g @jxa/repl
    $ jxa-repl
    > Application("System Events").currentUser().name();

## Command

### `.clear`

Clear current buffer and history.
It will release defined variables.
 
## Changelog

See [Releases page](https://github.com/JXA-userland/JXA/releases).

## Reference

- [REPL | Node.js v10.5.0 Documentation](https://nodejs.org/api/repl.html)

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/JXA-userland/JXA/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu
npm package: @jxa/run
Description: Run JXA code and get result.
Author: azu
Latest version: 1.4.0

# @jxa/run

Run JXA code and get result.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @jxa/run

Requirement:

- macOS 10.10 or later.

## Usage

### `export declare function run<R>(jxaCodeFunction: (...args: any[]) => void, ...args: any[]): Promise<R>`

Illustration of usage

```js
const resultPromise = run(JSXFn, argumentsOfJSXFn);
```

- `JSXFn`: This function is run as JXA.
    - :memo: This `JSXFn` is serialized(`toString`) and pass to JXA environment.
    - **Warning** The function cannot close over variables in a parent's scope.
    - You need to pass arguments as `argumentsOfJSXFn` explicitly 
- `argumentsOfJSXFn`: An arguments of `JSXFn`

**OK:**

```ts
// OK
(async () => {
    // `name` is "nodejs"
    const result = await run(name => {
        return "Hello there, " + name + "!"
    }, "nodejs");
    assert.strictEqual(result, "Hello there, nodejs!");
})();
```

**NG:**

```ts
// NG
(async () => {
    const name = "nodejs"
    const result = await run(name => {
        return "Hello there, " + name + "!"; // can not access to `name` from JXA enviroment
    });
    assert.strictEqual(result, "Hello there, nodejs!");
})();
```

## Example

```ts
(async () => {
    const result = await run(
        // run this function as JXA code
        () => {
            return Application("System Events")
                .currentUser()
                .name()
        }
    );
    assert.strictEqual(result, process.env.USER);
})();
```

## Changelog

See [Releases page](https://github.com/JXA-userland/JXA/releases).

## Running tests

    yarn test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/JXA-userland/JXA/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)


## Related

- [wtfaremyinitials/osa2: Interact with Apple's Open Scripting Architecture in node.js](https://github.com/wtfaremyinitials/osa2 "wtfaremyinitials/osa2: Interact with Apple's Open Scripting Architecture in node.js")
- [sindresorhus/run-jxa: Run JXA code and get the result](https://github.com/sindresorhus/run-jxa "sindresorhus/run-jxa: Run JXA code and get the result")

## License

MIT © azu
npm package: @jxa/sdef-to-dts
Description: Scripting definition files (sdefs) to TypeScript (d.ts)
Author: azu
Latest version: 1.4.0

# @jxa/sdef-to-dts

Convert Scripting definition files (`.sdefs`) to TypeScript(d.ts)

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @jxa/sdef-to-dts

## Usage as library

Convert `./input/*.sdef` file and output it as `d.ts` to `./output` directory.

```ts
const fs = require("fs");
const path = require("path");
const { transform } = require("@jxa/sdef-to-dts");
const sdefDir = path.join(__dirname, "./input");
const outputDir = path.join(__dirname, "./output");
const promises = fs.readdirSync(sdefDir).map(async caseName => {
    const fileName = path.basename(caseName, ".sdef");
    const normalizedTestName = fileName.replace(/\s/g, "");
    const actualContent = fs.readFileSync(path.join(fixturesDir, caseName), "utf-8");
    console.log("transform " + normalizedTestName);
    const actual = await transform(normalizedTestName, actualContent);
    fs.writeFileSync(path.join(outputDir, normalizedTestName) + ".d.ts", actual, "utf-8");
});
Promise.all(promises).then(() => {
    console.log("All write");
});
```

## Usage as command

Convert application bundles (e.g. `/Applications/Safari.app`) and output as `d.ts`.

```
  Scripting definition files (sdefs) to TypeScript (d.ts)

  Usage
    $ npx @jxa/sdef-to-dts <input> --output <output>

    <input>       path to an Application.app to read

  Options
    --output, -o  path to an Application.d.ts or a directory to write to
    --version     show the version
    --help        show this help page

  Examples
    $ npx @jxa/sdef-to-dts /Applications/Safari.app --output ./safari.d.ts
```

## Running tests

    yarn test

## Changelog

See [Releases page](https://github.com/JXA-userland/JXA/releases).

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/JXA-userland/JXA/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu
npm package: @jxa/types
Description: TypeScript definition for JXA core.
Author: azu
Latest version: 1.4.0

# @jxa/types

TypeScript definition for JXA core.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @jxa/types

## Usage

This library is just TypeScript definition files.
In other words, this library only used for importing.

If you want to modify `global`, see [@jxa/global-type](../global-type).

### Use with custom Application type

`Application` support [generics type](https://www.typescriptlang.org/docs/handbook/generics.html) that return `T & Application`

Example: `GoogleChrome` Application

```ts
import { Application } from "@jxa/types";
import { GoogleChrome } from "./fixtures/GoogleChrome";
// Pass Custom Application type as generics
const chrome = Application<GoogleChrome>("Google Chrome");
const frontWindow: GoogleChrome.Window = chrome.app.windows[0];
```

### Update Core d.ts

1. Update `tools/sdefs/*.sdefes`
2. Update d.ts with follows command:
    
    yarn run dts:update

## Running tests

    yarn test

## Changelog

See [Releases page](https://github.com/JXA-userland/JXA/releases).

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/JXA-userland/JXA/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu