Skip to content

Commit 95d89b5

Browse files
committed
Build with tsdown instead of tsup
tsup is no longer maintained (its README now points at tsdown). tsdown is the rolldown-based successor from the same lineage. - migrate all 25 build configs; published files now use explicit .mjs/.cjs extensions, which is what rolldown emits and removes the ambiguity that made module-format detection guess wrong - code splitting cannot be disabled in tsdown, so the self-contained CJS bundles (varlock init-server/init-edge) each get their own build. A shared chunk in those would emit a require() that cannot resolve where they get injected into webpack/turbopack runtimes - @env-spec/utils now emits declarations, which lets tsdown inline its types. varlock's published d.ts has been shipping a broken import of @env-spec/utils/type-utils, hidden only by skipLibCheck - drop keepNames: it was an esbuild-era workaround, and with tsdown it leaked a runtime-chunk import into the parser's declaration files. Class names survive without it since these builds never minify - port keepass's esbuild resolver plugin to a rolldown resolveId hook - infisical patched its bundle by string-replacing 'use strict', which tsdown does not emit. Use a real banner instead - drop two entries that pointed at files which no longer exist; tsup ignored them silently, tsdown errors Also enable publint on every publishable package's build. It fails the build on real errors (verified), so exports problems surface at build time instead of after publish. Fixing what it found: - varlock's ./test-helpers export pointed at src/test-helpers/plugin-test.ts, which is not in `files` and so was never published. It is a real entry point now (3.4kB, vitest externalized as an optional peer). Keeping only the monorepo `ts-src` condition was not viable: vite does not apply custom conditions when resolving a dependency, so plugin tests broke - repository.url everywhere is a full git+https URL - @env-spec/parser and @varlock/nextjs-integration declare "type": "commonjs" rather than making node sniff it. Their tsdown configs move to .mts, since node otherwise loads the .ts config as CJS and tsdown is ESM-only
1 parent a4ef7f8 commit 95d89b5

81 files changed

Lines changed: 744 additions & 639 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bumpy/migrate-to-tsdown.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
"@env-spec/parser": patch
3+
varlock: patch
4+
env-spec-language: patch
5+
"@varlock/ci-env-info": patch
6+
"@varlock/cloudflare-integration": patch
7+
"@varlock/expo-integration": patch
8+
"@varlock/vite-integration": patch
9+
"@varlock/nextjs-integration": patch
10+
"@varlock/astro-integration": patch
11+
"@varlock/azure-key-vault-plugin": patch
12+
"@varlock/hashicorp-vault-plugin": patch
13+
"@varlock/pass-plugin": patch
14+
"@varlock/dashlane-plugin": patch
15+
"@varlock/aws-secrets-plugin": patch
16+
"@varlock/doppler-plugin": patch
17+
"@varlock/keepass-plugin": patch
18+
"@varlock/passbolt-plugin": patch
19+
"@varlock/infisical-plugin": patch
20+
"@varlock/akeyless-plugin": patch
21+
"@varlock/bitwarden-plugin": patch
22+
"@varlock/google-secret-manager-plugin": patch
23+
"@varlock/proton-pass-plugin": patch
24+
"@varlock/keeper-plugin": patch
25+
"@varlock/kubernetes-plugin": patch
26+
"@varlock/1password-plugin": patch
27+
---
28+
29+
Build with tsdown instead of tsup; published files now use explicit .mjs/.cjs extensions. `varlock/test-helpers` is now actually published (it previously pointed at a file that was not in the tarball).

bun.lock

