@xylabs/ts-scripts-yarn3 4.0.0-rc.4 → 4.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.mjs +26 -97
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +5 -76
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +5 -76
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +3 -157
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +19 -90
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +5 -76
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +7 -78
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +5 -159
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +7 -78
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +7 -78
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +36 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/packageCompileTsup.ts +4 -10
|
@@ -2,7 +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/compile.ts
|
|
5
|
-
import
|
|
5
|
+
import chalk4 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/loadConfig.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -187,86 +187,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
187
187
|
}
|
|
188
188
|
}, "buildEntries");
|
|
189
189
|
|
|
190
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
191
|
-
import { cwd as cwd2 } from "node:process";
|
|
192
|
-
import chalk4 from "chalk";
|
|
193
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
194
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
195
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
196
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
197
|
-
if (verbose) {
|
|
198
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
199
|
-
}
|
|
200
|
-
const compilerOptions = {
|
|
201
|
-
...getCompilerOptions({
|
|
202
|
-
declaration: true,
|
|
203
|
-
emitDeclarationOnly: true,
|
|
204
|
-
outDir: "dist",
|
|
205
|
-
removeComments: true,
|
|
206
|
-
skipDefaultLibCheck: true,
|
|
207
|
-
skipLibCheck: true,
|
|
208
|
-
sourceMap: true
|
|
209
|
-
}),
|
|
210
|
-
...compilerOptionsParam
|
|
211
|
-
};
|
|
212
|
-
const files = buildEntries(folder, "all");
|
|
213
|
-
const result = createProgramFromConfig2({
|
|
214
|
-
basePath: pkg ?? cwd2(),
|
|
215
|
-
compilerOptions,
|
|
216
|
-
exclude: [
|
|
217
|
-
"dist",
|
|
218
|
-
"docs",
|
|
219
|
-
"**/*.spec.*",
|
|
220
|
-
"**/*.stories.*",
|
|
221
|
-
"src/**/spec/**/*"
|
|
222
|
-
],
|
|
223
|
-
files
|
|
224
|
-
}).emit();
|
|
225
|
-
const diagResults = result.diagnostics.length;
|
|
226
|
-
for (const diag of result.diagnostics) {
|
|
227
|
-
switch (diag.category) {
|
|
228
|
-
case DiagnosticCategory2.Error: {
|
|
229
|
-
console.error(chalk4.red(diag.messageText));
|
|
230
|
-
console.error(chalk4.grey(pkg));
|
|
231
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
case DiagnosticCategory2.Warning: {
|
|
235
|
-
console.error(chalk4.yellow(diag.messageText));
|
|
236
|
-
console.error(chalk4.grey(pkg));
|
|
237
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
case DiagnosticCategory2.Suggestion: {
|
|
241
|
-
console.error(chalk4.white(diag.messageText));
|
|
242
|
-
console.error(chalk4.grey(pkg));
|
|
243
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return diagResults;
|
|
249
|
-
}, "packageCompileTscTypes");
|
|
250
|
-
|
|
251
190
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
252
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
191
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
253
192
|
const outDir = options?.outDir ?? "dist";
|
|
254
193
|
const entry = buildEntries(folder, entryMode);
|
|
255
194
|
const optionsResult = defineConfig({
|
|
256
195
|
bundle: true,
|
|
257
196
|
cjsInterop: true,
|
|
258
197
|
clean: true,
|
|
259
|
-
dts:
|
|
198
|
+
dts: true,
|
|
260
199
|
entry,
|
|
261
200
|
format: [
|
|
262
201
|
"esm"
|
|
263
202
|
],
|
|
264
|
-
// minify: true,
|
|
265
203
|
outDir,
|
|
266
204
|
silent: true,
|
|
267
205
|
sourcemap: true,
|
|
268
206
|
splitting: false,
|
|
269
|
-
// terserOptions: { format: { comments: false } },
|
|
270
207
|
tsconfig: "tsconfig.json",
|
|
271
208
|
...options
|
|
272
209
|
});
|
|
@@ -281,11 +218,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
281
218
|
];
|
|
282
219
|
}))).flat();
|
|
283
220
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
284
|
-
packageCompileTscTypes(folder, {
|
|
285
|
-
verbose
|
|
286
|
-
}, {
|
|
287
|
-
outDir
|
|
288
|
-
});
|
|
289
221
|
return 0;
|
|
290
222
|
}, "compileFolder");
|
|
291
223
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
@@ -328,10 +260,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
328
260
|
sourcemap: true,
|
|
329
261
|
target: "esnext"
|
|
330
262
|
};
|
|
331
|
-
return await
|
|
332
|
-
publint: false,
|
|
333
|
-
verbose
|
|
334
|
-
}) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
263
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
335
264
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
336
265
|
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
337
266
|
...standardOptions,
|
|
@@ -376,7 +305,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
376
305
|
// src/actions/package/compile/compile.ts
|
|
377
306
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
378
307
|
const pkg = process.env.INIT_CWD;
|
|
379
|
-
console.log(
|
|
308
|
+
console.log(chalk4.green(`Compiling ${pkg}`));
|
|
380
309
|
const config2 = await loadConfig(inConfig);
|
|
381
310
|
const publint = config2.publint;
|
|
382
311
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTscTypes.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: false,\n entry,\n format: ['esm'],\n // minify: true,\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n // terserOptions: { format: { comments: 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","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n"],"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,gBA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,kBAAkBR;MACvB;MACAzC,QAAQ;MACRmD,UAAU;MACV,GAAGxB,SAASyB,MAAMtD;MAClB,GAAI,OAAOA,YAAY,WAAWA,UAAU,CAAC;IAC/C,GACAC,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFsD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAtGkC;;;ALpC3B,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","cwd","chalk","createProgramFromConfig","DiagnosticCategory","packageCompileTscTypes","folder","verbose","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","compileFolder","folder","entryMode","options","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","packageCompileTscTypes","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 { 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 ...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,WA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AO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GArGkC;;;AL/B3B,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","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,7 +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/compile.ts
|
|
5
|
-
import
|
|
5
|
+
import chalk4 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/loadConfig.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -187,86 +187,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
187
187
|
}
|
|
188
188
|
}, "buildEntries");
|
|
189
189
|
|
|
190
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
191
|
-
import { cwd as cwd2 } from "node:process";
|
|
192
|
-
import chalk4 from "chalk";
|
|
193
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
194
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
195
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
196
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
197
|
-
if (verbose) {
|
|
198
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
199
|
-
}
|
|
200
|
-
const compilerOptions = {
|
|
201
|
-
...getCompilerOptions({
|
|
202
|
-
declaration: true,
|
|
203
|
-
emitDeclarationOnly: true,
|
|
204
|
-
outDir: "dist",
|
|
205
|
-
removeComments: true,
|
|
206
|
-
skipDefaultLibCheck: true,
|
|
207
|
-
skipLibCheck: true,
|
|
208
|
-
sourceMap: true
|
|
209
|
-
}),
|
|
210
|
-
...compilerOptionsParam
|
|
211
|
-
};
|
|
212
|
-
const files = buildEntries(folder, "all");
|
|
213
|
-
const result = createProgramFromConfig2({
|
|
214
|
-
basePath: pkg ?? cwd2(),
|
|
215
|
-
compilerOptions,
|
|
216
|
-
exclude: [
|
|
217
|
-
"dist",
|
|
218
|
-
"docs",
|
|
219
|
-
"**/*.spec.*",
|
|
220
|
-
"**/*.stories.*",
|
|
221
|
-
"src/**/spec/**/*"
|
|
222
|
-
],
|
|
223
|
-
files
|
|
224
|
-
}).emit();
|
|
225
|
-
const diagResults = result.diagnostics.length;
|
|
226
|
-
for (const diag of result.diagnostics) {
|
|
227
|
-
switch (diag.category) {
|
|
228
|
-
case DiagnosticCategory2.Error: {
|
|
229
|
-
console.error(chalk4.red(diag.messageText));
|
|
230
|
-
console.error(chalk4.grey(pkg));
|
|
231
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
case DiagnosticCategory2.Warning: {
|
|
235
|
-
console.error(chalk4.yellow(diag.messageText));
|
|
236
|
-
console.error(chalk4.grey(pkg));
|
|
237
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
case DiagnosticCategory2.Suggestion: {
|
|
241
|
-
console.error(chalk4.white(diag.messageText));
|
|
242
|
-
console.error(chalk4.grey(pkg));
|
|
243
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return diagResults;
|
|
249
|
-
}, "packageCompileTscTypes");
|
|
250
|
-
|
|
251
190
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
252
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
191
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
253
192
|
const outDir = options?.outDir ?? "dist";
|
|
254
193
|
const entry = buildEntries(folder, entryMode);
|
|
255
194
|
const optionsResult = defineConfig({
|
|
256
195
|
bundle: true,
|
|
257
196
|
cjsInterop: true,
|
|
258
197
|
clean: true,
|
|
259
|
-
dts:
|
|
198
|
+
dts: true,
|
|
260
199
|
entry,
|
|
261
200
|
format: [
|
|
262
201
|
"esm"
|
|
263
202
|
],
|
|
264
|
-
// minify: true,
|
|
265
203
|
outDir,
|
|
266
204
|
silent: true,
|
|
267
205
|
sourcemap: true,
|
|
268
206
|
splitting: false,
|
|
269
|
-
// terserOptions: { format: { comments: false } },
|
|
270
207
|
tsconfig: "tsconfig.json",
|
|
271
208
|
...options
|
|
272
209
|
});
|
|
@@ -281,11 +218,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
281
218
|
];
|
|
282
219
|
}))).flat();
|
|
283
220
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
284
|
-
packageCompileTscTypes(folder, {
|
|
285
|
-
verbose
|
|
286
|
-
}, {
|
|
287
|
-
outDir
|
|
288
|
-
});
|
|
289
221
|
return 0;
|
|
290
222
|
}, "compileFolder");
|
|
291
223
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
@@ -328,10 +260,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
328
260
|
sourcemap: true,
|
|
329
261
|
target: "esnext"
|
|
330
262
|
};
|
|
331
|
-
return await
|
|
332
|
-
publint: false,
|
|
333
|
-
verbose
|
|
334
|
-
}) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
263
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
335
264
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
336
265
|
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
337
266
|
...standardOptions,
|
|
@@ -376,7 +305,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
376
305
|
// src/actions/package/compile/compile.ts
|
|
377
306
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
378
307
|
const pkg = process.env.INIT_CWD;
|
|
379
|
-
console.log(
|
|
308
|
+
console.log(chalk4.green(`Compiling ${pkg}`));
|
|
380
309
|
const config2 = await loadConfig(inConfig);
|
|
381
310
|
const publint = config2.publint;
|
|
382
311
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTscTypes.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: false,\n entry,\n format: ['esm'],\n // minify: true,\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n // terserOptions: { format: { comments: 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","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n"],"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,SA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,CAAA,CAAA,GAEFsD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MACpC3B,UAAU,MAAM4B,eAAAA,IAAmB;AAE3C,GAtGkC;;;ALpC3B,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","cwd","chalk","createProgramFromConfig","DiagnosticCategory","packageCompileTscTypes","folder","verbose","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","compileFolder","folder","entryMode","options","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","packageCompileTscTypes","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 { 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 ...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;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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","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"]}
|