UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

64 lines (62 loc) 2.6 kB
import { __name } from './chunk-43IZMM3W.js'; import { findFileExtension } from '@stryke/path/file-path-fns'; import { replacePath } from '@stryke/path/replace'; import { isString } from '@stryke/type-checks/is-string'; import defu from 'defu'; function resolveEsbuildEntryOptions(context, entryPoints) { return entryPoints.reduce((ret, entry) => { if (isString(entry)) { ret[replacePath(entry, context.options.workspaceRoot).replace(findFileExtension(entry) || "", "")] = replacePath(entry, context.options.workspaceRoot); } else { ret[entry.output || replacePath(entry.input.file, context.options.workspaceRoot).replace(findFileExtension(entry.input.file) || "", "") || replacePath(entry.file, context.options.workspaceRoot).replace(findFileExtension(entry.file) || "", "")] = replacePath(entry.file, context.options.workspaceRoot); } return ret; }, {}); } __name(resolveEsbuildEntryOptions, "resolveEsbuildEntryOptions"); function resolveESBuildOptions(context, override = {}, bundleOptions = {}) { const result = defu(override ?? {}, { alias: bundleOptions.alias, sourcemap: false }, { alias: context.vfs.runtimeIdMap.keys().reduce((ret, id) => { const path = context.vfs.runtimeIdMap.get(id); if (path) { ret[id] = path; } return ret; }, {}) }, bundleOptions.override ?? {}, context.options.esbuild.override ?? {}, { platform: context.options.platform, format: context.options.esbuild.format, target: context.options.esbuild.target, globalName: context.options.esbuild.globalName, minify: context.options.mode !== "development", metafile: context.options.mode === "development", sourcemap: context.options.mode === "development", bundle: context.options.esbuild.bundle, treeShaking: context.options.esbuild.treeshake, keepNames: context.options.esbuild.keepNames, splitting: context.options.esbuild.splitting, outdir: context.options.output.outputPath, tsconfig: context.tsconfig.tsconfigFilePath, banner: context.options.esbuild.banner, footer: context.options.esbuild.footer, plugins: context.options.esbuild.plugins }, { platform: "neutral", format: "esm", minify: true, sourcemap: false, bundle: true, treeShaking: true, keepNames: true, splitting: true, logLevel: "silent" }); return result; } __name(resolveESBuildOptions, "resolveESBuildOptions"); export { resolveESBuildOptions, resolveEsbuildEntryOptions }; //# sourceMappingURL=chunk-2IJX7TED.js.map //# sourceMappingURL=chunk-2IJX7TED.js.map