# @iyowei/is-esm

> 通过 AST 检测 JS 文件是不是 ESM，并非读取 'package.json' 文件中 'type' 设置。

Latest version **1.0.1** (published 2021-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @iyowei/is-esm
pnpm add @iyowei/is-esm
yarn add @iyowei/is-esm
bun add @iyowei/is-esm
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-12-18 |
| First published | 2021-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12.20.0 |
| Dependencies | 2 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | itonyyo |
| Keywords | iyowei |

## Links

- npm: https://www.npmjs.com/package/@iyowei/is-esm
- Repository: https://github.com/iyowei/is-esm
- Homepage: https://github.com/iyowei/is-esm#readme
- Issues: https://github.com/iyowei/is-esm/issues
- npm.io page: https://npm.io/package/@iyowei/is-esm

## Dependencies (2)

- [ast-module-types](https://npm.io/package/ast-module-types.md) ^2.7.1
- [node-source-walk](https://npm.io/package/node-source-walk.md) ^4.2.0

## Recent versions

- 1.0.1 (latest) — 2021-12-18
- 1.0.0 — 2021-12-17

## README

[node version badge]: https://img.shields.io/badge/node.js-%3E%3D12.20.0-brightgreen?style=flat&logo=Node.js
[download node.js]: https://nodejs.org/en/download/
[prs welcome badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat

# isESM(path)

> 通过 AST 检测 JS 文件是不是 ESM，并非读取 "package.json " 文件中 "type" 设置。

## 使用

- `path`，{ String }，路径

```js
import { log } from "console";
import { isESM, isESMSync } from "@iyowei/is-esm";

(async () => {
  log(await isESM("/Users/iyowei/Development/iyowei/create-esm/src/print.js")); // 异步
  // true

  log(isESMSync("/Users/iyowei/Development/iyowei/create-esm/src/print.js")); // 串行
  // true
})();
```

## 安装

[![Node Version Badge][node version badge]][download node.js]

```shell
# Pnpm
pnpm add @iyowei/is-esm

# yarn
yarn add @iyowei/is-esm

# npm
npm add @iyowei/is-esm
```

## 参与贡献

![PRs Welcome][prs welcome badge]

---
_Source: https://npm.io/package/@iyowei/is-esm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
