Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Remove restrict-imports-loader #96

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

SimonAlling
Copy link
Owner

@SimonAlling SimonAlling commented Jul 18, 2023

I think this feature adds more complexity than it does value. While I believe consumers won't have their builds broken (unless they have a test that checks what happens if they import { … } from "userscripter/build"), I'm making it a breaking change because it is a feature being removed after all.

@SimonAlling
Copy link
Owner Author

Not sure if this is a breaking change or whether it should be its own PR or part of some API redesign.

@SimonAlling SimonAlling changed the title Remove restrict-imports-loader feat!: Remove restrict-imports-loader Jul 15, 2024
@SimonAlling SimonAlling marked this pull request as ready for review July 15, 2024 12:26
@SimonAlling SimonAlling merged commit c42aad3 into master Jul 15, 2024
5 of 6 checks passed
@SimonAlling SimonAlling deleted the remove-restrict-imports-loader branch July 15, 2024 12:27
@SimonAlling SimonAlling mentioned this pull request Jul 17, 2024
SimonAlling added a commit that referenced this pull request Jul 17, 2024
This version shouldn't be breaking for most consumers, but could be if
they expect any imports from `userscripter/build` (which aren't intended
to work in userscripts' run-time code) to break the build with a
descriptive error message instead of a cryptic wall of text (#96).
SimonAlling added a commit that referenced this pull request Jul 31, 2024
This PR modifies the public API in an attempt to clarify the distinction between the build-time and the run-time parts of Userscripter. This should help users not accidentally import a build-time module in run-time code, which results in a completely incomprehensible wall of error messages since #96 (v3.0.0).

Consumers will have to adapt as follows:

  * ```diff
    -import … from "userscripter/build";
    +import … from "userscripter/build-time";
    ```

  * ```diff
    -import … from "userscripter/lib/foo";
    +import … from "userscripter/run-time/foo";
    ```

This command should make the required changes in a typical Git-tracked userscript:

```bash
for f in $(git ls-files "$(git rev-parse --show-toplevel)"); do
  sed -i 's#userscripter/build#userscripter/build-time#g' $f
  sed -i 's#userscripter/lib#userscripter/run-time#g' $f
done
```

💡 `git show --color-words='build-time|\w+|.'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant