ts-project-builder
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EACR,cAAc,EAEjB,MAAM,SAAS,CAAC;AAsBjB,eAAO,MAAM,qBAAqB,EAAG,iCAA0C,CAAC;AAChF,eAAO,MAAM,gBAAgB,EAAG,QAAiB,CAAC;AAClD,eAAO,MAAM,gCAAgC,EAAG,OAAgB,CAAC;AAcjE,qBAAa,OAAO;;gBAIJ,OAAO,EAAE,cAAc;IA2B7B,KAAK;CA6Id;AAED,eAAe,OAAO,CAAC"} | ||
| {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EACR,cAAc,EAEjB,MAAM,SAAS,CAAC;AAsBjB,eAAO,MAAM,qBAAqB,EAAG,iCAA0C,CAAC;AAChF,eAAO,MAAM,gBAAgB,EAAG,QAAiB,CAAC;AAClD,eAAO,MAAM,gCAAgC,EAAG,OAAgB,CAAC;AAcjE,qBAAa,OAAO;;gBAIJ,OAAO,EAAE,cAAc;IA2B7B,KAAK;CAgJd;AAED,eAAe,OAAO,CAAC"} |
+6
-3
@@ -0,1 +1,2 @@ | ||
| import { globSync } from 'node:fs'; | ||
| import { rm } from 'node:fs/promises'; | ||
@@ -6,5 +7,4 @@ import { resolve, relative, isAbsolute } from 'node:path'; | ||
| import json from '@rollup/plugin-json'; | ||
| import nodeResolve from '@rollup/plugin-node-resolve'; | ||
| import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
| import typescript from '@rollup/plugin-typescript'; | ||
| import { globSync } from 'glob'; | ||
| import { cloneDeep, merge } from 'lodash-es'; | ||
@@ -14,3 +14,3 @@ import prettyMilliseconds from 'pretty-ms'; | ||
| import { minify } from 'rollup-plugin-esbuild'; | ||
| import nodeExternals from 'rollup-plugin-node-externals'; | ||
| import { nodeExternals } from 'rollup-plugin-node-externals'; | ||
| import { pathIsFile } from './utils/index.mjs'; | ||
@@ -130,2 +130,3 @@ import { cyan, bold, green } from './utils/rollup/colors.mjs'; | ||
| preserveModules: this.#isOutputOptionEnabled(format, 'preserveModules'), | ||
| // eslint-disable-next-line style/max-len | ||
| preserveModulesRoot: this.#options.output.preserveModulesRoots?.[format] || baseOutputOptions.preserveModulesRoot, | ||
@@ -135,2 +136,3 @@ sourcemap: this.#options.output.sourcemaps?.[format] ?? baseOutputOptions.sourcemap, | ||
| if (this.#isOutputOptionEnabled(format, 'minify')) { | ||
| // eslint-disable-next-line style/max-len | ||
| const minifyOptions = config.builtInOutputPluginOptions?.minify?.[format] || config.builtInOutputPluginOptions?.minify?.default; | ||
@@ -170,2 +172,3 @@ outputOptions.plugins?.push(minify(minifyOptions)); | ||
| && !this.#isOutputOptionEnabled(format, 'forceClean')) { | ||
| // eslint-disable-next-line style/max-len | ||
| throw new Error(`The path "${absoluteOutputPath}" to be cleaned is not under the running directory. To force clean, please add the --force-clean parameter.`); | ||
@@ -172,0 +175,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"builder.mjs","sources":["../src/builder.ts"],"sourcesContent":["import { rm } from 'node:fs/promises';\nimport {\n isAbsolute,\n relative,\n resolve,\n} from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport typescript from '@rollup/plugin-typescript';\nimport { globSync } from 'glob';\nimport {\n cloneDeep,\n merge,\n} from 'lodash-es';\nimport prettyMilliseconds from 'pretty-ms';\nimport { rollup } from 'rollup';\nimport type {\n ModuleFormat,\n OutputOptions,\n OutputPlugin,\n Plugin,\n RollupOptions,\n} from 'rollup';\nimport { minify } from 'rollup-plugin-esbuild';\nimport nodeExternals from 'rollup-plugin-node-externals';\nimport type { SetFieldType } from 'type-fest';\n\nimport type {\n BuilderOptions,\n Config,\n} from './types';\nimport { pathIsFile } from './utils';\nimport {\n bold,\n cyan,\n green,\n} from './utils/rollup/colors';\nimport { stderr } from './utils/rollup/logging';\n\nconst availableOutputFormats = new Set<ModuleFormat>([\n 'amd',\n 'cjs',\n 'commonjs',\n 'es',\n 'esm',\n 'iife',\n 'module',\n 'system',\n 'systemjs',\n 'umd',\n]);\n\nexport const defaultConfigFilePath = './ts-project-builder.config.mjs' as const;\nexport const defaultOutputDir = './dist' as const;\nexport const defaultOutputPreserveModulesRoot = './src' as const;\nconst outputFormatToExtMap = Object.freeze<Record<ModuleFormat, string>>({\n amd: 'amd.js',\n cjs: 'cjs',\n commonjs: 'cjs',\n es: 'mjs',\n esm: 'mjs',\n iife: 'iife.js',\n module: 'mjs',\n system: 'system.js',\n systemjs: 'system.js',\n umd: 'umd.js',\n});\n\nexport class Builder {\n #configFilePath: string;\n #options: BuilderOptions;\n\n constructor(options: BuilderOptions) {\n options = cloneDeep(options);\n if (!options.inputs.length) throw new Error('No inputs specified');\n if (!options.output.formats.size) throw new Error('No output formats specified');\n this.#configFilePath = resolve(options.configFilePath || defaultConfigFilePath);\n this.#options = options;\n }\n\n async #getConfig() {\n if (!this.#configFilePath) return {};\n if (!await pathIsFile(this.#configFilePath)) {\n if (relative(this.#configFilePath, resolve(defaultConfigFilePath)) !== '') {\n throw new Error(`Config file not found: ${this.#configFilePath}`);\n }\n\n return {};\n }\n\n const config = await import(pathToFileURL(resolve(this.#configFilePath)).toString());\n return (config && typeof config === 'object' && 'default' in config ? config.default : config) as Config;\n }\n\n #isOutputOptionEnabled(format: ModuleFormat, optionKey: 'clean' | 'forceClean' | 'minify' | 'preserveModules') {\n if (!this.#options.output[optionKey]) return;\n return this.#options.output[optionKey] === true || this.#options.output[optionKey].has(format);\n }\n\n async build() {\n stderr(cyan('Starting build...'));\n const startAt = Date.now();\n const config = await this.#getConfig();\n const baseOutputOptions: OutputOptions & { ext?: string } = {\n dir: this.#options.output.dirs?.default || defaultOutputDir,\n ext: this.#options.output.exts?.default,\n file: this.#options.output.files?.default,\n preserveModulesRoot: this.#options.output.preserveModulesRoots?.default || defaultOutputPreserveModulesRoot,\n sourcemap: this.#options.output.sourcemaps?.default,\n };\n\n const logOutputTargetsStrings: string[] = [];\n const rollupInputPlugins: Plugin[] = [\n ...config.additionalInputPlugins?.beforeBuiltIns || [],\n nodeExternals(config.builtInInputPluginOptions?.nodeExternal),\n nodeResolve(config.builtInInputPluginOptions?.nodeResolve),\n commonjs(config.builtInInputPluginOptions?.commonjs),\n json(config.builtInInputPluginOptions?.json),\n typescript(config.builtInInputPluginOptions?.typescript),\n ...config.additionalInputPlugins?.afterBuiltIns || [],\n ];\n\n const rollupOptions: RollupOptions = {\n ...config.rollupOptions,\n input: [...new Set(this.#options.inputs)].map((input) => globSync(input)).flat().sort(),\n };\n\n const rollupOutputs: OutputOptions[] = [];\n const rootPath = resolve();\n const toRemovePaths = new Set<string>();\n for (const format of this.#options.output.formats) {\n if (!availableOutputFormats.has(format)) throw new Error(`Invalid output format: ${format}`);\n const configOutputOptions = config.outputOptions?.[format] || config.outputOptions?.default;\n let outputOptions: SetFieldType<OutputOptions, 'plugins', OutputPlugin[]>;\n if (configOutputOptions?.processMethod === 'replace') {\n outputOptions = configOutputOptions.options as typeof outputOptions;\n } else {\n const entryFileNames = `[name].${\n this.#options.output.exts?.[format]\n || baseOutputOptions.ext\n || outputFormatToExtMap[format]\n }`;\n\n outputOptions = {\n dir: this.#options.output.dirs?.[format] || baseOutputOptions.dir,\n entryFileNames,\n exports: 'named',\n externalLiveBindings: false,\n file: this.#options.output.files?.[format] || baseOutputOptions.file,\n generatedCode: {\n arrowFunctions: true,\n constBindings: true,\n objectShorthand: true,\n },\n interop: 'compat',\n plugins: [],\n preserveModules: this.#isOutputOptionEnabled(format, 'preserveModules'),\n preserveModulesRoot: this.#options.output.preserveModulesRoots?.[format] || baseOutputOptions.preserveModulesRoot,\n sourcemap: this.#options.output.sourcemaps?.[format] ?? baseOutputOptions.sourcemap,\n };\n\n if (this.#isOutputOptionEnabled(format, 'minify')) {\n const minifyOptions = config.builtInOutputPluginOptions?.minify?.[format] || config.builtInOutputPluginOptions?.minify?.default;\n outputOptions.plugins?.push(minify(minifyOptions));\n }\n\n outputOptions.plugins?.push(\n ...config.additionalOutputPlugins?.[format]?.afterBuiltIns\n || config.additionalOutputPlugins?.default?.afterBuiltIns\n || [],\n );\n\n outputOptions.plugins?.unshift(\n ...config.additionalOutputPlugins?.[format]?.beforeBuiltIns\n || config.additionalOutputPlugins?.default?.beforeBuiltIns\n || [],\n );\n\n if (configOutputOptions?.processMethod === 'assign') {\n Object.assign(outputOptions, configOutputOptions.options);\n } else merge(outputOptions, configOutputOptions?.options);\n }\n\n outputOptions.format = format;\n if (outputOptions.file) {\n delete outputOptions.dir;\n logOutputTargetsStrings.push(`${outputOptions.file} (${format})`);\n } else if (outputOptions.dir) {\n delete outputOptions.file;\n logOutputTargetsStrings.push(`${outputOptions.dir} (${format})`);\n }\n\n if (this.#isOutputOptionEnabled(format, 'clean')) {\n const outputPath = outputOptions.dir || outputOptions.file;\n if (outputPath) {\n const absoluteOutputPath = resolve(outputPath);\n const relativePath = relative(rootPath, absoluteOutputPath);\n if (relativePath === '') {\n throw new Error('The directory to be cleared is the same as the running directory.');\n }\n\n if (\n !(!isAbsolute(relativePath) && !relativePath.startsWith('..'))\n && !this.#isOutputOptionEnabled(format, 'forceClean')\n ) {\n throw new Error(`The path \"${absoluteOutputPath}\" to be cleaned is not under the running directory. To force clean, please add the --force-clean parameter.`);\n }\n\n toRemovePaths.add(absoluteOutputPath);\n }\n }\n\n rollupOutputs.push(outputOptions);\n }\n\n const logInputFiles = [...rollupOptions.input as string[]];\n if (logInputFiles.length > 20) {\n logInputFiles.splice(20, logInputFiles.length, `... (${logInputFiles.length - 20} more)`);\n }\n\n const logOutputTargetsString = bold(logOutputTargetsStrings.join(', ').trim());\n stderr(cyan(`${bold(logInputFiles.join(', ').trim())} → ${logOutputTargetsString}...`));\n const rollupResult = await rollup({\n ...rollupOptions,\n plugins: rollupInputPlugins,\n });\n\n await Promise.all(\n [...toRemovePaths].map(async (path) => rm(\n path,\n {\n force: true,\n recursive: true,\n },\n )),\n );\n\n await Promise.all(rollupOutputs.map((outputOptions) => rollupResult.write(outputOptions)));\n stderr(green(`Created ${logOutputTargetsString} in ${bold(prettyMilliseconds(Date.now() - startAt))}`));\n }\n}\n\nexport default Builder;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0CA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAe;IACjD,KAAK;IACL,KAAK;IACL,UAAU;IACV,IAAI;IACJ,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,KAAK;AACR,CAAA,CAAC;AAEK,MAAM,qBAAqB,GAAG;AAC9B,MAAM,gBAAgB,GAAG;AACzB,MAAM,gCAAgC,GAAG;AAChD,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAA+B;AACrE,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,EAAE,EAAE,KAAK;AACT,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,GAAG,EAAE,QAAQ;AAChB,CAAA,CAAC;MAEW,OAAO,CAAA;AAChB,IAAA,eAAe;AACf,IAAA,QAAQ;AAER,IAAA,WAAA,CAAY,OAAuB,EAAA;AAC/B,QAAA,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;AAC5B,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC;AAClE,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI;AAAE,YAAA,MAAM,IAAI,KAAK,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AM,GAAG,EAAE,EAAE;AAC3B,YAAA,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,MAAM,EAAE,CAAA,KAAA,EAAQ,aAAa,CAAC,MAAM,GAAG,EAAE,CAAA,MAAA,CAAQ,CAAC;;AAG7F,QAAA,MAAM,sBAAsB,GAAG,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9E,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,sBAAsB,CAAA,GAAA,CAAK,CAAC,CAAC;AACvF,QAAA,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC;AAC9B,YAAA,GAAG,aAAa;AAChB,YAAA,OAAO,EAAE,kBAAkB;AAC9B,SAAA,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CACb,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,OAAO,IAAI,KAAK,EAAE,CACrC,IAAI,EACJ;AACI,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,SAAS,EAAE,IAAI;SAClB,CACJ,CAAC,CACL;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,MAAM,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,sBAAsB,CAAO,IAAA,EAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC;;AAE9G;;;;"} | ||
| {"version":3,"file":"builder.mjs","sources":["../src/builder.ts"],"sourcesContent":["import { globSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport {\n isAbsolute,\n relative,\n resolve,\n} from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport typescript from '@rollup/plugin-typescript';\nimport {\n cloneDeep,\n merge,\n} from 'lodash-es';\nimport prettyMilliseconds from 'pretty-ms';\nimport { rollup } from 'rollup';\nimport type {\n ModuleFormat,\n OutputOptions,\n OutputPlugin,\n Plugin,\n RollupOptions,\n} from 'rollup';\nimport { minify } from 'rollup-plugin-esbuild';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\nimport type { SetFieldType } from 'type-fest';\n\nimport type {\n BuilderOptions,\n Config,\n} from './types';\nimport { pathIsFile } from './utils';\nimport {\n bold,\n cyan,\n green,\n} from './utils/rollup/colors';\nimport { stderr } from './utils/rollup/logging';\n\nconst availableOutputFormats = new Set<ModuleFormat>([\n 'amd',\n 'cjs',\n 'commonjs',\n 'es',\n 'esm',\n 'iife',\n 'module',\n 'system',\n 'systemjs',\n 'umd',\n]);\n\nexport const defaultConfigFilePath = './ts-project-builder.config.mjs' as const;\nexport const defaultOutputDir = './dist' as const;\nexport const defaultOutputPreserveModulesRoot = './src' as const;\nconst outputFormatToExtMap = Object.freeze<Record<ModuleFormat, string>>({\n amd: 'amd.js',\n cjs: 'cjs',\n commonjs: 'cjs',\n es: 'mjs',\n esm: 'mjs',\n iife: 'iife.js',\n module: 'mjs',\n system: 'system.js',\n systemjs: 'system.js',\n umd: 'umd.js',\n});\n\nexport class Builder {\n #configFilePath: string;\n #options: BuilderOptions;\n\n constructor(options: BuilderOptions) {\n options = cloneDeep(options);\n if (!options.inputs.length) throw new Error('No inputs specified');\n if (!options.output.formats.size) throw new Error('No output formats specified');\n this.#configFilePath = resolve(options.configFilePath || defaultConfigFilePath);\n this.#options = options;\n }\n\n async #getConfig() {\n if (!this.#configFilePath) return {};\n if (!await pathIsFile(this.#configFilePath)) {\n if (relative(this.#configFilePath, resolve(defaultConfigFilePath)) !== '') {\n throw new Error(`Config file not found: ${this.#configFilePath}`);\n }\n\n return {};\n }\n\n const config = await import(pathToFileURL(resolve(this.#configFilePath)).toString());\n return (config && typeof config === 'object' && 'default' in config ? config.default : config) as Config;\n }\n\n #isOutputOptionEnabled(format: ModuleFormat, optionKey: 'clean' | 'forceClean' | 'minify' | 'preserveModules') {\n if (!this.#options.output[optionKey]) return;\n return this.#options.output[optionKey] === true || this.#options.output[optionKey].has(format);\n }\n\n async build() {\n stderr(cyan('Starting build...'));\n const startAt = Date.now();\n const config = await this.#getConfig();\n const baseOutputOptions: OutputOptions & { ext?: string } = {\n dir: this.#options.output.dirs?.default || defaultOutputDir,\n ext: this.#options.output.exts?.default,\n file: this.#options.output.files?.default,\n preserveModulesRoot: this.#options.output.preserveModulesRoots?.default || defaultOutputPreserveModulesRoot,\n sourcemap: this.#options.output.sourcemaps?.default,\n };\n\n const logOutputTargetsStrings: string[] = [];\n const rollupInputPlugins: Plugin[] = [\n ...config.additionalInputPlugins?.beforeBuiltIns || [],\n nodeExternals(config.builtInInputPluginOptions?.nodeExternal),\n nodeResolve(config.builtInInputPluginOptions?.nodeResolve),\n commonjs(config.builtInInputPluginOptions?.commonjs),\n json(config.builtInInputPluginOptions?.json),\n typescript(config.builtInInputPluginOptions?.typescript),\n ...config.additionalInputPlugins?.afterBuiltIns || [],\n ];\n\n const rollupOptions: RollupOptions = {\n ...config.rollupOptions,\n input: [...new Set(this.#options.inputs)].map((input) => globSync(input)).flat().sort(),\n };\n\n const rollupOutputs: OutputOptions[] = [];\n const rootPath = resolve();\n const toRemovePaths = new Set<string>();\n for (const format of this.#options.output.formats) {\n if (!availableOutputFormats.has(format)) throw new Error(`Invalid output format: ${format}`);\n const configOutputOptions = config.outputOptions?.[format] || config.outputOptions?.default;\n let outputOptions: SetFieldType<OutputOptions, 'plugins', OutputPlugin[]>;\n if (configOutputOptions?.processMethod === 'replace') {\n outputOptions = configOutputOptions.options as typeof outputOptions;\n } else {\n const entryFileNames = `[name].${\n this.#options.output.exts?.[format]\n || baseOutputOptions.ext\n || outputFormatToExtMap[format]\n }`;\n\n outputOptions = {\n dir: this.#options.output.dirs?.[format] || baseOutputOptions.dir,\n entryFileNames,\n exports: 'named',\n externalLiveBindings: false,\n file: this.#options.output.files?.[format] || baseOutputOptions.file,\n generatedCode: {\n arrowFunctions: true,\n constBindings: true,\n objectShorthand: true,\n },\n interop: 'compat',\n plugins: [],\n preserveModules: this.#isOutputOptionEnabled(format, 'preserveModules'),\n // eslint-disable-next-line style/max-len\n preserveModulesRoot: this.#options.output.preserveModulesRoots?.[format] || baseOutputOptions.preserveModulesRoot,\n sourcemap: this.#options.output.sourcemaps?.[format] ?? baseOutputOptions.sourcemap,\n };\n\n if (this.#isOutputOptionEnabled(format, 'minify')) {\n // eslint-disable-next-line style/max-len\n const minifyOptions = config.builtInOutputPluginOptions?.minify?.[format] || config.builtInOutputPluginOptions?.minify?.default;\n outputOptions.plugins?.push(minify(minifyOptions));\n }\n\n outputOptions.plugins?.push(\n ...config.additionalOutputPlugins?.[format]?.afterBuiltIns\n || config.additionalOutputPlugins?.default?.afterBuiltIns\n || [],\n );\n\n outputOptions.plugins?.unshift(\n ...config.additionalOutputPlugins?.[format]?.beforeBuiltIns\n || config.additionalOutputPlugins?.default?.beforeBuiltIns\n || [],\n );\n\n if (configOutputOptions?.processMethod === 'assign') {\n Object.assign(outputOptions, configOutputOptions.options);\n } else merge(outputOptions, configOutputOptions?.options);\n }\n\n outputOptions.format = format;\n if (outputOptions.file) {\n delete outputOptions.dir;\n logOutputTargetsStrings.push(`${outputOptions.file} (${format})`);\n } else if (outputOptions.dir) {\n delete outputOptions.file;\n logOutputTargetsStrings.push(`${outputOptions.dir} (${format})`);\n }\n\n if (this.#isOutputOptionEnabled(format, 'clean')) {\n const outputPath = outputOptions.dir || outputOptions.file;\n if (outputPath) {\n const absoluteOutputPath = resolve(outputPath);\n const relativePath = relative(rootPath, absoluteOutputPath);\n if (relativePath === '') {\n throw new Error('The directory to be cleared is the same as the running directory.');\n }\n\n if (\n !(!isAbsolute(relativePath) && !relativePath.startsWith('..'))\n && !this.#isOutputOptionEnabled(format, 'forceClean')\n ) {\n // eslint-disable-next-line style/max-len\n throw new Error(`The path \"${absoluteOutputPath}\" to be cleaned is not under the running directory. To force clean, please add the --force-clean parameter.`);\n }\n\n toRemovePaths.add(absoluteOutputPath);\n }\n }\n\n rollupOutputs.push(outputOptions);\n }\n\n const logInputFiles = [...rollupOptions.input as string[]];\n if (logInputFiles.length > 20) {\n logInputFiles.splice(20, logInputFiles.length, `... (${logInputFiles.length - 20} more)`);\n }\n\n const logOutputTargetsString = bold(logOutputTargetsStrings.join(', ').trim());\n stderr(cyan(`${bold(logInputFiles.join(', ').trim())} → ${logOutputTargetsString}...`));\n const rollupResult = await rollup({\n ...rollupOptions,\n plugins: rollupInputPlugins,\n });\n\n await Promise.all(\n [...toRemovePaths].map(async (path) => rm(\n path,\n {\n force: true,\n recursive: true,\n },\n )),\n );\n\n await Promise.all(rollupOutputs.map((outputOptions) => rollupResult.write(outputOptions)));\n stderr(green(`Created ${logOutputTargetsString} in ${bold(prettyMilliseconds(Date.now() - startAt))}`));\n }\n}\n\nexport default Builder;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0CA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAe;IACjD,KAAK;IACL,KAAK;IACL,UAAU;IACV,IAAI;IACJ,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,KAAK;AACR,CAAA,CAAC;AAEK,MAAM,qBAAqB,GAAG;AAC9B,MAAM,gBAAgB,GAAG;AACzB,MAAM,gCAAgC,GAAG;AAChD,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAA+B;AACrE,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,EAAE,EAAE,KAAK;AACT,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,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;SAClB,CACJ,CAAC,CACL;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,MAAM,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,sBAAsB,CAAO,IAAA,EAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC;;AAE9G;;;;"} |
+9
-2
@@ -9,3 +9,7 @@ #!/usr/bin/env node | ||
| const BooleanOrModuleFormats = (value) => (value === '' ? true : new Set(value.split(',').map((value) => value.trim().toLowerCase()))); | ||
| function BooleanOrModuleFormats(value) { | ||
| if (value === '') | ||
| return true; | ||
| return new Set(value.split(',').map((value) => value.trim().toLowerCase())); | ||
| } | ||
| function parseSourcemapFlagValue(value) { | ||
@@ -92,2 +96,3 @@ if (!value || value === 'true') | ||
| preserveModules: args.flags.preserveModules, | ||
| // eslint-disable-next-line style/max-len | ||
| preserveModulesRoots: parseCliArgString(args.flags.preserveModulesRoots), | ||
@@ -99,4 +104,6 @@ sourcemaps: (() => { | ||
| const sourcemaps = {}; | ||
| for (const key in parseResult) | ||
| for (const key in parseResult) { | ||
| // eslint-disable-next-line style/max-len | ||
| sourcemaps[key] = parseSourcemapFlagValue(parseResult[key]); | ||
| } | ||
| sourcemaps.default ??= true; | ||
@@ -103,0 +110,0 @@ return sourcemaps; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import { cli } from 'cleye';\nimport type { ModuleFormat } from 'rollup';\n\nimport {\n name,\n version,\n} from '../package.json';\n\nimport Builder, {\n defaultConfigFilePath,\n defaultOutputDir,\n defaultOutputPreserveModulesRoot,\n} from './builder';\nimport type { NonNullableBuilderOutputOptions } from './types';\nimport { parseCliArgString } from './utils';\nimport { handleError } from './utils/rollup/logging';\n\nconst BooleanOrModuleFormats = (value: string) => (value === '' ? true : new Set(value.split(',').map((value) => value.trim().toLowerCase()))) as boolean | Set<ModuleFormat>;\n\nfunction parseSourcemapFlagValue(value?: string) {\n if (!value || value === 'true') return true;\n if (value === 'false') return false;\n if (value === 'hidden' || value === 'inline') return value;\n throw new Error(`Invalid sourcemap option: '${value}'. Valid options are 'true', 'false', 'hidden', or 'inline'.`);\n}\n\n(async () => {\n const args = cli({\n flags: {\n clean: {\n description: 'Clean the target directory or files before output.',\n type: BooleanOrModuleFormats,\n },\n config: {\n alias: 'c',\n default: defaultConfigFilePath,\n description: 'The path to the config file.',\n type: String,\n },\n dirs: {\n default: defaultOutputDir,\n description: 'The output directory paths.',\n type: String,\n },\n exts: {\n description: 'The output file extensions.',\n type: String,\n },\n files: {\n description: 'The output file paths.',\n type: String,\n },\n forceClean: {\n description: 'Force clean the target directory or files before output.',\n type: BooleanOrModuleFormats,\n },\n formats: {\n alias: 'f',\n default: 'cjs,esm',\n description: 'The output formats.',\n type: String,\n },\n minify: {\n alias: 'm',\n description: 'Enable minify output.',\n type: BooleanOrModuleFormats,\n },\n preserveModules: { type: BooleanOrModuleFormats },\n preserveModulesRoots: {\n default: defaultOutputPreserveModulesRoot,\n type: String,\n },\n sourcemaps: {\n description: 'The output sourcemap options.',\n type: String,\n },\n },\n help: { usage: `${name} <inputs...> [flags...]` },\n name,\n parameters: ['<inputs...>'],\n version,\n });\n\n const inputs = args._.inputs;\n if (!inputs.length) inputs.push('./src/index.ts');\n try {\n await new Builder({\n configFilePath: args.flags.config,\n inputs,\n output: {\n clean: args.flags.clean,\n dirs: parseCliArgString<NonNullableBuilderOutputOptions['dirs']>(args.flags.dirs),\n exts: parseCliArgString<NonNullableBuilderOutputOptions['exts']>(args.flags.exts || ''),\n files: parseCliArgString<NonNullableBuilderOutputOptions['files']>(args.flags.files || ''),\n forceClean: args.flags.forceClean,\n formats: new Set(args.flags.formats.split(',') as ModuleFormat[]),\n minify: args.flags.minify,\n preserveModules: args.flags.preserveModules,\n preserveModulesRoots: parseCliArgString<NonNullableBuilderOutputOptions['preserveModulesRoots']>(args.flags.preserveModulesRoots),\n sourcemaps: (() => {\n if (args.flags.sourcemaps === undefined) return;\n const parseResult = parseCliArgString(args.flags.sourcemaps);\n const sourcemaps: NonNullableBuilderOutputOptions['sourcemaps'] = {};\n for (const key in parseResult) sourcemaps[key as keyof NonNullableBuilderOutputOptions['sourcemaps']] = parseSourcemapFlagValue(parseResult[key]);\n sourcemaps.default ??= true;\n return sourcemaps;\n })(),\n },\n }).build();\n } catch (error) {\n handleError(error as Error);\n process.exit(1);\n }\n})();\n"],"names":[],"mappings":";;;;;;;;AAiBA,MAAM,sBAAsB,GAAG,CAAC,KAAa,MAAM,KAAK,KAAK,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAgC;AAE7K,SAAS,uBAAuB,CAAC,KAAc,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,MAAM;AAAE,QAAA,OAAO,IAAI;IAC3C,IAAI,KAAK,KAAK,OAAO;AAAE,QAAA,OAAO,KAAK;AACnC,IAAA,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;AAC1D,IAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAA,4DAAA,CAA8D,CAAC;AACtH;AAEA,CAAC,YAAW;IACR,MAAM,IAAI,GAAG,GAAG,CAAC;AACb,QAAA,KAAK,EAAE;AACH,YAAA,KAAK,EAAE;AACH,gBAAA,WAAW,EAAE,oDAAoD;AACjE,gBAAA,IAAI,EAAE,sBAAsB;AAC/B,aAAA;AACD,YAAA,MAAM,EAAE;AACJ,gBAAA,KAAK,EAA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CAAC,GAAG,uBAAuB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AACjJ,oBAAA,UAAU,CAAC,OAAO,KAAK,IAAI;AAC3B,oBAAA,OAAO,UAAU;AACrB,iBAAC,GAAG;AACP,aAAA;SACJ,CAAC,CAAC,KAAK,EAAE;;IACZ,OAAO,KAAK,EAAE;QACZ,WAAW,CAAC,KAAc,CAAC;AAC3B,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;AAEvB,CAAC,GAAG"} | ||
| {"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import { cli } from 'cleye';\nimport type { ModuleFormat } from 'rollup';\n\nimport {\n name,\n version,\n} from '../package.json';\n\nimport Builder, {\n defaultConfigFilePath,\n defaultOutputDir,\n defaultOutputPreserveModulesRoot,\n} from './builder';\nimport type { NonNullableBuilderOutputOptions } from './types';\nimport { parseCliArgString } from './utils';\nimport { handleError } from './utils/rollup/logging';\n\nfunction BooleanOrModuleFormats(value: string): boolean | Set<ModuleFormat> {\n if (value === '') return true;\n return new Set(value.split(',').map((value) => value.trim().toLowerCase())) as Set<ModuleFormat>;\n}\n\nfunction parseSourcemapFlagValue(value?: string) {\n if (!value || value === 'true') return true;\n if (value === 'false') return false;\n if (value === 'hidden' || value === 'inline') return value;\n throw new Error(`Invalid sourcemap option: '${value}'. Valid options are 'true', 'false', 'hidden', or 'inline'.`);\n}\n\n(async () => {\n const args = cli({\n flags: {\n clean: {\n description: 'Clean the target directory or files before output.',\n type: BooleanOrModuleFormats,\n },\n config: {\n alias: 'c',\n default: defaultConfigFilePath,\n description: 'The path to the config file.',\n type: String,\n },\n dirs: {\n default: defaultOutputDir,\n description: 'The output directory paths.',\n type: String,\n },\n exts: {\n description: 'The output file extensions.',\n type: String,\n },\n files: {\n description: 'The output file paths.',\n type: String,\n },\n forceClean: {\n description: 'Force clean the target directory or files before output.',\n type: BooleanOrModuleFormats,\n },\n formats: {\n alias: 'f',\n default: 'cjs,esm',\n description: 'The output formats.',\n type: String,\n },\n minify: {\n alias: 'm',\n description: 'Enable minify output.',\n type: BooleanOrModuleFormats,\n },\n preserveModules: { type: BooleanOrModuleFormats },\n preserveModulesRoots: {\n default: defaultOutputPreserveModulesRoot,\n type: String,\n },\n sourcemaps: {\n description: 'The output sourcemap options.',\n type: String,\n },\n },\n help: { usage: `${name} <inputs...> [flags...]` },\n name,\n parameters: ['<inputs...>'],\n version,\n });\n\n const inputs = args._.inputs;\n if (!inputs.length) inputs.push('./src/index.ts');\n try {\n await new Builder({\n configFilePath: args.flags.config,\n inputs,\n output: {\n clean: args.flags.clean,\n dirs: parseCliArgString<NonNullableBuilderOutputOptions['dirs']>(args.flags.dirs),\n exts: parseCliArgString<NonNullableBuilderOutputOptions['exts']>(args.flags.exts || ''),\n files: parseCliArgString<NonNullableBuilderOutputOptions['files']>(args.flags.files || ''),\n forceClean: args.flags.forceClean,\n formats: new Set(args.flags.formats.split(',') as ModuleFormat[]),\n minify: args.flags.minify,\n preserveModules: args.flags.preserveModules,\n // eslint-disable-next-line style/max-len\n preserveModulesRoots: parseCliArgString<NonNullableBuilderOutputOptions['preserveModulesRoots']>(args.flags.preserveModulesRoots),\n sourcemaps: (() => {\n if (args.flags.sourcemaps === undefined) return;\n const parseResult = parseCliArgString(args.flags.sourcemaps);\n const sourcemaps: NonNullableBuilderOutputOptions['sourcemaps'] = {};\n for (const key in parseResult) {\n // eslint-disable-next-line style/max-len\n sourcemaps[key as keyof NonNullableBuilderOutputOptions['sourcemaps']] = parseSourcemapFlagValue(parseResult[key]);\n }\n\n sourcemaps.default ??= true;\n return sourcemaps;\n })(),\n },\n }).build();\n } catch (error) {\n handleError(error as Error);\n process.exit(1);\n }\n})();\n"],"names":[],"mappings":";;;;;;;;AAiBA,SAAS,sBAAsB,CAAC,KAAa,EAAA;IACzC,IAAI,KAAK,KAAK,EAAE;AAAE,QAAA,OAAO,IAAI;IAC7B,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC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2C,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;AAC1F,gBAAA,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;AACjC,gBAAA,OAAO,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;AACjE,gBAAA,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;AACzB,gBAAA,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;;gBAE3C,oBAAoB,EAAE,iBAAiB,CAA0D,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC;gBACjI,UAAU,EAAE,CAAC,MAAK;AACd,oBAAA,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS;wBAAE;oBACzC,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;oBAC5D,MAAM,UAAU,GAAkD,EAAE;AACpE,oBAAA,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE;;wBAE3B,UAAU,CAAC,GAA0D,CAAC,GAAG,uBAAuB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;;AAGtH,oBAAA,UAAU,CAAC,OAAO,KAAK,IAAI;AAC3B,oBAAA,OAAO,UAAU;AACrB,iBAAC,GAAG;AACP,aAAA;SACJ,CAAC,CAAC,KAAK,EAAE;;IACZ,OAAO,KAAK,EAAE;QACZ,WAAW,CAAC,KAAc,CAAC;AAC3B,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;AAEvB,CAAC,GAAG"} |
| var name = "ts-project-builder"; | ||
| var version = "3.4.3"; | ||
| var version = "3.4.4"; | ||
| export { name, version }; | ||
| //# sourceMappingURL=package.json.mjs.map |
+4
-2
@@ -45,5 +45,7 @@ import type { RollupCommonJSOptions } from '@rollup/plugin-commonjs'; | ||
| * | ||
| * - If a corresponding value for a format is set, only the specified value will be used for that format. Other formats that are not set will use the default value. | ||
| * - If a corresponding value for a format is set, only the specified value will be used for that format. | ||
| * Other formats that are not set will use the default value. | ||
| * | ||
| * For example, when outputting CJS and ESM formats, if `default.afterBuiltIns` and `esm.afterBuiltIns` are set, ESM will use only `esm.afterBuiltIns`, while CJS will use `default.afterBuiltIns`. | ||
| * For example, when outputting CJS and ESM formats, if `default.afterBuiltIns` and `esm.afterBuiltIns` are set, | ||
| * ESM will use only `esm.afterBuiltIns`, while CJS will use `default.afterBuiltIns`. | ||
| */ | ||
@@ -50,0 +52,0 @@ additionalOutputPlugins?: PartialModuleFormatWithDefaultDict<{ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACR,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,MAAM,EACN,aAAa,EAChB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,MAAM,MAAM,+BAA+B,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC9F,MAAM,MAAM,kCAAkC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,SA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"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAU,MAAM,MAAM,iCAAiD,CAAC;AAE/F,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GASvF,CAAC,CACnB"} |
@@ -7,3 +7,4 @@ import { stat } from 'node:fs/promises'; | ||
| value.split(',').forEach((part) => { | ||
| const [key, value,] = part.replaceAll(/\s+/g, '').split('='); | ||
| // eslint-disable-next-line style/array-bracket-newline, style/array-element-newline | ||
| const [key, value] = part.replaceAll(/\s+/g, '').split('='); | ||
| if (value === undefined) | ||
@@ -10,0 +11,0 @@ key !== undefined && (data.default = key); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.mjs","sources":["../../src/utils/index.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\n\nexport const pathIsFile = async (path: string) => (await stat(path).catch(() => {}))?.isFile();\n\nexport function parseCliArgString<T extends Record<string, string> = Record<string, string>>(value: string) {\n const data: Record<string, string> = {};\n value.split(',').forEach((part) => {\n const [\n key,\n value,\n ] = part.replaceAll(/\\s+/g, '').split('=');\n if (value === undefined) key !== undefined && (data.default = key);\n else if (key) data[key] = value;\n });\n\n return data as T;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,UAAU,GAAG,OAAO,IAAY,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAK,GAAG,CAAC,GAAG,MAAM;AAEtF,SAAU,iBAAiB,CAA4D,KAAa,EAAA;IACtG,MAAM,IAAI,GAA2B,EAAE;IACvC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AAC9B,QAAA,MAAM,CACF,GAAG,EACH,KAAK,EACR,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,KAAK,SAAS,KAAK,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;AAC7D,aAAA,IAAI,GAAG;AAAE,YAAA,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK;AACnC,KAAC,CAAC;AAEF,IAAA,OAAO,IAAS;AACpB;;;;"} | ||
| {"version":3,"file":"index.mjs","sources":["../../src/utils/index.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\n\nexport const pathIsFile = async (path: string) => (await stat(path).catch(() => {}))?.isFile();\n\nexport function parseCliArgString<T extends Record<string, string> = Record<string, string>>(value: string) {\n const data: Record<string, string> = {};\n value.split(',').forEach((part) => {\n // eslint-disable-next-line style/array-bracket-newline, style/array-element-newline\n const [key, value] = part.replaceAll(/\\s+/g, '').split('=');\n if (value === undefined) key !== undefined && (data.default = key);\n else if (key) data[key] = value;\n });\n\n return data as T;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,UAAU,GAAG,OAAO,IAAY,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAK,GAAG,CAAC,GAAG,MAAM;AAEtF,SAAU,iBAAiB,CAA4D,KAAa,EAAA;IACtG,MAAM,IAAI,GAA2B,EAAE;IACvC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;;AAE9B,QAAA,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAC3D,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,KAAK,SAAS,KAAK,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;AAC7D,aAAA,IAAI,GAAG;AAAE,YAAA,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK;AACnC,KAAC,CAAC;AAEF,IAAA,OAAO,IAAS;AACpB;;;;"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/rollup/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAW1C,eAAO,MAAM,MAAM,GAAI,GAAG,YAAY,SAAS,OAAO,EAAE,YAAqD,CAAC;AAC9G,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CA4BpD"} | ||
| {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/rollup/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAW1C,eAAO,MAAM,MAAM,GAAI,GAAG,YAAY,SAAS,OAAO,EAAE,YAAqD,CAAC;AAC9G,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CA6BpD"} |
@@ -14,4 +14,5 @@ import { bold, red, cyan, dim } from './colors.mjs'; | ||
| outputLines.push(cyan(error.url)); | ||
| if (error.loc) | ||
| if (error.loc) { | ||
| outputLines.push(`${relativeId((error.loc.file || error.id))}:${error.loc.line}:${error.loc.column}`); | ||
| } | ||
| else if (error.id) | ||
@@ -18,0 +19,0 @@ outputLines.push(relativeId(error.id)); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"logging.mjs","sources":["../../../src/utils/rollup/logging.ts"],"sourcesContent":["import type { RollupError } from 'rollup';\n\nimport {\n bold,\n cyan,\n dim,\n red,\n} from './colors';\nimport relativeId from './relativeId';\n\n// log to stderr to keep `rollup main.js > bundle.js` from breaking\nexport const stderr = (...parameters: readonly unknown[]) => process.stderr.write(`${parameters.join('')}\\n`);\nexport function handleError(error: RollupError): void {\n const name = error.name || (error.cause as Error)?.name;\n const nameSection = name ? `${name}: ` : '';\n const pluginSection = error.plugin ? `(plugin ${error.plugin}) ` : '';\n const message = `${pluginSection}${nameSection}${error.message}`;\n const outputLines = [bold(red(`[!] ${bold(message.toString())}`))];\n if (error.url) outputLines.push(cyan(error.url));\n if (error.loc) outputLines.push(`${relativeId((error.loc.file || error.id)!)}:${error.loc.line}:${error.loc.column}`);\n else if (error.id) outputLines.push(relativeId(error.id));\n if (error.frame) outputLines.push(dim(error.frame));\n if (error.stack) outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\\n`, '')));\n // ES2022: Error.prototype.cause is optional\n if (error.cause) {\n let cause = error.cause as Error | undefined;\n const causeErrorLines = [];\n let indent = '';\n while (cause) {\n indent += ' ';\n const message = cause.stack || cause;\n causeErrorLines.push(...`[cause] ${message}`.split('\\n').map((line) => `${indent}${line}`));\n cause = cause.cause as Error | undefined;\n }\n\n outputLines.push(dim(causeErrorLines.join('\\n')));\n }\n\n outputLines.push('', '');\n stderr(outputLines.join('\\n'));\n}\n"],"names":[],"mappings":";;;AAUA;AACa,MAAA,MAAM,GAAG,CAAC,GAAG,UAA8B,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,EAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAI,EAAA,CAAA;AACtG,SAAU,WAAW,CAAC,KAAkB,EAAA;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAK,KAAK,CAAC,KAAe,EAAE,IAAI;AACvD,IAAA,MAAM,WAAW,GAAG,IAAI,GAAG,CAAG,EAAA,IAAI,CAAI,EAAA,CAAA,GAAG,EAAE;AAC3C,IAAA,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,GAAG,CAAW,QAAA,EAAA,KAAK,CAAC,MAAM,CAAA,EAAA,CAAI,GAAG,EAAE;IACrE,MAAM,OAAO,GAAG,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,CAAA,EAAG,KAAK,CAAC,OAAO,CAAA,CAAE;AAChE,IAAA,MAAM,WAAW,GAAG,CAAC,IAAI,C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C,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAA,EAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAE,CAAC,CAAC;AAC3F,YAAA,KAAK,GAAG,KAAK,CAAC,KAA0B;;AAG5C,QAAA,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;;AAGrD,IAAA,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IACxB,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClC;;;;"} | ||
| {"version":3,"file":"logging.mjs","sources":["../../../src/utils/rollup/logging.ts"],"sourcesContent":["import type { RollupError } from 'rollup';\n\nimport {\n bold,\n cyan,\n dim,\n red,\n} from './colors';\nimport relativeId from './relativeId';\n\n// log to stderr to keep `rollup main.js > bundle.js` from breaking\nexport const stderr = (...parameters: readonly unknown[]) => process.stderr.write(`${parameters.join('')}\\n`);\nexport function handleError(error: RollupError): void {\n const name = error.name || (error.cause as Error)?.name;\n const nameSection = name ? `${name}: ` : '';\n const pluginSection = error.plugin ? `(plugin ${error.plugin}) ` : '';\n const message = `${pluginSection}${nameSection}${error.message}`;\n const outputLines = [bold(red(`[!] ${bold(message.toString())}`))];\n if (error.url) outputLines.push(cyan(error.url));\n if (error.loc) {\n outputLines.push(`${relativeId((error.loc.file || error.id)!)}:${error.loc.line}:${error.loc.column}`);\n } else if (error.id) outputLines.push(relativeId(error.id));\n if (error.frame) outputLines.push(dim(error.frame));\n if (error.stack) outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\\n`, '')));\n // ES2022: Error.prototype.cause is optional\n if (error.cause) {\n let cause = error.cause as Error | undefined;\n const causeErrorLines = [];\n let indent = '';\n while (cause) {\n indent += ' ';\n const message = cause.stack || cause;\n causeErrorLines.push(...`[cause] ${message}`.split('\\n').map((line) => `${indent}${line}`));\n cause = cause.cause as Error | undefined;\n }\n\n outputLines.push(d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,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;AAKD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,GAAG,MAAM,CAoBhI"} | ||
| {"version":3,"file":"relativeId.d.ts","sourceRoot":"","sources":["../../../src/utils/rollup/relativeId.ts"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;AAKD,wBAAgB,aAAa,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,OAAO,EACzB,cAAc,EAAE,OAAO,GACxB,MAAM,CAoBR"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"relativeId.mjs","sources":["../../../src/utils/rollup/relativeId.ts"],"sourcesContent":["import { relative } from './browser-path';\nimport {\n basename,\n dirname,\n extname,\n isAbsolute,\n normalize,\n resolve,\n} from './path';\n\nexport function getAliasName(id: string): string {\n const base = basename(id);\n return base.slice(0, Math.max(0, base.length - extname(id).length));\n}\n\nexport default function relativeId(id: string): string {\n if (!isAbsolute(id)) return id;\n return relative(resolve(), id);\n}\n\nexport function isPathFragment(name: string): boolean {\n // starting with \"/\", \"./\", \"../\", \"C:/\"\n return name.startsWith('/') || (name.startsWith('.') && (name[1] === '/' || name[1] === '.')) || isAbsolute(name);\n}\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst UPPER_DIR_REGEX = /^(\\.\\.\\/)*\\.\\.$/;\n\nexport function getImportPath(importerId: string, targetPath: string, stripJsExtension: boolean, ensureFileName: boolean): string {\n while (targetPath.startsWith('../')) {\n targetPath = targetPath.slice(3);\n importerId = `_/${importerId}`;\n }\n let relativePath = normalize(relative(dirname(importerId), targetPath));\n if (stripJsExtension && relativePath.endsWith('.js')) {\n relativePath = relativePath.slice(0, -3);\n }\n if (ensureFileName) {\n if (relativePath === '') return `../${basename(targetPath)}`;\n if (UPPER_DIR_REGEX.test(relativePath)) {\n return [\n ...relativePath.split('/'),\n '..',\n basename(targetPath),\n ].join('/');\n }\n }\n return relativePath ? relativePath.startsWith('..') ? relativePath : `./${relativePath}` : '.';\n}\n"],"names":[],"mappings":";;;;AAewB,SAAA,UAAU,CAAC,EAAU,EAAA;AACzC,IAAA,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;AAAE,QAAA,OAAO,EAAE;AAC9B,IAAA,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC;AAClC;;;;"} | ||
| {"version":3,"file":"relativeId.mjs","sources":["../../../src/utils/rollup/relativeId.ts"],"sourcesContent":["import { relative } from './browser-path';\nimport {\n basename,\n dirname,\n extname,\n isAbsolute,\n normalize,\n resolve,\n} from './path';\n\nexport function getAliasName(id: string): string {\n const base = basename(id);\n return base.slice(0, Math.max(0, base.length - extname(id).length));\n}\n\nexport default function relativeId(id: string): string {\n if (!isAbsolute(id)) return id;\n return relative(resolve(), id);\n}\n\nexport function isPathFragment(name: string): boolean {\n // starting with \"/\", \"./\", \"../\", \"C:/\"\n return name.startsWith('/') || (name.startsWith('.') && (name[1] === '/' || name[1] === '.')) || isAbsolute(name);\n}\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst UPPER_DIR_REGEX = /^(\\.\\.\\/)*\\.\\.$/;\n\nexport function getImportPath(\n importerId: string,\n targetPath: string,\n stripJsExtension: boolean,\n ensureFileName: boolean,\n): string {\n while (targetPath.startsWith('../')) {\n targetPath = targetPath.slice(3);\n importerId = `_/${importerId}`;\n }\n let relativePath = normalize(relative(dirname(importerId), targetPath));\n if (stripJsExtension && relativePath.endsWith('.js')) {\n relativePath = relativePath.slice(0, -3);\n }\n if (ensureFileName) {\n if (relativePath === '') return `../${basename(targetPath)}`;\n if (UPPER_DIR_REGEX.test(relativePath)) {\n return [\n ...relativePath.split('/'),\n '..',\n basename(targetPath),\n ].join('/');\n }\n }\n return relativePath ? relativePath.startsWith('..') ? relativePath : `./${relativePath}` : '.';\n}\n"],"names":[],"mappings":";;;;AAewB,SAAA,UAAU,CAAC,EAAU,EAAA;AACzC,IAAA,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;AAAE,QAAA,OAAO,EAAE;AAC9B,IAAA,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC;AAClC;;;;"} |
+5
-6
| { | ||
| "name": "ts-project-builder", | ||
| "type": "module", | ||
| "version": "3.4.3", | ||
| "version": "3.4.4", | ||
| "description": "A powerful TypeScript project builder supporting multiple output formats, automatic cleaning, and customizable plugins.", | ||
@@ -51,9 +51,8 @@ "author": "kiki-kanri", | ||
| "colorette": "^2.0.20", | ||
| "glob": "^11.0.1", | ||
| "lodash-es": "^4.17.21", | ||
| "pretty-ms": "^9.2.0", | ||
| "rollup": "^4.36.0", | ||
| "rollup": "^4.39.0", | ||
| "rollup-plugin-esbuild": "^6.2.1", | ||
| "rollup-plugin-node-externals": "^8.0.0", | ||
| "type-fest": "^4.37.0" | ||
| "type-fest": "^4.39.1" | ||
| }, | ||
@@ -63,5 +62,5 @@ "devDependencies": { | ||
| "@kikiutils/eslint-config": "^0.12.0", | ||
| "@kikiutils/tsconfigs": "^3.0.3", | ||
| "@kikiutils/tsconfigs": "^4.0.0", | ||
| "@types/lodash-es": "^4.17.12", | ||
| "@types/node": "^22.13.11", | ||
| "@types/node": "^22.14.0", | ||
| "jiti": "^2.4.2", | ||
@@ -68,0 +67,0 @@ "tslib": "^2.8.1" |
+6
-3
@@ -0,1 +1,2 @@ | ||
| import { globSync } from 'node:fs'; | ||
| import { rm } from 'node:fs/promises'; | ||
@@ -11,5 +12,4 @@ import { | ||
| import json from '@rollup/plugin-json'; | ||
| import nodeResolve from '@rollup/plugin-node-resolve'; | ||
| import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
| import typescript from '@rollup/plugin-typescript'; | ||
| import { globSync } from 'glob'; | ||
| import { | ||
@@ -29,3 +29,3 @@ cloneDeep, | ||
| import { minify } from 'rollup-plugin-esbuild'; | ||
| import nodeExternals from 'rollup-plugin-node-externals'; | ||
| import { nodeExternals } from 'rollup-plugin-node-externals'; | ||
| import type { SetFieldType } from 'type-fest'; | ||
@@ -163,2 +163,3 @@ | ||
| preserveModules: this.#isOutputOptionEnabled(format, 'preserveModules'), | ||
| // eslint-disable-next-line style/max-len | ||
| preserveModulesRoot: this.#options.output.preserveModulesRoots?.[format] || baseOutputOptions.preserveModulesRoot, | ||
@@ -169,2 +170,3 @@ sourcemap: this.#options.output.sourcemaps?.[format] ?? baseOutputOptions.sourcemap, | ||
| if (this.#isOutputOptionEnabled(format, 'minify')) { | ||
| // eslint-disable-next-line style/max-len | ||
| const minifyOptions = config.builtInOutputPluginOptions?.minify?.[format] || config.builtInOutputPluginOptions?.minify?.default; | ||
@@ -213,2 +215,3 @@ outputOptions.plugins?.push(minify(minifyOptions)); | ||
| ) { | ||
| // eslint-disable-next-line style/max-len | ||
| throw new Error(`The path "${absoluteOutputPath}" to be cleaned is not under the running directory. To force clean, please add the --force-clean parameter.`); | ||
@@ -215,0 +218,0 @@ } |
+10
-2
@@ -18,3 +18,6 @@ import { cli } from 'cleye'; | ||
| const BooleanOrModuleFormats = (value: string) => (value === '' ? true : new Set(value.split(',').map((value) => value.trim().toLowerCase()))) as boolean | Set<ModuleFormat>; | ||
| function BooleanOrModuleFormats(value: string): boolean | Set<ModuleFormat> { | ||
| if (value === '') return true; | ||
| return new Set(value.split(',').map((value) => value.trim().toLowerCase())) as Set<ModuleFormat>; | ||
| } | ||
@@ -100,2 +103,3 @@ function parseSourcemapFlagValue(value?: string) { | ||
| preserveModules: args.flags.preserveModules, | ||
| // eslint-disable-next-line style/max-len | ||
| preserveModulesRoots: parseCliArgString<NonNullableBuilderOutputOptions['preserveModulesRoots']>(args.flags.preserveModulesRoots), | ||
@@ -106,3 +110,7 @@ sourcemaps: (() => { | ||
| const sourcemaps: NonNullableBuilderOutputOptions['sourcemaps'] = {}; | ||
| for (const key in parseResult) sourcemaps[key as keyof NonNullableBuilderOutputOptions['sourcemaps']] = parseSourcemapFlagValue(parseResult[key]); | ||
| for (const key in parseResult) { | ||
| // eslint-disable-next-line style/max-len | ||
| sourcemaps[key as keyof NonNullableBuilderOutputOptions['sourcemaps']] = parseSourcemapFlagValue(parseResult[key]); | ||
| } | ||
| sourcemaps.default ??= true; | ||
@@ -109,0 +117,0 @@ return sourcemaps; |
+4
-2
@@ -56,5 +56,7 @@ import type { RollupCommonJSOptions } from '@rollup/plugin-commonjs'; | ||
| * | ||
| * - If a corresponding value for a format is set, only the specified value will be used for that format. Other formats that are not set will use the default value. | ||
| * - If a corresponding value for a format is set, only the specified value will be used for that format. | ||
| * Other formats that are not set will use the default value. | ||
| * | ||
| * For example, when outputting CJS and ESM formats, if `default.afterBuiltIns` and `esm.afterBuiltIns` are set, ESM will use only `esm.afterBuiltIns`, while CJS will use `default.afterBuiltIns`. | ||
| * For example, when outputting CJS and ESM formats, if `default.afterBuiltIns` and `esm.afterBuiltIns` are set, | ||
| * ESM will use only `esm.afterBuiltIns`, while CJS will use `default.afterBuiltIns`. | ||
| */ | ||
@@ -61,0 +63,0 @@ additionalOutputPlugins?: PartialModuleFormatWithDefaultDict<{ |
@@ -8,6 +8,4 @@ import { stat } from 'node:fs/promises'; | ||
| value.split(',').forEach((part) => { | ||
| const [ | ||
| key, | ||
| value, | ||
| ] = part.replaceAll(/\s+/g, '').split('='); | ||
| // eslint-disable-next-line style/array-bracket-newline, style/array-element-newline | ||
| const [key, value] = part.replaceAll(/\s+/g, '').split('='); | ||
| if (value === undefined) key !== undefined && (data.default = key); | ||
@@ -14,0 +12,0 @@ else if (key) data[key] = value; |
@@ -20,4 +20,5 @@ import type { RollupError } from 'rollup'; | ||
| if (error.url) outputLines.push(cyan(error.url)); | ||
| if (error.loc) outputLines.push(`${relativeId((error.loc.file || error.id)!)}:${error.loc.line}:${error.loc.column}`); | ||
| else if (error.id) outputLines.push(relativeId(error.id)); | ||
| if (error.loc) { | ||
| outputLines.push(`${relativeId((error.loc.file || error.id)!)}:${error.loc.line}:${error.loc.column}`); | ||
| } else if (error.id) outputLines.push(relativeId(error.id)); | ||
| if (error.frame) outputLines.push(dim(error.frame)); | ||
@@ -24,0 +25,0 @@ if (error.stack) outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\n`, ''))); |
@@ -29,3 +29,8 @@ import { relative } from './browser-path'; | ||
| export function getImportPath(importerId: string, targetPath: string, stripJsExtension: boolean, ensureFileName: boolean): string { | ||
| export function getImportPath( | ||
| importerId: string, | ||
| targetPath: string, | ||
| stripJsExtension: boolean, | ||
| ensureFileName: boolean, | ||
| ): string { | ||
| while (targetPath.startsWith('../')) { | ||
@@ -32,0 +37,0 @@ targetPath = targetPath.slice(3); |
105903
1.5%12
-7.69%1196
2.57%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated