Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ebf537d
chore(build): Use Rolldown
timfish Oct 31, 2025
f844d5a
Lint
timfish Oct 31, 2025
8f03186
fixes
timfish Oct 31, 2025
56af22e
chore: it builds :O
logaretm Nov 11, 2025
2fdde1d
fix: bring back preserve modules
logaretm Nov 11, 2025
759384e
fix: lint
logaretm Nov 11, 2025
a7330ca
chore: remove ts and terser from replay
logaretm Nov 11, 2025
ee24dcb
chore: remove last uses of rollup replace
logaretm Nov 11, 2025
cc35989
chore: fix replace plugin usage
logaretm Nov 11, 2025
6e91af1
chore: remove unused rollup plugins
logaretm Nov 11, 2025
8023846
chore: use defineConfig for type assist
logaretm Nov 11, 2025
5463d58
chore: module preservation root
logaretm Nov 11, 2025
8b60aaf
chore: revert some changes
logaretm Nov 11, 2025
b49568d
fix: revert more changes
logaretm Nov 11, 2025
5fe61aa
fix: format
logaretm Nov 11, 2025
9dbdb67
fix: nextjs build
logaretm Nov 11, 2025
e40c5e7
chore: upgrade to rolldown 1.0.0-beta.50
logaretm Nov 13, 2025
f0c4b2e
chore: properly replace the smallest preset value
logaretm Nov 13, 2025
54e29a2
chore: remove sucrase, and try out latest preview build
logaretm Nov 17, 2025
7159a68
chore: revert to latest beta
logaretm Nov 17, 2025
cb25598
chore: try out latest rolldown preview
logaretm Nov 17, 2025
90f1388
chore: ensure sub files in externals are treated as externals
logaretm Nov 17, 2025
38924e4
chore: fix astro export for middleware
logaretm Nov 17, 2025
9ea0b2e
chore: nextjs config
logaretm Nov 17, 2025
354398a
chore: fix nextjs output
logaretm Nov 18, 2025
c45f96d
chore: bump to rolldown 1.0.0-beta.51
logaretm Nov 19, 2025
03b1ad8
chore: upgrade to latest rolldown release
logaretm Nov 27, 2025
230c4a8
fix(remix): properly point to esm and require builds
logaretm Nov 27, 2025
c7e90ff
fix: use custom preseveration logic for nextjs templates
logaretm Nov 27, 2025
f231c4e
fix: simplify import placeholder replacers
logaretm Nov 28, 2025
fa7bf58
fix: send in module conditionally since it may not be available in ES…
logaretm Nov 28, 2025
ebc036c
fix: wrapper tests
logaretm Nov 28, 2025
ceb284f
fix: astro tests
logaretm Nov 28, 2025
d1e85bb
fix: ensure passing the tsconfig
logaretm Nov 28, 2025
6bb1d2c
fix: aws-serverless replace plugin
logaretm Nov 28, 2025
5b68f46
fix: revert remix change
logaretm Nov 28, 2025
b496ec5
fix: revert astro structure changes
logaretm Nov 28, 2025
5925e40
fix: temporary fix remix till i figure it out
logaretm Nov 28, 2025
437a24e
fix: ANR replacements
logaretm Nov 28, 2025
765ca61
fix: spotlight shaking
logaretm Nov 28, 2025
8c9f37f
refactor: remix vite plugin imports
logaretm Dec 1, 2025
0da9c5d
chore: use latest rolldown beta 53
logaretm Dec 3, 2025
b81f0d3
chore: dedup yarn
logaretm Dec 4, 2025
c54d7e3
fix: more remix fixes
logaretm Dec 4, 2025
07e0b14
fix: module compat for remix esm
logaretm Dec 4, 2025
12dce6b
ref: restore no longer needed changes to remix vite configs
logaretm Dec 4, 2025
8c7521a
chore: implement a custom transport for remix tests
logaretm Dec 4, 2025
81791e2
chore: remove strict key
logaretm Dec 4, 2025
d195dd0
chore: NODE_ENV replacement for rollup compat
logaretm Dec 4, 2025
37fdbd3
fix: alias preact for feedback bundling
logaretm Dec 4, 2025
48f1197
fix(remix): isolate node-specific imports to their own paths
logaretm Dec 4, 2025
9d7c822
fix: lint errors and nextjs re-export
logaretm Dec 4, 2025
8866996
fix: nextjs commonjs issues
logaretm Dec 4, 2025
2a0d176
chore: include tsconfig into the bundle opts
logaretm Dec 5, 2025
45d9b47
fix: ensure es2020 compat
logaretm Dec 5, 2025
4d5e665
chore: try oxc minifier
logaretm Dec 5, 2025
ac768ba
chore: added note on rolldown minification
logaretm Dec 5, 2025
bfb82f3
tests: update minified tests expectations
logaretm Dec 5, 2025
5bebf07
chore: upgrade rolldown to latest beta 54
logaretm Dec 11, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ sentryTest('should not add source context lines to errors from script files', as

const exception = eventData.exception?.values?.[0];
const frames = exception?.stacktrace?.frames;
expect(frames).toHaveLength(1);
expect(frames?.length).toBeGreaterThanOrEqual(1);
// Verify the subject.bundle.js frame is present
expect(frames?.some(f => f.filename?.includes('subject.bundle.js'))).toBe(true);
// Core assertion: no context lines should be added for script files
frames?.forEach(f => {
expect(f).not.toHaveProperty('pre_context');
expect(f).not.toHaveProperty('context_line');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ sentryTest('should provide module_metadata on stack frames in beforeSend', async
const url = await getLocalTestUrl({ testDir: __dirname });

const errorEvent = await getFirstSentryEnvelopeRequest<Event>(page, url);
expect(errorEvent.extra?.['module_metadata_entries']).toEqual([{ foo: 'bar' }]);
// Filter out null entries from internal Sentry frames that don't have module metadata
const metadataEntries = (errorEvent.extra?.['module_metadata_entries'] as Array<unknown>)?.filter(
entry => entry !== null,
);
expect(metadataEntries).toEqual([{ foo: 'bar' }]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ sentryTest(
const url = await getLocalTestUrl({ testDir: __dirname });

const errorEvent = await getFirstSentryEnvelopeRequest<Event>(page, url);
expect(errorEvent?.extra?.['module_metadata_entries']).toEqual([{ foo: 'baz' }]);
// Filter out null entries from internal Sentry frames that don't have module metadata
const metadataEntries = (errorEvent?.extra?.['module_metadata_entries'] as Array<unknown>)?.filter(
entry => entry !== null,
);
expect(metadataEntries).toEqual([{ foo: 'baz' }]);
},
);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import("next").NextConfig} */
const config = {};

import { withSentryConfig } from '@sentry/nextjs';
const { withSentryConfig } = require('@sentry/nextjs');

export default withSentryConfig(config, {
module.exports = withSentryConfig(config, {
disableLogger: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "next-orpc",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"dev": "next dev -p 3030",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
await import('./src/env.js');
require('./src/env.js');

/** @type {import("next").NextConfig} */
const config = {};

import { withSentryConfig } from '@sentry/nextjs';
const { withSentryConfig } = require('@sentry/nextjs');

export default withSentryConfig(config, {
module.exports = withSentryConfig(config, {
disableLogger: true,
silent: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "t3",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ export default defineConfig({
}),
sveltekit(),
],
build: {
rollupOptions: {
external: ['fsevents'],
},
},
});
2 changes: 1 addition & 1 deletion dev-packages/node-core-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"build": "run-s build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:transpile": "rolldown -c rollup.npm.config.mjs",
"build:types": "tsc -p tsconfig.types.json",
"clean": "rimraf -g **/node_modules && run-p clean:script",
"clean:script": "node scripts/clean.js",
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"build": "run-s build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:transpile": "rolldown -c rollup.npm.config.mjs",
"build:types": "tsc -p tsconfig.types.json",
"clean": "rimraf -g suites/**/node_modules suites/**/tmp_* && run-p clean:script",
"clean:script": "node scripts/clean.js",
Expand Down
63 changes: 32 additions & 31 deletions dev-packages/rollup-utils/bundleHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,46 @@
*/

import { builtinModules } from 'module';

import path from 'node:path';
import fs from 'node:fs';
import deepMerge from 'deepmerge';

import {
makeBrowserBuildPlugin,
makeCleanupPlugin,
makeCommonJSPlugin,
makeIsDebugBuildPlugin,
makeLicensePlugin,
makeNodeResolvePlugin,
makeRrwebBuildPlugin,
makeSetSDKSourcePlugin,
makeSucrasePlugin,
makeTerserPlugin,
makeBannerOptions,
makeMinifierOptions,
} from './plugins/index.mjs';
import { mergePlugins } from './utils.mjs';
import { makeProductionReplacePlugin } from './plugins/npmPlugins.mjs';
import { mergePlugins, treeShakePreset } from './utils.mjs';

const BUNDLE_VARIANTS = ['.js', '.min.js', '.debug.min.js'];

const packageDotJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }));

export function makeBaseBundleConfig(options) {
const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig, sucrase } = options;
const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig } = options;

const nodeResolvePlugin = makeNodeResolvePlugin();
const sucrasePlugin = makeSucrasePlugin({}, sucrase);
const cleanupPlugin = makeCleanupPlugin();
const markAsBrowserBuildPlugin = makeBrowserBuildPlugin(true);
const licensePlugin = makeLicensePlugin(licenseTitle);
const banner = makeBannerOptions(licenseTitle, packageDotJSON.version);
const rrwebBuildPlugin = makeRrwebBuildPlugin({
excludeIframe: false,
excludeShadowDom: false,
});
const productionReplacePlugin = makeProductionReplacePlugin();

// The `commonjs` plugin is the `esModuleInterop` of the bundling world. When used with `transformMixedEsModules`, it
// will include all dependencies, imported or required, in the final bundle. (Without it, CJS modules aren't included
// at all, and without `transformMixedEsModules`, they're only included if they're imported, not if they're required.)
const commonJSPlugin = makeCommonJSPlugin({ transformMixedEsModules: true });

// used by `@sentry/browser`
const standAloneBundleConfig = {
output: {
banner,
format: 'iife',
name: 'Sentry',
intro: () => {
return 'exports = window.Sentry || {};';
},
},
context: 'window',
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin, licensePlugin],
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],
};

// used by `@sentry/wasm` & pluggable integrations from core/browser (bundles which need to be combined with a stand-alone SDK bundle)
Expand All @@ -63,7 +53,7 @@ export function makeBaseBundleConfig(options) {
format: 'cjs',

// code to add before the CJS wrapper
banner: '(function (__window) {',
banner: `${banner}\n(function (__window) {`,

// code to add just inside the CJS wrapper, before any of the wrapped code
intro: 'var exports = {};',
Expand All @@ -86,40 +76,48 @@ export function makeBaseBundleConfig(options) {
// code to add after the CJS wrapper
footer: '}(window));',
},
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin, licensePlugin],
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],
};

