MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / makeBaseNPMConfig

Function makeBaseNPMConfig

dev-packages/rollup-utils/npmHelpers.mjs:32–126  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

30const ignoreSideEffects = /[\\/]debug-build\.ts$/;
31
32export function makeBaseNPMConfig(options = {}) {
33 const {
34 entrypoints = ['src/index.ts'],
35 hasBundles = false,
36 packageSpecificConfig = {},
37 esbuild = {},
38 bundledBuiltins = [],
39 } = options;
40
41 const nodeResolvePlugin = makeNodeResolvePlugin();
42 const transpilePlugin = makeEsbuildPlugin(esbuild);
43 const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin();
44 const rrwebBuildPlugin = makeRrwebBuildPlugin({
45 excludeShadowDom: undefined,
46 excludeIframe: undefined,
47 });
48
49 const deps = [
50 ...builtinModules.filter(m => !bundledBuiltins.includes(m)),
51 ...Object.keys(packageDotJSON.dependencies || {}),
52 ...Object.keys(packageDotJSON.peerDependencies || {}),
53 ...Object.keys(packageDotJSON.optionalDependencies || {}),
54 ];
55
56 const defaultBaseConfig = {
57 input: entrypoints,
58
59 output: {
60 // an appropriately-named directory will be added to this base value when we specify either a cjs or esm build
61 dir: hasBundles ? 'build/npm' : 'build',
62
63 sourcemap: true,
64
65 // Include __esModule property when there is a default prop
66 esModule: 'if-default-prop',
67
68 // output individual files rather than one big bundle
69 preserveModules: true,
70
71 hoistTransitiveImports: false,
72
73 // Allow wrappers or helper functions generated by rollup to use any ES2015 features
74 generatedCode: {
75 preset: 'es2015',
76 },
77
78 // don't add `"use strict"` to the top of cjs files
79 strict: false,
80
81 // do TS-3.8-style exports
82 // exports.dogs = are.great
83 // rather than TS-3.9-style exports
84 // Object.defineProperty(exports, 'dogs', {
85 // enumerable: true,
86 // get: () => are.great,
87 // });
88 externalLiveBindings: false,
89

Calls 6

makeNodeResolvePluginFunction · 0.90
makeEsbuildPluginFunction · 0.90
makeRrwebBuildPluginFunction · 0.90
keysMethod · 0.65
testMethod · 0.65

Tested by

no test coverage detected