-
Notifications
You must be signed in to change notification settings - Fork 99
feat: add tanstack support #159
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
4a2f2b3 to
20477c3
Compare
ada7022 to
30bd956
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file contains unresolved git merge conflict markers (<<<<<<< HEAD, =======, >>>>>>> e28cfa93). The merge conflict must be resolved by keeping the getWorkflowDirs and unique functions that are actively used by the @workflow/nitro package.
View Details
📝 Patch Details
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index f600452..b9e8e14 100644
--- a/packages/sveltekit/src/builder.ts
+++ b/packages/sveltekit/src/builder.ts
@@ -228,7 +228,6 @@ export const OPTIONS = createSvelteKitHandler('OPTIONS');`,
}
}
}
-<<<<<<< HEAD
/**
* Gets the list of directories to scan for workflow files.
@@ -250,5 +249,3 @@ export function getWorkflowDirs(options?: { dirs?: string[] }): string[] {
function unique<T>(array: T[]): T[] {
return Array.from(new Set(array));
}
-=======
->>>>>>> e28cfa93 (fix: cleanup builder directories (#319))
Analysis
Git merge conflict markers in sveltekit builder
What fails: TypeScript compiler fails on packages/sveltekit/src/builder.ts due to unresolved git merge conflict markers
How to reproduce:
cd packages/sveltekit && pnpm run buildResult:
[ERROR] @workflow/sveltekit:build: src/builder.ts(231,1): error TS1185: Merge conflict marker encountered.
[ERROR] @workflow/sveltekit:build: src/builder.ts(253,1): error TS1185: Merge conflict marker encountered.
[ERROR] @workflow/sveltekit:build: src/builder.ts(254,1): error TS1185: Merge conflict marker encountered.
Root cause: The repository contained unresolved git merge conflict markers (<<<<<<< HEAD, =======, >>>>>>> ) in the file that were causing TypeScript's error TS1185 during compilation. The conflict was between HEAD (which includes the getWorkflowDirs and unique functions) and an incoming commit that attempted to remove them. However, these functions are actively used in the @workflow/nitro package, so they needed to be retained.
packages/sveltekit/src/builder.ts
Outdated
| stepsBundlePath: '', // unused in base | ||
| workflowsBundlePath: '', // unused in base | ||
| webhookBundlePath: '', // unused in base | ||
| dirs: ["workflows", "src/workflows", "routes", "src/routes"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dirs: ["workflows", "src/workflows", "routes", "src/routes"], | |
| dirs: config?.dirs ?? ["workflows", "src/workflows", "routes", "src/routes"], |
The constructor hardcodes the dirs array, which means the dirs option passed from the Vite plugin (added in plugin.ts line 100-102) will be silently ignored.
View Details
Analysis
SvelteKitBuilder constructor ignores custom dirs from plugin configuration
What fails: The dirs option passed from the Vite plugin (plugin.ts line 100-102: new SvelteKitBuilder({ dirs: options?.dirs })) is silently ignored by the SvelteKitBuilder constructor, which hardcodes a default array instead.
How to reproduce:
// In plugin.ts, configResolved hook:
const options = { dirs: ["my-workflows", "services/workflows"] };
const builder = new SvelteKitBuilder({ dirs: options.dirs });
// Expected: builder.config.dirs === ["my-workflows", "services/workflows"]
// Actual: builder.config.dirs === ["workflows", "src/workflows", "routes", "src/routes"]Result: Custom workflow directories specified in WorkflowPluginOptions.dirs are ignored. The builder always scans only the hardcoded default directories, making the newly added dirs configuration option non-functional.
Expected: When config?.dirs is provided, it should be used. Only when not provided should the default directories be used as a fallback.
Root cause: In builder.ts line 26, the property spread on line 25 (...config) is immediately overridden by explicit dirs assignment, since JavaScript property assignments that follow a spread operator override the spread's properties.
Fix: Use nullish coalescing to preserve custom dirs while providing defaults: dirs: config?.dirs ?? ["workflows", "src/workflows", "routes", "src/routes"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The workflowPlugin function parameter options references an undefined type WorkflowPluginOptions and is never used, causing TypeScript compilation to fail with two errors.
View Details
📝 Patch Details
diff --git a/packages/sveltekit/src/plugin.ts b/packages/sveltekit/src/plugin.ts
index 99502ab..d8139f2 100644
--- a/packages/sveltekit/src/plugin.ts
+++ b/packages/sveltekit/src/plugin.ts
@@ -4,7 +4,7 @@ import { resolveModulePath } from 'exsolve';
import type { HotUpdateOptions, Plugin } from 'vite';
import { SvelteKitBuilder } from './builder.js';
-export function workflowPlugin(options?: WorkflowPluginOptions): Plugin {
+export function workflowPlugin(_options?: unknown): Plugin {
let builder: SvelteKitBuilder;
return {
Analysis
TypeScript compilation errors in SvelteKit plugin
What fails: TypeScript compiler fails on packages/sveltekit/src/plugin.ts with two errors:
'options' is declared but its value is never read(error TS6133)Cannot find name 'WorkflowPluginOptions'(error TS2304)
How to reproduce:
cd packages/sveltekit && npx tscResult:
src/plugin.ts(7,32): error TS6133: 'options' is declared but its value is never read.
src/plugin.ts(7,42): error TS2304: Cannot find name 'WorkflowPluginOptions'.
Fix applied: Changed the unused options parameter to _options with type unknown to suppress the error and remove the undefined type reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Suggestion:
The SvelteKitBuilder constructor was hardcoding the dirs array instead of respecting custom directories passed from the plugin configuration, causing the newly added dirs option to be silently ignored.
View Details
📝 Patch Details
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index e26b568..94d4345 100644
--- a/packages/sveltekit/src/builder.ts
+++ b/packages/sveltekit/src/builder.ts
@@ -23,7 +23,7 @@ export class SvelteKitBuilder extends BaseBuilder {
super({
...config,
- dirs: ['workflows', 'src/workflows', 'routes', 'src/routes'],
+ dirs: config?.dirs ?? ['workflows', 'src/workflows', 'routes', 'src/routes'],
buildTarget: 'sveltekit' as const,
stepsBundlePath: '', // unused in base
workflowsBundlePath: '', // unused in base
diff --git a/packages/sveltekit/src/plugin.ts b/packages/sveltekit/src/plugin.ts
index 99502ab..b9dc13d 100644
--- a/packages/sveltekit/src/plugin.ts
+++ b/packages/sveltekit/src/plugin.ts
@@ -4,6 +4,14 @@ import { resolveModulePath } from 'exsolve';
import type { HotUpdateOptions, Plugin } from 'vite';
import { SvelteKitBuilder } from './builder.js';
+export interface WorkflowPluginOptions {
+ /**
+ * Directories to scan for workflow files.
+ * If not specified, defaults to ['workflows', 'src/workflows', 'routes', 'src/routes']
+ */
+ dirs?: string[];
+}
+
export function workflowPlugin(options?: WorkflowPluginOptions): Plugin {
let builder: SvelteKitBuilder;
@@ -89,7 +97,9 @@ export function workflowPlugin(options?: WorkflowPluginOptions): Plugin {
},
configResolved() {
- builder = new SvelteKitBuilder();
+ builder = new SvelteKitBuilder({
+ dirs: options?.dirs,
+ });
},
// TODO: Move this to @workflow/vite or something since this is vite specific
Analysis
SvelteKitBuilder Constructor Ignores Custom dirs from Plugin Configuration
What fails: The dirs option passed from the Vite plugin via WorkflowPluginOptions.dirs is silently ignored by the SvelteKitBuilder constructor, which hardcodes a default array instead of respecting custom directory configurations.
How to reproduce:
// In plugin.ts configResolved() hook:
const options: WorkflowPluginOptions = { dirs: ["my-workflows", "services/workflows"] };
const builder = new SvelteKitBuilder({ dirs: options.dirs });
// Expected: builder.config.dirs === ["my-workflows", "services/workflows"]
// Actual: builder.config.dirs === ["workflows", "src/workflows", "routes", "src/routes"]Root cause: In builder.ts line 26, the dirs property in the super() constructor call was hardcoded to a default array immediately after spreading the config object. In JavaScript, property assignments that follow a spread operator override the spread's properties, so custom dirs values were silently discarded.
What happens vs expected:
- Actual: Custom workflow directories specified in the plugin options are ignored
- Expected: Custom
dirsconfiguration should be used when provided; only when not provided should defaults be used as a fallback
Fix applied:
- Modified
builder.tsline 26 to use nullish coalescing:dirs: config?.dirs ?? ["workflows", "src/workflows", "routes", "src/routes"] - Added
WorkflowPluginOptionsinterface toplugin.tsdefining the optionaldirsproperty - Updated
plugin.tsconfigResolved() hook to pass options to SvelteKitBuilder:new SvelteKitBuilder({ dirs: options?.dirs })
The bug was reintroduced during a merge conflict resolution (commit 664cc36) where the conflict was resolved by removing the options passing entirely instead of properly handling the merge of both code paths.
| import { SvelteKitBuilder } from './builder.js'; | ||
|
|
||
| export function workflowPlugin(): Plugin { | ||
| export function workflowPlugin(options?: WorkflowPluginOptions): Plugin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export function workflowPlugin(options?: WorkflowPluginOptions): Plugin { | |
| export type WorkflowPluginOptions = Record<string, never>; | |
| export function workflowPlugin(_options?: WorkflowPluginOptions): Plugin { |
The WorkflowPluginOptions type is used in the function signature but is never defined or imported, causing a TypeScript compilation error.
View Details
Analysis
Undefined TypeScript type in workflowPlugin function signature
What fails: packages/sveltekit/src/plugin.ts line 7 declares parameter options?: WorkflowPluginOptions but the type WorkflowPluginOptions is not defined, causing TypeScript compilation to fail with error TS2304.
How to reproduce:
cd packages/sveltekit
pnpm run buildResult: TypeScript compiler fails with:
src/plugin.ts(7,42): error TS2304: Cannot find name 'WorkflowPluginOptions'.
Expected: TypeScript compilation succeeds without errors in plugin.ts.
Fix: Added type definition for WorkflowPluginOptions as an empty interface since the parameter is not currently used. Per Vite Plugin API documentation, plugin factories should define types for their options parameter. The type is defined as Record<string, never> to explicitly indicate no options are currently supported while maintaining type safety for future expansion.
No description provided.