@xylabs/ts-scripts-yarn3 6.5.7 → 6.5.9
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 +2 -2
- package/dist/actions/clean-docs.mjs +3 -3
- package/dist/actions/clean-eslint.mjs +2 -2
- package/dist/actions/clean-jest.mjs +2 -2
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +2 -2
- package/dist/actions/compile-types.mjs +2 -2
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +2 -2
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +2 -2
- package/dist/actions/cycle.mjs +2 -2
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +2 -2
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +8 -6
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +2 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +2 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +8 -6
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +9 -7
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +2 -2
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +2 -2
- package/dist/actions/deplint/getImportsFromFile.mjs +2 -2
- package/dist/actions/deplint/index.mjs +9 -7
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +4 -4
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +4 -4
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +4 -4
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +4 -4
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +3 -3
- package/dist/actions/fix.mjs +2 -2
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +2 -2
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +2 -2
- package/dist/actions/gitlint-fix.mjs +1 -1
- package/dist/actions/index.mjs +46 -44
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +2 -2
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +1 -1
- package/dist/actions/lint.mjs +2 -2
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +2 -2
- package/dist/actions/package/clean-outputs.mjs +2 -2
- package/dist/actions/package/clean-typescript.mjs +2 -2
- package/dist/actions/package/clean.mjs +3 -3
- package/dist/actions/package/compile/compile.mjs +10 -10
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +2 -2
- package/dist/actions/package/compile/copyTypeFiles.mjs +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +1 -1
- package/dist/actions/package/compile/index.mjs +10 -10
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +2 -2
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -2
- package/dist/actions/package/compile/packageCompileTsup.mjs +9 -9
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +1 -1
- package/dist/actions/package/gen-docs.mjs +2 -2
- package/dist/actions/package/index.mjs +20 -20
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +4 -4
- package/dist/actions/package/publint.mjs +1 -1
- package/dist/actions/package/recompile.mjs +13 -13
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +4 -4
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +2 -2
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +2 -2
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +4 -4
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +2 -2
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +2 -2
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +3 -3
- package/dist/actions/test.mjs +2 -2
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +2 -2
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +2 -2
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +2 -2
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +2 -2
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +1 -1
- package/dist/bin/package/build-only.mjs +10 -10
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +10 -10
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +2 -2
- package/dist/bin/package/clean-typescript.mjs +2 -2
- package/dist/bin/package/clean.mjs +3 -3
- package/dist/bin/package/compile-only.mjs +10 -10
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +9 -9
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +2 -2
- package/dist/bin/package/compile.mjs +10 -10
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +1 -1
- package/dist/bin/package/fix.mjs +4 -4
- package/dist/bin/package/gen-docs.mjs +2 -2
- package/dist/bin/package/lint.mjs +4 -4
- package/dist/bin/package/publint.mjs +1 -1
- package/dist/bin/package/recompile.mjs +13 -13
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +4 -4
- package/dist/bin/xy.mjs +27 -25
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +49 -47
- package/dist/index.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +1 -1
- package/dist/lib/deleteGlob.mjs +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +2 -2
- package/dist/lib/dependencies/index.mjs +2 -2
- package/dist/lib/file/fileLines.mjs +1 -1
- package/dist/lib/file/index.mjs +2 -2
- package/dist/lib/file/tryReadFileSync.mjs +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +2 -2
- package/dist/lib/index.mjs +13 -13
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +1 -1
- package/dist/lib/runSteps.mjs +2 -2
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +2 -2
- package/dist/lib/runXy.mjs +2 -2
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +2 -2
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +1 -1
- package/dist/lib/yarn/workspace/index.mjs +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +1 -1
- package/dist/loadPackageConfig.mjs +1 -1
- package/dist/xy/index.mjs +27 -25
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +27 -25
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +6 -6
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +8 -8
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +7 -7
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +9 -9
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +13 -11
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +12 -11
package/dist/actions/knip.mjs
CHANGED
|
@@ -58,8 +58,8 @@ var safeExit = (func, exitOnFail = true) => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
// src/lib/runSteps.ts
|
|
61
|
-
import { spawnSync } from "
|
|
62
|
-
import { existsSync } from "
|
|
61
|
+
import { spawnSync } from "child_process";
|
|
62
|
+
import { existsSync } from "fs";
|
|
63
63
|
import chalk3 from "chalk";
|
|
64
64
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
65
65
|
return safeExit(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/knip.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep
|
|
1
|
+
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/knip.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { runSteps } from '../lib/index.ts'\n\nexport const knip = () => {\n return runSteps('Knip', [['yarn', ['knip', '--dependencies', '--no-exit-code']]])\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,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/dist/actions/license.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import chalk from "chalk";
|
|
|
3
3
|
import { init } from "license-checker";
|
|
4
4
|
|
|
5
5
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
6
|
-
import { spawnSync } from "
|
|
6
|
+
import { spawnSync } from "child_process";
|
|
7
7
|
var yarnWorkspaces = () => {
|
|
8
8
|
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
9
9
|
if (result.error) {
|
package/dist/actions/lint.mjs
CHANGED
|
@@ -61,8 +61,8 @@ var safeExit = (func, exitOnFail = true) => {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
// src/lib/runSteps.ts
|
|
64
|
-
import { spawnSync } from "
|
|
65
|
-
import { existsSync } from "
|
|
64
|
+
import { spawnSync } from "child_process";
|
|
65
|
+
import { existsSync } from "fs";
|
|
66
66
|
import chalk3 from "chalk";
|
|
67
67
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
68
68
|
return safeExit(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg\n ? lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep
|
|
1
|
+
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg\n ? lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,Y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;AAAA,EACnB;AAAA,EAAK;AAAA,EAAS;AAAA,EAAa;AAC7B,IAAgB,CAAC,MAAM;AACrB,SAAO,MACH,YAAY,EAAE,KAAK,IAAI,CAAC,IACxB,gBAAgB;AAAA,IACd;AAAA,IAAS;AAAA,IAAa;AAAA,EACxB,CAAC;AACP;AAEO,IAAM,kBAAkB,CAAC,EAAE,MAAM,MAAM,IAAgB,CAAC,MAAM;AACnE,UAAQ,IAAIA,OAAM,KAAK,GAAG,MAAM,QAAQ,MAAM,iBAAiB,CAAC;AAChE,QAAM,QAAQ,KAAK,IAAI;AAGvB,QAAM,aAAa,MAAM,CAAC,OAAO,IAAI,CAAC;AAEtC,QAAM,SAAS,SAAS,GAAG,MAAM,QAAQ,MAAM,oBAAoB;AAAA,IACjE,CAAC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;AAAA,EACpC,CAAC;AACD,UAAQ,IAAIA,OAAM,KAAK,GAAG,MAAM,aAAa,WAAW,KAAKA,OAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE,CAAC;AACjJ,SAAO;AACT;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","chalk"]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
existsSync,
|
|
8
8
|
readFileSync,
|
|
9
9
|
writeFileSync
|
|
10
|
-
} from "
|
|
10
|
+
} from "fs";
|
|
11
11
|
|
|
12
12
|
// src/lib/string/empty.ts
|
|
13
13
|
var empty = (value) => value?.trim().length === 0;
|
|
@@ -32,7 +32,7 @@ var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
|
32
32
|
import chalk from "chalk";
|
|
33
33
|
|
|
34
34
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
35
|
-
import { spawnSync } from "
|
|
35
|
+
import { spawnSync } from "child_process";
|
|
36
36
|
var yarnWorkspaces = () => {
|
|
37
37
|
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
38
38
|
if (result.error) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/actions/package/clean-outputs.ts
|
|
2
|
-
import path from "
|
|
2
|
+
import path from "path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
|
|
5
5
|
// src/lib/deleteGlob.ts
|
|
6
|
-
import fs from "
|
|
6
|
+
import fs from "fs";
|
|
7
7
|
import { glob } from "glob";
|
|
8
8
|
var deleteGlob = (globPath) => {
|
|
9
9
|
const files = glob.sync(globPath);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/actions/package/clean-typescript.ts
|
|
2
|
-
import path from "
|
|
2
|
+
import path from "path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
|
|
5
5
|
// src/lib/deleteGlob.ts
|
|
6
|
-
import fs from "
|
|
6
|
+
import fs from "fs";
|
|
7
7
|
import { glob } from "glob";
|
|
8
8
|
var deleteGlob = (globPath) => {
|
|
9
9
|
const files = glob.sync(globPath);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/actions/package/clean-outputs.ts
|
|
2
|
-
import path from "
|
|
2
|
+
import path from "path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
|
|
5
5
|
// src/lib/deleteGlob.ts
|
|
6
|
-
import fs from "
|
|
6
|
+
import fs from "fs";
|
|
7
7
|
import { glob } from "glob";
|
|
8
8
|
var deleteGlob = (globPath) => {
|
|
9
9
|
const files = glob.sync(globPath);
|
|
@@ -25,7 +25,7 @@ var packageCleanOutputs = () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// src/actions/package/clean-typescript.ts
|
|
28
|
-
import path2 from "
|
|
28
|
+
import path2 from "path";
|
|
29
29
|
import chalk2 from "chalk";
|
|
30
30
|
var packageCleanTypescript = () => {
|
|
31
31
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
@@ -21,7 +21,7 @@ var loadConfig = async (params) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
// src/actions/package/publint.ts
|
|
24
|
-
import { promises as fs } from "
|
|
24
|
+
import { promises as fs } from "fs";
|
|
25
25
|
import chalk2 from "chalk";
|
|
26
26
|
import sortPackageJson from "sort-package-json";
|
|
27
27
|
var packagePublint = async (params) => {
|
|
@@ -95,7 +95,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
98
|
-
import { cwd } from "
|
|
98
|
+
import { cwd } from "process";
|
|
99
99
|
import chalk3 from "chalk";
|
|
100
100
|
import { createProgramFromConfig } from "tsc-prog";
|
|
101
101
|
import {
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
} from "typescript";
|
|
107
107
|
|
|
108
108
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
109
|
-
import { createRequire } from "
|
|
109
|
+
import { createRequire } from "module";
|
|
110
110
|
import deepmerge2 from "deepmerge";
|
|
111
111
|
import {
|
|
112
112
|
findConfigFile,
|
|
@@ -207,7 +207,7 @@ function deepMergeObjects(objects) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
210
|
-
import { cwd as cwd2 } from "
|
|
210
|
+
import { cwd as cwd2 } from "process";
|
|
211
211
|
import chalk4 from "chalk";
|
|
212
212
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
213
213
|
import {
|
|
@@ -337,7 +337,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
337
337
|
return (await Promise.all(
|
|
338
338
|
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
339
339
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
340
|
-
return folder ? await compileFolder(
|
|
340
|
+
return typeof folder === "string" ? await compileFolder(
|
|
341
341
|
folder,
|
|
342
342
|
compile?.entryMode,
|
|
343
343
|
tsupOptions([
|
|
@@ -349,10 +349,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
349
349
|
verbose
|
|
350
350
|
) : 0;
|
|
351
351
|
})
|
|
352
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
352
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
353
353
|
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
354
354
|
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
|
|
355
|
-
return folder ? await compileFolder(
|
|
355
|
+
return typeof folder === "string" ? await compileFolder(
|
|
356
356
|
folder,
|
|
357
357
|
compile?.entryMode,
|
|
358
358
|
tsupOptions([
|
|
@@ -364,10 +364,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
364
364
|
verbose
|
|
365
365
|
) : 0;
|
|
366
366
|
})
|
|
367
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
367
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
368
368
|
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
369
369
|
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
|
|
370
|
-
return folder ? await compileFolder(
|
|
370
|
+
return typeof folder === "string" ? await compileFolder(
|
|
371
371
|
folder,
|
|
372
372
|
compile?.entryMode,
|
|
373
373
|
tsupOptions([
|
|
@@ -379,7 +379,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
379
379
|
verbose
|
|
380
380
|
) : 0;
|
|
381
381
|
})
|
|
382
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
382
|
+
)).reduce((prev, value) => prev + value, 0) + 0;
|
|
383
383
|
};
|
|
384
384
|
|
|
385
385
|
// src/actions/package/compile/compile.ts
|
|
@@ -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 { 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;AACrE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,YAAY,gBAAgB,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AACrF,QAAM,GAAG,UAAU,GAAG,MAAM,iBAAiB,SAAS;AAEtD,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAA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AAQ;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
|
+
{"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 typeof folder === 'string'\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 typeof folder === 'string'\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 typeof folder === 'string'\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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W,WACrB,MAAM;AAAA,QACJ;AAAA,QACA,SAAS;AAAA,QACT,YAAY;AAAA,UAAC;AAAA,UACX,SAAS,MAAM,WAAW,CAAC;AAAA,UAC1B,OAAO,YAAY,WAAW,UAAU,CAAC;AAAA,UAC1C,EAAE,UAAU,WAAW,QAAQ,eAAe;AAAA,QAAC,CAAC;AAAA,QAClD;AAAA,MACF,IACA;AAAA,IACN,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,IACvC;AAEN;;;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"]}
|
|
@@ -18,7 +18,7 @@ var loadConfig = async (params) => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
21
|
-
import { cwd } from "
|
|
21
|
+
import { cwd } from "process";
|
|
22
22
|
import chalk2 from "chalk";
|
|
23
23
|
import { createProgramFromConfig } from "tsc-prog";
|
|
24
24
|
import {
|
|
@@ -56,7 +56,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
59
|
-
import { createRequire } from "
|
|
59
|
+
import { createRequire } from "module";
|
|
60
60
|
import deepmerge2 from "deepmerge";
|
|
61
61
|
import {
|
|
62
62
|
findConfigFile,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/actions/package/compile/copyTypeFiles.ts
|
|
2
|
-
import { copyFile, readdir } from "
|
|
2
|
+
import { copyFile, readdir } from "fs/promises";
|
|
3
3
|
import { Mutex } from "async-mutex";
|
|
4
4
|
var copyFileMutex = new Mutex();
|
|
5
5
|
var getDistTypeFiles = async (compilerOptions) => {
|
|
@@ -21,7 +21,7 @@ var loadConfig = async (params) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
// src/actions/package/publint.ts
|
|
24
|
-
import { promises as fs } from "
|
|
24
|
+
import { promises as fs } from "fs";
|
|
25
25
|
import chalk2 from "chalk";
|
|
26
26
|
import sortPackageJson from "sort-package-json";
|
|
27
27
|
var packagePublint = async (params) => {
|
|
@@ -95,7 +95,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
98
|
-
import { cwd } from "
|
|
98
|
+
import { cwd } from "process";
|
|
99
99
|
import chalk3 from "chalk";
|
|
100
100
|
import { createProgramFromConfig } from "tsc-prog";
|
|
101
101
|
import {
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
} from "typescript";
|
|
107
107
|
|
|
108
108
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
109
|
-
import { createRequire } from "
|
|
109
|
+
import { createRequire } from "module";
|
|
110
110
|
import deepmerge2 from "deepmerge";
|
|
111
111
|
import {
|
|
112
112
|
findConfigFile,
|
|
@@ -207,7 +207,7 @@ function deepMergeObjects(objects) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
210
|
-
import { cwd as cwd2 } from "
|
|
210
|
+
import { cwd as cwd2 } from "process";
|
|
211
211
|
import chalk4 from "chalk";
|
|
212
212
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
213
213
|
import {
|
|
@@ -337,7 +337,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
337
337
|
return (await Promise.all(
|
|
338
338
|
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
339
339
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
340
|
-
return folder ? await compileFolder(
|
|
340
|
+
return typeof folder === "string" ? await compileFolder(
|
|
341
341
|
folder,
|
|
342
342
|
compile?.entryMode,
|
|
343
343
|
tsupOptions([
|
|
@@ -349,10 +349,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
349
349
|
verbose
|
|
350
350
|
) : 0;
|
|
351
351
|
})
|
|
352
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
352
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
353
353
|
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
354
354
|
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
|
|
355
|
-
return folder ? await compileFolder(
|
|
355
|
+
return typeof folder === "string" ? await compileFolder(
|
|
356
356
|
folder,
|
|
357
357
|
compile?.entryMode,
|
|
358
358
|
tsupOptions([
|
|
@@ -364,10 +364,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
364
364
|
verbose
|
|
365
365
|
) : 0;
|
|
366
366
|
})
|
|
367
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
367
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
368
368
|
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
369
369
|
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
|
|
370
|
-
return folder ? await compileFolder(
|
|
370
|
+
return typeof folder === "string" ? await compileFolder(
|
|
371
371
|
folder,
|
|
372
372
|
compile?.entryMode,
|
|
373
373
|
tsupOptions([
|
|
@@ -379,7 +379,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
379
379
|
verbose
|
|
380
380
|
) : 0;
|
|
381
381
|
})
|
|
382
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
382
|
+
)).reduce((prev, value) => prev + value, 0) + 0;
|
|
383
383
|
};
|
|
384
384
|
|
|
385
385
|
// src/actions/package/compile/compile.ts
|