Lines changed: 148 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"eslint-stylistic-airbnb": "^2.0.1",
5555
"globals": "^17.3.0",
5656
"lefthook": "^2.1.6",
57-
"tsdown": "^0.22.1",
57+
"publint": "^0.3.24",
58+
"tsdown": "catalog:",
5859
"turbo": "^2.9.14",
5960
"typescript": "catalog:",
6061
"typescript-eslint": "^8.56.1",
@@ -85,7 +86,7 @@
8586
"ky": "^1.14.3",
8687
"msw": "^2.12.14",
8788
"outdent": "^0.8.0",
88-
"tsup": "^8.5.1",
89+
"tsdown": "^0.22.14",
8990
"typescript": "^5.9.3",
9091
"vite": "^7.3.1",
9192
"vitest": "^4.0.18"

packages/ci-env-info/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
"type": "module",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/dmno-dev/varlock.git",
8+
"url": "git+https://github.com/dmno-dev/varlock.git",
99
"directory": "packages/ci-env-info"
1010
},
11-
"main": "dist/index.js",
12-
"types": "dist/index.d.ts",
11+
"main": "dist/index.mjs",
12+
"types": "dist/index.d.mts",
1313
"exports": {
1414
".": {
1515
"ts-src": "./src/index.ts",
16-
"types": "./dist/index.d.ts",
17-
"import": "./dist/index.js",
18-
"default": "./dist/index.js"
16+
"types": "./dist/index.d.mts",
17+
"import": "./dist/index.mjs",
18+
"default": "./dist/index.mjs"
1919
}
2020
},
2121
"files": ["dist"],
2222
"scripts": {
23-
"build": "tsup",
24-
"dev": "tsup --watch",
23+
"build": "tsdown",
24+
"dev": "tsdown --watch",
2525
"test": "vitest",
2626
"test:ci": "vitest --run",
2727
"typecheck": "tsc --noEmit"
@@ -42,7 +42,7 @@
4242
},
4343
"devDependencies": {
4444
"@types/node": "catalog:",
45-
"tsup": "catalog:",
45+
"tsdown": "catalog:",
4646
"typescript": "catalog:",
4747
"vitest": "catalog:"
4848
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from 'tsup';
1+
import { defineConfig } from 'tsdown';
22

33
export default defineConfig({
44
entry: ['src/index.ts'],
@@ -7,7 +7,8 @@ export default defineConfig({
77
treeshake: true,
88
clean: true,
99
outDir: 'dist',
10+
publint: true,
1011
format: ['esm'],
11-
splitting: false,
12+
platform: 'node',
1213
target: 'esnext',
1314
});

packages/env-spec-parser/package.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
{
22
"name": "@env-spec/parser",
33
"version": "0.5.0",
4+
"type": "commonjs",
45
"description": "Parser for @env-spec enabled dotenv files",
56
"homepage": "https://varlock.dev",
67
"bugs": "https://github.com/dmno-dev/varlock/issues",
78
"repository": {
89
"type": "git",
9-
"url": "https://github.com/dmno-dev/varlock.git",
10+
"url": "git+https://github.com/dmno-dev/varlock.git",
1011
"directory": "packages/env-spec-parser"
1112
},
12-
"main": "dist/index.js",
13-
"types": "dist/index.d.ts",
13+
"main": "dist/index.cjs",
14+
"types": "dist/index.d.cts",
1415
"files": ["dist"],
1516
"exports": {
1617
".": {
1718
"ts-src": "./src/index.ts",
18-
"types": "./dist/index.d.ts",
19-
"import": "./dist/index.mjs",
20-
"require": "./dist/index.js"
19+
"import": {
20+
"types": "./dist/index.d.mts",
21+
"default": "./dist/index.mjs"
22+
},
23+
"require": {
24+
"types": "./dist/index.d.cts",
25+
"default": "./dist/index.cjs"
26+
}
2127
}
2228
},
2329
"scripts": {
2430
"dev": "bun run --parallel dev:grammar dev:ts",
2531
"dev:grammar": "bun run build:grammar:watch",
26-
"dev:ts": "tsup --watch",
32+
"dev:ts": "tsdown --watch",
2733
"build:grammar": "peggy -c peggy.config.cjs",
2834
"build:grammar:watch": "peggy -c peggy.config.cjs -w",
29-
"build:lib": "tsup",
35+
"build:lib": "tsdown",
3036
"build": "bun run build:grammar && bun run build:lib",
3137
"test": "bun run --parallel build:grammar:watch _test:watch",
3238
"_test:watch": "vitest",
@@ -53,7 +59,7 @@
5359
"ansis": "catalog:",
5460
"outdent": "catalog:",
5561
"peggy": "^5.0.6",
56-
"tsup": "catalog:",
62+
"tsdown": "catalog:",
5763
"vitest": "catalog:"
5864
}
5965
}

packages/env-spec-parser/scripts/dotenv-comparison.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// we dont need everything to match 100% - but good to know what differences are
88

99
import util from 'node:util';
10-
import { parseEnvSpecDotEnvFile } from '../dist/index.js';
11-
import { simpleResolver } from '../dist/simple-resolver.js';
10+
import { parseEnvSpecDotEnvFile } from '../dist/index.mjs';
11+
import { simpleResolver } from '../dist/simple-resolver.mjs';
1212
const COMPARISON_SCENARIOS = {
1313
scenarios: [
1414
{

packages/env-spec-parser/scripts/playground.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// helpful script for testing the parser - loads .env.playground file
44
import {
55
expand, parseEnvSpecDotEnvFile,
6-
} from '../dist/index.js';
7-
import { simpleResolver } from '../dist/simple-resolver.js';
6+
} from '../dist/index.mjs';
7+
import { simpleResolver } from '../dist/simple-resolver.mjs';
88
import fs from 'node:fs/promises';
99
import path from 'node:path';
1010
import { fileURLToPath } from 'node:url';
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { defineConfig } from 'tsup';
1+
import { defineConfig } from 'tsdown';
22

33
export default defineConfig({
44
entry: ['src/index.ts', 'src/simple-resolver.ts'],
55
dts: true,
6-
// minify: true, // Minify output
76
sourcemap: true, // Generate sourcemaps
87
treeshake: true, // Remove unused code
98
clean: true, // Clean output directory before building
109
outDir: 'dist', // Output directory
10+
publint: true,
1111
format: ['esm', 'cjs'], // Output format(s)
12-
splitting: true,
13-
keepNames: true, // stops build from prefixing our class names with `_` in some cases
12+
platform: 'node',
1413
});

packages/integrations/astro/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"version": "1.3.0",
55
"repository": {
66
"type": "git",
7-
"url": "https://github.com/dmno-dev/varlock.git",
7+
"url": "git+https://github.com/dmno-dev/varlock.git",
88
"directory": "packages/integrations/astro"
99
},
1010
"type": "module",
11-
"main": "dist/index.js",
12-
"types": "dist/index.d.ts",
11+
"main": "dist/index.mjs",
12+
"types": "dist/index.d.mts",
1313
"exports": {
1414
".": {
15-
"types": "./dist/index.d.ts",
16-
"import": "./dist/index.js",
17-
"default": "./dist/index.js"
15+
"types": "./dist/index.d.mts",
16+
"import": "./dist/index.mjs",
17+
"default": "./dist/index.mjs"
1818
}
1919
},
2020
"files": ["dist"],
2121
"scripts": {
22-
"dev": "tsup --watch",
23-
"build": "tsup",
22+
"dev": "tsdown --watch",
23+
"build": "tsdown",
2424
"typecheck": "tsc --noEmit"
2525
},
2626
"keywords": [
@@ -57,7 +57,7 @@
5757
"@varlock/cloudflare-integration": "workspace:*",
5858
"@varlock/vite-integration": "workspace:*",
5959
"astro": ">=5.12.8",
60-
"tsup": "catalog:",
60+
"tsdown": "catalog:",
6161
"varlock": "workspace:^",
6262
"vitest": "catalog:"
6363
}

0 commit comments

Comments
 (0)