Skip to content

Commit

Permalink
release: 1.3.0 [skip ci]
Browse files Browse the repository at this point in the history
## [1.3.0](v1.2.0...v1.3.0) (2024-10-27)

#### ✨ Features

* Make `filepath` available in replacer context and add support for `TSImportType` replacements ([0be1eda](0be1eda))

#### ⚙️ Build system

* **husky:** update commit hooks ([5719706](5719706))
  • Loading branch information
Xunnamius committed Oct 27, 2024
1 parent 0be1eda commit 129765f
Show file tree
Hide file tree
Showing 9 changed files with 541 additions and 5,996 deletions.
109 changes: 61 additions & 48 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,91 @@ All notable changes to this project will be documented in this auto-generated
file. The format is based on [Conventional Commits][1];
this project adheres to [Semantic Versioning][2].

## [1.2.0][3] (2023-02-02)
## [1.3.0][3] (2024-10-27)

#### ✨ Features

- `appendExtension` and `replaceExtensions` accept callbacks for advanced functionality ([618f4c3][4])
- Make `filepath` available in replacer context and add support for `TSImportType` replacements ([0be1eda][4])

## [1.1.0][5] (2023-01-29)
#### ⚙️ Build System

- **husky:** update commit hooks ([5719706][5])

## [1.2.0][6] (2023-02-02)

#### ✨ Features

- `appendExtension` and `replaceExtensions` accept callbacks for advanced functionality ([618f4c3][7])

## [1.1.0][8] (2023-01-29)

#### ✨ Features

- **src:** use more aesthetically appealing output format ([7390e3a][6])
- **src:** use more aesthetically appealing output format ([7390e3a][9])

### [1.0.1][7] (2023-01-28)
### [1.0.1][10] (2023-01-28)

#### 🪄 Fixes

- Use console.log for output, retire debug log function, improve type usage ([70e4053][8])
- Use console.log for output, retire debug log function, improve type usage ([70e4053][11])

#### ⚙️ Build System

- Reorganize output distributables ([cb4346d][9])
- Reorganize output distributables ([cb4346d][12])

## [1.0.0][10] (2023-01-27)
## [1.0.0][13] (2023-01-27)

#### ✨ Features

- Add drone ci test pipeline ([ae66e28][11])
- Add github action to lint and test ([dafd93f][12])
- Add support for exports ([32188ab][13])
- Add tests and update plugin version ([948baea][14])
- Automate package publishing ([2fd6c22][15])
- Handle ../ paths ([470b358][16])
- Skip type-only imports and exports ([49fdd96][17])
- Support ExportAllDeclaration ([8a39cf6][18])
- Add drone ci test pipeline ([ae66e28][14])
- Add github action to lint and test ([dafd93f][15])
- Add support for exports ([32188ab][16])
- Add tests and update plugin version ([948baea][17])
- Automate package publishing ([2fd6c22][18])
- Handle ../ paths ([470b358][19])
- Skip type-only imports and exports ([49fdd96][20])
- Support ExportAllDeclaration ([8a39cf6][21])

#### 🪄 Fixes

- ✅replace "false" extension value to "undefined" for default value tests ([054921e][19])
- 🐛replace extension properly ([0609c35][20])
- Add linter(standardjs) ([db0f337][21])
- Don't exclude relative paths ([99668ab][22])
- Make drone use npm ci instead of npm install ([1c2c16f][23])
- Missing import ([3aa9d12][24])
- ✅replace "false" extension value to "undefined" for default value tests ([054921e][22])
- 🐛replace extension properly ([0609c35][23])
- Add linter(standardjs) ([db0f337][24])
- Don't exclude relative paths ([99668ab][25])
- Make drone use npm ci instead of npm install ([1c2c16f][26])
- Missing import ([3aa9d12][27])

#### ⚙️ Build System

- **readme:** update maintenance badge ([4d47b6e][25])
- Update tooling ([74a87dd][26])
- **readme:** update maintenance badge ([4d47b6e][28])
- Update tooling ([74a87dd][29])

