@xylabs/ts-scripts-yarn3 4.0.0-rc.28 → 4.0.0-rc.30

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.
Files changed (118) hide show
  1. package/dist/actions/build.mjs.map +1 -1
  2. package/dist/actions/clean-docs.mjs.map +1 -1
  3. package/dist/actions/clean-eslint.mjs.map +1 -1
  4. package/dist/actions/clean-jest.mjs.map +1 -1
  5. package/dist/actions/clean.mjs.map +1 -1
  6. package/dist/actions/compile.mjs.map +1 -1
  7. package/dist/actions/copy-assets.mjs.map +1 -1
  8. package/dist/actions/cycle.mjs.map +1 -1
  9. package/dist/actions/dead.mjs.map +1 -1
  10. package/dist/actions/deploy-major.mjs.map +1 -1
  11. package/dist/actions/deploy-minor.mjs.map +1 -1
  12. package/dist/actions/deploy-next.mjs.map +1 -1
  13. package/dist/actions/deploy.mjs.map +1 -1
  14. package/dist/actions/deps.mjs.map +1 -1
  15. package/dist/actions/dupdeps.mjs.map +1 -1
  16. package/dist/actions/fix.mjs.map +1 -1
  17. package/dist/actions/gen-docs.mjs.map +1 -1
  18. package/dist/actions/gitignore-gen.mjs.map +1 -1
  19. package/dist/actions/index.mjs.map +1 -1
  20. package/dist/actions/license.mjs.map +1 -1
  21. package/dist/actions/lint-clean.mjs.map +1 -1
  22. package/dist/actions/lint-profile.mjs.map +1 -1
  23. package/dist/actions/lint.mjs.map +1 -1
  24. package/dist/actions/npmignore-gen.mjs.map +1 -1
  25. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  26. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  27. package/dist/actions/package/clean.mjs.map +1 -1
  28. package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
  29. package/dist/actions/package/compile/compile.mjs.map +1 -1
  30. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
  31. package/dist/actions/package/compile/index.mjs.map +1 -1
  32. package/dist/actions/package/compile/inputs.mjs.map +1 -1
  33. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  34. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  35. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  36. package/dist/actions/package/deps.mjs.map +1 -1
  37. package/dist/actions/package/index.mjs.map +1 -1
  38. package/dist/actions/package/recompile.mjs.map +1 -1
  39. package/dist/actions/publint.mjs.map +1 -1
  40. package/dist/actions/rebuild.mjs.map +1 -1
  41. package/dist/actions/recompile.mjs.map +1 -1
  42. package/dist/actions/reinstall.mjs.map +1 -1
  43. package/dist/actions/relint.mjs.map +1 -1
  44. package/dist/actions/retest.mjs.map +1 -1
  45. package/dist/actions/sonar.mjs.map +1 -1
  46. package/dist/actions/statics.mjs.map +1 -1
  47. package/dist/actions/test.mjs.map +1 -1
  48. package/dist/actions/up.mjs.map +1 -1
  49. package/dist/actions/updo.mjs.map +1 -1
  50. package/dist/actions/upplug.mjs.map +1 -1
  51. package/dist/actions/upyarn.mjs.map +1 -1
  52. package/dist/actions/yarn3only.mjs.map +1 -1
  53. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  54. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  55. package/dist/bin/package/clean.mjs.map +1 -1
  56. package/dist/bin/package/compile-only.mjs.map +1 -1
  57. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  58. package/dist/bin/package/compile.mjs.map +1 -1
  59. package/dist/bin/package/deps.mjs.map +1 -1
  60. package/dist/bin/package/recompile.mjs.map +1 -1
  61. package/dist/bin/xy-ts.mjs.map +1 -1
  62. package/dist/bin/xy.mjs.map +1 -1
  63. package/dist/index.d.ts +6 -6
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/lib/deleteGlob.mjs.map +1 -1
  66. package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
  67. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  68. package/dist/lib/dependencies/index.mjs.map +1 -1
  69. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  70. package/dist/lib/index.mjs.map +1 -1
  71. package/dist/lib/runSteps.mjs.map +1 -1
  72. package/dist/lib/runStepsAsync.mjs.map +1 -1
  73. package/dist/lib/runXy.mjs.map +1 -1
  74. package/dist/lib/yarn/index.mjs.map +1 -1
  75. package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
  76. package/dist/lib/yarn/workspace/index.mjs.map +1 -1
  77. package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
  78. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
  79. package/dist/xy/index.mjs.map +1 -1
  80. package/dist/xy/xy.mjs.map +1 -1
  81. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  82. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  83. package/dist/xy/xyDeployCommands.mjs.map +1 -1
  84. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  85. package/dist/xy/xyLintCommands.mjs.map +1 -1
  86. package/package.json +6 -6
  87. package/src/actions/clean-docs.ts +1 -3
  88. package/src/actions/clean.ts +2 -6
  89. package/src/actions/compile.ts +1 -3
  90. package/src/actions/copy-assets.ts +2 -6
  91. package/src/actions/cycle.ts +1 -3
  92. package/src/actions/deps.ts +1 -3
  93. package/src/actions/dupdeps.ts +1 -3
  94. package/src/actions/gen-docs.ts +1 -3
  95. package/src/actions/license.ts +2 -6
  96. package/src/actions/lint-clean.ts +2 -6
  97. package/src/actions/lint-profile.ts +1 -5
  98. package/src/actions/lint.ts +1 -3
  99. package/src/actions/package/compile/copyTypeFiles.ts +1 -3
  100. package/src/actions/package/compile/inputs.ts +2 -6
  101. package/src/actions/package/compile/packageCompileTsc.ts +1 -3
  102. package/src/actions/package/compile/packageCompileTsup.ts +2 -6
  103. package/src/actions/package/deps.ts +3 -9
  104. package/src/actions/publint.ts +3 -9
  105. package/src/actions/reinstall.ts +3 -9
  106. package/src/actions/relint.ts +3 -9
  107. package/src/actions/statics.ts +1 -3
  108. package/src/actions/yarn3only.ts +1 -3
  109. package/src/bin/package/compile-only.ts +1 -3
  110. package/src/lib/deleteGlob.ts +1 -3
  111. package/src/lib/dependencies/DuplicateDetector.ts +1 -3
  112. package/src/lib/generateIgnoreFiles.ts +1 -3
  113. package/src/lib/runSteps.ts +1 -3
  114. package/src/lib/runStepsAsync.ts +1 -3
  115. package/src/lib/yarn/isYarnVersionOrGreater.ts +1 -3
  116. package/src/lib/yarn/workspace/yarnWorkspaces.ts +1 -3
  117. package/src/xy/xyCommonCommands.ts +1 -3
  118. package/src/xy/xyLintCommands.ts +1 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/license.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { init } from 'license-checker'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\n\nexport const license = async (pkg?: string) => {\n const workspaces = yarnWorkspaces()\n const workspaceList = workspaces.filter(({ name }) => {\n return pkg === undefined || name === pkg\n })\n\n const exclude = new Set([\n 'MIT',\n 'MIT*',\n 'ISC',\n 'Apache-2.0',\n 'BSD',\n 'BSD*',\n 'BSD-2-Clause',\n 'BSD-3-Clause',\n 'CC-BY-4.0',\n 'Unlicense',\n 'CC-BY-3.0',\n 'CC0-1.0',\n 'LGPL-3.0-only',\n 'LGPL-3.0',\n 'LGPL-3.0-or-later',\n 'Python-2.0',\n ])\n\n console.log(chalk.green('License Checker'))\n\n return (\n (\n await Promise.all(\n workspaceList.map(({\n location, name,\n }) => {\n return new Promise<number>((resolve) => {\n init({\n production: true, start: location,\n }, (error, packages) => {\n if (error) {\n console.error(chalk.red(`License Checker [${name}] Error`))\n console.error(chalk.gray(error))\n console.log('\\n')\n resolve(1)\n } else {\n console.log(chalk.green(`License Checker [${name}]`))\n let count = 0\n for (const [name, info] of Object.entries(packages)) {\n const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses]\n for (let license of licenses) {\n if (license) {\n // remove surrounding parens on some string\n if (license[0] === '(' && license.at(-1) === ')') {\n license = license.slice(1, -2)\n }\n // get list of OR licenses from string\n const orLicenses = license.split(' OR ')\n let orLicenseFound = false\n for (const orLicense of orLicenses) {\n if (exclude.has(orLicense)) {\n orLicenseFound = true\n }\n }\n if (!orLicenseFound) {\n count++\n console.warn(chalk.yellow(`${name}: Package License not allowed [${license}]`))\n }\n }\n }\n }\n console.log('\\n')\n resolve(count)\n }\n })\n })\n }),\n )\n )\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, value) => prev || value, 0)\n )\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {\n encoding: 'utf8', shell: true,\n })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAClB,SAASC,YAAY;;;ACDrB,SAASC,iBAAiB;AAInB,IAAMC,iBAAiB,6BAAA;AAC5B,QAAMC,SAASC,UAAU,QAAQ;IAAC;IAAc;IAAQ;IAAU;KAAgB;IAChFC,UAAU;IAAQC,OAAO;EAC3B,CAAA;AACA,MAAIH,OAAOI,OAAO;AAChB,UAAMJ,OAAOI;EACf;AACA,SACEJ,OAAOK,OACJC,SAAQ,EAGRC,MAAM,IAAA,EACNC,MAAM,GAAG,EAAC,EACVC,IAAI,CAACC,SAAAA;AACJ,WAAOC,KAAKC,MAAMF,IAAAA;EACpB,CAAA;AAEN,GAlB8B;;;ADCvB,IAAMG,UAAU,8BAAOC,QAAAA;AAC5B,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,gBAAgBF,WAAWG,OAAO,CAAC,EAAEC,KAAI,MAAE;AAC/C,WAAOL,QAAQM,UAAaD,SAASL;EACvC,CAAA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AAA,kCAAsCN,QAAAA,GAAU,CAAA;gBAC/E;cACF;YACF;UACF;AACAU,kBAAQC,IAAI,IAAA;AACZO,kBAAQQ,KAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF,CAAA,CAAA,GAIDgB,OAAO,CAACC,MAAMC,UAAUD,QAAQC,OAAO,CAAA;AAE9C,GA/EuB;","names":["chalk","init","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","license","pkg","workspaces","yarnWorkspaces","workspaceList","filter","name","undefined","exclude","Set","console","log","chalk","green","Promise","all","map","location","resolve","init","production","start","error","packages","red","gray","count","info","Object","entries","licenses","Array","isArray","at","slice","orLicenses","split","orLicenseFound","orLicense","has","warn","yellow","reduce","prev","value"]}
1
+ {"version":3,"sources":["../../src/actions/license.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { init } from 'license-checker'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\n\nexport const license = async (pkg?: string) => {\n const workspaces = yarnWorkspaces()\n const workspaceList = workspaces.filter(({ name }) => {\n return pkg === undefined || name === pkg\n })\n\n const exclude = new Set([\n 'MIT',\n 'MIT*',\n 'ISC',\n 'Apache-2.0',\n 'BSD',\n 'BSD*',\n 'BSD-2-Clause',\n 'BSD-3-Clause',\n 'CC-BY-4.0',\n 'Unlicense',\n 'CC-BY-3.0',\n 'CC0-1.0',\n 'LGPL-3.0-only',\n 'LGPL-3.0',\n 'LGPL-3.0-or-later',\n 'Python-2.0',\n ])\n\n console.log(chalk.green('License Checker'))\n\n return (\n (\n await Promise.all(\n workspaceList.map(({ location, name }) => {\n return new Promise<number>((resolve) => {\n init({ production: true, start: location }, (error, packages) => {\n if (error) {\n console.error(chalk.red(`License Checker [${name}] Error`))\n console.error(chalk.gray(error))\n console.log('\\n')\n resolve(1)\n } else {\n console.log(chalk.green(`License Checker [${name}]`))\n let count = 0\n for (const [name, info] of Object.entries(packages)) {\n const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses]\n for (let license of licenses) {\n if (license) {\n // remove surrounding parens on some string\n if (license[0] === '(' && license.at(-1) === ')') {\n license = license.slice(1, -2)\n }\n // get list of OR licenses from string\n const orLicenses = license.split(' OR ')\n let orLicenseFound = false\n for (const orLicense of orLicenses) {\n if (exclude.has(orLicense)) {\n orLicenseFound = true\n }\n }\n if (!orLicenseFound) {\n count++\n console.warn(chalk.yellow(`${name}: Package License not allowed [${license}]`))\n }\n }\n }\n }\n console.log('\\n')\n resolve(count)\n }\n })\n })\n }),\n )\n )\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, value) => prev || value, 0)\n )\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAClB,SAASC,YAAY;;;ACDrB,SAASC,iBAAiB;AAInB,IAAMC,iBAAiB,6BAAA;AAC5B,QAAMC,SAASC,UAAU,QAAQ;IAAC;IAAc;IAAQ;IAAU;KAAgB;IAAEC,UAAU;IAAQC,OAAO;EAAK,CAAA;AAClH,MAAIH,OAAOI,OAAO;AAChB,UAAMJ,OAAOI;EACf;AACA,SACEJ,OAAOK,OACJC,SAAQ,EAGRC,MAAM,IAAA,EACNC,MAAM,GAAG,EAAC,EACVC,IAAI,CAACC,SAAAA;AACJ,WAAOC,KAAKC,MAAMF,IAAAA;EACpB,CAAA;AAEN,GAhB8B;;;ADCvB,IAAMG,UAAU,8BAAOC,QAAAA;AAC5B,QAAMC,aAAaC,eAAAA;AACnB,QAAMC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kBACnB;gBACF;AACA,oBAAI,CAACA,gBAAgB;AACnBX;AACAhB,0BAAQ8B,KAAK5B,MAAM6B,OAAO,GAAGnC,KAAAA,kCAAsCN,QAAAA,GAAU,CAAA;gBAC/E;cACF;YACF;UACF;AACAU,kBAAQC,IAAI,IAAA;AACZO,kBAAQQ,KAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF,CAAA,CAAA,GAIDgB,OAAO,CAACC,MAAMC,UAAUD,QAAQC,OAAO,CAAA;AAE9C,GA3EuB;","names":["chalk","init","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","license","pkg","workspaces","yarnWorkspaces","workspaceList","filter","name","undefined","exclude","Set","console","log","chalk","green","Promise","all","map","location","resolve","init","production","start","error","packages","red","gray","count","info","Object","entries","licenses","Array","isArray","at","slice","orLicenses","split","orLicenseFound","orLicense","has","warn","yellow","reduce","prev","value"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/lint-clean.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts","../../src/actions/lint.ts"],"sourcesContent":["import { rmSync } from 'node:fs'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\nimport { lint } from './lint.ts'\n\nexport const lintClean = () => {\n console.log('Lint Clean [.eslintcache]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({\n location, name,\n }) => {\n const dist = `${location}/.eslintcache`\n try {\n rmSync(dist, {\n force: true, recursive: true,\n })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`)\n return 1\n }\n })\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, result) => prev || result, 0)\n return result || lint()\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 !== undefined && ex.message !== undefined,\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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {\n encoding: 'utf8', shell: true,\n })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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: {\n FORCE_COLOR: '3', ...process.env,\n },\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 chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport {\n runSteps, yarnWorkspaces,\n} from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,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KAAK,CAAA;EACf;AAEA,QAAMC,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAUZ,UAAUa,QAAQ;AAE7DhC,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AA0BpB,IAAMC,OAAO,8BAAO,EAAEC,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMC,YAAY;IAAED;EAAI,CAAA,IAAKE,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;;;ARzDb,IAAMC,YAAY,6BAAA;AACvBC,UAAQC,IAAI,2BAAA;AACZ,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,SAASF,WACZG,IAAI,CAAC,EACJC,UAAUC,KAAI,MACf;AACC,UAAMC,OAAO,GAAGF,QAAAA;AAChB,QAAI;AACFG,aAAOD,MAAM;QACXE,OAAO;QAAMC,WAAW;MAC1B,CAAA;AACA,aAAO;IACT,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdZ,cAAQa,MAAM,qCAAqCN,IAAAA,KAASM,MAAMC,OAAO,GAAG;AAC5E,aAAO;IACT;EACF,CAAA,EAECC,OAAO,CAACC,MAAMZ,YAAWY,QAAQZ,SAAQ,CAAA;AAC5C,SAAOA,UAAUa,KAAAA;AACnB,GAtByB;","names":["rmSync","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","chalk","ESLint","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","lintPackage","runSteps","lintClean","console","log","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","lint"]}
1
+ {"version":3,"sources":["../../src/actions/lint-clean.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts","../../src/actions/lint.ts"],"sourcesContent":["import { rmSync } from 'node:fs'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\nimport { lint } from './lint.ts'\n\nexport const lintClean = () => {\n console.log('Lint Clean [.eslintcache]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({ location, name }) => {\n const dist = `${location}/.eslintcache`\n try {\n rmSync(dist, { force: true, recursive: true })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`)\n return 1\n }\n })\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, result) => prev || result, 0)\n return result || lint()\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 !== undefined && ex.message !== undefined,\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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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 chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC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,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AA0BpB,IAAMC,OAAO,8BAAO,EAAEC,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMC,YAAY;IAAED;EAAI,CAAA,IAAKE,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;;;ARvDb,IAAMC,YAAY,6BAAA;AACvBC,UAAQC,IAAI,2BAAA;AACZ,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,SAASF,WACZG,IAAI,CAAC,EAAEC,UAAUC,KAAI,MAAE;AACtB,UAAMC,OAAO,GAAGF,QAAAA;AAChB,QAAI;AACFG,aAAOD,MAAM;QAAEE,OAAO;QAAMC,WAAW;MAAK,CAAA;AAC5C,aAAO;IACT,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdZ,cAAQa,MAAM,qCAAqCN,IAAAA,KAASM,MAAMC,OAAO,GAAG;AAC5E,aAAO;IACT;EACF,CAAA,EAECC,OAAO,CAACC,MAAMZ,YAAWY,QAAQZ,SAAQ,CAAA;AAC5C,SAAOA,UAAUa,KAAAA;AACnB,GAlByB;","names":["rmSync","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","chalk","ESLint","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","lintPackage","runSteps","lintClean","console","log","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","lint"]}
@@ -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/lint-profile.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 !== undefined && ex.message !== undefined,\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: {\n FORCE_COLOR: '3', ...process.env,\n },\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 lintProfile = () => {\n return runSteps('Lint Profile', [['yarn', ['xy', 'lint'], {\n env: {\n ...process.env, TIMING: '1',\n },\n }]])\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWI;AACjD,GAPyB;;;ACElB,IAAME,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,OAAO;AACLH,cAAQL,MAAMM,OAAMC,IAAI,UAAUP,OAAMI,I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,cAAM,IAAIK,MAAM,mBAAmBL,QAAQ,CAAA,CAAE,GAAG;MAClD;AACA,YAAMM,SACFC,UAAUZ,SAASM,MAAMC,QAAQN,IAAAA,IAAQA,OAAOA,KAAKO,MAAM,GAAA,GAAM;QACjE,GAAGN;QACHW,UAAU;QACVrB,KAAK;UACHsB,aAAa;UAAK,GAAGvB,QAAQC;QAC/B;QACAuB,OAAO;QACPC,OAAO;MACT,CAAA,EAAGL,UAAU;AACfM,kBAAYhC,MAAM0B,QAAQ,SAASxB,UAAAA;AACnCW,qBAAea,UAAU;IAC3B;AACA,WAAOb;EACT,GAAG,CAAC,CAACX,UAAAA;AACP,GA5BwB;;;ACXjB,IAAM+B,cAAc,6BAAA;AACzB,SAAOC,SAAS,gBAAgB;IAAC;MAAC;MAAQ;QAAC;QAAM;;MAAS;QACxDC,KAAK;UACH,GAAGC,QAAQD;UAAKE,QAAQ;QAC1B;MACF;;GAAG;AACL,GAN2B;","names":["chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintProfile","runSteps","env","process","TIMING"]}
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/lint-profile.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 !== undefined && ex.message !== undefined,\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 lintProfile = () => {\n return runSteps('Lint Profile', [['yarn', ['xy', 'lint'], { env: { ...process.env, TIMING: '1' } }]])\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAm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AAC;QAAM;;MAAS;QAAEC,KAAK;UAAE,GAAGC,QAAQD;UAAKE,QAAQ;QAAI;MAAE;;GAAG;AACtG,GAF2B;","names":["chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintProfile","runSteps","env","process","TIMING"]}
@@ -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/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport {\n runSteps, yarnWorkspaces,\n} from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\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 !== undefined && ex.message !== undefined,\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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {\n encoding: 'utf8', shell: true,\n })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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: {\n FORCE_COLOR: '3', ...process.env,\n },\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;AAClB,SAASC,cAAc;;;ACDvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWI;AACjD,GAPyB;;;ACElB,IAAME,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,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AA;AAChF,GARuB;AAUhB,IAAME,OAAO,8BAAO,EAAEnB,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMD,YAAY;IAAEC;EAAI,CAAA,IAAKoB,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;","names":["chalk","ESLint","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lintAll","lint","runSteps"]}
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/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\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 !== undefined && ex.message !== undefined,\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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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;AAClB,SAASC,cAAc;;;ACDvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;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AO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AAgBpB,IAAMC,UAAU,mCAAA;AACrB,QAAMR,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAU,UAAA;AAE3C/B,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GARuB;AAUhB,IAAME,OAAO,8BAAO,EAAEnB,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMD,YAAY;IAAEC;EAAI,CAAA,IAAKoB,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;","names":["chalk","ESLint","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lintAll","lint","runSteps"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/actions/npmignore-gen.ts"],"sourcesContent":["export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync, writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].sort()\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({\n location, name,\n }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {\n encoding: 'utf8', shell: true,\n })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import { generateIgnoreFiles } from '../lib/index.ts'\n\nconst filename = '.np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AAAA,MAAUE,MAAMC,OAAO,GAAG;AACvE,aAAO;IACT;EACF,CAAA;AACA,QAAMC,YAAYN,QAAQO,MAAMC,CAAAA,WAAUA,WAAW,CAAA;AACrD,SAAOF,YAAY,IAAI;AACzB,GApBmC;;;AIRnC,IAAMG,WAAW;AAEV,IAAMC,eAAe,wBAACC,QAAiBC,oBAAoBH,UAAUE,GAAAA,GAAhD;","names":["WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","existsSync","readFileSync","writeFileSync","empty","value","trim","length","notEmpty","union","a","b","Set","defaultReadFileSyncOptions","encoding","readLines","uri","options","defaultReadFileSyncOptions","existsSync","readFileSync","replace","WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","split","readNonEmptyLines","filter","notEmpty","writeLines","lines","existing","undefined","desired","join","writeFileSync","chalk","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","yarnWorkspace","pkg","workspace","yarnWorkspaces","find","name","Error","INIT_CWD","process","env","console","error","mergeEntries","a","b","union","sort","generateIgnoreFiles","filename","pkg","console","log","chalk","green","cwd","INIT_CWD","workspaces","yarnWorkspace","yarnWorkspaces","readEntries","location","readNonEmptyLines","writeEntries","entries","writeLines","results","map","name","ex","error","message","succeeded","every","result","filename","npmignoreGen","pkg","generateIgnoreFiles"]}
1
+ {"version":3,"sources":["../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/actions/npmignore-gen.ts"],"sourcesContent":["export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync, writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].sort()\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({ location, name }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import { generateIgnoreFiles } from '../lib/index.ts'\n\nconst filename = '.npmignore'\n\nexport const npmignoreGen = (pkg?: string) => generateIgnoreFiles(filename, pkg)\n"],"mappings":";;;;AAAO,IAAMA,wBAAwB;AAC9B,IAAMC,yBAAyB;;;ACAtC,SACEC,YAAYC,cAAcC,qBACrB;;;ACHA,IAAMC,QAAQ,wBAACC,UAAwCA,OAAOC,KAAAA,EAAOC,WAAW,GAAlE;AACd,IAAMC,WAAW,wBAACH,UAAwC,CAACD,MAAMC,KAAAA,GAAhD;;;ACDjB,IAAMI,QAAQ,wBAACC,GAAaC,MAA6B,oBAA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mpty","union","a","b","Set","defaultReadFileSyncOptions","encoding","readLines","uri","options","defaultReadFileSyncOptions","existsSync","readFileSync","replace","WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","split","readNonEmptyLines","filter","notEmpty","writeLines","lines","existing","undefined","desired","join","writeFileSync","chalk","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","yarnWorkspace","pkg","workspace","yarnWorkspaces","find","name","Error","INIT_CWD","process","env","console","error","mergeEntries","a","b","union","sort","generateIgnoreFiles","filename","pkg","console","log","chalk","green","cwd","INIT_CWD","workspaces","yarnWorkspace","yarnWorkspaces","readEntries","location","readNonEmptyLines","writeEntries","entries","writeLines","results","map","name","ex","error","message","succeeded","every","result","filename","npmignoreGen","pkg","generateIgnoreFiles"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, {\n recursive: true, force: true,\n })\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MACdG,WAAW;MAAMC,OAAO;IAC1B,CAAA;EACF;AACF,GAV0B;;;ADEnB,IAAMC,sBAAsB,mCAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,QAAMS,QAAQC,IAAIR,QAAQS,IAAIC,CAAAA,WAAUC,WAAWD,MAAAA,CAAAA,CAAAA;AAEnD,SAAO;AACT,GATmC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,sBAAsB,mCAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,QAAMS,QAAQC,IAAIR,QAAQS,IAAIC,CAAAA,WAAUC,WAAWD,MAAAA,CAAAA,CAAAA;AAEnD,SAAO;AACT,GATmC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-typescript.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, {\n recursive: true, force: true,\n })\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MACdG,WAAW;MAAMC,OAAO;IAC1B,CAAA;EACF;AACF,GAV0B;;;ADEnB,IAAMC,yBAAyB,mCAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,MAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,KAAKC,KAAKZ,KAAK,eAAA;IAAkBW,KAAKC,KAAKZ,KAAK,aAAA;IAAgBW,KAAKC,KAAKZ,KAAK,cAAA;;AAExG,QAAMa,QAAQC,IAAIJ,MAAMK,IAAIC,CAAAA,SAAQC,WAAWD,IAAAA,CAAAA,CAAAA;AAE/C,SAAO;AACT,GATsC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-typescript.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,yBAAyB,mCAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,MAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,KAAKC,KAAKZ,KAAK,eAAA;IAAkBW,KAAKC,KAAKZ,KAAK,aAAA;IAAgBW,KAAKC,KAAKZ,KAAK,cAAA;;AAExG,QAAMa,QAAQC,IAAIJ,MAAMK,IAAIC,CAAAA,SAAQC,WAAWD,IAAAA,CAAAA,CAAAA;AAE/C,SAAO;AACT,GATsC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, {\n recursive: true, force: true,\n })\n }\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MACdG,WAAW;MAAMC,OAAO;IAC1B,CAAA;EACF;AACF,GAV0B;;;ADEnB,IAAMC,sBAAsB,mCAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,QAAMS,QAAQC,IAAIR,QAAQS,IAAIC,CAAAA,WAAUC,WAAWD,MAAAA,CAAAA,CAAAA;AAEnD,SAAO;AACT,GATmC;;;AENnC,OAAOE,WAAU;AAEjB,OAAOC,YAAW;AAIX,IAAMC,yBAAyB,mCAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,OAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,MAAKC,KAAKZ,KAAK,eAAA;IAAkBW,MAAKC,KAAKZ,KAAK,aAAA;IAAgBW,MAAKC,KAAKZ,KAAK,cAAA;;AAExG,QAAMa,QAAQC,IAAIJ,MAAMK,IAAIC,CAAAA,SAAQC,WAAWD,IAAAA,CAAAA,CAAAA;AAE/C,SAAO;AACT,GATsC;;;ACH/B,IAAME,eAAe,mCAAA;AAC1B,UAAQ,MAAMC,QAAQC,IAAI;IAACC,oBAAAA;IAAuBC,uBAAAA;GAAyB,GAAGC,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA;AACtH,GAF4B;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob","path","chalk","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,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fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob","path","chalk","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', {\n recursive: true, withFileTypes: true,\n }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, {\n ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true,\n })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n"],"mappings":";;;;AAEA,SAASA,YAAY;AAsCd,IAAMC,gBAAgB,wBAACC,WAAAA;AAE5B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IACnCG,QAAQ;MAAC;MAAe;MAAkB;;IAAiBC,OAAO;EACpE,CAAA;AACF,GAL6B;;;ACrCtB,IAAMC,eAAe,wBAACC,QAAgBC,WAAuBC,UAAU,UAAK;AACjF,UAAQD,WAAAA;IACN,KAAK,YAAY;AACf,UAAIC,QAASC,SAAQC,IAAI,yBAAA;AACzB,aAAO;QAAC,GAAGJ,MAAAA;QAAwB,GAAGA,MAAAA;;IACxC;IACA,KAAK,OAAO;AACV,UAAIE,QAASC,SAAQC,IAAI,oBAAA;AACzB,aAAOC,cAAcL,MAAAA,EAAQM,OAAOC,CAAAA,UAAS,CAACA,MAAMC,SAAS,QAAA,KAAa,CAACD,MAAMC,SAAS,SAAA,CAAA;IAC5F;IACA,SAAS;AACP,UAAIN,QAASC,SAAQC,IAAI,uBAAA;AACzB,aAAO;QAAC,GAAGJ,MAAAA;;IACb;EACF;AACF,GAf4B;","names":["glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes"]}
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n"],"mappings":";;;;AAEA,SAASA,YAAY;AAoCd,IAAMC,gBAAgB,wBAACC,WAAAA;AAE5B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,QAAQ;MAAC;MAAe;MAAkB;;IAAiBC,OAAO;EAAK,CAAA;AAChH,GAH6B;;;ACnCtB,IAAMC,eAAe,wBAACC,QAAgBC,WAAuBC,UAAU,UAAK;AACjF,UAAQD,WAAAA;IACN,KAAK,YAAY;AACf,UAAIC,QAASC,SAAQC,IAAI,yBAAA;AACzB,aAAO;QAAC,GAAGJ,MAAAA;QAAwB,GAAGA,MAAAA;;IACxC;IACA,KAAK,OAAO;AACV,UAAIE,QAASC,SAAQC,IAAI,oBAAA;AACzB,aAAOC,cAAcL,MAAAA,EAAQM,OAAOC,CAAAA,UAAS,CAACA,MAAMC,SAAS,QAAA,KAAa,CAACD,MAAMC,SAAS,SAAA,CAAA;IAC5F;IACA,SAAS;AACP,UAAIN,QAASC,SAAQC,IAAI,uBAAA;AACzB,aAAO;QAAC,GAAGJ,MAAAA;;IACb;EACF;AACF,GAf4B;","names":["glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../node_modules/deepmerge/dist/cjs.js","../../../../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"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","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 = {}): 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)\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'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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 : {\n character: 0, line: 0,\n }\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\nexport const 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 type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport {\n build, defineConfig,\n} from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport type {\n EntryMode, XyTsupConfig,\n} from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: true,\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 await Promise.all(optionsList.map(options => build(options)))\n // packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\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 const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\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 (\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', {\n recursive: true, withFileTypes: true,\n }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, {\n ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true,\n })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;AAEA,QAAIA,oBAAoB,gCAASA,mBAAkBC,OAAK;AACvD,aAAOC,gBAAgBD,KAAAA,KACnB,CAACE,UAAUF,KAAAA;IAChB,GAHwB;AAKxB,aAASC,gBAAgBD,OAAK;AAC7B,aAAO,CAAC,CAACA,SAAS,OAAOA,UAAU;IACpC;AAFSC;AAIT,aAASC,UAAUF,OAAK;AACvB,UAAIG,cAAcC,OAAOC,UAAUC,SAASC,KAAKP,KAAAA;AAEjD,aAAOG,gBAAgB,qBACnBA,gBAAgB,mBAChBK,eAAeR,KAAAA;IACpB;AANSE;AAST,QAAIO,eAAe,OAAOC,WAAW,cAAcA,OAAOC;AAC1D,QAAIC,qBAAqBH,eAAeC,OAAOC,IAAI,eAAA,IAAmB;AAEtE,aAASH,eAAeR,OAAK;AAC5B,aAAOA,MAAMa,aAAaD;IAC3B;AAFSJ;AAIT,aAASM,YAAYC,KAAG;AACvB,aAAOC,MAAMC,QAAQF,GAAAA,IAAO,CAAA,IAAK,CAAC;IACnC;AAFSD;AAIT,aAASI,8BAA8BlB,OAAOmB,SAAO;AACpD,aAAQA,QAAQC,UAAU,SAASD,QAAQpB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AmB,OAAOtB,SAASY,SAASW,mBAAmB,WAAWvB,SAASY,SAASW,iBAAiB,CAAC;AACpH,WAAOrD,SACH,MAAMD,cACNC,QACA8B,SAAS7B,WACT;MACE,GAAG2C;MACHC,QAAQ;QACN,GAAGD,gBAAgBC;QACnB,GAAGO,kBAAkBP;MACvB;MACAzC,QAAQ;MACRkD,UAAU;MACV,GAAGxB,SAASyB,MAAMrD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACA8B,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFwB,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAvGkC;;;ALlC3B,IAAMC,iBAAiB,8BAAOC,WAAqB,CAAC,MAAC;AAC1D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,aAAaP,GAAAA,EAAK,CAAA;AAC1C,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAChC,QAAMW,UAAUF,QAAOE;AAEvB,QAAMC,OAAOH,QAAOI,SAASD,QAAQ;AACrC,MAAIE,SAAiB;AACrB,UAAQF,MAAAA;IACN,KAAK,OAAO;AACVE,gBAAU,MAAMC,kBAAkBC,QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;","names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","Object","prototype","toString","call","isReactElement","canUseSymbol","Symbol","for","REACT_ELEMENT_TYPE","$$typeof","emptyTarget","val","Array","isArray","cloneUnlessOtherwiseSpecified","options","clone","deepmerge","defaultArrayMerge","target","source","concat","map","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","getKeys","keys","propertyIsOnObject","object","property","_","propertyIsUnsafe","hasOwnProperty","mergeObject","destination","forEach","arrayMerge","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","all","deepmergeAll","array","Error","reduce","prev","next","deepmerge_1","module","exports","chalk","chalk","cosmiconfig","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","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","import_deepmerge","createRequire","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","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","compileFolder","folder","entryMode","options","_verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTsup","config","compile","publint","verbose","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint"]}
1
+ {"version":3,"sources":["../../../../../../node_modules/deepmerge/dist/cjs.js","../../../../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"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","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 = {}): 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)\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'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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\nexport const 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 type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: true,\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 await Promise.all(optionsList.map(options => build(options)))\n // packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\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 const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\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 (\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\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 {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\n ...compile?.tsup?.options,\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;AAEA,QAAIA,oBAAoB,gCAASA,mBAAkBC,OAAK;AACvD,aAAOC,gBAAgBD,KAAAA,KACnB,CAACE,UAAUF,KAAAA;IAChB,GAHwB;AAKxB,aAASC,gBAAgBD,OAAK;AAC7B,aAAO,CAAC,CAACA,SAAS,OAAOA,UAAU;IACpC;AAFSC;AAIT,aAASC,UAAUF,OAAK;AACvB,UAAIG,cAAcC,OAAOC,UAAUC,SAASC,KAAKP,KAAAA;AAEjD,aAAOG,gBAAgB,qBACnBA,gBAAgB,mBAChBK,eAAeR,KAAAA;IACpB;AANSE;AAST,QAAIO,eAAe,OAAOC,WAAW,cAAcA,OAAOC;AAC1D,QAAIC,qBAAqBH,eAAeC,OAAOC,IAAI,eAAA,IAAmB;AAEtE,aAASH,eAAeR,OAAK;AAC5B,aAAOA,MAAMa,aAAaD;IAC3B;AAFSJ;AAIT,aAASM,YAAYC,KAAG;AACvB,aAAOC,MAAMC,QAAQF,GAAAA,IAAO,CAAA,IAAK,CAAC;IACnC;AAFSD;AAIT,aAASI,8BAA8BlB,OAAOmB,SAAO;AACpD,aAAQA,QAAQC,UAAU,SAASD,QAAQpB,kBAAkBC,KAAAA,IAC1DqB,WAAUP,YAAYd,KAAAA,GAAQA,OAAOmB,OAAAA,IACrCnB;IACJ;AAJSkB;AAMT,aAASI,kBAAkBC,QAAQC,QAAQL,SAAO;AACjD,aAAOI,OAAOE,OAAOD,MAAAA,EAAQE,IAAI,SAASC,SAAO;AA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MACvB;MACAzC,QAAQ;MACRkD,UAAU;MACV,GAAGxB,SAASyB,MAAMrD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACA8B,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFwB,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAvGkC;;;AL9B3B,IAAMC,iBAAiB,8BAAOC,WAAqB,CAAC,MAAC;AAC1D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,aAAaP,GAAAA,EAAK,CAAA;AAC1C,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAChC,QAAMW,UAAUF,QAAOE;AAEvB,QAAMC,OAAOH,QAAOI,SAASD,QAAQ;AACrC,MAAIE,SAAiB;AACrB,UAAQF,MAAAA;IACN,KAAK,OAAO;AACVE,gBAAU,MAAMC,kBAAkBC,QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;","names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","Object","prototype","toString","call","isReactElement","canUseSymbol","Symbol","for","REACT_ELEMENT_TYPE","$$typeof","emptyTarget","val","Array","isArray","cloneUnlessOtherwiseSpecified","options","clone","deepmerge","defaultArrayMerge","target","source","concat","map","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","getKeys","keys","propertyIsOnObject","object","property","_","propertyIsUnsafe","hasOwnProperty","mergeObject","destination","forEach","arrayMerge","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","all","deepmergeAll","array","Error","reduce","prev","next","deepmerge_1","module","exports","chalk","chalk","cosmiconfig","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","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","import_deepmerge","createRequire","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","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","compileFolder","folder","entryMode","options","_verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTsup","config","compile","publint","verbose","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import {\n copyFile, readdir,\n} from 'node:fs/promises'\n\nimport { Mutex } from 'async-mutex'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n // using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n // hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n"],"mappings":";;;;AAAA,SACEA,UAAUC,eACL;AAEP,SAASC,aAAa;AAGtB,IAAMC,gBAAgB,IAAIC,MAAAA;AAE1B,IAAMC,mBAAmB,8BAAOC,oBAAAA;AAC9B,QAAMC,SAASD,gBAAgBC,UAAU;AACzC,UAAQ,MAAMC,QAAQD,QAAQ;IAAEE,WAAW;EAAK,CAAA,GAAIC,OAAOC,CAAAA,SAAQA,KAAKC,SAAS,MAAA,CAAA,EAASC,IAAIF,CAAAA,SAAQ,GAAGJ,MAAAA,IAAUI,IAAAA,EAAM;AAC3H,GAHyB;AAKzB,IAAMG,sBAAsB,8BAAOR,oBAAAA;AACjC,QAAMC,SAASD,gBAAgBC,UAAU;AACzC,UAAQ,MAAMC,QAAQD,QAAQ;IAAEE,WAAW;EAAK,CAAA,GAAIC,OAAOC,CAAAA,SAAQA,KAAKC,SAAS,UAAA,CAAA,EAAaC,IAAIF,CAAAA,SAAQ,GAAGJ,MAAAA,IAAUI,IAAAA,EAAM;AAC/H,GAH4B;AAKrB,IAAMI,gBAAgB,8BAAOT,oBAAAA;AAElC,QAAMH,cAAca,aAAa,YAAA;AAE/B,UAAMC,gBAAgB,MAAMZ,iBAAiBC,eAAAA;AAC7C,UAAMY,QAAQC,IACZF,cAAcJ,IAAI,OAAOF,SAAAA;AACvB,YAAMS,SAAST,MAAMA,KAAKU,QAAQ,QAAQ,OAAA,CAAA;AAC1C,YAAMD,SAAST,MAAMA,KAAKU,QAAQ,QAAQ,OAAA,CAAA;IAC5C,CAAA,CAAA;AAGF,UAAMC,mBAAmB,MAAMR,oBAAoBR,eAAAA;AACnD,UAAMY,QAAQC,IACZG,iBAAiBT,IAAI,OAAOF,SAAAA;AAC1B,YAAMS,SAAST,MAAMA,KAAKU,QAAQ,YAAY,WAAA,CAAA;AAC9C,YAAMD,SAAST,MAAMA,KAAKU,QAAQ,YAAY,WAAA,CAAA;IAChD,CAAA,CAAA;EAEJ,CAAA;AACF,GApB6B;","names":["copyFile","readdir","Mutex","copyFileMutex","Mutex","getDistTypeFiles","compilerOptions","outDir","readdir","recursive","filter","file","endsWith","map","getDistTypeMapFiles","copyTypeFiles","runExclusive","distTypeFiles","Promise","all","copyFile","replace","distTypeMapFiles"]}
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'node:fs/promises'\n\nimport { Mutex } from 'async-mutex'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n // using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n // hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n"],"mappings":";;;;AAAA,SAASA,UAAUC,eAAe;AAElC,SAASC,aAAa;AAGtB,IAAMC,gBAAgB,IAAIC,MAAAA;AAE1B,IAAMC,mBAAmB,8BAAOC,oBAAAA;AAC9B,QAAMC,SAASD,gBAAgBC,UAAU;AACzC,UAAQ,MAAMC,QAAQD,QAAQ;IAAEE,WAAW;EAAK,CAAA,GAAIC,OAAOC,CAAAA,SAAQA,KAAKC,SAAS,MAAA,CAAA,EAASC,IAAIF,CAAAA,SAAQ,GAAGJ,MAAAA,IAAUI,IAAAA,EAAM;AAC3H,GAHyB;AAKzB,IAAMG,sBAAsB,8BAAOR,oBAAAA;AACjC,QAAMC,SAASD,gBAAgBC,UAAU;AACzC,UAAQ,MAAMC,QAAQD,QAAQ;IAAEE,WAAW;EAAK,CAAA,GAAIC,OAAOC,CAAAA,SAAQA,KAAKC,SAAS,UAAA,CAAA,EAAaC,IAAIF,CAAAA,SAAQ,GAAGJ,MAAAA,IAAUI,IAAAA,EAAM;AAC/H,GAH4B;AAKrB,IAAMI,gBAAgB,8BAAOT,oBAAAA;AAElC,QAAMH,cAAca,aAAa,YAAA;AAE/B,UAAMC,gBAAgB,MAAMZ,iBAAiBC,eAAAA;AAC7C,UAAMY,QAAQC,IACZF,cAAcJ,IAAI,OAAOF,SAAAA;AACvB,YAAMS,SAAST,MAAMA,KAAKU,QAAQ,QAAQ,OAAA,CAAA;AAC1C,YAAMD,SAAST,MAAMA,KAAKU,QAAQ,QAAQ,OAAA,CAAA;IAC5C,CAAA,CAAA;AAGF,UAAMC,mBAAmB,MAAMR,oBAAoBR,eAAAA;AACnD,UAAMY,QAAQC,IACZG,iBAAiBT,IAAI,OAAOF,SAAAA;AAC1B,YAAMS,SAAST,MAAMA,KAAKU,QAAQ,YAAY,WAAA,CAAA;AAC9C,YAAMD,SAAST,MAAMA,KAAKU,QAAQ,YAAY,WAAA,CAAA;IAChD,CAAA,CAAA;EAEJ,CAAA;AACF,GApB6B;","names":["copyFile","readdir","Mutex","copyFileMutex","Mutex","getDistTypeFiles","compilerOptions","outDir","readdir","recursive","filter","file","endsWith","map","getDistTypeMapFiles","copyTypeFiles","runExclusive","distTypeFiles","Promise","all","copyFile","replace","distTypeMapFiles"]}