@xylabs/ts-scripts-yarn3 6.1.6 → 6.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.mjs +11 -16
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +8 -8
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +11 -16
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +10 -15
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +11 -16
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +6 -6
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +9 -9
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +10 -11
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +11 -16
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +11 -16
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +11 -16
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +11 -16
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +11 -16
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +11 -16
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +11 -16
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +10 -15
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +11 -16
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +11 -16
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +11 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -3,19 +3,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/actions/package/compile/inputs.ts
|
|
5
5
|
import { glob } from "glob";
|
|
6
|
-
var getAllInputs = /* @__PURE__ */ __name((folder
|
|
6
|
+
var getAllInputs = /* @__PURE__ */ __name((folder, ignore = [
|
|
7
|
+
"**/*.spec.*",
|
|
8
|
+
"**/*.stories.*",
|
|
9
|
+
"**/spec/**/*"
|
|
10
|
+
]) => {
|
|
7
11
|
return glob.sync(`${folder}/**/*.*`, {
|
|
8
|
-
ignore
|
|
9
|
-
"**/*.spec.*",
|
|
10
|
-
"**/*.stories.*",
|
|
11
|
-
"**/spec/**/*"
|
|
12
|
-
],
|
|
12
|
+
ignore,
|
|
13
13
|
posix: true
|
|
14
14
|
});
|
|
15
15
|
}, "getAllInputs");
|
|
16
16
|
|
|
17
17
|
// src/actions/package/compile/buildEntries.ts
|
|
18
|
-
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose = false) => {
|
|
18
|
+
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", excludeSpecAndStory = true, verbose = false) => {
|
|
19
19
|
let entries = [];
|
|
20
20
|
switch (entryMode) {
|
|
21
21
|
case "platform": {
|
|
@@ -26,7 +26,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
case "all": {
|
|
29
|
-
entries = getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".
|
|
29
|
+
entries = excludeSpecAndStory ? getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(folder, []);
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
default: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string, ignore = ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*']) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore, posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStory = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStory ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder, [])\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n"],"mappings":";;;;AAAA,SAASA,YAAY;AAEd,IAAMC,eAAe,wBAACC,QAAgBC,SAAS;EAAC;EAAe;EAAkB;MAAe;AAErG,SAAOC,KAAKC,KAAK,GAAGH,MAAAA,WAAiB;IAAEC;IAAQG,OAAO;EAAK,CAAA;AAC7D,GAH4B;;;ACCrB,IAAMC,eAAe,wBAACC,QAAgBC,YAAuB,UAAUC,sBAAsB,MAAMC,UAAU,UAAK;AACvH,MAAIC,UAAoB,CAAA;AACxB,UAAQH,WAAAA;IACN,KAAK,YAAY;AACfG,gBAAU;QAAC,GAAGJ,MAAAA;QAAwB,GAAGA,MAAAA;;AACzC;IACF;IACA,KAAK,OAAO;AACVI,gBAAUF,sBAAsBG,aAAaL,MAAAA,EAAQM,OAAOC,CAAAA,UAAS,CAACA,MAAMC,SAAS,QAAA,KAAa,CAACD,MAAMC,SAAS,WAAA,CAAA,IAAgBH,aAAaL,QAAQ,CAAA,CAAE;AACzJ;IACF;IACA,SAAS;AACPI,gBAAU;QAAC,GAAGJ,MAAAA;;AACd;IACF;EACF;AACA,MAAIG,QAASM,SAAQC,IAAI,iBAAiBT,SAAAA,KAAcG,QAAQO,MAAM,EAAE;AACxE,SAAOP;AACT,GAlB4B;","names":["glob","getAllInputs","folder","ignore","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStory","verbose","entries","getAllInputs","filter","entry","includes","console","log","length"]}
|
|
@@ -73,19 +73,19 @@ import { build, defineConfig } from "tsup";
|
|
|
73
73
|
|
|
74
74
|
// src/actions/package/compile/inputs.ts
|
|
75
75
|
import { glob } from "glob";
|
|
76
|
-
var getAllInputs = /* @__PURE__ */ __name((folder
|
|
76
|
+
var getAllInputs = /* @__PURE__ */ __name((folder, ignore = [
|
|
77
|
+
"**/*.spec.*",
|
|
78
|
+
"**/*.stories.*",
|
|
79
|
+
"**/spec/**/*"
|
|
80
|
+
]) => {
|
|
77
81
|
return glob.sync(`${folder}/**/*.*`, {
|
|
78
|
-
ignore
|
|
79
|
-
"**/*.spec.*",
|
|
80
|
-
"**/*.stories.*",
|
|
81
|
-
"**/spec/**/*"
|
|
82
|
-
],
|
|
82
|
+
ignore,
|
|
83
83
|
posix: true
|
|
84
84
|
});
|
|
85
85
|
}, "getAllInputs");
|
|
86
86
|
|
|
87
87
|
// src/actions/package/compile/buildEntries.ts
|
|
88
|
-
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose = false) => {
|
|
88
|
+
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", excludeSpecAndStory = true, verbose = false) => {
|
|
89
89
|
let entries = [];
|
|
90
90
|
switch (entryMode) {
|
|
91
91
|
case "platform": {
|
|
@@ -96,7 +96,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "all": {
|
|
99
|
-
entries = getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".
|
|
99
|
+
entries = excludeSpecAndStory ? getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(folder, []);
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
default: {
|
|
@@ -110,11 +110,9 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
110
110
|
return entries;
|
|
111
111
|
}, "buildEntries");
|
|
112
112
|
|
|
113
|
-
// src/actions/package/compile/compileTypes.ts
|
|
114
|
-
import chalk3 from "chalk";
|
|
115
|
-
|
|
116
113
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
117
114
|
import { cwd } from "node:process";
|
|
115
|
+
import chalk3 from "chalk";
|
|
118
116
|
import { createProgramFromConfig } from "tsc-prog";
|
|
119
117
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
120
118
|
|
|
@@ -144,9 +142,6 @@ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tscon
|
|
|
144
142
|
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
145
143
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
146
144
|
const verbose = config2?.verbose ?? false;
|
|
147
|
-
if (verbose) {
|
|
148
|
-
console.log(`Compiling types [${pkg}]`);
|
|
149
|
-
}
|
|
150
145
|
const compilerOptions = {
|
|
151
146
|
...getCompilerOptions({
|
|
152
147
|
emitDeclarationOnly: true,
|
|
@@ -170,6 +165,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
170
165
|
".d.mts"
|
|
171
166
|
];
|
|
172
167
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
168
|
+
console.log(chalk3.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
173
169
|
const program = createProgramFromConfig({
|
|
174
170
|
basePath: pkg ?? cwd(),
|
|
175
171
|
compilerOptions,
|
|
@@ -198,7 +194,6 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
198
194
|
// src/actions/package/compile/compileTypes.ts
|
|
199
195
|
var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
200
196
|
const pkg = process.env.INIT_CWD;
|
|
201
|
-
console.log(chalk3.green(`Compiling Types ${pkg}`));
|
|
202
197
|
const config2 = await loadConfig(inConfig);
|
|
203
198
|
return packageCompileTscTypes(void 0, config2);
|
|
204
199
|
}, "packageCompileTypes");
|
|
@@ -236,7 +231,6 @@ import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAn
|
|
|
236
231
|
var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
237
232
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
238
233
|
const verbose = config2?.verbose ?? false;
|
|
239
|
-
console.log(chalk4.green(`Compiling Files ${pkg}`));
|
|
240
234
|
const compilerOptions = {
|
|
241
235
|
...getCompilerOptions({
|
|
242
236
|
outDir: "dist/types",
|
|
@@ -259,6 +253,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
259
253
|
".d.mts"
|
|
260
254
|
];
|
|
261
255
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
256
|
+
console.log(chalk4.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
262
257
|
const program = createProgramFromConfig2({
|
|
263
258
|
basePath: pkg ?? cwd2(),
|
|
264
259
|
compilerOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","import { cwd } from 'node:process'\n\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n console.log(chalk.green(`Compiling Files ${pkg}`))\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACN1B,SAASY,YAAYC,UAAU;AAE/B,OAAOC,YAAW;AAElB,OAAOC,qBAAqB;AAIrB,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAE3B,QAAMC,YAAYC,gBAAgB,MAAMC,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAC9E,QAAMM,GAAGE,UAAU,GAAGR,MAAAA,iBAAuBI,SAAAA;AAE7C,QAAMK,MAAMC,KAAKC,MAAM,MAAML,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAEnEY,UAAQC,IAAIC,OAAMC,MAAM,YAAYN,IAAIO,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,OAAMG,KAAKjB,MAAAA,CAAAA;AAEvB,QA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,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MAEtC,MAAMzC,QAAQC,IACZgC,OAAOC,QAAQP,iBAAAA,EAAmBpB,IAAI,OAAO,CAAC5B,QAAQE,OAAAA,MAAQ;AAC5D,UAAMsD,mBAAmB,OAAOf,SAASQ,SAASQ,mBAAmB,WAAWhB,SAASQ,SAASQ,iBAAiB,CAAC;AACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA9EkC;;;AHtE3B,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,cAAc,MAAMC,mBAAmBJ,OAAAA;AAE7C,MAAIG,cAAc,GAAG;AACnB,WAAOA;EACT;AAEA,SAAQD,UAAU,MAAMG,eAAeL,OAAAA,IAAU;AACnD,GAb8B;","names":["chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","promises","fs","chalk","sortPackageJson","packagePublint","params","pkgDir","process","env","INIT_CWD","sortedPkg","sortPackageJson","fs","readFile","writeFile","pkg","JSON","parse","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","build","defineConfig","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","chalk","cwd","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","chalk","green","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","tsupResults","packageCompileTsup","packagePublint"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string, ignore = ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*']) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore, posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStory = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStory ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder, [])\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n console.log(chalk.green(`Compiling Files ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SA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AAEP,GA9EkC;;;AHtE3B,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,cAAc,MAAMC,mBAAmBJ,OAAAA;AAE7C,MAAIG,cAAc,GAAG;AACnB,WAAOA;EACT;AAEA,SAAQD,UAAU,MAAMG,eAAeL,OAAAA,IAAU;AACnD,GAb8B;","names":["chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","promises","fs","chalk","sortPackageJson","packagePublint","params","pkgDir","process","env","INIT_CWD","sortedPkg","sortPackageJson","fs","readFile","writeFile","pkg","JSON","parse","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","build","defineConfig","glob","getAllInputs","folder","ignore","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStory","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","tsupResults","packageCompileTsup","packagePublint"]}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/actions/package/compile/compileTypes.ts
|
|
5
|
-
import chalk2 from "chalk";
|
|
6
|
-
|
|
7
4
|
// src/lib/loadConfig.ts
|
|
8
5
|
import chalk from "chalk";
|
|
9
6
|
import { cosmiconfig } from "cosmiconfig";
|
|
@@ -26,24 +23,25 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
|
26
23
|
|
|
27
24
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
28
25
|
import { cwd } from "node:process";
|
|
26
|
+
import chalk2 from "chalk";
|
|
29
27
|
import { createProgramFromConfig } from "tsc-prog";
|
|
30
28
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
31
29
|
|
|
32
30
|
// src/actions/package/compile/inputs.ts
|
|
33
31
|
import { glob } from "glob";
|
|
34
|
-
var getAllInputs = /* @__PURE__ */ __name((folder
|
|
32
|
+
var getAllInputs = /* @__PURE__ */ __name((folder, ignore = [
|
|
33
|
+
"**/*.spec.*",
|
|
34
|
+
"**/*.stories.*",
|
|
35
|
+
"**/spec/**/*"
|
|
36
|
+
]) => {
|
|
35
37
|
return glob.sync(`${folder}/**/*.*`, {
|
|
36
|
-
ignore
|
|
37
|
-
"**/*.spec.*",
|
|
38
|
-
"**/*.stories.*",
|
|
39
|
-
"**/spec/**/*"
|
|
40
|
-
],
|
|
38
|
+
ignore,
|
|
41
39
|
posix: true
|
|
42
40
|
});
|
|
43
41
|
}, "getAllInputs");
|
|
44
42
|
|
|
45
43
|
// src/actions/package/compile/buildEntries.ts
|
|
46
|
-
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose = false) => {
|
|
44
|
+
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", excludeSpecAndStory = true, verbose = false) => {
|
|
47
45
|
let entries = [];
|
|
48
46
|
switch (entryMode) {
|
|
49
47
|
case "platform": {
|
|
@@ -54,7 +52,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
54
52
|
break;
|
|
55
53
|
}
|
|
56
54
|
case "all": {
|
|
57
|
-
entries = getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".
|
|
55
|
+
entries = excludeSpecAndStory ? getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(folder, []);
|
|
58
56
|
break;
|
|
59
57
|
}
|
|
60
58
|
default: {
|
|
@@ -94,9 +92,6 @@ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tscon
|
|
|
94
92
|
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
95
93
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
96
94
|
const verbose = config2?.verbose ?? false;
|
|
97
|
-
if (verbose) {
|
|
98
|
-
console.log(`Compiling types [${pkg}]`);
|
|
99
|
-
}
|
|
100
95
|
const compilerOptions = {
|
|
101
96
|
...getCompilerOptions({
|
|
102
97
|
emitDeclarationOnly: true,
|
|
@@ -120,6 +115,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
120
115
|
".d.mts"
|
|
121
116
|
];
|
|
122
117
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
118
|
+
console.log(chalk2.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
123
119
|
const program = createProgramFromConfig({
|
|
124
120
|
basePath: pkg ?? cwd(),
|
|
125
121
|
compilerOptions,
|
|
@@ -148,7 +144,6 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
148
144
|
// src/actions/package/compile/compileTypes.ts
|
|
149
145
|
var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
150
146
|
const pkg = process.env.INIT_CWD;
|
|
151
|
-
console.log(chalk2.green(`Compiling Types ${pkg}`));
|
|
152
147
|
const config2 = await loadConfig(inConfig);
|
|
153
148
|
return packageCompileTscTypes(void 0, config2);
|
|
154
149
|
}, "packageCompileTypes");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compileTypes.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,UAAUH,QAAQE,UAAU,CAAC,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N;MACrBwC,YAAY,6BAAMC,KAAIC,SAAV;IACd,CAAA;AAEFjC,YAAQkC,MAAMR,oBAAAA;EAChB;AAEAP,UAAQgB,KAAI;AACZ,SAAOZ,YAAYa,OAAO,CAACC,KAAKC,SAASD,OAAOC,KAAKC,aAAaC,mBAAmBC,QAAQ,IAAI,IAAI,CAAA;AACvG,GAtDsC;;;AFP/B,IAAMC,sBAAsB,8BAAOC,WAAqB,CAAC,MAAC;AAC/D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,mBAAmBP,GAAAA,EAAK,CAAA;AAChD,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAEhC,SAAOW,uBAAuBC,QAAWH,OAAAA;AAC3C,GANmC;","names":["chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","cwd","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string, ignore = ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*']) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore, posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStory = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStory ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder, [])\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,UAAUH,QAAQE,UAAU,CA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AC1B,UAAMO,uBAAuBC,qCAC3BH,aACA;MACEI,sBAAsBC,wBAAAA,aAAYA,UAAZA;MACtBC,qBAAqB,6BAAMzC,QAAN;MACrB0C,YAAY,6BAAMC,KAAIC,SAAV;IACd,CAAA;AAEFlB,YAAQmB,MAAMR,oBAAAA;EAChB;AAEAN,UAAQe,KAAI;AACZ,SAAOX,YAAYY,OAAO,CAACC,KAAKC,SAASD,OAAOC,KAAKC,aAAaC,mBAAmBC,QAAQ,IAAI,IAAI,CAAA;AACvG,GApDsC;;;AIR/B,IAAMC,sBAAsB,8BAAOC,WAAqB,CAAC,MAAC;AAC/D,QAAMC,MAAMC,QAAQC,IAAIC;AACxB,QAAMC,UAAS,MAAMC,WAAWN,QAAAA;AAEhC,SAAOO,uBAAuBC,QAAWH,OAAAA;AAC3C,GALmC;","names":["chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","glob","getAllInputs","folder","ignore","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStory","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined"]}
|
|
@@ -73,19 +73,19 @@ import { build, defineConfig } from "tsup";
|
|
|
73
73
|
|
|
74
74
|
// src/actions/package/compile/inputs.ts
|
|
75
75
|
import { glob } from "glob";
|
|
76
|
-
var getAllInputs = /* @__PURE__ */ __name((folder
|
|
76
|
+
var getAllInputs = /* @__PURE__ */ __name((folder, ignore = [
|
|
77
|
+
"**/*.spec.*",
|
|
78
|
+
"**/*.stories.*",
|
|
79
|
+
"**/spec/**/*"
|
|
80
|
+
]) => {
|
|
77
81
|
return glob.sync(`${folder}/**/*.*`, {
|
|
78
|
-
ignore
|
|
79
|
-
"**/*.spec.*",
|
|
80
|
-
"**/*.stories.*",
|
|
81
|
-
"**/spec/**/*"
|
|
82
|
-
],
|
|
82
|
+
ignore,
|
|
83
83
|
posix: true
|
|
84
84
|
});
|
|
85
85
|
}, "getAllInputs");
|
|
86
86
|
|
|
87
87
|
// src/actions/package/compile/buildEntries.ts
|
|
88
|
-
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose = false) => {
|
|
88
|
+
var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", excludeSpecAndStory = true, verbose = false) => {
|
|
89
89
|
let entries = [];
|
|
90
90
|
switch (entryMode) {
|
|
91
91
|
case "platform": {
|
|
@@ -96,7 +96,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "all": {
|
|
99
|
-
entries = getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".
|
|
99
|
+
entries = excludeSpecAndStory ? getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(folder, []);
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
default: {
|
|
@@ -110,11 +110,9 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
|
|
|
110
110
|
return entries;
|
|
111
111
|
}, "buildEntries");
|
|
112
112
|
|
|
113
|
-
// src/actions/package/compile/compileTypes.ts
|
|
114
|
-
import chalk3 from "chalk";
|
|
115
|
-
|
|
116
113
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
117
114
|
import { cwd } from "node:process";
|
|
115
|
+
import chalk3 from "chalk";
|
|
118
116
|
import { createProgramFromConfig } from "tsc-prog";
|
|
119
117
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
120
118
|
|
|
@@ -144,9 +142,6 @@ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tscon
|
|
|
144
142
|
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
145
143
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
146
144
|
const verbose = config2?.verbose ?? false;
|
|
147
|
-
if (verbose) {
|
|
148
|
-
console.log(`Compiling types [${pkg}]`);
|
|
149
|
-
}
|
|
150
145
|
const compilerOptions = {
|
|
151
146
|
...getCompilerOptions({
|
|
152
147
|
emitDeclarationOnly: true,
|
|
@@ -170,6 +165,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
170
165
|
".d.mts"
|
|
171
166
|
];
|
|
172
167
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
168
|
+
console.log(chalk3.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
173
169
|
const program = createProgramFromConfig({
|
|
174
170
|
basePath: pkg ?? cwd(),
|
|
175
171
|
compilerOptions,
|
|
@@ -198,7 +194,6 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
198
194
|
// src/actions/package/compile/compileTypes.ts
|
|
199
195
|
var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
200
196
|
const pkg = process.env.INIT_CWD;
|
|
201
|
-
console.log(chalk3.green(`Compiling Types ${pkg}`));
|
|
202
197
|
const config2 = await loadConfig(inConfig);
|
|
203
198
|
return packageCompileTscTypes(void 0, config2);
|
|
204
199
|
}, "packageCompileTypes");
|
|
@@ -236,7 +231,6 @@ import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAn
|
|
|
236
231
|
var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
237
232
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
238
233
|
const verbose = config2?.verbose ?? false;
|
|
239
|
-
console.log(chalk4.green(`Compiling Files ${pkg}`));
|
|
240
234
|
const compilerOptions = {
|
|
241
235
|
...getCompilerOptions({
|
|
242
236
|
outDir: "dist/types",
|
|
@@ -259,6 +253,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
259
253
|
".d.mts"
|
|
260
254
|
];
|
|
261
255
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
|
|
256
|
+
console.log(chalk4.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
262
257
|
const program = createProgramFromConfig2({
|
|
263
258
|
basePath: pkg ?? cwd2(),
|
|
264
259
|
compilerOptions,
|