@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
45 lines (40 loc) • 1.97 kB
JavaScript
;
var chunk5QXHN37U_cjs = require('./chunk-5QXHN37U.cjs');
var chunkWMPMHBXV_cjs = require('./chunk-WMPMHBXV.cjs');
var chunkJ5FGHGMA_cjs = require('./chunk-J5FGHGMA.cjs');
var chunkUY2GAVJJ_cjs = require('./chunk-UY2GAVJJ.cjs');
var chunk3ONWID2V_cjs = require('./chunk-3ONWID2V.cjs');
var types = require('@storm-software/config-tools/types');
var isString = require('@stryke/type-checks/is-string');
var defu = require('defu');
var esbuild = require('esbuild');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var defu__default = /*#__PURE__*/_interopDefault(defu);
async function bundle(context, bundleOptions = {}) {
const options = defu__default.default({
plugins: [
chunkJ5FGHGMA_cjs.resolverPlugin(context, {
external: bundleOptions.external,
noExternal: bundleOptions.noExternal,
skipNodeModulesBundle: bundleOptions.skipNodeModulesBundle
}),
bundleOptions.compiler?.skipAllTransforms === true ? chunkWMPMHBXV_cjs.transpilerPlugin(context, bundleOptions.compiler) : chunkUY2GAVJJ_cjs.compilerPlugin(context, bundleOptions.compiler)
].filter(Boolean)
}, chunk5QXHN37U_cjs.resolveESBuildOptions(context, {
outdir: bundleOptions.outputPath,
entryPoints: chunk5QXHN37U_cjs.resolveEsbuildEntryOptions(context, bundleOptions.entry ? Array.isArray(bundleOptions.entry) ? bundleOptions.entry : isString.isString(bundleOptions.entry) ? [
bundleOptions.entry
] : Object.values(bundleOptions.entry) : []),
bundle: true
}, bundleOptions));
try {
return await esbuild.build(options);
} catch (error) {
context.log(types.LogLevelLabel.ERROR, error?.message ? `An error occurred while bundling: ${error?.message}` : "An error occurred while bundling");
throw error;
}
}
chunk3ONWID2V_cjs.__name(bundle, "bundle");
exports.bundle = bundle;
//# sourceMappingURL=chunk-X2JNQCAO.cjs.map
//# sourceMappingURL=chunk-X2JNQCAO.cjs.map