Skip to content

1.0.2

Compare
Choose a tag to compare
@HichemTab-tech HichemTab-tech released this 14 Dec 12:09
· 66 commits to master since this release

🚀 What's New in v1.0.2?

This release introduces an important improvement to the transformer logic, ensuring that the package operates more accurately and avoids unintended behavior when using createPicker with aliases or conflicting names.


🔧 Improvements

  1. Enhanced Transformer Logic:

    • The transformer now identifies the createPicker function specifically imported from ts-runtime-picker.
    • It supports cases where createPicker is aliased (e.g., import { createPicker as cp }).
    • Prevents accidental transformations of unrelated createPicker functions from other libraries or user-defined functions.
  2. Alias Resolution:

    • Whether you import createPicker directly or alias it (e.g., cp), the transformer will correctly handle it.

🐞 Bug Fixes

  • Unintended Transformations:
    • Fixed an issue where the transformer could erroneously replace functions named createPicker from unrelated sources or other libraries.
    • The transformer now reliably targets only createPicker imported from ts-runtime-picker.

🌟 Example Scenarios Fixed

✅ Case 1: Correct Import

import { createPicker } from "ts-runtime-picker";

const picker = createPicker<User>();
// ✔️ Works as expected

✅ Case 2: Aliased Import

import { createPicker as cp } from "ts-runtime-picker";

const picker = cp<User>();
// ✔️ Now works with the alias

🚫 Case 3: Conflicting Import

import { createPicker } from "another-library";

const picker = createPicker<User>();
// ❌ Transformer ignores this, as it’s not from `ts-runtime-picker`

🚫 Case 4: Locally Defined Function

function createPicker() {
    return "Not related to ts-runtime-picker";
}

const picker = createPicker();
// ❌ Transformer ignores this, as it’s not imported from `ts-runtime-picker`

🛠 How to Upgrade

  1. Update your package to the latest version:

    npm install ts-runtime-picker@latest
  2. Ensure your vite.config.ts includes the plugin:

    import tsRuntimePicker from "ts-runtime-picker/vite-plugin";
    
    export default {
        plugins: [tsRuntimePicker()],
    };
  3. No further changes are needed—enjoy the improved transformer logic! 🚀


❤️ Thank You!

Thank you for using ts-runtime-picker! If you encounter any issues, feel free to open an issue on our [GitHub repository](https://github.com/HichemTab-tech/ts-runtime-picker). Your feedback and contributions help us improve the package with each release.