const workerBundleConfig = {
output: {
banner,
format: 'esm',
minify: makeMinifierOptions(),
},
plugins: [commonJSPlugin, makeTerserPlugin(), licensePlugin],
// Don't bundle any of Node's core modules
external: builtinModules,
};

const awsLambdaExtensionBundleConfig = {
output: {
format: 'esm',
minify: makeMinifierOptions(),
},
plugins: [commonJSPlugin, makeIsDebugBuildPlugin(true), makeTerserPlugin()],
plugins: [makeIsDebugBuildPlugin(true)],
// Don't bundle any of Node's core modules
external: builtinModules,
};

// used by all bundles
const sharedBundleConfig = {
input: entrypoints,
// Point to the package's tsconfig.json so rolldown respects TypeScript & JSX settings
tsconfig: path.resolve(process.cwd(), './tsconfig.json'),

// Enforce ES2020 target for all builds
transform: {
target: 'es2020',
},

output: {
// a file extension will be added to this base value when we specify either a minified or non-minified build
entryFileNames: outputFileBase,
dir: 'build',
sourcemap: true,
strict: false,
esModule: false,
},
plugins: [productionReplacePlugin, sucrasePlugin, nodeResolvePlugin, cleanupPlugin],
treeshake: 'smallest',
treeshake: treeShakePreset('smallest'),
};

