Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/core/e2e/local-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getWorkbenchAppPath } from './utils';

const exec = promisify(execOriginal);

describe.each(['nextjs-webpack', 'nextjs-turbopack', 'nitro'])(
describe.each(['nextjs-webpack', 'nextjs-turbopack', 'nitro', 'vite'])(
'e2e',
(project) => {
test('builds without errors', { timeout: 180_000 }, async () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/nitro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
"exports": {
".": "./dist/index.js",
"./rollup-plugin": "./dist/rollup-plugin.js"
"./rollup-plugin": "./dist/rollup-plugin.js",
"./vite": "./dist/vite.js"
},
"scripts": {
"build": "tsc",
Expand All @@ -36,6 +37,7 @@
"devDependencies": {
"@types/node": "catalog:",
"@workflow/tsconfig": "workspace:*",
"nitro": "latest"
"nitro": "catalog:",
"vite": "^7.1.12"
}
}
6 changes: 3 additions & 3 deletions packages/nitro/src/builders.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder';
import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder.js';
import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api.js';

const CommonBuildOptions = {
buildTarget: 'next' as const, // unused in base
Expand Down
11 changes: 5 additions & 6 deletions packages/nitro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { Nitro, NitroModule, RollupConfig } from 'nitro/types';
import { join } from 'pathe';
import { LocalBuilder, VercelBuilder } from './builders';
import { workflowRollupPlugin } from './rollup-plugin';
import type { ModuleOptions } from './types';

import { join } from 'pathe';
import { LocalBuilder, VercelBuilder } from './builders.js';
import { workflowRollupPlugin } from './rollup-plugin.js';


export type { ModuleOptions };

export default {
Expand All @@ -17,9 +19,6 @@ export default {
(config.plugins as Array<unknown>).push(workflowRollupPlugin());
});

// Temporary workaround for debug unenv mock
nitro.options.alias['debug'] ??= 'debug';

// Generate functions for vercel build
if (isVercelDeploy) {
nitro.hooks.hook('compiled', async () => {
Expand Down
14 changes: 14 additions & 0 deletions packages/nitro/src/vite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Plugin } from 'vite'
import { workflowRollupPlugin } from './rollup-plugin.js';
import nitroModule from './index.js'

export function workflow(): Plugin[] {
return [
workflowRollupPlugin(),
{
name: 'workflow:nitro',
// @ts-expect-error https://github.com/nitrojs/nitro/pull/3712
nitro: nitroModule
}
]
}
1 change: 1 addition & 0 deletions packages/workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"./next": "./dist/next.js",
"./nitro": "./dist/nitro.js",
"./rollup-plugin": "./dist/rollup-plugin.js",
"./vite": "./dist/vite.js",
"./runtime": "./dist/runtime.js"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions packages/workflow/src/vite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { workflow } from '@workflow/nitro/vite';
Loading
Loading