Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clear-server-external-warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@workflow/next': patch
---

Clarify that workflow packages removed from `serverExternalPackages` are still compiled during the build.
11 changes: 11 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"bright-pears-drum",
"bright-waits-refresh",
"builders-discovery-fixes",
"bump-esbuild-0-28-1",
"bump-undici-7-26",
"bundle-aliased-project-local-helpers",
"byte-stream-wire-framing",
Expand Down Expand Up @@ -142,6 +143,7 @@
"hook-conflict-web-reviver",
"hook-get-conflict",
"hook-sleep-replay-ordering",
"idempotency-strategy-e2e",
"ignore-generated-manifest",
"inline-step-registration",
"large-inline-sourcemap-remap",
Expand Down Expand Up @@ -183,6 +185,7 @@
"rare-badgers-judge",
"ready-pens-hug",
"reconnect-object-streams",
"relative-time-card",
"remove-client-mode",
"remove-private-subpath",
"remove-sdk-serde-exclusion",
Expand All @@ -193,6 +196,7 @@
"replay-timeout-excludes-step-bodies",
"retry-vqs-handler-errors-immediately",
"rich-toes-live",
"run-idempotency-docs",
"run-step-error-hydration",
"runtime-decryption-error",
"runtime-schema-validation-failure",
Expand All @@ -203,16 +207,20 @@
"serializable-reviver-surfaces",
"serialization-refactor",
"setup-graphile-worker-schema",
"shy-turtles-decide",
"silver-coins-deny",
"silver-comics-care",
"sixty-plants-shout",
"skip-community-worlds-main",
"skip-world-local-nov-ghosts",
"slow-bottles-pull",
"small-cycles-rest",
"smart-baths-make",
"socket-info-out-of-cache",
"sourcemap-config-option",
"split-tarballs-from-docs",
"stale-sveltekit-triggers-main",
"start-allow-reserved-attributes",
"start-in-workflow",
"step-attributes",
"step-bind-preserves-metadata",
Expand Down Expand Up @@ -243,15 +251,18 @@
"upgrading-workflows-cookbook",
"upset-ghosts-rush",
"v2-combined-bundle",
"v4-events-client",
"validate-step-id-duplicates",
"vast-oranges-fail",
"vercel-world-custom-dispatcher",
"versioning-docs",
"warn-external-workflow-packages",
"web-shared-error-family-revivers",
"web-vercel-preset",
"wild-taxes-guess",
"windows-inline-sourcemaps",
"wise-frogs-thank",
"witty-pugs-applaud",
"workflow-function-serialization",
"world-init-cold-start",
"world-local-path-traversal",
Expand Down
5 changes: 5 additions & 0 deletions .changeset/swc-gitignore-builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@workflow/builders': patch
---

Add `.swc` to the builder's default gitignore handling.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default withWorkflow(nextConfig, workflowConfig); // [!code highlight]
If a package in `serverExternalPackages` contains workflow code (`"use step"`,
`"use workflow"`, or serialization classes), `withWorkflow()` automatically
removes it from `serverExternalPackages` for the current build and prints a
warning. This ensures the package still gets transformed by the Workflow
compiler. Remove that package from `serverExternalPackages` in your
warning. Workflow still compiles the package so its directives are transformed.
Remove that package from `serverExternalPackages` in your
`next.config` to silence the warning.
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default withWorkflow(nextConfig, workflowConfig); // [!code highlight]
If a package in `serverExternalPackages` contains workflow code (`"use step"`,
`"use workflow"`, or serialization classes), `withWorkflow()` automatically
removes it from `serverExternalPackages` for the current build and prints a
warning. This ensures the package still gets transformed by the Workflow
compiler. Remove that package from `serverExternalPackages` in your
warning. Workflow still compiles the package so its directives are transformed.
Remove that package from `serverExternalPackages` in your
`next.config` to silence the warning.
</Callout>

Expand Down
7 changes: 7 additions & 0 deletions packages/ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @workflow/ai

## 5.0.0-beta.10

### Patch Changes

