@xylabs/ts-scripts-yarn3 6.0.5 → 6.0.7
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 +11 -0
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/compile-types.mjs +2 -2
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +7 -9
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/index.mjs +198 -214
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +97 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +16 -31
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +152 -177
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +14 -29
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +94 -82
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +168 -193
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +97 -169
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +100 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +100 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +1 -6
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +1 -6
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +99 -171
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +110 -96
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -55
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +99 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +99 -171
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +20 -12
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +6 -11
- package/dist/index.mjs +208 -225
- package/dist/index.mjs.map +1 -1
- package/dist/types/actions/build.d.ts +9 -0
- package/dist/types/actions/build.d.ts.map +1 -0
- package/dist/types/actions/clean-docs.d.ts +2 -0
- package/dist/types/actions/clean-docs.d.ts.map +1 -0
- package/dist/types/actions/clean-eslint.d.ts +2 -0
- package/dist/types/actions/clean-eslint.d.ts.map +1 -0
- package/dist/types/actions/clean-jest.d.ts +2 -0
- package/dist/types/actions/clean-jest.d.ts.map +1 -0
- package/dist/types/actions/clean.d.ts +12 -0
- package/dist/types/actions/clean.d.ts.map +1 -0
- package/dist/types/actions/compile-types.d.ts +16 -0
- package/dist/types/actions/compile-types.d.ts.map +1 -0
- package/dist/types/actions/compile.d.ts +19 -0
- package/dist/types/actions/compile.d.ts.map +1 -0
- package/dist/types/actions/copy-assets.d.ts +6 -0
- package/dist/types/actions/copy-assets.d.ts.map +1 -0
- package/dist/types/actions/cycle.d.ts +2 -0
- package/dist/types/actions/cycle.d.ts.map +1 -0
- package/dist/types/actions/dead.d.ts +2 -0
- package/dist/types/actions/dead.d.ts.map +1 -0
- package/dist/types/actions/deploy-major.d.ts +2 -0
- package/dist/types/actions/deploy-major.d.ts.map +1 -0
- package/dist/types/actions/deploy-minor.d.ts +2 -0
- package/dist/types/actions/deploy-minor.d.ts.map +1 -0
- package/dist/types/actions/deploy-next.d.ts +2 -0
- package/dist/types/actions/deploy-next.d.ts.map +1 -0
- package/dist/types/actions/deploy.d.ts +2 -0
- package/dist/types/actions/deploy.d.ts.map +1 -0
- package/dist/types/actions/deps.d.ts +13 -0
- package/dist/types/actions/deps.d.ts.map +1 -0
- package/dist/types/actions/dupdeps.d.ts +2 -0
- package/dist/types/actions/dupdeps.d.ts.map +1 -0
- package/dist/types/actions/fix.d.ts +3 -0
- package/dist/types/actions/fix.d.ts.map +1 -0
- package/dist/types/actions/gen-docs.d.ts +11 -0
- package/dist/types/actions/gen-docs.d.ts.map +1 -0
- package/dist/types/actions/gitignore-gen.d.ts +2 -0
- package/dist/types/actions/gitignore-gen.d.ts.map +1 -0
- package/dist/types/actions/gitlint-fix.d.ts +2 -0
- package/dist/types/actions/gitlint-fix.d.ts.map +1 -0
- package/dist/types/actions/gitlint.d.ts +2 -0
- package/dist/types/actions/gitlint.d.ts.map +1 -0
- package/dist/types/actions/index.d.ts +38 -0
- package/dist/types/actions/index.d.ts.map +1 -0
- package/dist/types/actions/license.d.ts +2 -0
- package/dist/types/actions/license.d.ts.map +1 -0
- package/dist/types/actions/lint.d.ts +14 -0
- package/dist/types/actions/lint.d.ts.map +1 -0
- package/dist/types/actions/npmignore-gen.d.ts +2 -0
- package/dist/types/actions/npmignore-gen.d.ts.map +1 -0
- package/dist/types/actions/package/clean-outputs.d.ts +2 -0
- package/dist/types/actions/package/clean-outputs.d.ts.map +1 -0
- package/dist/types/actions/package/clean-typescript.d.ts +2 -0
- package/dist/types/actions/package/clean-typescript.d.ts.map +1 -0
- package/dist/types/actions/package/clean.d.ts +2 -0
- package/dist/types/actions/package/clean.d.ts.map +1 -0
- package/dist/types/actions/package/compile/XyConfig.d.ts +58 -0
- package/dist/types/actions/package/compile/XyConfig.d.ts.map +1 -0
- package/dist/types/actions/package/compile/buildEntries.d.ts +3 -0
- package/dist/types/actions/package/compile/buildEntries.d.ts.map +1 -0
- package/dist/types/actions/package/compile/compile.d.ts +3 -0
- package/dist/types/actions/package/compile/compile.d.ts.map +1 -0
- package/dist/types/actions/package/compile/compileTypes.d.ts +3 -0
- package/dist/types/actions/package/compile/compileTypes.d.ts.map +1 -0
- package/dist/types/actions/package/compile/copyTypeFiles.d.ts +3 -0
- package/dist/types/actions/package/compile/copyTypeFiles.d.ts.map +1 -0
- package/dist/types/actions/package/compile/deepMerge.d.ts +4 -0
- package/dist/types/actions/package/compile/deepMerge.d.ts.map +1 -0
- package/dist/types/actions/package/compile/getCompilerOptions.d.ts +3 -0
- package/dist/types/actions/package/compile/getCompilerOptions.d.ts.map +1 -0
- package/dist/types/actions/package/compile/index.d.ts +7 -0
- package/dist/types/actions/package/compile/index.d.ts.map +1 -0
- package/dist/types/actions/package/compile/inputs.d.ts +2 -0
- package/dist/types/actions/package/compile/inputs.d.ts.map +1 -0
- package/dist/types/actions/package/compile/packageCompileTsc.d.ts +4 -0
- package/dist/types/actions/package/compile/packageCompileTsc.d.ts.map +1 -0
- package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts +4 -0
- package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts.map +1 -0
- package/dist/types/actions/package/compile/packageCompileTsup.d.ts +5 -0
- package/dist/types/actions/package/compile/packageCompileTsup.d.ts.map +1 -0
- package/dist/types/actions/package/copy-assets.d.ts +5 -0
- package/dist/types/actions/package/copy-assets.d.ts.map +1 -0
- package/dist/types/actions/package/deps.d.ts +2 -0
- package/dist/types/actions/package/deps.d.ts.map +1 -0
- package/dist/types/actions/package/gen-docs.d.ts +2 -0
- package/dist/types/actions/package/gen-docs.d.ts.map +1 -0
- package/dist/types/actions/package/index.d.ts +11 -0
- package/dist/types/actions/package/index.d.ts.map +1 -0
- package/dist/types/actions/package/lint.d.ts +2 -0
- package/dist/types/actions/package/lint.d.ts.map +1 -0
- package/dist/types/actions/package/publint.d.ts +5 -0
- package/dist/types/actions/package/publint.d.ts.map +1 -0
- package/dist/types/actions/package/recompile.d.ts +2 -0
- package/dist/types/actions/package/recompile.d.ts.map +1 -0
- package/dist/types/actions/publint.d.ts +12 -0
- package/dist/types/actions/publint.d.ts.map +1 -0
- package/dist/types/actions/rebuild.d.ts +6 -0
- package/dist/types/actions/rebuild.d.ts.map +1 -0
- package/dist/types/actions/recompile.d.ts +16 -0
- package/dist/types/actions/recompile.d.ts.map +1 -0
- package/dist/types/actions/reinstall.d.ts +2 -0
- package/dist/types/actions/reinstall.d.ts.map +1 -0
- package/dist/types/actions/relint.d.ts +13 -0
- package/dist/types/actions/relint.d.ts.map +1 -0
- package/dist/types/actions/retest.d.ts +2 -0
- package/dist/types/actions/retest.d.ts.map +1 -0
- package/dist/types/actions/sonar.d.ts +2 -0
- package/dist/types/actions/sonar.d.ts.map +1 -0
- package/dist/types/actions/statics.d.ts +2 -0
- package/dist/types/actions/statics.d.ts.map +1 -0
- package/dist/types/actions/test.d.ts +2 -0
- package/dist/types/actions/test.d.ts.map +1 -0
- package/dist/types/actions/up.d.ts +2 -0
- package/dist/types/actions/up.d.ts.map +1 -0
- package/dist/types/actions/updo.d.ts +2 -0
- package/dist/types/actions/updo.d.ts.map +1 -0
- package/dist/types/actions/upplug.d.ts +2 -0
- package/dist/types/actions/upplug.d.ts.map +1 -0
- package/dist/types/actions/upyarn.d.ts +2 -0
- package/dist/types/actions/upyarn.d.ts.map +1 -0
- package/dist/types/actions/yarn3only.d.ts +2 -0
- package/dist/types/actions/yarn3only.d.ts.map +1 -0
- package/dist/types/bin/package/build-only.d.ts +3 -0
- package/dist/types/bin/package/build-only.d.ts.map +1 -0
- package/dist/types/bin/package/build.d.ts +3 -0
- package/dist/types/bin/package/build.d.ts.map +1 -0
- package/dist/types/bin/package/clean-outputs.d.ts +3 -0
- package/dist/types/bin/package/clean-outputs.d.ts.map +1 -0
- package/dist/types/bin/package/clean-typescript.d.ts +3 -0
- package/dist/types/bin/package/clean-typescript.d.ts.map +1 -0
- package/dist/types/bin/package/clean.d.ts +3 -0
- package/dist/types/bin/package/clean.d.ts.map +1 -0
- package/dist/types/bin/package/compile-only.d.ts +3 -0
- package/dist/types/bin/package/compile-only.d.ts.map +1 -0
- package/dist/types/bin/package/compile-tsup.d.ts +3 -0
- package/dist/types/bin/package/compile-tsup.d.ts.map +1 -0
- package/dist/types/bin/package/compile-types.d.ts +3 -0
- package/dist/types/bin/package/compile-types.d.ts.map +1 -0
- package/dist/types/bin/package/compile.d.ts +3 -0
- package/dist/types/bin/package/compile.d.ts.map +1 -0
- package/dist/types/bin/package/copy-assets-cjs.d.ts +3 -0
- package/dist/types/bin/package/copy-assets-cjs.d.ts.map +1 -0
- package/dist/types/bin/package/copy-assets-esm.d.ts +3 -0
- package/dist/types/bin/package/copy-assets-esm.d.ts.map +1 -0
- package/dist/types/bin/package/deps.d.ts +3 -0
- package/dist/types/bin/package/deps.d.ts.map +1 -0
- package/dist/types/bin/package/fix.d.ts +3 -0
- package/dist/types/bin/package/fix.d.ts.map +1 -0
- package/dist/types/bin/package/gen-docs.d.ts +3 -0
- package/dist/types/bin/package/gen-docs.d.ts.map +1 -0
- package/dist/types/bin/package/lint.d.ts +3 -0
- package/dist/types/bin/package/lint.d.ts.map +1 -0
- package/dist/types/bin/package/publint.d.ts +3 -0
- package/dist/types/bin/package/publint.d.ts.map +1 -0
- package/dist/types/bin/package/recompile.d.ts +3 -0
- package/dist/types/bin/package/recompile.d.ts.map +1 -0
- package/dist/types/bin/package/relint.d.ts +3 -0
- package/dist/types/bin/package/relint.d.ts.map +1 -0
- package/dist/types/bin/xy.d.ts +3 -0
- package/dist/types/bin/xy.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/checkResult.d.ts +2 -0
- package/dist/types/lib/checkResult.d.ts.map +1 -0
- package/dist/types/lib/createBuildConfig.d.ts +2 -0
- package/dist/types/lib/createBuildConfig.d.ts.map +1 -0
- package/dist/types/lib/defaultBuildConfig.d.ts +9 -0
- package/dist/types/lib/defaultBuildConfig.d.ts.map +1 -0
- package/dist/types/lib/deleteGlob.d.ts +2 -0
- package/dist/types/lib/deleteGlob.d.ts.map +1 -0
- package/dist/types/lib/dependencies/DuplicateDetector.d.ts +9 -0
- package/dist/types/lib/dependencies/DuplicateDetector.d.ts.map +1 -0
- package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts +2 -0
- package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts.map +1 -0
- package/dist/types/lib/dependencies/index.d.ts +3 -0
- package/dist/types/lib/dependencies/index.d.ts.map +1 -0
- package/dist/types/lib/file/ReadFileSyncOptions.d.ts +6 -0
- package/dist/types/lib/file/ReadFileSyncOptions.d.ts.map +1 -0
- package/dist/types/lib/file/constants.d.ts +3 -0
- package/dist/types/lib/file/constants.d.ts.map +1 -0
- package/dist/types/lib/file/fileLines.d.ts +6 -0
- package/dist/types/lib/file/fileLines.d.ts.map +1 -0
- package/dist/types/lib/file/index.d.ts +5 -0
- package/dist/types/lib/file/index.d.ts.map +1 -0
- package/dist/types/lib/file/tryReadFileSync.d.ts +4 -0
- package/dist/types/lib/file/tryReadFileSync.d.ts.map +1 -0
- package/dist/types/lib/generateIgnoreFiles.d.ts +2 -0
- package/dist/types/lib/generateIgnoreFiles.d.ts.map +1 -0
- package/dist/types/lib/index.d.ts +21 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/jsonFormatters.d.ts +2 -0
- package/dist/types/lib/jsonFormatters.d.ts.map +1 -0
- package/dist/types/lib/loadConfig.d.ts +2 -0
- package/dist/types/lib/loadConfig.d.ts.map +1 -0
- package/dist/types/lib/parsedPackageJSON.d.ts +2 -0
- package/dist/types/lib/parsedPackageJSON.d.ts.map +1 -0
- package/dist/types/lib/processEx.d.ts +2 -0
- package/dist/types/lib/processEx.d.ts.map +1 -0
- package/dist/types/lib/runSteps.d.ts +4 -0
- package/dist/types/lib/runSteps.d.ts.map +1 -0
- package/dist/types/lib/runStepsAsync.d.ts +4 -0
- package/dist/types/lib/runStepsAsync.d.ts.map +1 -0
- package/dist/types/lib/runXy.d.ts +2 -0
- package/dist/types/lib/runXy.d.ts.map +1 -0
- package/dist/types/lib/runXyWithWarning.d.ts +2 -0
- package/dist/types/lib/runXyWithWarning.d.ts.map +1 -0
- package/dist/types/lib/safeExit.d.ts +5 -0
- package/dist/types/lib/safeExit.d.ts.map +1 -0
- package/dist/types/lib/string/empty.d.ts +3 -0
- package/dist/types/lib/string/empty.d.ts.map +1 -0
- package/dist/types/lib/string/index.d.ts +3 -0
- package/dist/types/lib/string/index.d.ts.map +1 -0
- package/dist/types/lib/string/union.d.ts +2 -0
- package/dist/types/lib/string/union.d.ts.map +1 -0
- package/dist/types/lib/withErrnoException.d.ts +2 -0
- package/dist/types/lib/withErrnoException.d.ts.map +1 -0
- package/dist/types/lib/withError.d.ts +2 -0
- package/dist/types/lib/withError.d.ts.map +1 -0
- package/dist/types/lib/yarn/index.d.ts +4 -0
- package/dist/types/lib/yarn/index.d.ts.map +1 -0
- package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts +2 -0
- package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts.map +1 -0
- package/dist/types/lib/yarn/workspace/Workspace.d.ts +5 -0
- package/dist/types/lib/yarn/workspace/Workspace.d.ts.map +1 -0
- package/dist/types/lib/yarn/workspace/index.d.ts +4 -0
- package/dist/types/lib/yarn/workspace/index.d.ts.map +1 -0
- package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts +3 -0
- package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts.map +1 -0
- package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts +3 -0
- package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts.map +1 -0
- package/dist/types/lib/yarn/yarnInitCwd.d.ts +2 -0
- package/dist/types/lib/yarn/yarnInitCwd.d.ts.map +1 -0
- package/dist/types/loadPackageConfig.d.ts +6 -0
- package/dist/types/loadPackageConfig.d.ts.map +1 -0
- package/dist/types/xy/index.d.ts +8 -0
- package/dist/types/xy/index.d.ts.map +1 -0
- package/dist/types/xy/param.d.ts +5 -0
- package/dist/types/xy/param.d.ts.map +1 -0
- package/dist/types/xy/xy.d.ts +10 -0
- package/dist/types/xy/xy.d.ts.map +1 -0
- package/dist/types/xy/xyBuildCommands.d.ts +3 -0
- package/dist/types/xy/xyBuildCommands.d.ts.map +1 -0
- package/dist/types/xy/xyCommonCommands.d.ts +3 -0
- package/dist/types/xy/xyCommonCommands.d.ts.map +1 -0
- package/dist/types/xy/xyDeployCommands.d.ts +3 -0
- package/dist/types/xy/xyDeployCommands.d.ts.map +1 -0
- package/dist/types/xy/xyInstallCommands.d.ts +3 -0
- package/dist/types/xy/xyInstallCommands.d.ts.map +1 -0
- package/dist/types/xy/xyLintCommands.d.ts +3 -0
- package/dist/types/xy/xyLintCommands.d.ts.map +1 -0
- package/dist/types/xy/xyParseOptions.d.ts +3 -0
- package/dist/types/xy/xyParseOptions.d.ts.map +1 -0
- package/dist/xy/index.mjs +20 -12
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +20 -12
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +20 -12
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/build.ts +1 -0
- package/src/actions/compile-types.ts +1 -1
- package/src/actions/compile.ts +7 -11
- package/src/actions/package/compile/XyConfig.ts +0 -4
- package/src/actions/package/compile/compile.ts +8 -17
- package/src/actions/package/compile/packageCompileTscTypes.ts +21 -29
- package/src/actions/package/compile/packageCompileTsup.ts +12 -19
- package/src/bin/package/build-only.ts +1 -1
- package/src/bin/package/build.ts +1 -1
- package/src/bin/package/clean-outputs.ts +1 -8
- package/src/bin/package/clean-typescript.ts +1 -8
- package/src/xy/xyBuildCommands.ts +0 -1
|
@@ -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/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type {\n XyConfig, XyTscConfig, XyTsupConfig,\n} from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}, types?: 'tsc' | 'tsup'): 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 mode = config.compile?.mode ?? 'tsup'\n let result: number = 0\n switch (mode) {\n case 'tsc': {\n result += await packageCompileTsc(undefined, config as XyTscConfig)\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(config as XyTsupConfig, types)\n break\n }\n }\n return result + (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 { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type {\n CompilerOptions,\n FormatDiagnosticsHost,\n LineAndCharacter,\n} from 'typescript'\nimport {\n DiagnosticCategory,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file\n ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0)\n : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 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","/* eslint-disable complexity */\nimport type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n types: 'tsc' | 'tsup' = 'tsc',\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: types === 'tsup',\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}] ${types}`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}] ${types}`)\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, types: 'tsc' | 'tsup' = 'tsc') => {\n console.warn('packageCompileTsup-types', types)\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 (types === 'tsc') {\n if (verbose) {\n console.log(`Calling packageCompileTscTypes [${types}`)\n }\n const errors = packageCompileTscTypes('src', { verbose })\n if (errors) {\n return errors\n }\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 types,\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 types,\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 types,\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}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', 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 = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\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","// 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 { DiagnosticCategory } 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 if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\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 // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n","import chalk from 'chalk'\n\nimport { 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 pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\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;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACN1B,SAASY,YAAYC,UAAU;AAE/B,OAAOC,YAAW;AAElB,OAAOC,qBAAqB;AAIrB,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAE3B,QAAMC,YAAYC,gBAAgB,MAAMC,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAC9E,QAAMM,GAAGE,UAAU,GAAGR,MAAAA,iBAAuBI,SAAAA;AAE7C,QAAMK,MAAMC,KAAKC,MAAM,MAAML,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAEnEY,UAAQC,IAAIC,OAAM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AACrC,MAAIE,SAAiB;AACrB,UAAQF,MAAAA;IACN,KAAK,OAAO;AACVE,gBAAU,MAAMC,kBAAkBC,QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,SAAwBT,KAAAA;AAC3D;IACF;EACF;AACA,SAAOc,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;;;AUV9B,OAAOU,YAAW;AAMX,IAAMC,sBAAsB,8BAAOC,WAAqB,CAAC,MAAC;AAC/D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,mBAAmBP,GAAAA,EAAK,CAAA;AAChD,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAEhC,SAAOW,uBAAuBC,QAAWH,OAAAA;AAC3C,GANmC;","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","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","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","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint","build","defineConfig","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","compileFolder","folder","entryMode","options","types","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","warn","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTscTypes","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompile","inConfig","types","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint","chalk","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined"]}
|
|
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/compileTypes.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.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 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 console.log('packageCompileTsup-types')\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 const errors = await packageCompileTypes(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}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', 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 = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\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 chalk from 'chalk'\n\nimport { 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 pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","import { cwd } from 'node:process'\n\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 if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\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 // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n\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","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","// 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 {\n CompilerOptions,\n FormatDiagnosticsHost,\n LineAndCharacter,\n} from 'typescript'\nimport {\n DiagnosticCategory,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file\n ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0)\n : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array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rBC,QAAQ;MACRC,gBAAgB;MAChBC,SAAS;IACX,CAAA;IACA,GAAGnB;IACH,GAAIF,WAAWsB,SAAY,CAAC,IAAI;MAAEtB;IAAO;EAC3C;AAEA,QAAMuB,UAAUC,yBAAwB;IACtCC,UAAUtB,OAAOI,KAAAA;IACjBU;IACAS,SAAS;MAAC;MAAQ;MAAQ;MAAe;MAAkB;;IAC3DC,SAAS;MAAC;;EACZ,CAAA;AAEA,QAAMC,UAAUC,uBAAsBN,OAAAA;AAEtC,aAAWO,QAAQF,SAAS;AAC1B,UAAMG,cAAgCD,KAAKE,OACvCC,8BAA8BH,KAAKE,MAAMF,KAAKI,SAAS,CAAA,IACvD;MAAEC,WAAW;MAAGC,MAAM;IAAE;AAC5BrB,YAAQC,IAAIqB,OAAMC,KAAK,GAAGR,KAAKE,MAAMpB,QAAAA,IAAYmB,YAAYK,OAAO,CAAA,IAAKL,YAAYI,YAAY,CAAA,EAAG,CAAA;AACpGpB,YAAQC,IAAIuB,sCAAqC;MAACT;OAAOpB,UAAAA,CAAAA;EAC3D;AAGA,SAAOkB,QAAQY,OAAO,CAACC,MAAMX,SAAUW,OAAOX,KAAKY,aAAaC,oBAAmBC,QAAQ,IAAI,GAAI,CAAA,MAAOpC,UAAU,MAAMqC,eAAAA,IAAmB;AAC/I,GA7CiC;","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","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","chalk","cwd","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","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","files","buildEntries","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","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","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","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint"]}
|
|
@@ -3,9 +3,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
5
5
|
import { cwd } from "node:process";
|
|
6
|
-
import chalk from "chalk";
|
|
7
6
|
import { createProgramFromConfig } from "tsc-prog";
|
|
8
|
-
import { DiagnosticCategory } from "typescript";
|
|
7
|
+
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
9
8
|
|
|
10
9
|
// src/actions/package/compile/inputs.ts
|
|
11
10
|
import { glob } from "glob";
|
|
@@ -73,11 +72,10 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config = {}
|
|
|
73
72
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
74
73
|
const verbose = config?.verbose ?? false;
|
|
75
74
|
if (verbose) {
|
|
76
|
-
console.log(`Compiling types
|
|
75
|
+
console.log(`Compiling types [${pkg}]`);
|
|
77
76
|
}
|
|
78
77
|
const compilerOptions = {
|
|
79
78
|
...getCompilerOptions({
|
|
80
|
-
declaration: true,
|
|
81
79
|
emitDeclarationOnly: true,
|
|
82
80
|
outDir: "dist/types",
|
|
83
81
|
removeComments: false,
|
|
@@ -90,7 +88,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config = {}
|
|
|
90
88
|
noEmit: false
|
|
91
89
|
};
|
|
92
90
|
const files = buildEntries(folder, "all", verbose);
|
|
93
|
-
const
|
|
91
|
+
const program = createProgramFromConfig({
|
|
94
92
|
basePath: pkg ?? cwd(),
|
|
95
93
|
compilerOptions,
|
|
96
94
|
exclude: [
|
|
@@ -101,31 +99,18 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config = {}
|
|
|
101
99
|
"src/**/spec/**/*"
|
|
102
100
|
],
|
|
103
101
|
files
|
|
104
|
-
})
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
case DiagnosticCategory.Warning: {
|
|
115
|
-
console.error(chalk.yellow(diag.messageText));
|
|
116
|
-
console.error(chalk.grey(pkg));
|
|
117
|
-
console.error(chalk.blue(diag.file?.fileName));
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
case DiagnosticCategory.Suggestion: {
|
|
121
|
-
console.error(chalk.white(diag.messageText));
|
|
122
|
-
console.error(chalk.grey(pkg));
|
|
123
|
-
console.error(chalk.blue(diag.file?.fileName));
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
102
|
+
});
|
|
103
|
+
const diagnostics = getPreEmitDiagnostics(program);
|
|
104
|
+
if (diagnostics.length > 0) {
|
|
105
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
106
|
+
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
107
|
+
getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
|
|
108
|
+
getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
|
|
109
|
+
});
|
|
110
|
+
console.error(formattedDiagnostics);
|
|
127
111
|
}
|
|
128
|
-
|
|
112
|
+
program.emit();
|
|
113
|
+
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
129
114
|
}, "packageCompileTscTypes");
|
|
130
115
|
export {
|
|
131
116
|
packageCompileTscTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\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 if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\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 // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n\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","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', 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 = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\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(configF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Z,YAAYa,OAAO,CAACC,KAAKC,SAASD,OAAOC,KAAKC,aAAaC,mBAAmBC,QAAQ,IAAI,IAAI,CAAA;AACvG,GApDsC;","names":["cwd","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","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","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","files","buildEntries","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error"]}
|
|
@@ -43,69 +43,65 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
43
43
|
return entries;
|
|
44
44
|
}, "buildEntries");
|
|
45
45
|
|
|
46
|
-
// src/actions/package/compile/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
46
|
+
// src/actions/package/compile/compileTypes.ts
|
|
47
|
+
import chalk2 from "chalk";
|
|
48
|
+
|
|
49
|
+
// src/lib/loadConfig.ts
|
|
50
|
+
import chalk from "chalk";
|
|
51
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
52
|
+
import deepmerge from "deepmerge";
|
|
53
|
+
var config;
|
|
54
|
+
var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
55
|
+
if (config) {
|
|
56
|
+
return deepmerge(config, params ?? {});
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
59
|
+
cache: true
|
|
60
|
+
}).search();
|
|
61
|
+
config = cosmicConfigResult?.config;
|
|
62
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
63
|
+
if (configFilePath) {
|
|
64
|
+
console.log(chalk.gray(`Loading config from ${configFilePath}`));
|
|
66
65
|
}
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
66
|
+
return deepmerge(config, params ?? {});
|
|
67
|
+
}, "loadConfig");
|
|
70
68
|
|
|
71
69
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
72
70
|
import { cwd } from "node:process";
|
|
73
|
-
import chalk from "chalk";
|
|
74
71
|
import { createProgramFromConfig } from "tsc-prog";
|
|
75
|
-
import { DiagnosticCategory } from "typescript";
|
|
72
|
+
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
76
73
|
|
|
77
74
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
78
75
|
import { createRequire } from "node:module";
|
|
79
|
-
import
|
|
76
|
+
import deepmerge2 from "deepmerge";
|
|
80
77
|
import { findConfigFile, readConfigFile, sys } from "typescript";
|
|
81
|
-
var getNested = /* @__PURE__ */ __name((
|
|
82
|
-
if (
|
|
78
|
+
var getNested = /* @__PURE__ */ __name((config2) => {
|
|
79
|
+
if (config2.extends) {
|
|
83
80
|
const require2 = createRequire(import.meta.url);
|
|
84
|
-
const opts = require2(
|
|
85
|
-
return
|
|
81
|
+
const opts = require2(config2.extends);
|
|
82
|
+
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
86
83
|
}
|
|
87
|
-
return
|
|
84
|
+
return config2.compilerOptions;
|
|
88
85
|
}, "getNested");
|
|
89
86
|
var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename) => {
|
|
90
|
-
const
|
|
91
|
-
return getNested(
|
|
87
|
+
const config2 = readConfigFile(filename, sys.readFile).config;
|
|
88
|
+
return getNested(config2);
|
|
92
89
|
}, "getCompilerOptionsJSONFollowExtends");
|
|
93
90
|
var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tsconfig.json") => {
|
|
94
91
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
95
92
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
96
|
-
return
|
|
93
|
+
return deepmerge2(configFileCompilerOptions, options);
|
|
97
94
|
}, "getCompilerOptions");
|
|
98
95
|
|
|
99
96
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
100
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src",
|
|
97
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
101
98
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
102
|
-
const verbose =
|
|
99
|
+
const verbose = config2?.verbose ?? false;
|
|
103
100
|
if (verbose) {
|
|
104
|
-
console.log(`Compiling types
|
|
101
|
+
console.log(`Compiling types [${pkg}]`);
|
|
105
102
|
}
|
|
106
103
|
const compilerOptions = {
|
|
107
104
|
...getCompilerOptions({
|
|
108
|
-
declaration: true,
|
|
109
105
|
emitDeclarationOnly: true,
|
|
110
106
|
outDir: "dist/types",
|
|
111
107
|
removeComments: false,
|
|
@@ -118,7 +114,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config = {}
|
|
|
118
114
|
noEmit: false
|
|
119
115
|
};
|
|
120
116
|
const files = buildEntries(folder, "all", verbose);
|
|
121
|
-
const
|
|
117
|
+
const program = createProgramFromConfig({
|
|
122
118
|
basePath: pkg ?? cwd(),
|
|
123
119
|
compilerOptions,
|
|
124
120
|
exclude: [
|
|
@@ -129,35 +125,55 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config = {}
|
|
|
129
125
|
"src/**/spec/**/*"
|
|
130
126
|
],
|
|
131
127
|
files
|
|
132
|
-
})
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
});
|
|
129
|
+
const diagnostics = getPreEmitDiagnostics(program);
|
|
130
|
+
if (diagnostics.length > 0) {
|
|
131
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
132
|
+
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
133
|
+
getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
|
|
134
|
+
getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
|
|
135
|
+
});
|
|
136
|
+
console.error(formattedDiagnostics);
|
|
137
|
+
}
|
|
138
|
+
program.emit();
|
|
139
|
+
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
140
|
+
}, "packageCompileTscTypes");
|
|
141
|
+
|
|
142
|
+
// src/actions/package/compile/compileTypes.ts
|
|
143
|
+
var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
144
|
+
const pkg = process.env.INIT_CWD;
|
|
145
|
+
console.log(chalk2.green(`Compiling Types ${pkg}`));
|
|
146
|
+
const config2 = await loadConfig(inConfig);
|
|
147
|
+
return packageCompileTscTypes(void 0, config2);
|
|
148
|
+
}, "packageCompileTypes");
|
|
149
|
+
|
|
150
|
+
// src/actions/package/compile/deepMerge.ts
|
|
151
|
+
function deepMerge(target, source) {
|
|
152
|
+
if (!source || typeof source !== "object") return target;
|
|
153
|
+
for (const key of Object.keys(source)) {
|
|
154
|
+
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
|
|
155
|
+
if (!target[key] || typeof target[key] !== "object") {
|
|
156
|
+
target[key] = {};
|
|
153
157
|
}
|
|
158
|
+
deepMerge(target[key], source[key]);
|
|
159
|
+
} else {
|
|
160
|
+
target[key] = source[key];
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
|
-
return
|
|
157
|
-
}
|
|
163
|
+
return target;
|
|
164
|
+
}
|
|
165
|
+
__name(deepMerge, "deepMerge");
|
|
166
|
+
function deepMergeObjects(objects) {
|
|
167
|
+
const result = {};
|
|
168
|
+
for (const obj of objects) {
|
|
169
|
+
deepMerge(result, obj);
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
__name(deepMergeObjects, "deepMergeObjects");
|
|
158
174
|
|
|
159
175
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
160
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
176
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
|
|
161
177
|
const outDir = options?.outDir ?? "dist";
|
|
162
178
|
if (verbose) {
|
|
163
179
|
console.log(`compileFolder [${folder}]`);
|
|
@@ -167,7 +183,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
167
183
|
bundle: true,
|
|
168
184
|
cjsInterop: true,
|
|
169
185
|
clean: true,
|
|
170
|
-
dts:
|
|
186
|
+
dts: false,
|
|
171
187
|
entry,
|
|
172
188
|
format: [
|
|
173
189
|
"esm"
|
|
@@ -190,11 +206,11 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
190
206
|
];
|
|
191
207
|
}))).flat();
|
|
192
208
|
if (verbose) {
|
|
193
|
-
console.log(`TSUP:build:start [${folder}]
|
|
209
|
+
console.log(`TSUP:build:start [${folder}]`);
|
|
194
210
|
}
|
|
195
211
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
196
212
|
if (verbose) {
|
|
197
|
-
console.log(`TSUP:build:stop [${folder}]
|
|
213
|
+
console.log(`TSUP:build:stop [${folder}]`);
|
|
198
214
|
}
|
|
199
215
|
return 0;
|
|
200
216
|
}, "compileFolder");
|
|
@@ -228,10 +244,10 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
228
244
|
...options
|
|
229
245
|
]);
|
|
230
246
|
}, "tsupOptions");
|
|
231
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (
|
|
232
|
-
console.
|
|
233
|
-
const compile =
|
|
234
|
-
const verbose =
|
|
247
|
+
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
248
|
+
console.log("packageCompileTsup-types");
|
|
249
|
+
const compile = config2?.compile;
|
|
250
|
+
const verbose = config2?.verbose ?? false;
|
|
235
251
|
if (verbose) {
|
|
236
252
|
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
237
253
|
}
|
|
@@ -244,16 +260,12 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config, types = "tsc") =>
|
|
|
244
260
|
const compileForNeutral = compile?.neutral ?? {
|
|
245
261
|
src: {}
|
|
246
262
|
};
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
254
|
-
if (errors) {
|
|
255
|
-
return errors;
|
|
256
|
-
}
|
|
263
|
+
if (verbose) {
|
|
264
|
+
console.log("Calling packageCompileTscTypes");
|
|
265
|
+
}
|
|
266
|
+
const errors = await packageCompileTypes(config2);
|
|
267
|
+
if (errors > 0) {
|
|
268
|
+
return errors;
|
|
257
269
|
}
|
|
258
270
|
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
259
271
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
@@ -265,7 +277,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config, types = "tsc") =>
|
|
|
265
277
|
platform: "node",
|
|
266
278
|
outDir: "dist/node"
|
|
267
279
|
}
|
|
268
|
-
]),
|
|
280
|
+
]), verbose) : 0;
|
|
269
281
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
270
282
|
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
|
|
271
283
|
return folder ? await compileFolder(folder, compile?.entryMode, tsupOptions([
|
|
@@ -276,7 +288,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config, types = "tsc") =>
|
|
|
276
288
|
platform: "browser",
|
|
277
289
|
outDir: "dist/browser"
|
|
278
290
|
}
|
|
279
|
-
]),
|
|
291
|
+
]), verbose) : 0;
|
|
280
292
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
281
293
|
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
|
|
282
294
|
return folder ? await compileFolder(folder, compile?.entryMode, tsupOptions([
|
|
@@ -287,7 +299,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config, types = "tsc") =>
|
|
|
287
299
|
platform: "neutral",
|
|
288
300
|
outDir: "dist/neutral"
|
|
289
301
|
}
|
|
290
|
-
]),
|
|
302
|
+
]), verbose) : 0;
|
|
291
303
|
}))).reduce((prev, value) => prev + value, 0) || 0;
|
|
292
304
|
}, "packageCompileTsup");
|
|
293
305
|
export {
|