@xylabs/ts-scripts-yarn3 4.0.0-rc.5 → 4.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -149,6 +149,7 @@ var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerO
149
149
  }, "packageCompileTsc");
150
150
 
151
151
  // src/actions/package/compile/packageCompileTsup.ts
152
+ import svgrPlugin from "esbuild-plugin-svgr";
152
153
  import { build, defineConfig } from "tsup";
153
154
 
154
155
  // src/actions/package/compile/inputs.ts
@@ -188,7 +189,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
188
189
  }, "buildEntries");
189
190
 
190
191
  // src/actions/package/compile/packageCompileTsup.ts
191
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
192
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
192
193
  const outDir = options?.outDir ?? "dist";
193
194
  const entry = buildEntries(folder, entryMode);
194
195
  const optionsResult = defineConfig({
@@ -205,6 +206,9 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
205
206
  sourcemap: true,
206
207
  splitting: false,
207
208
  tsconfig: "tsconfig.json",
209
+ esbuildPlugins: [
210
+ svgrPlugin()
211
+ ],
208
212
  ...options
209
213
  });
210
214
  const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
@@ -260,10 +264,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
260
264
  sourcemap: true,
261
265
  target: "esnext"
262
266
  };
263
- return await packageCompileTsc(true, {
264
- publint: false,
265
- verbose
266
- }) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
267
+ return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
267
268
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
268
269
  return folder ? await compileFolder(folder, compile?.entryMode, {
269
270
  ...standardOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\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 merge({}, config, params)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { 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 ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { 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\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } 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 { ...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 merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport { 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\n// eslint-disable-next-line complexity\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (await packageCompileTsc(true, { publint: false, verbose }))\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 { 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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ACH,MAAMD,cACNC,QACA8B,SAAS7B,WACT;MACE,GAAG0C;MACHC,QAAQ;QACN,GAAGD,gBAAgBC;QACnB,GAAGQ,kBAAkBR;MACvB;MACAxC,QAAQ;MACRkD,UAAU;MACV,GAAGxB,SAASyB,MAAMrD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACAC,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFqD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAtGkC;;;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":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","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","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","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","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","packageCompileTsc","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":["../../../../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":["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 { XyConfig, XyTscConfig, XyTsupConfig } 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'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\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 merge({}, config, params)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { 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 ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { 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\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } 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 { ...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 merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport svgrPlugin from 'esbuild-plugin-svgr'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { 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 esbuildPlugins: [\n svgrPlugin(),\n ],\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 { 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,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3B,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":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","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","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","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","svgrPlugin","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","esbuildPlugins","svgrPlugin","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"]}
@@ -149,6 +149,7 @@ var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerO
149
149
  }, "packageCompileTsc");
150
150
 
151
151
  // src/actions/package/compile/packageCompileTsup.ts
152
+ import svgrPlugin from "esbuild-plugin-svgr";
152
153
  import { build, defineConfig } from "tsup";
153
154
 
154
155
  // src/actions/package/compile/inputs.ts
@@ -188,7 +189,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
188
189
  }, "buildEntries");
189
190
 
190
191
  // src/actions/package/compile/packageCompileTsup.ts
191
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
192
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
192
193
  const outDir = options?.outDir ?? "dist";
193
194
  const entry = buildEntries(folder, entryMode);
194
195
  const optionsResult = defineConfig({
@@ -205,6 +206,9 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
205
206
  sourcemap: true,
206
207
  splitting: false,
207
208
  tsconfig: "tsconfig.json",
209
+ esbuildPlugins: [
210
+ svgrPlugin()
211
+ ],
208
212
  ...options
209
213
  });
210
214
  const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
@@ -260,10 +264,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
260
264
  sourcemap: true,
261
265
  target: "esnext"
262
266
  };
