Skip to content

build: migrate bundle pipeline to tsdown #305

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
941 changes: 552 additions & 389 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/blobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"server.d.ts"
],
"scripts": {
"build": "tsup-node",
"dev": "tsup-node --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"prepack": "npm run build",
"test": "run-s build test:ci",
"test:dev": "run-s build test:dev:*",
Expand All @@ -72,7 +72,7 @@
"npm-run-all2": "^8.0.4",
"semver": "^7.5.3",
"tmp-promise": "^3.0.3",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
clean: true,
entry: ['src/server.ts', 'src/main.ts'],
tsconfig: 'tsconfig.json',
bundle: true,
format: ['cjs', 'esm'],
dts: true,
outDir: './dist',
watch: argv.includes('--watch'),
},
])
6 changes: 3 additions & 3 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"dist/**/*"
],
"scripts": {
"build": "tsup-node",
"dev": "tsup-node --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"prepack": "npm run build",
"test": "run-s build test:ci",
"test:dev": "run-s build test:dev:*",
Expand All @@ -71,7 +71,7 @@
"@netlify/dev-utils": "3.2.0",
"@netlify/types": "2.0.2",
"npm-run-all2": "^7.0.2",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/bootstrap/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { Operation, RequestContextFactory } from './environment.ts'
export { Operation, type RequestContextFactory } from './environment.ts'
export { NetlifyCache } from './cache.ts'
export { NetlifyCacheStorage } from './cachestorage.ts'
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
clean: true,
format: ['cjs', 'esm'],
entry: ['src/bootstrap/main.ts', 'src/main.ts'],
tsconfig: 'tsconfig.json',
splitting: false,
bundle: true,
dts: true,
outDir: './dist',
watch: argv.includes('--watch'),
},
])
6 changes: 3 additions & 3 deletions packages/dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"dist/**/*"
],
"scripts": {
"build": "tsup-node",
"build": "tsdown",
"prepack": "npm run build",
"test": "vitest run",
"test:dev": "vitest",
"test:ci": "npm run build && vitest run",
"dev": "tsup-node --watch",
"dev": "tsdown --watch",
"publint": "npx -y publint --strict"
},
"keywords": [],
Expand All @@ -47,7 +47,7 @@
"@types/parse-gitignore": "^1.0.2",
"@types/write-file-atomic": "^4.0.3",
"tmp-promise": "^3.0.3",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"dependencies": {
Expand Down
16 changes: 8 additions & 8 deletions packages/dev-utils/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
export { getAPIToken } from './lib/api-token.js'
export { shouldBase64Encode } from './lib/base64.js'
export { renderFunctionErrorPage } from './lib/errors.js'
export { DevEvent, DevEventHandler } from './lib/event.js'
export { type DevEvent, type DevEventHandler } from './lib/event.js'
export { type Geolocation, mockLocation } from './lib/geo-location.js'
export { ensureNetlifyIgnore } from './lib/gitignore.js'
export { headers, toMultiValueHeaders } from './lib/headers.js'
export * as globalConfig from './lib/global-config.js'
export { Handler } from './lib/handler.js'
export { LocalState } from './lib/local-state.js'
export { type Handler } from './lib/handler.js'
export { type LocalState } from './lib/local-state.js'
export { type Logger, netlifyCommand, netlifyCyan, netlifyBanner } from './lib/logger.js'
export { memoize, MemoizeCache } from './lib/memoize.js'
export { HTTPServer } from './server/http_server.js'
export { memoize, type MemoizeCache } from './lib/memoize.js'
export { type HTTPServer } from './server/http_server.js'
export { watchDebounced } from './lib/watch-debounced.js'

export { EventInspector } from './test/event_inspector.js'
export { MockFetch } from './test/fetch.js'
export { Fixture } from './test/fixture.js'
export { type EventInspector } from './test/event_inspector.js'
export { type MockFetch } from './test/fetch.js'
export { type Fixture } from './test/fixture.js'
export { createImageServerHandler, generateImage, getImageResponseSize } from './test/image.js'
export { createMockLogger } from './test/logger.js'
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
Expand All @@ -9,9 +7,6 @@ export default defineConfig([
outDir: 'dist',
format: ['esm'],
dts: true,
splitting: false,
watch: argv.includes('--watch'),
platform: 'node',
bundle: true,
},
])
6 changes: 3 additions & 3 deletions packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"dist/**/*"
],
"scripts": {
"build": "tsup-node",
"build": "tsdown",
"prepack": "npm run build",
"test": "vitest run",
"test:dev": "vitest",
"test:ci": "npm run build && vitest run",
"dev": "tsup-node --watch",
"dev": "tsdown --watch",
"publint": "npx -y publint --strict"
},
"keywords": [],
Expand All @@ -48,7 +48,7 @@
"devDependencies": {
"@netlify/api": "^14.0.3",
"@netlify/types": "2.0.2",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
Expand All @@ -9,9 +7,6 @@ export default defineConfig([
outDir: 'dist',
format: ['cjs', 'esm'],
dts: true,
splitting: false,
watch: argv.includes('--watch'),
platform: 'node',
bundle: true,
},
])
7 changes: 4 additions & 3 deletions packages/edge-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"deno/**/*"
],
"scripts": {
"build": "tsup-node",
"build": "tsdown",
"prepack": "npm run build",
"test": "vitest run",
"test:dev": "vitest",
"test:ci": "npm run build && vitest run",
"dev": "tsup-node --watch",
"dev": "tsdown --watch",
"publint": "npx -y publint --strict"
},
"keywords": [
Expand All @@ -51,8 +51,9 @@
},
"devDependencies": {
"@netlify/types": "2.0.2",
"esbuild": "^0.25.5",
"execa": "^8.0.1",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { argv } from 'node:process'

import { getURL } from '@netlify/edge-functions-bootstrap/version'
import { execa } from 'execa'
import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

const __filename = fileURLToPath(import.meta.url)

Expand All @@ -17,33 +15,25 @@ export default defineConfig([
format: ['esm'],
entry: ['src/main.ts'],
tsconfig: 'tsconfig.json',
splitting: false,
bundle: true,
dts: true,
outDir: './dist',
watch: argv.includes('--watch'),
},
{
clean: true,
format: ['esm'],
entry: ['src/version.ts'],
tsconfig: 'tsconfig.json',
splitting: false,
bundle: true,
dts: true,
outDir: './dist',
watch: argv.includes('--watch'),
},
{
clean: true,
outDir: 'dist-dev/node',
entry: ['dev/node/main.ts'],
format: ['esm'],
dts: true,
splitting: false,
watch: argv.includes('--watch'),
platform: 'node',
bundle: true,


// Using a custom function to copy the contents of the `deno` directory and
// preserve the original structure, so that the relative path to the worker
Expand All @@ -56,7 +46,7 @@ export default defineConfig([
await fs.cp(denoPath, path.resolve(distPath, 'deno'), { recursive: true })

// We need to bundle the bootstrap layer with the package because Deno
// does not support HTTP imports when inside a `node_modukes` directory.
// does not support HTTP imports when inside a `node_modules` directory.
const distBootstrapPath = path.resolve(distPath, 'deno', BOOTSTRAP_FILENAME)
await execa(
'deno',
Expand Down
6 changes: 3 additions & 3 deletions packages/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"internal.d.ts"
],
"scripts": {
"dev": "tsup-node --watch",
"build": "tsup-node",
"dev": "tsdown --watch",
"build": "tsdown",
"prepack": "npm run build",
"test": "run-s test:ci",
"test:dev": "run-s build test:dev:*",
Expand Down Expand Up @@ -99,7 +99,7 @@
"npm-run-all2": "^5.0.0",
"semver": "^7.6.3",
"tsd": "^0.32.0",
"tsup": "^8.0.2",
"tsdown": "^0.12.7",
"vitest": "^3.0.0"
},
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions packages/functions/src/function/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { HandlerContext } from './handler_context.js'
export { HandlerEvent } from './handler_event.js'
export { BuilderHandler, Handler, BackgroundHandler, HandlerCallback, StreamingHandler } from './handler.js'
export { BuilderResponse, HandlerResponse, StreamingResponse } from './handler_response.js'
export { Context, Config } from './v2.js'
export { type HandlerContext } from './handler_context.js'
export { type HandlerEvent } from './handler_event.js'
export { type BuilderHandler, type Handler, type BackgroundHandler, type HandlerCallback, type StreamingHandler } from './handler.js'
export { type BuilderResponse, type HandlerResponse, type StreamingResponse } from './handler_response.js'
export { type Context, type Config } from './v2.js'
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
Expand All @@ -9,21 +7,15 @@ export default defineConfig([
outDir: 'dist',
format: ['cjs', 'esm'],
dts: true,
splitting: false,
watch: argv.includes('--watch'),
platform: 'node',
bundle: true,
},
{
clean: true,
outDir: 'dist-dev',
entry: ['dev/main.ts'],
format: ['esm'],
dts: true,
splitting: false,
watch: argv.includes('--watch'),
platform: 'node',
bundle: true,
publicDir: 'dev/runtimes/nodejs',
copy: 'dev/runtimes/nodejs',
},
])
6 changes: 3 additions & 3 deletions packages/headers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"dist/**/*"
],
"scripts": {
"build": "tsup-node",
"dev": "tsup-node --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"prepack": "npm run build",
"publint": "npx -y publint --strict",
"test": "vitest run",
Expand All @@ -34,7 +34,7 @@
"devDependencies": {
"@netlify/dev-utils": "^3.2.0",
"@types/node": "^20.17.57",
"tsup": "^8.0.0",
"tsdown": "^0.12.7",
"vitest": "^3.1.4"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import { argv } from 'node:process'

import { defineConfig } from 'tsup'
import { defineConfig } from 'tsdown'

export default defineConfig([
{
clean: true,
format: ['esm'],
entry: ['src/main.ts'],
tsconfig: 'tsconfig.json',
splitting: false,
bundle: true,
dts: true,
outDir: './dist',
watch: argv.includes('--watch'),
},
])
Loading
Loading