@xylabs/ts-scripts-yarn3 6.3.5 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile-types.mjs +45 -68
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +50 -76
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +23 -38
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +28 -57
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +16 -31
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint.mjs +195 -0
- package/dist/actions/deplint.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +20 -41
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +20 -41
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +20 -41
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +20 -41
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -54
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +864 -1241
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -48
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +191 -271
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +6 -16
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1086 -1237
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1338 -1583
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +100 -154
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +4 -8
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1086 -1238
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1086 -1238
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +413 -292
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +3 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const includes = ['.stories.', '.spec.', '.d.ts', '.d.cts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && (includes.find(include => file.includes(include))))\n\n console.log(chalk.green(`Compiling Files ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;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Q,SAASQ,iBAAiB,CAAC;AACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA9EkC;;;AHtE3B,IAAMC,iBAAiB,8BAAOC,WAAqB,CAAC,MAAC;AAC1D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,aAAaP,GAAAA,EAAK,CAAA;AAC1C,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAChC,QAAMW,UAAUF,QAAOE;AAEvB,QAAMC,cAAc,MAAMC,mBAAmBJ,OAAAA;AAE7C,MAAIG,cAAc,GAAG;AACnB,WAAOA;EACT;AAEA,SAAQD,UAAU,MAAMG,eAAeL,OAAAA,IAAU;AACnD,GAb8B;","names":["chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","promises","fs","chalk","sortPackageJson","packagePublint","params","pkgDir","process","env","INIT_CWD","sortedPkg","sortPackageJson","fs","readFile","writeFile","pkg","JSON","parse","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","build","defineConfig","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","includes","files","buildEntries","filter","file","find","ext","endsWith","include","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","tsupResults","packageCompileTsup","packagePublint"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const includes = ['.stories.', '.spec.', '.d.ts', '.d.cts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && (includes.find(include => file.includes(include))))\n\n console.log(chalk.green(`Compiling Files ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,OAAO,eAAe;AAEtB,IAAI;AAEG,IAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,WAAO,UAAU,QAAQ,UAAU,CAAC,CAAC;AAAA,EACvC;AAEA,QAAM,qBAAqB,MAAM,YAAY,MAAM,EAAE,OAAO,MAAM,SAAS,EAAE,OAAO,iBAAiB,EAAE,EAAE,CAAC,EAAE,OAAO;AACnH,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,MAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,SAAO,UAAU,QAAQ,UAAU,CAAC,CAAC;AACvC;;;ACnBA,SAAS,YAAY,UAAU;AAE/B,OAAOC,YAAW;AAElB,OAAO,qBAAqB;AAIrB,IAAM,iBAAiB,OAAO,WAAkC;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AA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,KACtC;AAEP;;;AHpJO,IAAM,iBAAiB,OAAO,WAAqB,CAAC,MAAuB;AAChF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAIC,OAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAMC,UAAS,MAAM,WAAW,QAAQ;AACxC,QAAM,UAAUA,QAAO;AAEvB,QAAM,cAAc,MAAM,mBAAmBA,OAAM;AAEnD,MAAI,cAAc,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,SAAQ,UAAU,MAAM,eAAeA,OAAM,IAAI;AACnD;","names":["chalk","chalk","chalk","sys","deepmerge","config","require","config","chalk","sys","config","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","config","cwd","chalk","createProgramFromConfig","getPreEmitDiagnostics","formatDiagnosticsWithColorAndContext","sys","DiagnosticCategory","options","config","chalk","config"]}
|
|
@@ -1,49 +1,45 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/lib/loadConfig.ts
|
|
5
2
|
import chalk from "chalk";
|
|
6
3
|
import { cosmiconfig } from "cosmiconfig";
|
|
4
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
7
5
|
import deepmerge from "deepmerge";
|
|
8
6
|
var config;
|
|
9
|
-
var loadConfig =
|
|
7
|
+
var loadConfig = async (params) => {
|
|
10
8
|
if (config) {
|
|
11
9
|
return deepmerge(config, params ?? {});
|
|
12
10
|
}
|
|
13
|
-
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
14
|
-
cache: true
|
|
15
|
-
}).search();
|
|
11
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
16
12
|
config = cosmicConfigResult?.config;
|
|
17
13
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
18
14
|
if (configFilePath) {
|
|
19
15
|
console.log(chalk.gray(`Loading config from ${configFilePath}`));
|
|
20
16
|
}
|
|
21
17
|
return deepmerge(config, params ?? {});
|
|
22
|
-
}
|
|
18
|
+
};
|
|
23
19
|
|
|
24
20
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
25
21
|
import { cwd } from "node:process";
|
|
26
22
|
import chalk2 from "chalk";
|
|
27
23
|
import { createProgramFromConfig } from "tsc-prog";
|
|
28
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
DiagnosticCategory,
|
|
26
|
+
formatDiagnosticsWithColorAndContext,
|
|
27
|
+
getPreEmitDiagnostics,
|
|
28
|
+
sys as sys2
|
|
29
|
+
} from "typescript";
|
|
29
30
|
|
|
30
31
|
// src/actions/package/compile/inputs.ts
|
|
31
32
|
import { glob } from "glob";
|
|
32
|
-
var getAllInputs =
|
|
33
|
-
return glob.sync(`${folder}/**/*.*`, {
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}, "getAllInputs");
|
|
33
|
+
var getAllInputs = (folder) => {
|
|
34
|
+
return glob.sync(`${folder}/**/*.*`, { posix: true });
|
|
35
|
+
};
|
|
37
36
|
|
|
38
37
|
// src/actions/package/compile/buildEntries.ts
|
|
39
|
-
var buildEntries =
|
|
38
|
+
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
40
39
|
let entries = [];
|
|
41
40
|
switch (entryMode) {
|
|
42
41
|
case "platform": {
|
|
43
|
-
entries = [
|
|
44
|
-
`${folder}/index-node.ts`,
|
|
45
|
-
`${folder}/index-browser.ts`
|
|
46
|
-
];
|
|
42
|
+
entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`];
|
|
47
43
|
break;
|
|
48
44
|
}
|
|
49
45
|
case "all": {
|
|
@@ -51,40 +47,42 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
51
47
|
break;
|
|
52
48
|
}
|
|
53
49
|
default: {
|
|
54
|
-
entries = [
|
|
55
|
-
`${folder}/index.ts`
|
|
56
|
-
];
|
|
50
|
+
entries = [`${folder}/index.ts`];
|
|
57
51
|
break;
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
61
55
|
return entries;
|
|
62
|
-
}
|
|
56
|
+
};
|
|
63
57
|
|
|
64
58
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
65
59
|
import { createRequire } from "node:module";
|
|
66
60
|
import deepmerge2 from "deepmerge";
|
|
67
|
-
import {
|
|
68
|
-
|
|
61
|
+
import {
|
|
62
|
+
findConfigFile,
|
|
63
|
+
readConfigFile,
|
|
64
|
+
sys
|
|
65
|
+
} from "typescript";
|
|
66
|
+
var getNested = (config2) => {
|
|
69
67
|
if (config2.extends) {
|
|
70
68
|
const require2 = createRequire(import.meta.url);
|
|
71
69
|
const opts = require2(config2.extends);
|
|
72
70
|
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
73
71
|
}
|
|
74
72
|
return config2.compilerOptions;
|
|
75
|
-
}
|
|
76
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
73
|
+
};
|
|
74
|
+
var getCompilerOptionsJSONFollowExtends = (filename) => {
|
|
77
75
|
const config2 = readConfigFile(filename, sys.readFile).config;
|
|
78
76
|
return getNested(config2);
|
|
79
|
-
}
|
|
80
|
-
var getCompilerOptions =
|
|
77
|
+
};
|
|
78
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
81
79
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
82
80
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
83
81
|
return deepmerge2(configFileCompilerOptions, options);
|
|
84
|
-
}
|
|
82
|
+
};
|
|
85
83
|
|
|
86
84
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
87
|
-
var packageCompileTscTypes =
|
|
85
|
+
var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
88
86
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
89
87
|
const verbose = config2?.verbose ?? false;
|
|
90
88
|
const compilerOptions = {
|
|
@@ -100,54 +98,40 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
100
98
|
emitDeclarationOnly: true,
|
|
101
99
|
noEmit: false
|
|
102
100
|
};
|
|
103
|
-
const validTsExt = [
|
|
104
|
-
|
|
105
|
-
".tsx",
|
|
106
|
-
".d.ts",
|
|
107
|
-
".cts",
|
|
108
|
-
".d.cts",
|
|
109
|
-
".mts",
|
|
110
|
-
".d.mts"
|
|
111
|
-
];
|
|
112
|
-
const excludes = [
|
|
113
|
-
".stories.",
|
|
114
|
-
".spec."
|
|
115
|
-
];
|
|
101
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
102
|
+
const excludes = [".stories.", ".spec."];
|
|
116
103
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
117
104
|
console.log(chalk2.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
118
105
|
if (files.length > 0) {
|
|
119
106
|
const program = createProgramFromConfig({
|
|
120
107
|
basePath: pkg ?? cwd(),
|
|
121
108
|
compilerOptions,
|
|
122
|
-
exclude: [
|
|
123
|
-
"dist",
|
|
124
|
-
"docs",
|
|
125
|
-
"**/*.spec.*",
|
|
126
|
-
"**/*.stories.*",
|
|
127
|
-
"src/**/spec/**/*"
|
|
128
|
-
],
|
|
109
|
+
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
129
110
|
files
|
|
130
111
|
});
|
|
131
112
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
132
113
|
if (diagnostics.length > 0) {
|
|
133
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
114
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
115
|
+
diagnostics,
|
|
116
|
+
{
|
|
117
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
118
|
+
getCurrentDirectory: () => folder,
|
|
119
|
+
getNewLine: () => sys2.newLine
|
|
120
|
+
}
|
|
121
|
+
);
|
|
138
122
|
console.error(formattedDiagnostics);
|
|
139
123
|
}
|
|
140
124
|
program.emit();
|
|
141
125
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
142
126
|
}
|
|
143
127
|
return 0;
|
|
144
|
-
}
|
|
128
|
+
};
|
|
145
129
|
|
|
146
130
|
// src/actions/package/compile/compileTypes.ts
|
|
147
|
-
var packageCompileTypes =
|
|
131
|
+
var packageCompileTypes = async (inConfig = {}) => {
|
|
148
132
|
const config2 = await loadConfig(inConfig);
|
|
149
133
|
return packageCompileTscTypes(void 0, config2);
|
|
150
|
-
}
|
|
134
|
+
};
|
|
151
135
|
export {
|
|
152
136
|
packageCompileTypes
|
|
153
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACN1B,SAASY,WAAW;AAEpB,OAAOC,YAAW;AAElB,SAASC,+BAA+B;AAExC,SACEC,oBAAoBC,sCAAsCC,uBAAuBC,OAAAA,YAC5E;;;ACRP,SAASC,YAAY;AAEd,IAAMC,eAAe,wBAACC,WAAAA;AAE3B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,OAAO;EAAK,CAAA;AACrD,GAH4B;;;ACCrB,IAAMC,eAAe,wBAACC,QAAgBC,YAAuB,UAAUC,wBAAwB,MAAMC,UAAU,UAAK;AACzH,MAAIC,UAAoB,CAAA;AACxB,UAAQH,WAAAA;IACN,KAAK,YAAY;AACfG,gBAAU;QAAC,GAAGJ,MAAAA;QAAwB,GAAGA,MAAAA;;AACzC;IACF;IACA,KAAK,OAAO;AACVI,gB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AA;AAEhC,SAAOG,uBAAuBC,QAAWH,OAAAA;AAC3C,GAJmC;","names":["chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","config","loadConfig","packageCompileTscTypes","undefined"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,OAAO,eAAe;AAEtB,IAAI;AAEG,IAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,WAAO,UAAU,QAAQ,UAAU,CAAC,CAAC;AAAA,EACvC;AAEA,QAAM,qBAAqB,MAAM,YAAY,MAAM,EAAE,OAAO,MAAM,SAAS,EAAE,OAAO,iBAAiB,EAAE,EAAE,CAAC,EAAE,OAAO;AACnH,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,MAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,SAAO,UAAU,QAAQ,UAAU,CAAC,CAAC;AACvC;;;ACnBA,SAAS,WAAW;AAEpB,OAAOA,YAAW;AAElB,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EAAoB;AAAA,EAAsC;AAAA,EAAuB,OAAAC;AAAA,OAC5E;;;ACRP,SAAS,YAAY;AAEd,IAAM,eAAe,CAAC,WAAmB;AAE9C,SAAO,KAAK,KAAK,GAAG,MAAM,WAAW,EAAE,OAAO,KAAK,CAAC;AACtD;;;ACFO,IAAM,eAAe,CAAC,QAAgB,YAAuB,UAAU,wBAAwB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AI,CAAC;AAAA,EACxG;AACA,SAAO;AACT;;;AInEO,IAAM,sBAAsB,OAAO,WAAqB,CAAC,MAAuB;AACrF,QAAMC,UAAS,MAAM,WAAW,QAAQ;AAExC,SAAO,uBAAuB,QAAWA,OAAqB;AAChE;","names":["chalk","sys","deepmerge","config","require","config","chalk","sys","config"]}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/actions/package/compile/copyTypeFiles.ts
|
|
5
2
|
import { copyFile, readdir } from "node:fs/promises";
|
|
6
3
|
import { Mutex } from "async-mutex";
|
|
7
4
|
var copyFileMutex = new Mutex();
|
|
8
|
-
var getDistTypeFiles =
|
|
5
|
+
var getDistTypeFiles = async (compilerOptions) => {
|
|
9
6
|
const outDir = compilerOptions.outDir ?? "dist";
|
|
10
|
-
return (await readdir(outDir, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, "getDistTypeFiles");
|
|
14
|
-
var getDistTypeMapFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
7
|
+
return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts")).map((file) => `${outDir}/${file}`);
|
|
8
|
+
};
|
|
9
|
+
var getDistTypeMapFiles = async (compilerOptions) => {
|
|
15
10
|
const outDir = compilerOptions.outDir ?? "dist";
|
|
16
|
-
return (await readdir(outDir, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, "getDistTypeMapFiles");
|
|
20
|
-
var copyTypeFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
11
|
+
return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts.map")).map((file) => `${outDir}/${file}`);
|
|
12
|
+
};
|
|
13
|
+
var copyTypeFiles = async (compilerOptions) => {
|
|
21
14
|
await copyFileMutex.runExclusive(async () => {
|
|
22
15
|
const distTypeFiles = await getDistTypeFiles(compilerOptions);
|
|
23
|
-
await Promise.all(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
await Promise.all(
|
|
17
|
+
distTypeFiles.map(async (file) => {
|
|
18
|
+
await copyFile(file, file.replace("d.ts", "d.mts"));
|
|
19
|
+
await copyFile(file, file.replace("d.ts", "d.cts"));
|
|
20
|
+
})
|
|
21
|
+
);
|
|
27
22
|
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
28
|
-
await Promise.all(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
await Promise.all(
|
|
24
|
+
distTypeMapFiles.map(async (file) => {
|
|
25
|
+
await copyFile(file, file.replace("d.ts.map", "d.mts.map"));
|
|
26
|
+
await copyFile(file, file.replace("d.ts.map", "d.cts.map"));
|
|
27
|
+
})
|
|
28
|
+
);
|
|
32
29
|
});
|
|
33
|
-
}
|
|
30
|
+
};
|
|
34
31
|
export {
|
|
35
32
|
copyTypeFiles
|
|
36
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'node:fs/promises'\n\nimport { Mutex } from 'async-mutex'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n // using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n // hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'node:fs/promises'\n\nimport { Mutex } from 'async-mutex'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n // using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n // hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.repl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(target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/actions/package/compile/deepMerge.ts
|
|
5
2
|
function deepMerge(target, source) {
|
|
6
3
|
if (!source || typeof source !== "object") return target;
|
|
@@ -16,7 +13,6 @@ function deepMerge(target, source) {
|
|
|
16
13
|
}
|
|
17
14
|
return target;
|
|
18
15
|
}
|
|
19
|
-
__name(deepMerge, "deepMerge");
|
|
20
16
|
function deepMergeObjects(objects) {
|
|
21
17
|
const result = {};
|
|
22
18
|
for (const obj of objects) {
|
|
@@ -24,7 +20,6 @@ function deepMergeObjects(objects) {
|
|
|
24
20
|
}
|
|
25
21
|
return result;
|
|
26
22
|
}
|
|
27
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
28
23
|
export {
|
|
29
24
|
deepMergeObjects
|
|
30
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/deepMerge.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/deepMerge.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n"],"mappings":";AAGA,SAAS,UAA+B,QAAmB,QAAsB;AAC/E,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAElD,aAAW,OAAO,OAAO,KAAK,MAAM,GAAG;AACrC,QACE,OAAO,OAAO,GAAG,MAAM,YACpB,OAAO,GAAG,MAAM,QAChB,CAAC,MAAM,QAAQ,OAAO,GAAG,CAAC,GAC7B;AAEA,UAAI,CAAC,OAAO,GAAG,KAAK,OAAO,OAAO,GAAG,MAAM,UAAU;AACnD,eAAO,GAAG,IAAI,CAAC;AAAA,MACjB;AACA,gBAAU,OAAO,GAAG,GAAG,OAAO,GAAG,CAAC;AAAA,IACpC,OAAO;AAEL,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,iBAAsC,SAAiB;AACrE,QAAM,SAAS,CAAC;AAChB,aAAW,OAAO,SAAS;AACzB,cAAU,QAAQ,GAAG;AAAA,EACvB;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
5
2
|
import { createRequire } from "node:module";
|
|
6
3
|
import deepmerge from "deepmerge";
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import {
|
|
5
|
+
findConfigFile,
|
|
6
|
+
readConfigFile,
|
|
7
|
+
sys
|
|
8
|
+
} from "typescript";
|
|
9
|
+
var getNested = (config) => {
|
|
9
10
|
if (config.extends) {
|
|
10
11
|
const require2 = createRequire(import.meta.url);
|
|
11
12
|
const opts = require2(config.extends);
|
|
12
13
|
return deepmerge(getNested(opts), config.compilerOptions ?? {});
|
|
13
14
|
}
|
|
14
15
|
return config.compilerOptions;
|
|
15
|
-
}
|
|
16
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
16
|
+
};
|
|
17
|
+
var getCompilerOptionsJSONFollowExtends = (filename) => {
|
|
17
18
|
const config = readConfigFile(filename, sys.readFile).config;
|
|
18
19
|
return getNested(config);
|
|
19
|
-
}
|
|
20
|
-
var getCompilerOptions =
|
|
20
|
+
};
|
|
21
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
21
22
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
22
23
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
23
24
|
return deepmerge(configFileCompilerOptions, options);
|
|
24
|
-
}
|
|
25
|
+
};
|
|
25
26
|
export {
|
|
26
27
|
getCompilerOptions
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAE9B,OAAO,eAAe;AAGtB;AAAA,EACE;AAAA,EAAgB;AAAA,EAAgB;AAAA,OAC3B;AAEP,IAAM,YAAY,CAAC,WAAsC;AACvD,MAAI,OAAO,SAAS;AAClB,UAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,UAAM,OAAOA,SAAQ,OAAO,OAAO;AACnC,WAAO,UAAU,UAAU,IAAI,GAAG,OAAO,mBAAmB,CAAC,CAAC;AAAA,EAChE;AAEA,SAAO,OAAO;AAChB;AAEA,IAAM,sCAAsC,CAAC,aAAsC;AACjF,QAAM,SAAS,eAAe,UAAU,IAAI,QAAQ,EAAE;AACtD,SAAO,UAAU,MAAM;AACzB;AAEO,IAAM,qBAAqB,CAAC,UAA2B,CAAC,GAAG,WAAmB,oBAAqC;AACxH,QAAM,iBAAiB,eAAe,MAAM,IAAI,YAAY,QAAQ;AACpE,QAAM,6BAA6B,iBAAiB,oCAAoC,cAAc,IAAI,WAAc,CAAC;AAEzH,SAAO,UAAU,2BAA2B,OAAO;AACrD;","names":["require"]}
|