Conversation
Owner
Author
|
@daijh FYI |
There was a problem hiding this comment.
Pull Request Overview
This PR extends template loading and building to support multiple source directories with optional aliases.
- Adds
loadFromDirectoriesto the loader with alias and conflict detection - Updates
buildAPI and runner to accept multiplesourceDirsinstead of a singlesourceDir - Expands test types and test runners to cover "loader-directories" scenarios
Reviewed Changes
Copilot reviewed 30 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Extended Loader and BuildOptions to use multiple directories |
| src/loader-impl.ts | Implemented loadFromDirectories and alias support |
| src/index.ts | Replaced sourceDir with sourceDirs in build API |
| test/test-types.ts | Added LoaderDirectoriesTestConfig and sourceDirs |
| test/test-runner-loader.ts | Added runLoaderDirectoriesTest handler |
| test/test-runner-build.ts | Updated runBuildTest to map and validate sourceDirs |
| test/test-main.ts | Registered the "loader-directories" test runner |
| test/testcases/... | New and updated test fixtures for multi-directory loader |
Comments suppressed due to low confidence (2)
src/index.ts:34
- Changing the public API from a single
sourceDirtosourceDirsis a breaking change. Consider providing an overload or deprecatingsourceDirbefore removing it to maintain backward compatibility.
sourceDirs: ({ path: string; alias?: string } | string)[];
test/testcases/build-directories/src/effects/blur.wgsl.template:3
- The code calls
textureSamplewithsamp, but nosamplerparameter namedsampis defined in this function. Consider adding a sampler argument or correcting the variable name.
return textureSample(tex, samp, uv);
Comment on lines
+181
to
+182
| // Use the first directory as the base path for simplicity | ||
| const basePath = resolvedBasePaths.length === 1 ? resolvedBasePaths[0] : resolvedBasePaths[0]; // For multiple directories, use the first one as base |
There was a problem hiding this comment.
[nitpick] This conditional always picks the first directory even when multiple are provided. Either simplify the expression or clarify how basePath should be determined when loading from multiple directories.
Suggested change
| // Use the first directory as the base path for simplicity | |
| const basePath = resolvedBasePaths.length === 1 ? resolvedBasePaths[0] : resolvedBasePaths[0]; // For multiple directories, use the first one as base | |
| // Determine the base path: use the common base directory for multiple directories | |
| const basePath = resolvedBasePaths.length === 1 | |
| ? resolvedBasePaths[0] | |
| : path.dirname(path.common(...resolvedBasePaths)); // Compute common base directory |
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.
Introduce functionality to load templates from multiple directories.