263
- return await packageCompileTsc(true, {
264
- publint: false,
265
- verbose
266
- }) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
267
+ return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
267
268
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
268
269
  return folder ? await compileFolder(folder, compile?.entryMode, {
269
270
  ...standardOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\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 merge({}, config, params)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { 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 ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { 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\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } 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 { ...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 merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport { 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\n// eslint-disable-next-line complexity\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (await packageCompileTsc(true, { publint: false, verbose }))\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 { 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,MAAM,CAAC,GAAGH,QAAQE,MAAAA;AAC3B,GAZ0B;;;ACP1B,SAASY,YAAYC,UAAU;AAE/B,OAAOC,YAAW;AAOX,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAC3B,QAAMC,MAAMC,KAAKC,MAAM,MAAMC,GAAGC,SAAS,GAAGR,MAAAA,iBAAuB,M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IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;","names":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","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","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","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","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","packageCompileTsc","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":["../../../../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":["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 { XyConfig, XyTscConfig, XyTsupConfig } 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'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\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 merge({}, config, params)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { 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 ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { 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\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } 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 { ...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 merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport svgrPlugin from 'esbuild-plugin-svgr'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { 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 esbuildPlugins: [\n svgrPlugin(),\n ],\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 { 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,MAAM,CAAC,GAAGH,QAAQE,MAAAA;AAC3B,GAZ0B;;;ACP1B,SAASY,YAAYC,UAAU;AAE/B,OAAOC,YAAW;AAOX,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAC3B,QAAMC,MAAMC,KAAKC,MAAM,MAAMC,GAAGC,SAAS,GAAGR,MAAAA,iBAAuB,MAAA,CAAA;AAEnES,UAAQC,IAAIC,OAAMC,MAAM,YAAYR,IAAIS,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,OAAMG,KAAKd,MAAAA,CAAAA;AAEvB,QAAM,EAAEe,QAAO,IAAK,MAAM,OAAO,SAAA;AAEjC,QAAM,EAAEC,SAAQ,IAAK,MAAMD,QAAQ;IACjCE,OAAO;IACPjB;IACAkB,QAAQ;EACV,CAAA;AAGA,QAAM,EAAEC,cAAa,IAAK,MAAM,OAAO,eAAA;AAEvC,QAAMC,eAAe,wBAACC,aAAAA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OAAAA,MAAQ;AAC5D,UAAMoD,mBAAmB,OAAOtB,SAASY,SAASW,mBAAmB,WAAWvB,SAASY,SAASW,iBAAiB,CAAC;AACpH,WAAOvD,SACH,MAAMD,cACNC,QACAgC,SAAS/B,WACT;MACE,GAAG6C;MACHC,QAAQ;QACN,GAAGD,gBAAgBC;QACnB,GAAGO,kBAAkBP;MACvB;MACA3C,QAAQ;MACRoD,UAAU;MACV,GAAGxB,SAASyB,MAAMvD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACAgC,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFwB,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GArGkC;;;ALnC3B,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":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","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","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","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","svgrPlugin","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","esbuildPlugins","svgrPlugin","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"]}
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/actions/package/compile/packageCompileTsup.ts
5
+ import svgrPlugin from "esbuild-plugin-svgr";
5
6
  import { build, defineConfig } from "tsup";
6
7
 
7
8
  // src/actions/package/publint.ts
@@ -81,91 +82,8 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
81
82
  }
82
83
  }, "buildEntries");
83
84
 
84
- // src/actions/package/compile/packageCompileTsc.ts
85
- import { cwd } from "node:process";
86
- import chalk2 from "chalk";
87
- import { createProgramFromConfig } from "tsc-prog";
88
- import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getLineAndCharacterOfPosition, getPreEmitDiagnostics } from "typescript";
89
-
90
- // src/actions/package/compile/getCompilerOptions.ts
91
- import { createRequire } from "node:module";
92
- import merge from "lodash/merge.js";
93
- import { findConfigFile, readConfigFile, sys } from "typescript";
94
- var getNested = /* @__PURE__ */ __name((config) => {
95
- if (config.extends) {
96
- const require2 = createRequire(import.meta.url);
97
- const opts = require2(config.extends);
98
- return {
99
- ...getNested(opts),
100
- ...config.compilerOptions
101
- };
102
- }
103
- return config.compilerOptions;
104
- }, "getNested");
105
- var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename) => {
106
- const config = readConfigFile(filename, sys.readFile).config;
107
- return getNested(config);
108
- }, "getCompilerOptionsJSONFollowExtends");
109
- var getCompilerOptions = /* @__PURE__ */ __name((options, tsconfig = "tsconfig.json") => {
110
- const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
111
- const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
112
- return merge({}, configFileCompilerOptions, options);
113
- }, "getCompilerOptions");
114
-
115
- // src/actions/package/compile/packageCompileTsc.ts
116
- var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config, compilerOptionsParam) => {
117
- const pkg = process.env.INIT_CWD ?? cwd();
118
- const publint = config?.publint ?? true;
119
- const verbose = config?.verbose ?? false;
120
- const formatHost = {
121
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
122
- getCurrentDirectory: /* @__PURE__ */ __name(() => pkg, "getCurrentDirectory"),
123
- getNewLine: /* @__PURE__ */ __name(() => "\n", "getNewLine")
124
- };
125
- if (verbose) {
126
- console.log(`Compiling with NoEmit TSC [${pkg}]`);
127
- }
128
- const compilerOptions = {
129
- ...getCompilerOptions({
130
- outDir: "dist",
131
- removeComments: true,
132
- rootDir: "src"
133
- }),
134
- ...compilerOptionsParam,
135
- ...noEmit === void 0 ? {} : {
136
- noEmit
137
- }
138
- };
139
- const program = createProgramFromConfig({
140
- basePath: pkg ?? cwd(),
141
- compilerOptions,
142
- exclude: [
143
- "dist",
144
- "docs",
145
- "**/*.spec.*",
146
- "**/*.stories.*",
147
- "src/**/spec/**/*"
148
- ],
149
- include: [
150
- "src"
151
- ]
152
- });
153
- const results = getPreEmitDiagnostics(program);
154
- for (const diag of results) {
155
- const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : {
156
- character: 0,
157
- line: 0
158
- };
159
- console.log(chalk2.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
160
- console.log(formatDiagnosticsWithColorAndContext([
161
- diag
162
- ], formatHost));
163
- }
164
- return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory.Error ? 1 : 0, 0) || (publint ? await packagePublint() : 0);
165
- }, "packageCompileTsc");
166
-
167
85
  // src/actions/package/compile/packageCompileTsup.ts