- Updated dependencies [[`628795a`](https://github.com/vercel/workflow/commit/628795aa8729bef442c7a1583cf2f3d986e9e4fc)]:
- workflow@5.0.0-beta.16

## 5.0.0-beta.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workflow/ai",
"version": "5.0.0-beta.9",
"version": "5.0.0-beta.10",
"description": "Workflow SDK compatible helper library for the AI SDK",
"type": "module",
"main": "dist/index.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @workflow/astro

## 5.0.0-beta.16

### Patch Changes

- Updated dependencies [[`011d482`](https://github.com/vercel/workflow/commit/011d482808793e8deb0e8523a9c16af129490ee6)]:
- @workflow/builders@5.0.0-beta.16
- @workflow/rollup@5.0.0-beta.16
- @workflow/vite@5.0.0-beta.16

## 5.0.0-beta.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workflow/astro",
"version": "5.0.0-beta.15",
"version": "5.0.0-beta.16",
"description": "Astro integration for Workflow SDK",
"type": "module",
"main": "dist/index.js",
Expand Down
10 changes: 10 additions & 0 deletions packages/builders/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @workflow/builders

## 5.0.0-beta.16

### Patch Changes

- [#2395](https://github.com/vercel/workflow/pull/2395) [`011d482`](https://github.com/vercel/workflow/commit/011d482808793e8deb0e8523a9c16af129490ee6) Thanks [@pranaygp](https://github.com/pranaygp)! - Upgrade esbuild to ^0.28.1 to resolve GHSA-gv7w-rqvm-qjhr (missing binary integrity verification before executing downloaded binaries).

- Updated dependencies [[`628795a`](https://github.com/vercel/workflow/commit/628795aa8729bef442c7a1583cf2f3d986e9e4fc)]:
- @workflow/core@5.0.0-beta.16
- @workflow/errors@5.0.0-beta.7

## 5.0.0-beta.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workflow/builders",
"version": "5.0.0-beta.15",
"version": "5.0.0-beta.16",
"description": "Shared builder infrastructure for Workflow SDK",
"type": "module",
"main": "./dist/index.js",
Expand Down
52 changes: 45 additions & 7 deletions packages/builders/src/base-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export abstract class BaseBuilder {
'**/.workflow-data/**',
'**/.workflow-vitest/**',
'**/.well-known/workflow/**',
'**/.swc/**',
'**/.svelte-kit/**',
'**/.turbo/**',
'**/.cache/**',
Expand Down Expand Up @@ -895,8 +896,7 @@ export abstract class BaseBuilder {
})
);

// Create .gitignore in .swc directory
await this.createSwcGitignore();
await this.ensureSwcIgnored();

if (this.config.watch) {
return { context: esbuildCtx, manifest: workflowManifest };
Expand Down Expand Up @@ -1125,8 +1125,7 @@ export abstract class BaseBuilder {
);
}

// Create .gitignore in .swc directory
await this.createSwcGitignore();
await this.ensureSwcIgnored();

if (
!interimBundle.outputFiles ||
Expand Down Expand Up @@ -1595,8 +1594,7 @@ export const POST = workflowEntrypoint(workflowCode${workflowEntrypointOptionsCo

this.logEsbuildMessages(clientResult, 'client library bundle');

// Create .gitignore in .swc directory
await this.createSwcGitignore();
await this.ensureSwcIgnored();
}

/**
Expand Down Expand Up @@ -1778,7 +1776,47 @@ export const OPTIONS = handler;`;
await mkdir(dirname(filePath), { recursive: true });
}

private async createSwcGitignore(): Promise<void> {
protected async ensureSwcIgnored(): Promise<void> {
await this.ensureProjectSwcGitignoreEntry();
await this.createSwcDirectoryGitignore();
}

private async ensureProjectSwcGitignoreEntry(): Promise<void> {
const gitignorePath = join(this.config.workingDir, '.gitignore');

try {
let content = '';
try {
content = await readFile(gitignorePath, 'utf-8');
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
return;
}
}

const hasSwcEntry = content.split(/\r?\n/).some((line) => {
const trimmed = line.trim();
return (
trimmed === '.swc' ||
trimmed === '.swc/' ||
trimmed === '/.swc' ||
trimmed === '/.swc/'
);
});

if (hasSwcEntry) {
return;
}

const separator =
content.length > 0 && !content.endsWith('\n') ? '\n' : '';
await writeFile(gitignorePath, `${content}${separator}/.swc\n`);
} catch {
// We're intentionally silently ignoring this error - updating .gitignore isn't critical
}
}

private async createSwcDirectoryGitignore(): Promise<void> {
try {
await writeFile(
join(this.config.workingDir, '.swc', '.gitignore'),
Expand Down
50 changes: 50 additions & 0 deletions packages/builders/src/get-input-files.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
mkdirSync,
mkdtempSync,
readFileSync,
realpathSync,
rmSync,
writeFileSync,
Expand All @@ -27,6 +28,10 @@ class TestBuilder extends BaseBuilder {
public getDiagnosticsManifestPath(): string | undefined {
return super.getDiagnosticsManifestPath();
}

public ensureSwcIgnored(): Promise<void> {
return super.ensureSwcIgnored();
}
}

// Resolve symlinks in tmpdir to avoid macOS /var -> /private/var issues
Expand Down Expand Up @@ -112,6 +117,7 @@ describe('getInputFiles', () => {
writeFile(srcDir, '.workflow-data/state.ts');
writeFile(srcDir, '.workflow-vitest/workflows.mjs');
writeFile(srcDir, '.well-known/workflow/route.ts');
writeFile(srcDir, '.swc/cache/plugin-output.ts');
writeFile(srcDir, '.turbo/cache/build.ts');
writeFile(srcDir, '.cache/babel/plugin.js');
writeFile(srcDir, '.yarn/releases/yarn.cjs');
Expand Down Expand Up @@ -147,6 +153,9 @@ describe('getInputFiles', () => {
expect(files).not.toContain(
normalize(join(srcDir, '.well-known/workflow/route.ts'))
);
expect(files).not.toContain(
normalize(join(srcDir, '.swc/cache/plugin-output.ts'))
);
expect(files).not.toContain(
normalize(join(srcDir, '.turbo/cache/build.ts'))
);
Expand Down Expand Up @@ -182,6 +191,47 @@ describe('getInputFiles', () => {
});
});

describe('ensureSwcIgnored', () => {
let testRoot: string;

beforeEach(() => {
testRoot = mkdtempSync(join(realTmpdir, 'swc-gitignore-'));
});

afterEach(() => {
rmSync(testRoot, { recursive: true, force: true });
});

it('adds .swc to the project .gitignore once', async () => {
writeFile(testRoot, '.gitignore', 'node_modules\n');

const builder = createBuilder(testRoot, ['src']);

await builder.ensureSwcIgnored();
await builder.ensureSwcIgnored();

const gitignore = readFileSync(join(testRoot, '.gitignore'), 'utf-8');
const swcEntries = gitignore
.split(/\r?\n/)
.filter((line) => line.trim() === '/.swc');

expect(gitignore).toBe('node_modules\n/.swc\n');
expect(swcEntries).toHaveLength(1);
});

it('preserves existing .swc gitignore variants', async () => {
writeFile(testRoot, '.gitignore', 'node_modules\n.swc/\n');

const builder = createBuilder(testRoot, ['src']);

await builder.ensureSwcIgnored();

expect(readFileSync(join(testRoot, '.gitignore'), 'utf-8')).toBe(
'node_modules\n.swc/\n'
);
});
});

describe('getDiagnosticsManifestPath', () => {
let testRoot: string;

Expand Down
15 changes: 15 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @workflow/cli

## 5.0.0-beta.16

### Patch Changes

- [#2395](https://github.com/vercel/workflow/pull/2395) [`011d482`](https://github.com/vercel/workflow/commit/011d482808793e8deb0e8523a9c16af129490ee6) Thanks [@pranaygp](https://github.com/pranaygp)! - Upgrade esbuild to ^0.28.1 to resolve GHSA-gv7w-rqvm-qjhr (missing binary integrity verification before executing downloaded binaries).

- Updated dependencies [[`011d482`](https://github.com/vercel/workflow/commit/011d482808793e8deb0e8523a9c16af129490ee6), [`af859c3`](https://github.com/vercel/workflow/commit/af859c3a6db812daf6c640ff3d99488cddca8bd0), [`628795a`](https://github.com/vercel/workflow/commit/628795aa8729bef442c7a1583cf2f3d986e9e4fc), [`0178fa5`](https://github.com/vercel/workflow/commit/0178fa5730fa8b4529bc179e2ff969e0fc882eb9)]:
- @workflow/builders@5.0.0-beta.16
- @workflow/world-local@5.0.0-beta.17
- @workflow/world-vercel@5.0.0-beta.15
- @workflow/core@5.0.0-beta.16
- @workflow/world@5.0.0-beta.10
- @workflow/web@5.0.0-beta.16
- @workflow/errors@5.0.0-beta.7

## 5.0.0-beta.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workflow/cli",
"version": "5.0.0-beta.15",
"version": "5.0.0-beta.16",
"description": "Command-line interface for Workflow SDK",
"type": "module",
"bin": {
Expand Down
14 changes: 14 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @workflow/core

## 5.0.0-beta.16

### Minor Changes

- [#2385](https://github.com/vercel/workflow/pull/2385) [`628795a`](https://github.com/vercel/workflow/commit/628795aa8729bef442c7a1583cf2f3d986e9e4fc) Thanks [@pranaygp](https://github.com/pranaygp)! - Add an `allowReservedAttributes` option to `start()` so framework-level callers can seed reserved `$`-prefixed run attributes at creation, matching the existing `experimental_setAttributes` option. The flag is carried through the resilient-start queue input so lazy run creation validates identically.

### Patch Changes

- Updated dependencies [[`af859c3`](https://github.com/vercel/workflow/commit/af859c3a6db812daf6c640ff3d99488cddca8bd0), [`628795a`](https://github.com/vercel/workflow/commit/628795aa8729bef442c7a1583cf2f3d986e9e4fc), [`0178fa5`](https://github.com/vercel/workflow/commit/0178fa5730fa8b4529bc179e2ff969e0fc882eb9)]:
- @workflow/world-local@5.0.0-beta.17
- @workflow/world-vercel@5.0.0-beta.15
- @workflow/world@5.0.0-beta.10
- @workflow/errors@5.0.0-beta.7

## 5.0.0-beta.15

### Minor Changes
Expand Down
Loading
Loading