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
11 changes: 10 additions & 1 deletion packages/core/rollup.npm.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';

export default makeNPMConfigVariants(makeBaseNPMConfig());
export default makeNPMConfigVariants(
makeBaseNPMConfig({
packageSpecificConfig: {
output: {
// Combine output into a single file to avoid expensive require/import calls
preserveModules: false,
},
},
}),
);
6 changes: 3 additions & 3 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"chai": "^4.1.2"
},
"scripts": {
"build": "run-p build:transpile build:types",
"build": "run-p build:transpile:uncached build:types",
"build:dev": "yarn build",
"build:transpile": "yarn ts-node scripts/buildRollup.ts",
"build:transpile:uncached": "yarn ts-node scripts/buildRollup.ts",
"build:transpile": "yarn rollup -c rollup.npm.config.js",
"build:transpile:uncached": "yarn build:transpile && yarn ts-node scripts/fixPolyfillsBuild.ts",
"build:types": "tsc -p tsconfig.types.json",
"build:watch": "run-p build:transpile:watch build:types:watch",
"build:dev:watch": "yarn build:watch",
Expand Down
25 changes: 23 additions & 2 deletions packages/utils/rollup.npm.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';

export default makeNPMConfigVariants(
const baseVariants = makeNPMConfigVariants(
makeBaseNPMConfig({
entrypoints: ['src/index.ts'],
packageSpecificConfig: {
output: {
// Combine output into a single file to avoid expensive require/import calls
preserveModules: false,
},
},
}),
);

const polyfillVariants = makeNPMConfigVariants(
makeBaseNPMConfig({
// We build the polyfills separately because they're not included in the top-level exports of the package, in order
// to keep them out of the public API.
entrypoints: ['src/index.ts', 'src/buildPolyfills/index.ts'],
entrypoints: ['src/buildPolyfills/index.ts'],
packageSpecificConfig: {
output: {
entryFileNames: () => 'buildPolyfills.js',
// Combine output into a single file to avoid expensive require/import calls
preserveModules: false,
},
},
}),
);

export default baseVariants.concat(polyfillVariants);
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import * as childProcess from 'child_process';
import * as fs from 'fs';

/**
* Run the given shell command, piping the shell process's `stdin`, `stdout`, and `stderr` to that of the current
* process. Returns contents of `stdout`.
*/
function run(cmd: string, options?: childProcess.ExecSyncOptions): string | Buffer {
return childProcess.execSync(cmd, { stdio: 'inherit', ...options });
}

run('yarn rollup -c rollup.npm.config.js');

// We want to distribute the README because it contains the MIT license blurb from Sucrase and Rollup
fs.copyFileSync('src/buildPolyfills/README.md', 'build/cjs/buildPolyfills/README.md');
fs.copyFileSync('src/buildPolyfills/README.md', 'build/esm/buildPolyfills/README.md');
fs.copyFileSync('src/buildPolyfills/README.md', 'build/cjs/buildPolyfills_README.md');
fs.copyFileSync('src/buildPolyfills/README.md', 'build/esm/buildPolyfills_README.md');

// Because we import our polyfills from `@sentry/utils/cjs/buildPolyfills` and `@sentry/utils/esm/buildPolyfills` rather
// than straight from `@sentry/utils` (so as to avoid having them in the package's public API), when tests run, they'll
Expand Down