168
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
86
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
169
87
  const outDir = options?.outDir ?? "dist";
170
88
  const entry = buildEntries(folder, entryMode);
171
89
  const optionsResult = defineConfig({
@@ -182,6 +100,9 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
182
100
  sourcemap: true,
183
101
  splitting: false,
184
102
  tsconfig: "tsconfig.json",
103
+ esbuildPlugins: [
104
+ svgrPlugin()
105
+ ],
185
106
  ...options
186
107
  });
187
108
  const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
@@ -237,10 +158,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config) => {
237
158
  sourcemap: true,
238
159
  target: "esnext"
239
160
  };
240
- return await packageCompileTsc(true, {
241
- publint: false,
242
- verbose
243
- }) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
161
+ return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
244
162
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
245
163
  return folder ? await compileFolder(folder, compile?.entryMode, {
246
164
  ...standardOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport { 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\n// eslint-disable-next-line complexity\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (await packageCompileTsc(true, { publint: false, verbose }))\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 { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { 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 { 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","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { 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 ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { 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\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } 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 { ...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 merge({}, configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AACA,SAASA,OAAOC,oBAA6B;;;ACD7C,SAASC,YAAYC,UAAU;AAE/B,OAAOC,WAAW;AAOX,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAC3B,QAAMC,MAAMC,KAAKC,MAAM,MAAMC,GAAGC,SAAS,GAAGR,MAAAA,iBAAuB,MAAA,CAAA;AAEnES,UAAQC,IAAIC,MAAMC,MAAM,YAAYR,IAAIS,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,MAAMG,KAAKd,MAAAA,CAAAA;AAEvB,QAAM,EAAEe,QAAO,IAAK,MAAM,OAAO,SAAA;AAEjC,QAAM,EAAEC,SAAQ,IAAK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C,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MAEtC,MAAMvC,QAAQC,IACZ8B,OAAOC,QAAQX,iBAAAA,EAAmBd,IAAI,OAAO,CAAC1B,QAAQE,OAAAA,MAAQ;AAC5D,UAAMkD,mBAAmB,OAAOtB,SAASW,SAASY,mBAAmB,WAAWvB,SAASW,SAASY,iBAAiB,CAAC;AACpH,WAAOrD,SACH,MAAMD,cACNC,QACA8B,SAAS7B,WACT;MACE,GAAG0C;MACHC,QAAQ;QACN,GAAGD,gBAAgBC;QACnB,GAAGQ,kBAAkBR;MACvB;MACAxC,QAAQ;MACRkD,UAAU;MACV,GAAGxB,SAASyB,MAAMrD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACAC,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFqD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAtGkC;","names":["build","defineConfig","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","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","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","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","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","packageCompileTsc","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint"]}
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import type { Loader } from 'esbuild'\nimport svgrPlugin from 'esbuild-plugin-svgr'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { 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 esbuildPlugins: [\n svgrPlugin(),\n ],\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> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\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/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 { 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 { 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":";;;;AACA,OAAOA,gBAAgB;AACvB,SAASC,OAAOC,oBAA6B;;;ACF7C,SAASC,YAAYC,UAAU;AAE/B,OAAOC,WAAW;AAOX,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAC3B,QAAMC,MAAMC,KAAKC,MAAM,MAAMC,GAAGC,SAAS,GAAGR,MAAAA,iBAAuB,MAAA,CAAA;AAEnES,UAAQC,IAAIC,MAAMC,MAAM,YAAYR,IAAIS,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,MAAMG,KAAKd,MAAAA,CAAAA;AAEvB,QAAM,EAAEe,QAAO,IAAK,MAAM,OAAO,SAAA;AAEjC,QAAM,EAAEC,SAAQ,IAAK,MAAMD,QAAQ;IACjCE,OAAO;IACPjB;IACAkB,QAAQ;EACV,CAAA;AAGA,QAAM,EAAEC,cAAa,IAAK,MAAM,OAAO,eAAA;AAEvC,QAAMC,eAAe,wBAACC,aAAAA;AACpB,WAAO;EAiBT,GAlBqB;AAqBrB,QAAMC,gBAAgBN,SAASO,OAAOH,YAAAA;AACtC,aAAWI,WAAWF,eAAe;AACnC,YAAQE,QAAQC,MAAI;MAClB,KAAK,SAAS;AACZhB,gBAAQiB,MAAMf,MAAMgB,IAAI,IAAIH,QAAQI,IAAI,KAAKT,cAAcK,SAASpB,GAAAA,CAAAA,EAAM,CAAA;AAC1E;MACF;MACA,KAAK,WAAW;AACdK,gBAAQoB,KAAKlB,MAAMmB,OAAO,IAAIN,QAAQI,IAAI,KAAKT,cAAcK,SAASpB,GAAAA,CAAAA,EAAM,CAAA;AAC5E;MACF;MACA,SAAS;AACPK,gBAAQC,IAAIC,MAAMoB,MAAM,IAAIP,QAAQI,IAAI,KAA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C;AACpH,WAAOvD,SACH,MAAMD,cACNC,QACAgC,SAAS/B,WACT;MACE,GAAG6C;MACHC,QAAQ;QACN,GAAGD,gBAAgBC;QACnB,GAAGO,kBAAkBP;MACvB;MACA3C,QAAQ;MACRoD,UAAU;MACV,GAAGxB,SAASyB,MAAMvD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACAgC,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFwB,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GArGkC;","names":["svgrPlugin","build","defineConfig","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","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","esbuildPlugins","svgrPlugin","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"]}
@@ -204,6 +204,7 @@ var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerO
204
204
  }, "packageCompileTsc");
205
205
 
206
206
  // src/actions/package/compile/packageCompileTsup.ts
207
+ import svgrPlugin from "esbuild-plugin-svgr";
207
208
  import { build, defineConfig } from "tsup";
208
209
 
209
210
  // src/actions/package/compile/inputs.ts
@@ -243,7 +244,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
243
244
  }, "buildEntries");
244
245
 
245
246
  // src/actions/package/compile/packageCompileTsup.ts
246
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
247
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
247
248
  const outDir = options?.outDir ?? "dist";
248
249
  const entry = buildEntries(folder, entryMode);
249
250
  const optionsResult = defineConfig({
@@ -260,6 +261,9 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
260
261
  sourcemap: true,
261
262
  splitting: false,
262
263
  tsconfig: "tsconfig.json",
264
+ esbuildPlugins: [
265
+ svgrPlugin()
266
+ ],
263
267
  ...options
264
268
  });
265
269
  const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
@@ -315,10 +319,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
315
319
  sourcemap: true,
316
320
  target: "esnext"
317
321
  };
318
- return await packageCompileTsc(true, {
319
- publint: false,
320
- verbose
321
- }) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
322
+ return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
322
323
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
323
324
  return folder ? await compileFolder(folder, compile?.entryMode, {
324
325
  ...standardOptions,