const bundleTypeConfigMap = {
Expand Down Expand Up @@ -149,7 +147,7 @@ export function makeBundleConfigVariants(baseConfig, options = {}) {

const includeDebuggingPlugin = makeIsDebugBuildPlugin(true);
const stripDebuggingPlugin = makeIsDebugBuildPlugin(false);
const terserPlugin = makeTerserPlugin();
const minifierOptions = makeMinifierOptions();
const setSdkSourcePlugin = makeSetSDKSourcePlugin('cdn');

// The additional options to use for each variant we're going to create.
Expand All @@ -164,22 +162,25 @@ export function makeBundleConfigVariants(baseConfig, options = {}) {
'.min.js': {
output: {
entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.min.js`,
minify: minifierOptions,
},
plugins: [stripDebuggingPlugin, setSdkSourcePlugin, terserPlugin],
plugins: [stripDebuggingPlugin, setSdkSourcePlugin],
},

'.debug.min.js': {
output: {
entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.debug.min.js`,
minify: minifierOptions,
},
plugins: [includeDebuggingPlugin, setSdkSourcePlugin, terserPlugin],
plugins: [includeDebuggingPlugin, setSdkSourcePlugin],
},
};

return variants.map(variant => {
if (!BUNDLE_VARIANTS.includes(variant)) {
throw new Error(`Unknown bundle variant requested: ${variant}`);
}

return deepMerge(baseConfig, variantSpecificConfigMap[variant], {
// Merge the plugin arrays and make sure the end result is in the correct order. Everything else can use the
// default merge strategy.
Expand Down
7 changes: 2 additions & 5 deletions dev-packages/rollup-utils/index.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// TODO Is this necessary?
import * as plugins from './plugins/index.mjs';
export { plugins };

export * from './plugins/index.mjs';
export * from './bundleHelpers.mjs';
export * from './npmHelpers.mjs';
export { insertAt } from './utils.mjs';
export { insertAt, treeShakePreset } from './utils.mjs';
55 changes: 27 additions & 28 deletions dev-packages/rollup-utils/npmHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ import * as fs from 'fs';
import { builtinModules } from 'module';
import * as path from 'path';
import { fileURLToPath } from 'url';

import deepMerge from 'deepmerge';

import { defineConfig } from 'rollup';
import { defineConfig } from 'rolldown';
import {
makeCleanupPlugin,
makeDebugBuildStatementReplacePlugin,
makeNodeResolvePlugin,
makeProductionReplacePlugin,
makeRrwebBuildPlugin,
makeSucrasePlugin,
} from './plugins/index.mjs';
import { makePackageNodeEsm } from './plugins/make-esm-plugin.mjs';
import { mergePlugins } from './utils.mjs';
Expand All @@ -34,22 +29,32 @@ export function makeBaseNPMConfig(options = {}) {
entrypoints = ['src/index.ts'],
hasBundles = false,
packageSpecificConfig = {},
sucrase = {},
bundledBuiltins = [],
} = options;

const nodeResolvePlugin = makeNodeResolvePlugin();
const sucrasePlugin = makeSucrasePlugin({}, sucrase);
// Make sure subpath imports are also treated as external (e.g., 'solid-js/web' when 'solid-js' is external)
const externalWithSubpaths = [
...Object.keys(packageDotJSON.dependencies || {}),
...Object.keys(packageDotJSON.peerDependencies || {}),
...Object.keys(packageDotJSON.optionalDependencies || {}),
].map(dep => new RegExp(`^${dep}(?:/.*)?$`));

const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin();
const cleanupPlugin = makeCleanupPlugin();
const rrwebBuildPlugin = makeRrwebBuildPlugin({
excludeShadowDom: undefined,
excludeIframe: undefined,
});

const defaultBaseConfig = {
const defaultBaseConfig = defineConfig({
input: entrypoints,

// Point to the package's tsconfig.json so rolldown respects TypeScript & JSX settings
tsconfig: path.resolve(process.cwd(), './tsconfig.json'),

checks: {
pluginTimings: true,
},

output: {
// an appropriately-named directory will be added to this base value when we specify either a cjs or esm build
dir: hasBundles ? 'build/npm' : 'build',
Expand All @@ -62,14 +67,14 @@ export function makeBaseNPMConfig(options = {}) {
// output individual files rather than one big bundle
preserveModules: true,

// output files relative to the src directory
preserveModulesRoot: 'src',

// Allow wrappers or helper functions generated by rollup to use any ES2015 features
generatedCode: {
preset: 'es2015',
},

// don't add `"use strict"` to the top of cjs files
strict: false,

// do TS-3.8-style exports
// exports.dogs = are.great
// rather than TS-3.9-style exports
Expand All @@ -78,12 +83,6 @@ export function makeBaseNPMConfig(options = {}) {
// get: () => are.great,
// });
externalLiveBindings: false,

// Don't call `Object.freeze` on the results of `import * as someModule from '...'`
// (We don't need it, so why waste the bytes?)
freeze: false,

interop: 'esModule',
},

treeshake: {
Expand All @@ -97,16 +96,16 @@ export function makeBaseNPMConfig(options = {}) {
},
},

plugins: [nodeResolvePlugin, sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin],
// Enforce ES2020 target for all builds
transform: {
target: 'es2020',
},

plugins: [debugBuildStatementReplacePlugin, rrwebBuildPlugin],

// don't include imported modules from outside the package in the final output
external: [
...builtinModules.filter(m => !bundledBuiltins.includes(m)),
...Object.keys(packageDotJSON.dependencies || {}),
...Object.keys(packageDotJSON.peerDependencies || {}),
...Object.keys(packageDotJSON.optionalDependencies || {}),
],
};
external: [...builtinModules.filter(m => !bundledBuiltins.includes(m)), ...externalWithSubpaths],
});

return deepMerge(defaultBaseConfig, packageSpecificConfig, {
// Plugins have to be in the correct order or everything breaks, so when merging we have to manually re-order them
Expand Down
Loading
Loading