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] prefer functions to globs #2430

Merged
merged 11 commits into from Sep 24, 2021
Merged

Conversation

ignatiusmb
Copy link
Member

Resolves #2374

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2021

🦋 Changeset detected

Latest commit: 2cfbc47

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's cool to see how these slight differences in handling files now all are harmonized into "this is a function and it returns whether or not to include the file".

packages/kit/package.json Show resolved Hide resolved
Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this will need a minor rebase

documentation/docs/14-configuration.md Show resolved Hide resolved
packages/kit/src/core/config/options.js Show resolved Hide resolved
documentation/docs/14-configuration.md Outdated Show resolved Hide resolved
@@ -132,8 +126,25 @@ Options related to [creating a package](#packaging).

- `dir` - output directory
- `emitTypes` - by default, `svelte-kit package` will automatically generate types for your package in the form of `d.ts.` files. While generating types is configurable, we believe it is best for the ecosystem quality to generate types, always. Please make sure you have a good reason when setting it to `false` (for example when you want to provide handwritten type definitions instead)
- `exports` - contains an `includes` and an `excludes` array which specifies which files to mark as exported from the `exports` field of the `package.json`. Will merge existing values if available with values from `package.json` taking precedence
- `files` - contains an `includes` and an `excludes` array which specifies which files to process and copy over when packaging
- `exports` - a function with the type of `(filepath: string) => boolean`. When `true`, the following export will be included in the `exports` field of the `package.json`. Any existing values in the `package.json` source will be merged with values from the original `exports` field taking precedence
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does "the following export" refer to?

@ignatiusmb
Copy link
Member Author

The micromatch example is a reference from #2374 (comment)

@benmccann
Copy link
Member

@ignatiusmb it looks like this PR will need a rebase


```js
// svelte.config.js
// example usage with a globbing library
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I missed this comment earlier and I thought this was demonstrating a default or something. I somewhat question if we need this example, but if we want to keep it, I'd probably remove this comment and instead put it in the prose above like For advanced file matching you can use these options in conjunction with a globbing library:

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I just updated one word in the docs. will merge this when the tests pass

@benmccann benmccann merged commit e1b788f into master Sep 24, 2021
@benmccann benmccann deleted the i2374/include-exclude-functions branch September 24, 2021 15:26
@Conduitry
Copy link
Member

This missed one of the references to config.kit.serviceWorker.exclude in https://kit.svelte.dev/docs#modules-$service-worker

We should get that fixed and get this released quickly, because anytime we merge PRs that update the docs, the site is redeployed right away, not when we release the feature to npm.

@benmccann
Copy link
Member

Thanks for catching that. PR here: #2485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out a consistent globbing strategy
5 participants