# cem-plugin-module-file-extensions

> Rewrite module path file extentions

Latest version **0.0.5** (published 2022-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cem-plugin-module-file-extensions
pnpm add cem-plugin-module-file-extensions
yarn add cem-plugin-module-file-extensions
bun add cem-plugin-module-file-extensions
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2022-03-23 |
| First published | 2021-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Benny Powers |
| Maintainers | bennyp |
| Keywords | custom-elements-manifest, plugin, extensions |

## Links

- npm: https://www.npmjs.com/package/cem-plugin-module-file-extensions
- Repository: https://github.com/bennypowers/cem-plugins
- Homepage: https://github.com/bennypowers/cem-plugins#readme
- Issues: https://github.com/bennypowers/cem-plugins/issues
- npm.io page: https://npm.io/package/cem-plugin-module-file-extensions

## Recent versions

- 0.0.5 (latest) — 2022-03-23
- 0.0.4 — 2022-03-22
- 0.0.3 — 2022-03-22
- 0.0.2 — 2021-10-21
- 0.0.1 — 2021-07-01

## README

# cem-plugin-readonly

Adds (non-standard) "readonly" flag to class fields

## Options

`from` and `to` are the 1st and 2nd parameter to [`String#replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter).

| Option | Type               | Default          | Description |
| ------ | ------------------ | ---------------- | ----------- |
| from   | string \| RegExp   | `/\.(t\|j)sx?$/` | path replacement test |
| to     | string \| function | '.js'            | replacer string or function |

## Example

`custom-elements-manifest.config.js`
```js
import { moduleFileExtensionsPlugin } from 'cem-plugin-module-file-extensions';

export default {
  globs: '*.ts',
  plugins: [
    moduleFileExtensionsPlugin(),
  ]
}
```

### Output
```json
{
  "schemaVersion": "1.0.0",
  "readme": "",
  "modules": [
    {
      "kind": "javascript-module",
      "path": "my-element.js",
      "declarations": [
        {
          "kind": "class",
          "description": "",
          "name": "MyElement",
          "customElement": true
        }
      ],
      "exports": [
        {
          "kind": "js",
          "name": "MyElement",
          "declaration": {
            "name": "MyElement",
            "module": "my-element.js"
          }
        }
      ]
    }
  ]
}
```

---
_Source: https://npm.io/package/cem-plugin-module-file-extensions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
