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(schema-files-loader): Customize file loading logic #24085

Merged
merged 10 commits into from May 14, 2024

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented May 6, 2024

Allows to swap files resolution logic used by the package.
By default, package still uses real fs (see realFsResolver).
Additinal implementatins are:

  • InMemoryFilesResolver as the name suggests, keeps virtual file tree
    in memory.
  • CompsoiteFilesResolver combines two resolvers together.

Both will be used for language-tools, where some of the source files
might diverge from their on-disk content while editing.

We had to make them both aware of potential case-sensitivity and adjust their logic
accordingly, because on case-insensitive file systems URIs we getting from VSCode
will not neccessary match casing of files on disk. Both new resolvers need to be aware of that
so they can de-duplicate in-memory and on-disk entries correctly on each system.

Contribute to prisma/team-orm#1042
For usage, see prisma/language-tools#1718
/integration

@SevInf SevInf added this to the 5.14.0 milestone May 6, 2024
Copy link
Contributor

github-actions bot commented May 6, 2024

size-limit report 📦

Path Size
packages/client/runtime/library.js 179.77 KB (0%)
packages/client/runtime/library.d.ts 81 B (0%)
packages/client/runtime/binary.js 600.89 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 159.02 KB (0%)
packages/client/runtime/edge-esm.js 158.91 KB (0%)
packages/client/runtime/wasm.js 114.85 KB (0%)
packages/client/runtime/index-browser.js 33.77 KB (0%)
packages/client/runtime/index-browser.d.ts 89 B (0%)
packages/cli/build/index.js 2.1 MB (+0.37% 🔺)
packages/client/prisma-client-0.0.0.tgz 3.02 MB (+0.09% 🔺)
packages/cli/prisma-0.0.0.tgz 3.73 MB (+0.17% 🔺)
packages/bundle-size/da-workers-libsql/output.tgz 888.49 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 967.08 KB (0%)
packages/bundle-size/da-workers-pg/output.tgz 985.82 KB (0%)
packages/bundle-size/da-workers-pg-worker/output.tgz 941.53 KB (0%)
packages/bundle-size/da-workers-planetscale/output.tgz 903.33 KB (0%)
packages/bundle-size/da-workers-d1/output.tgz 861.55 KB (0%)

Copy link

codspeed-hq bot commented May 7, 2024

CodSpeed Performance Report

Merging #24085 will not alter performance

Comparing schema-files-resolver (b214d77) with main (e0006b1)

Summary

✅ 3 untouched benchmarks

SevInf added a commit to prisma/language-tools that referenced this pull request May 8, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
@SevInf SevInf marked this pull request as ready for review May 8, 2024 14:01
@SevInf SevInf requested a review from a team as a code owner May 8, 2024 14:01
@SevInf SevInf requested review from Druue and removed request for a team May 8, 2024 14:01
Copy link
Contributor

@Druue Druue left a comment

Choose a reason for hiding this comment

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

lgtm! :) ✨

@Druue

This comment was marked as outdated.

@Druue
Copy link
Contributor

Druue commented May 8, 2024

Copy link

socket-security bot commented May 10, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

SevInf added a commit to prisma/language-tools that referenced this pull request May 14, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
Allows to swap files resolution logic used by the package.
By default, package still uses real fs (see `realFsResolver`).
Additinal implementatins are:

- `InMemoryFilesResolver` as the name suggests, keeps virtual file tree
in memory.
- `CompsoiteFilesResolver` combines two resolvers together.

Both will be used for language-tools, where some of the source files
might diverge from their on-disk content while editing.

Contribute to prisma/team-orm#1042
@SevInf SevInf merged commit 43184c2 into main May 14, 2024
217 checks passed
@SevInf SevInf deleted the schema-files-resolver branch May 14, 2024 10:33
SevInf added a commit to prisma/language-tools that referenced this pull request May 14, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
SevInf added a commit to prisma/language-tools that referenced this pull request May 15, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
SevInf added a commit to prisma/language-tools that referenced this pull request May 15, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
SevInf added a commit to prisma/language-tools that referenced this pull request May 15, 2024
Use `@prisma/schema-files-loader` to resolve schema files from
memory or disk.
See also prisma/prisma#24085

Message handler's methods now accept `PrismaSchema` instance from
outside, rather than creating it from a single document. Singatures of
the methods are also adjusted to consistently be in `(schema,
intitianigDocument, params)` form.
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.

None yet

2 participants