Skip to content

feat: allow multiple input dir#16

Merged
fs-eire merged 1 commit intomainfrom
allow-multiple-input-dir
Jul 9, 2025
Merged

feat: allow multiple input dir#16
fs-eire merged 1 commit intomainfrom
allow-multiple-input-dir

Conversation

@fs-eire
Copy link
Owner

@fs-eire fs-eire commented Jul 9, 2025

Introduce functionality to load templates from multiple directories.

@fs-eire fs-eire requested a review from Copilot July 9, 2025 10:04
@fs-eire
Copy link
Owner Author

fs-eire commented Jul 9, 2025

@daijh FYI

@fs-eire fs-eire merged commit 2525a53 into main Jul 9, 2025
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends template loading and building to support multiple source directories with optional aliases.

  • Adds loadFromDirectories to the loader with alias and conflict detection
  • Updates build API and runner to accept multiple sourceDirs instead of a single sourceDir
  • 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 sourceDir to sourceDirs is a breaking change. Consider providing an overload or deprecating sourceDir before 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 textureSample with samp, but no sampler parameter named samp is 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
Copy link

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

[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

Copilot uses AI. Check for mistakes.
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.

1 participant