Add GetDependentFiles to slim service.#14
Merged
ncave merged 1 commit intoncave:service_slimfrom Oct 25, 2023
Merged
Conversation
Owner
|
@nojaf Thanks, that looks useful, we can improve the current typecheck caching (see If we make the change to use the graph and improve the typecheck caching, do you still need this as a separate method? I'm not opposed to adding it, I'm sure you have some use for it in your plugin, just asking to make sure you need it. |
Author
At first glance, I do think I will need it. I believe the rough outline for the Vite plugin: const { compileFSharp } = require('./some-great-compile-fsharp-module');
export default function fablePlugin() {
return {
name: 'fable-plugin',
async transform(code, id) {
// Check if the file has a .fs extension
if (id.endsWith('.fs')) {
// Use your compileFSharp function to transform the F# code to JavaScript
const { compiledCode, dependencies } = await compileFSharp(code);
// Create an array to hold the transformed dependencies
const transformedDependencies = [];
// Process and emit the dependencies as separate files
for (const depId of dependencies) {
const { compiledCode: depCode } = await compileFSharp(
// Load the content of the dependency using Rollup's `this.emitFile` function
this.emitFile({ type: 'chunk', id: depId }),
);
transformedDependencies.push(depCode);
}
// Return the transformed code for the current module
return {
code: compiledCode,
map: null, // You may provide source maps if needed
};
}
},
};
}I would need to call the |
ncave
pushed a commit
that referenced
this pull request
Dec 8, 2023
ncave
pushed a commit
that referenced
this pull request
Nov 16, 2024
ncave
pushed a commit
that referenced
this pull request
Jan 15, 2025
ncave
pushed a commit
that referenced
this pull request
Oct 14, 2025
ncave
pushed a commit
that referenced
this pull request
Oct 16, 2025
ncave
pushed a commit
that referenced
this pull request
Oct 25, 2025
ncave
pushed a commit
that referenced
this pull request
Nov 11, 2025
ncave
pushed a commit
that referenced
this pull request
Nov 11, 2025
ncave
pushed a commit
that referenced
this pull request
Nov 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a method to the slim service to find the dependent files in a project using the new Graph-based type-checking code.
What the graph-based type-checking does is detect links between files using the untyped tree.
This turned out to be very reliable and helps to answer the question of what files should be reprocessed after the current file has changed.
More of the code could improve a bit, but I'm raising this more as a conversation starter. Would you be ok with having this?
This would be a puzzle piece in the work for fable-compiler/Fable#3552.