UNPKG

@storm-software/build-tools

Version:

A comprehensive set of tools for building and managing projects within a Storm workspace. Includes builders such as rollup, rolldown, tsup, and unbuild, along with various utilities.

81 lines (70 loc) 2.55 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _chunkUMP4EIASjs = require('./chunk-UMP4EIAS.js'); var _chunkJVKCJMCKjs = require('./chunk-JVKCJMCK.js'); var _chunkKTEGKYAHjs = require('./chunk-KTEGKYAH.js'); // src/utilities/get-entry-points.ts var _glob = require('glob'); var getEntryPoints = async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => { const workspaceRoot = config.workspaceRoot || _chunkUMP4EIASjs.findWorkspaceRoot.call(void 0, ); const entryPoints = []; if (entry) { if (typeof entry === "string") { entryPoints.push(entry); } else if (Array.isArray(entry)) { entryPoints.push(...entry); } else { entryPoints.push(...Object.values(entry)); } } if (emitOnAll) { entryPoints.push( _chunkJVKCJMCKjs.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}") ); } const results = await Promise.all( entryPoints.map(async (entryPoint) => { const paths = []; if (entryPoint.includes("*")) { const files = await _glob.glob.call(void 0, entryPoint, { withFileTypes: true, ignore: ["**/node_modules/**"] }); paths.push( ...files.reduce((ret, filePath) => { const result = _chunkJVKCJMCKjs.correctPaths.call(void 0, _chunkJVKCJMCKjs.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunkJVKCJMCKjs.correctPaths.call(void 0, workspaceRoot), "").replaceAll(_chunkJVKCJMCKjs.correctPaths.call(void 0, projectRoot), "") ); if (result) { _chunkKTEGKYAHjs.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunkJVKCJMCKjs.joinPaths.call(void 0, filePath.path, filePath.name )}"`, config ); if (!paths.includes(result)) { paths.push(result); } } return ret; }, []) ); } else { _chunkKTEGKYAHjs.writeDebug.call(void 0, `Trying to add entry point ${entryPoint}"`, config); if (!paths.includes(entryPoint)) { paths.push(entryPoint); } } return paths; }) ); return results.filter(Boolean).reduce((ret, result) => { result.forEach((res) => { if (res && !ret.includes(res)) { ret.push(res); } }); return ret; }, []); }; exports.getEntryPoints = getEntryPoints;