kit icon indicating copy to clipboard operation
kit copied to clipboard

feat: add config option to prevent import into client code

Open Dudek-AMS opened this issue 1 year ago • 5 comments

Closes #12477

Added ~~serverProtectedPaths~~ serverOnlyPaths to add additional rules to prevent import into client code


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [X] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [X] This message body should clearly illustrate what problems it solves.
  • [x] Ideally, include a test that fails without this PR but passes with it.

Tests

  • [x] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • [X] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Dudek-AMS avatar Jul 18 '24 18:07 Dudek-AMS

⚠️ No Changeset found

Latest commit: 82f1df281a2fa2d74f9ddf69f51923efcb70e51f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jul 18 '24 18:07 changeset-bot[bot]

Ive dropped the changeset so far to be added by maintainers.

Dudek-AMS avatar Jul 19 '24 08:07 Dudek-AMS

After reconsidering the naming, I would suggest naming the attribute serverOnlyPaths

Dudek-AMS avatar Jul 20 '24 05:07 Dudek-AMS

3 different ways to define user-supplied rules seems a bit much, esp. if there is ()=>boolean already, users can just use regex or string compare themselves. But before continuing on this PR please see my comment in #12477

dominikg avatar Jul 21 '24 12:07 dominikg

3 different ways to define user-supplied rules seems a bit much, esp. if there is ()=>boolean already, users can just use regex or string compare themselves. But before continuing on this PR please see my comment in #12477

the idea was to make the function method for more complicated rules, while string is prefered. ofc function only does work out

Dudek-AMS avatar Jul 21 '24 13:07 Dudek-AMS

closing per https://github.com/sveltejs/kit/issues/12477#issuecomment-3188409462

Rich-Harris avatar Aug 14 '25 13:08 Rich-Harris