[1]: https://conventionalcommits.org
[2]: https://semver.org
[3]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.1.0...v1.2.0
[4]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/618f4c3a161b526b09bcb5ba5f0eee81058a75bd
[5]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.0.1...v1.1.0
[6]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/7390e3adfea60a3ff0dc03b23f01d15467bc0ef2
[7]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.0.0...v1.0.1
[8]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/70e405373905799a7cc565d841f585fe87f12a26
[9]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/cb4346dc02e9df632acf7ac734f85c5c76c6d51d
[10]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/32188ab1317f1936e364d98658ff915f5d4dafd3...v1.0.0
[11]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/ae66e28d2ff61c1207bfa65c37a6541031c9504d
[12]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/dafd93fd33a5aab03734e64619ec84161ac42d73
[13]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/32188ab1317f1936e364d98658ff915f5d4dafd3
[14]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/948baeab189090375faf956397c370b62abc555a
[15]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/2fd6c22cf181baa83e8c6eac2fbdd6653f57b423
[16]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/470b358a0d749c1cee3ab0f3f5b649d3f05490ed
[17]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/49fdd9684668b8437bd11c4c5f03b40c1af50acd
[18]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/8a39cf60884d430c70be94183e70d11e25bb4ecd
[19]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/054921ee3cacd13a60a1837c4ab302310a5c1422
[20]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/0609c3524352763f743f9d3994f9e22847c28971
[21]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/db0f337812e99cfd58c56d5f1fe3a320e60892e7
[22]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/99668ab304703adcb329b60ff3ef29a88f5d3aad
[23]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/1c2c16f27e37a8376acd50799f07e8ae00e88d73
[24]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/3aa9d12066bd8469beee641a9d79007bacc1dd41
[25]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/4d47b6e0b2e9892aa563a525ed61e9a5087c59bf
[26]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/74a87ddcaeb6a3fae6ebeb0376910e1ad4408784
[3]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.2.0...v1.3.0
[4]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/0be1eda4a2b30709c0755c0ffd994f51ba295498
[5]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/5719706662031be27d19e940d41b502973d329fa
[6]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.1.0...v1.2.0
[7]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/618f4c3a161b526b09bcb5ba5f0eee81058a75bd
[8]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.0.1...v1.1.0
[9]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/7390e3adfea60a3ff0dc03b23f01d15467bc0ef2
[10]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/v1.0.0...v1.0.1
[11]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/70e405373905799a7cc565d841f585fe87f12a26
[12]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/cb4346dc02e9df632acf7ac734f85c5c76c6d51d
[13]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/compare/32188ab1317f1936e364d98658ff915f5d4dafd3...v1.0.0
[14]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/ae66e28d2ff61c1207bfa65c37a6541031c9504d
[15]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/dafd93fd33a5aab03734e64619ec84161ac42d73
[16]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/32188ab1317f1936e364d98658ff915f5d4dafd3
[17]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/948baeab189090375faf956397c370b62abc555a
[18]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/2fd6c22cf181baa83e8c6eac2fbdd6653f57b423
[19]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/470b358a0d749c1cee3ab0f3f5b649d3f05490ed
[20]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/49fdd9684668b8437bd11c4c5f03b40c1af50acd
[21]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/8a39cf60884d430c70be94183e70d11e25bb4ecd
[22]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/054921ee3cacd13a60a1837c4ab302310a5c1422
[23]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/0609c3524352763f743f9d3994f9e22847c28971
[24]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/db0f337812e99cfd58c56d5f1fe3a320e60892e7
[25]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/99668ab304703adcb329b60ff3ef29a88f5d3aad
[26]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/1c2c16f27e37a8376acd50799f07e8ae00e88d73
[27]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/3aa9d12066bd8469beee641a9d79007bacc1dd41
[28]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/4d47b6e0b2e9892aa563a525ed61e9a5087c59bf
[29]: https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/commit/74a87ddcaeb6a3fae6ebeb0376910e1ad4408784
1 change: 0 additions & 1 deletion docs/.nojekyll

This file was deleted.

99 changes: 7 additions & 92 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,18 @@
babel-plugin-transform-rewrite-imports
**babel-plugin-transform-rewrite-imports****Docs**

# babel-plugin-transform-rewrite-imports

## Table of contents

### Type Aliases

- [Callback](README.md#callback)
- [Options](README.md#options)

### Variables
***

- [defaultRecognizedExtensions](README.md#defaultrecognizedextensions)

### Functions

- [default](README.md#default)
# babel-plugin-transform-rewrite-imports

## Type Aliases

### Callback

Ƭ **Callback**<`ReturnType`\>: (`context`: { `capturingGroups`: `string`[] ; `specifier`: `string` }) => `ReturnType`

#### Type parameters

| Name |
| :------ |
| `ReturnType` |

#### Type declaration

▸ (`context`): `ReturnType`

A callback function provided as a value to `Options.appendExtension` or to an
entry in `Options.replaceExtensions`.

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `context` | `Object` | - |
| `context.capturingGroups` | `string`[] | An array of capturing groups returned by `String.prototype.match()` or an empty array if the matcher string was not a regular expression. |
| `context.specifier` | `string` | The import/export specifier being evaluated by babel. |

##### Returns

`ReturnType`

#### Defined in

[index.ts:15](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/e42f369/src/index.ts#L15)

___

### Options

Ƭ **Options**: `Object`

The options that can be passed to this plugin from babel.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `appendExtension?` | `string` \| [`Callback`](README.md#callback)<`string` \| `undefined`\> | This string will be appended to all relative import specifiers that do not already have a recognized extension. Also accepts a callback function for advanced use cases. **`Default`** undefined |
| `recognizedExtensions?` | `string`[] | Members of this array will be considered a "recognized extension". **`Default`** defaultRecognizedExtensions |
| `replaceExtensions?` | `Record`<`string`, `string` \| [`Callback`](README.md#callback)<`string`\>\> | Map of specifiers to their replacements. Specifiers can be strings or regular expressions (i.e. strings that start with ^ and/or end with $). If a specifier is a regular expression, capturing group notation can be used in the replacement. Replacements can either be a string or a callback function that returns a string. **`Default`** |
| `silent?` | `boolean` | If true, this plugin will generate no output. **`Default`** false |
| `verbose?` | `boolean` | If true, this plugin will generate more output than usual. **`Default`** false |

#### Defined in

[index.ts:30](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/e42f369/src/index.ts#L30)
- [Callback](type-aliases/Callback.md)
- [Options](type-aliases/Options.md)

## Variables

### defaultRecognizedExtensions

`Const` **defaultRecognizedExtensions**: readonly [``".js"``, ``".jsx"``, ``".mjs"``, ``".cjs"``, ``".json"``]

The default value of `Options.recognizedExtensions`.

#### Defined in

[index.ts:83](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/e42f369/src/index.ts#L83)
- [defaultRecognizedExtensions](variables/defaultRecognizedExtensions.md)

## Functions

### default

**default**(): `PluginObj`<`State`\>

A babel plugin that reliably rewrites import (and export) specifiers.

#### Returns

`PluginObj`<`State`\>

#### Defined in

[index.ts:96](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/e42f369/src/index.ts#L96)
- [default](functions/default.md)
19 changes: 19 additions & 0 deletions docs/functions/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**babel-plugin-transform-rewrite-imports**](../README.md)**Docs**

***

[babel-plugin-transform-rewrite-imports](../README.md) / default

# Function: default()

> **default**(): `PluginObj`\<`State`\>
A babel plugin that reliably rewrites import (and export) specifiers.

## Returns

`PluginObj`\<`State`\>

## Defined in

[index.ts:101](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/0be1eda4a2b30709c0755c0ffd994f51ba295498/src/index.ts#L101)
42 changes: 42 additions & 0 deletions docs/type-aliases/Callback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[**babel-plugin-transform-rewrite-imports**](../README.md)**Docs**

***

[babel-plugin-transform-rewrite-imports](../README.md) / Callback

# Type Alias: Callback()\<ReturnType\>

> **Callback**\<`ReturnType`\>: (`context`) => `ReturnType`
A callback function provided as a value to `Options.appendExtension` or to an
entry in `Options.replaceExtensions`.

## Type Parameters

**ReturnType**

## Parameters

**context**

**context.capturingGroups**: `string`[]

An array of capturing groups returned by `String.prototype.match()` or an
empty array if the matcher string was not a regular expression.

**context.filepath**: `string`

The absolute path of the file containing the specifier being evaluated by
Babel.

**context.specifier**: `string`

The import/export specifier being evaluated by Babel.

## Returns

`ReturnType`

## Defined in

[index.ts:15](https://github.com/Xunnamius/babel-plugin-transform-rewrite-imports/blob/0be1eda4a2b30709c0755c0ffd994f51ba295498/src/index.ts#L15)
Loading

0 comments on commit 129765f

Please sign in to comment.