@xylabs/ts-scripts-yarn3 3.0.28 → 3.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/compile.js +1 -1
- package/dist/actions/compile.js.map +1 -1
- package/dist/actions/compile.mjs +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compile.js +2 -2
- package/dist/actions/package/compile/compile.js.map +1 -1
- package/dist/actions/package/compile/compile.mjs +2 -2
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/tscNoEmit.js +54 -0
- package/dist/actions/package/compile/tscNoEmit.js.map +1 -0
- package/dist/actions/package/compile/tscNoEmit.mjs +30 -0
- package/dist/actions/package/compile/tscNoEmit.mjs.map +1 -0
- package/dist/actions/package/compile/tscTypes.js +9 -7
- package/dist/actions/package/compile/tscTypes.js.map +1 -1
- package/dist/actions/package/compile/tscTypes.mjs +9 -7
- package/dist/actions/package/compile/tscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/tsup.js +17 -12
- package/dist/actions/package/compile/tsup.js.map +1 -1
- package/dist/actions/package/compile/tsup.mjs +17 -12
- package/dist/actions/package/compile/tsup.mjs.map +1 -1
- package/dist/actions/package/compile/tsup2.js +65 -0
- package/dist/actions/package/compile/tsup2.js.map +1 -0
- package/dist/actions/package/compile/tsup2.mjs +41 -0
- package/dist/actions/package/compile/tsup2.mjs.map +1 -0
- package/dist/actions/package/publint.js +5 -4
- package/dist/actions/package/publint.js.map +1 -1
- package/dist/actions/package/publint.mjs +5 -4
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/bin/package/compile.js +6 -2
- package/dist/bin/package/compile.js.map +1 -1
- package/dist/bin/package/compile.mjs +6 -2
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/lib/loadConfig.js +1 -1
- package/dist/lib/loadConfig.js.map +1 -1
- package/dist/lib/loadConfig.mjs +1 -1
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/compile.ts +1 -1
- package/src/actions/package/compile/compile.ts +2 -2
- package/src/actions/package/compile/tscNoEmit.ts +32 -0
- package/src/actions/package/compile/tscTypes.ts +9 -7
- package/src/actions/package/compile/tsup.ts +24 -12
- package/src/actions/package/compile/tsup2.ts +64 -0
- package/src/actions/package/publint.ts +6 -4
- package/src/bin/package/compile.ts +6 -2
- package/src/lib/loadConfig.ts +1 -1
package/dist/actions/compile.js
CHANGED
|
@@ -47,7 +47,7 @@ const compileAll = ({ jobs, verbose, target, incremental }) => {
|
|
|
47
47
|
const start = Date.now();
|
|
48
48
|
const verboseOptions = verbose ? ["-v"] : [];
|
|
49
49
|
const targetOptions = target ? ["-t", target] : [];
|
|
50
|
-
const incrementalOptions = incremental ? ["--since", "-
|
|
50
|
+
const incrementalOptions = incremental ? ["--since", "-ptAi"] : ["-ptAi"];
|
|
51
51
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
52
52
|
if (jobs) {
|
|
53
53
|
console.log(import_chalk.default.blue(`Jobs set to [${jobs}]`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({ verbose, target, pkg, incremental, publint }: CompileParams) => {\n return pkg ? compilePackage({ pkg, publint, target, verbose }) : compileAll({ incremental, publint, target, verbose })\n}\n\nexport const compilePackage = ({ verbose, target, pkg, publint = true }: CompilePackageParams) => {\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n\n return publint\n ? runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n : runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n}\n\nexport const compileAll = ({ jobs, verbose, target, incremental }: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-
|
|
1
|
+
{"version":3,"sources":["../../src/actions/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({ verbose, target, pkg, incremental, publint }: CompileParams) => {\n return pkg ? compilePackage({ pkg, publint, target, verbose }) : compileAll({ incremental, publint, target, verbose })\n}\n\nexport const compilePackage = ({ verbose, target, pkg, publint = true }: CompilePackageParams) => {\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n\n return publint\n ? runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n : runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n}\n\nexport const compileAll = ({ jobs, verbose, target, incremental }: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-ptAi'] : ['-ptAi']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces', 'foreach', ...incrementalOptions, ...jobsOptions, 'run', 'package-compile', ...verboseOptions, ...targetOptions]],\n ])\n console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,iBAAyB;AAkBlB,MAAM,UAAU,CAAC,EAAE,SAAS,QAAQ,KAAK,aAAa,QAAQ,MAAqB;AACxF,SAAO,MAAM,eAAe,EAAE,KAAK,SAAS,QAAQ,QAAQ,CAAC,IAAI,WAAW,EAAE,aAAa,SAAS,QAAQ,QAAQ,CAAC;AACvH;AAEO,MAAM,iBAAiB,CAAC,EAAE,SAAS,QAAQ,KAAK,UAAU,KAAK,MAA4B;AAChG,QAAM,iBAAiB,UAAU,CAAC,IAAI,IAAI,CAAC;AAC3C,QAAM,gBAAgB,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC;AAEjD,SAAO,cACH,qBAAS,YAAY,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,QAC1H,qBAAS,YAAY,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC;AAChI;AAEO,MAAM,aAAa,CAAC,EAAE,MAAM,SAAS,QAAQ,YAAY,MAAqB;AACnF,QAAM,QAAQ,KAAK,IAAI;AACvB,QAAM,iBAAiB,UAAU,CAAC,IAAI,IAAI,CAAC;AAC3C,QAAM,gBAAgB,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC;AACjD,QAAM,qBAAqB,cAAc,CAAC,WAAW,OAAO,IAAI,CAAC,OAAO;AACxE,QAAM,cAAc,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC;AAChD,MAAI,MAAM;AACR,YAAQ,IAAI,aAAAA,QAAM,KAAK,gBAAgB,IAAI,GAAG,CAAC;AAAA,EACjD;AAEA,QAAM,aAAS,qBAAS,UAAU,cAAc,iBAAiB,EAAE,UAAU;AAAA,IAC3E,CAAC,QAAQ,CAAC,cAAc,WAAW,GAAG,oBAAoB,GAAG,aAAa,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAAA,EAC1I,CAAC;AACD,UAAQ,IAAI,GAAG,aAAAA,QAAM,KAAK,aAAa,CAAC,KAAK,aAAAA,QAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,aAAAA,QAAM,KAAK,SAAS,CAAC,EAAE;AAChI,SAAO;AACT;","names":["chalk"]}
|
package/dist/actions/compile.mjs
CHANGED
|
@@ -12,7 +12,7 @@ const compileAll = ({ jobs, verbose, target, incremental }) => {
|
|
|
12
12
|
const start = Date.now();
|
|
13
13
|
const verboseOptions = verbose ? ["-v"] : [];
|
|
14
14
|
const targetOptions = target ? ["-t", target] : [];
|
|
15
|
-
const incrementalOptions = incremental ? ["--since", "-
|
|
15
|
+
const incrementalOptions = incremental ? ["--since", "-ptAi"] : ["-ptAi"];
|
|
16
16
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
17
17
|
if (jobs) {
|
|
18
18
|
console.log(chalk.blue(`Jobs set to [${jobs}]`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({ verbose, target, pkg, incremental, publint }: CompileParams) => {\n return pkg ? compilePackage({ pkg, publint, target, verbose }) : compileAll({ incremental, publint, target, verbose })\n}\n\nexport const compilePackage = ({ verbose, target, pkg, publint = true }: CompilePackageParams) => {\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n\n return publint\n ? runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n : runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n}\n\nexport const compileAll = ({ jobs, verbose, target, incremental }: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-
|
|
1
|
+
{"version":3,"sources":["../../src/actions/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({ verbose, target, pkg, incremental, publint }: CompileParams) => {\n return pkg ? compilePackage({ pkg, publint, target, verbose }) : compileAll({ incremental, publint, target, verbose })\n}\n\nexport const compilePackage = ({ verbose, target, pkg, publint = true }: CompilePackageParams) => {\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n\n return publint\n ? runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n : runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...verboseOptions, ...targetOptions]]])\n}\n\nexport const compileAll = ({ jobs, verbose, target, incremental }: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-ptAi'] : ['-ptAi']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces', 'foreach', ...incrementalOptions, ...jobsOptions, 'run', 'package-compile', ...verboseOptions, ...targetOptions]],\n ])\n console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAElB,SAAS,gBAAgB;AAkBlB,MAAM,UAAU,CAAC,EAAE,SAAS,QAAQ,KAAK,aAAa,QAAQ,MAAqB;AACxF,SAAO,MAAM,eAAe,EAAE,KAAK,SAAS,QAAQ,QAAQ,CAAC,IAAI,WAAW,EAAE,aAAa,SAAS,QAAQ,QAAQ,CAAC;AACvH;AAEO,MAAM,iBAAiB,CAAC,EAAE,SAAS,QAAQ,KAAK,UAAU,KAAK,MAA4B;AAChG,QAAM,iBAAiB,UAAU,CAAC,IAAI,IAAI,CAAC;AAC3C,QAAM,gBAAgB,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC;AAEjD,SAAO,UACH,SAAS,YAAY,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,IAC1H,SAAS,YAAY,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC;AAChI;AAEO,MAAM,aAAa,CAAC,EAAE,MAAM,SAAS,QAAQ,YAAY,MAAqB;AACnF,QAAM,QAAQ,KAAK,IAAI;AACvB,QAAM,iBAAiB,UAAU,CAAC,IAAI,IAAI,CAAC;AAC3C,QAAM,gBAAgB,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC;AACjD,QAAM,qBAAqB,cAAc,CAAC,WAAW,OAAO,IAAI,CAAC,OAAO;AACxE,QAAM,cAAc,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC;AAChD,MAAI,MAAM;AACR,YAAQ,IAAI,MAAM,KAAK,gBAAgB,IAAI,GAAG,CAAC;AAAA,EACjD;AAEA,QAAM,SAAS,SAAS,UAAU,cAAc,iBAAiB,EAAE,UAAU;AAAA,IAC3E,CAAC,QAAQ,CAAC,cAAc,WAAW,GAAG,oBAAoB,GAAG,aAAa,OAAO,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAAA,EAC1I,CAAC;AACD,UAAQ,IAAI,GAAG,MAAM,KAAK,aAAa,CAAC,KAAK,MAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,KAAK,SAAS,CAAC,EAAE;AAChI,SAAO;AACT;","names":[]}
|
|
@@ -37,7 +37,7 @@ var import_lib = require("../../../lib");
|
|
|
37
37
|
var import_publint = require("../publint");
|
|
38
38
|
var import_rollup = require("./rollup");
|
|
39
39
|
var import_tsc = require("./tsc");
|
|
40
|
-
var
|
|
40
|
+
var import_tsup2 = require("./tsup2");
|
|
41
41
|
const packageCompile = async (params) => {
|
|
42
42
|
const pkg = process.env.INIT_CWD;
|
|
43
43
|
console.log(import_chalk.default.green(`Compiling ${pkg}`));
|
|
@@ -70,7 +70,7 @@ const packageCompile = async (params) => {
|
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
case "tsup": {
|
|
73
|
-
result += await (0,
|
|
73
|
+
result += await (0, import_tsup2.packageCompileTsup2)(
|
|
74
74
|
(0, import_merge.default)({}, params, {
|
|
75
75
|
compile: {
|
|
76
76
|
publint: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup2 } from './tsup2'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n const publint = config.compile?.publint ?? true\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n let result: number = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n result += await packageCompileRollup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsc': {\n result += await packageCompileTsc(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsup': {\n result += await packageCompileTsup2(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n }\n modeIndex++\n }\n return result + (publint ? await packagePublint(params) : 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAElB,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAAqC;AACrC,iBAAkC;AAClC,mBAAoC;AAU7B,MAAM,iBAAiB,OAAO,WAAmD;AACtF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAI,aAAAA,QAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,QAAM,UAAU,OAAO,SAAS,WAAW;AAE3C,QAAM,QAAQ,OAAO,SAAS,SAAS,CAAC,MAAM;AAC9C,MAAI,YAAY;AAChB,MAAI,SAAiB;AACrB,SAAO,YAAY,MAAM,QAAQ;AAC/B,UAAM,OAAO,MAAM,SAAS;AAC5B,YAAQ,MAAM;AAAA,MACZ,KAAK,UAAU;AACb,kBAAU,UAAM;AAAA,cACd,aAAAC,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,OAAO;AACV,kBAAU,UAAM;AAAA,cACd,aAAAA,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,QAAQ;AACX,kBAAU,UAAM;AAAA,cACd,aAAAA,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,IACF;AACA;AAAA,EACF;AACA,SAAO,UAAU,UAAU,UAAM,+BAAe,MAAM,IAAI;AAC5D;","names":["chalk","merge"]}
|
|
@@ -4,7 +4,7 @@ import { loadConfig } from "../../../lib";
|
|
|
4
4
|
import { packagePublint } from "../publint";
|
|
5
5
|
import { packageCompileRollup } from "./rollup";
|
|
6
6
|
import { packageCompileTsc } from "./tsc";
|
|
7
|
-
import {
|
|
7
|
+
import { packageCompileTsup2 } from "./tsup2";
|
|
8
8
|
const packageCompile = async (params) => {
|
|
9
9
|
const pkg = process.env.INIT_CWD;
|
|
10
10
|
console.log(chalk.green(`Compiling ${pkg}`));
|
|
@@ -37,7 +37,7 @@ const packageCompile = async (params) => {
|
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
39
|
case "tsup": {
|
|
40
|
-
result += await
|
|
40
|
+
result += await packageCompileTsup2(
|
|
41
41
|
merge({}, params, {
|
|
42
42
|
compile: {
|
|
43
43
|
publint: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup2 } from './tsup2'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n const publint = config.compile?.publint ?? true\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n let result: number = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n result += await packageCompileRollup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsc': {\n result += await packageCompileTsc(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsup': {\n result += await packageCompileTsup2(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n }\n modeIndex++\n }\n return result + (publint ? await packagePublint(params) : 0)\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAElB,OAAO,WAAW;AAElB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAU7B,MAAM,iBAAiB,OAAO,WAAmD;AACtF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAI,MAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,QAAM,UAAU,OAAO,SAAS,WAAW;AAE3C,QAAM,QAAQ,OAAO,SAAS,SAAS,CAAC,MAAM;AAC9C,MAAI,YAAY;AAChB,MAAI,SAAiB;AACrB,SAAO,YAAY,MAAM,QAAQ;AAC/B,UAAM,OAAO,MAAM,SAAS;AAC5B,YAAQ,MAAM;AAAA,MACZ,KAAK,UAAU;AACb,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,OAAO;AACV,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,QAAQ;AACX,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,IACF;AACA;AAAA,EACF;AACA,SAAO,UAAU,UAAU,MAAM,eAAe,MAAM,IAAI;AAC5D;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tscNoEmit_exports = {};
|
|
20
|
+
__export(tscNoEmit_exports, {
|
|
21
|
+
packageCompileTscNoEmit: () => packageCompileTscNoEmit
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tscNoEmit_exports);
|
|
24
|
+
var import_process = require("process");
|
|
25
|
+
var import_tsc_prog = require("tsc-prog");
|
|
26
|
+
var import_typescript = require("typescript");
|
|
27
|
+
var import_getCompilerOptions = require("./getCompilerOptions");
|
|
28
|
+
const packageCompileTscNoEmit = (params) => {
|
|
29
|
+
const pkg = process.env.INIT_CWD;
|
|
30
|
+
if (params?.verbose) {
|
|
31
|
+
console.log(`Compiling with NoEmit TSC [${pkg}]`);
|
|
32
|
+
}
|
|
33
|
+
const result = (0, import_tsc_prog.createProgramFromConfig)({
|
|
34
|
+
basePath: pkg ?? (0, import_process.cwd)(),
|
|
35
|
+
compilerOptions: (0, import_getCompilerOptions.getCompilerOptions)({
|
|
36
|
+
declaration: true,
|
|
37
|
+
declarationMap: true,
|
|
38
|
+
esModuleInterop: true,
|
|
39
|
+
noEmit: true,
|
|
40
|
+
outDir: "dist",
|
|
41
|
+
skipLibCheck: true,
|
|
42
|
+
sourceMap: true
|
|
43
|
+
}),
|
|
44
|
+
configFilePath: "tsconfig.json",
|
|
45
|
+
exclude: ["dist", "docs", "**/*.spec.*", "src/**/spec/**/*"],
|
|
46
|
+
include: ["src"]
|
|
47
|
+
}).emit();
|
|
48
|
+
return result.diagnostics.map((value) => value.category === import_typescript.DiagnosticCategory.Error).length;
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
packageCompileTscNoEmit
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=tscNoEmit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscNoEmit = (params?: CompileParams): number => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions: getCompilerOptions({\n declaration: true,\n declarationMap: true,\n esModuleInterop: true,\n noEmit: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }) as TsConfigCompilerOptions,\n configFilePath: 'tsconfig.json',\n exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n return result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAiE;AACjE,wBAAmC;AAGnC,gCAAmC;AAE5B,MAAM,0BAA0B,CAAC,WAAmC;AACzE,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,8BAA8B,GAAG,GAAG;AAAA,EAClD;AAEA,QAAM,aAAS,yCAAwB;AAAA,IACrC,UAAU,WAAO,oBAAI;AAAA,IACrB,qBAAiB,8CAAmB;AAAA,MAClC,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,IACb,CAAC;AAAA,IACD,gBAAgB;AAAA,IAChB,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB;AAAA,IAC3D,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,SAAO,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,qCAAmB,KAAK,EAAE;AACxF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cwd } from "process";
|
|
2
|
+
import { createProgramFromConfig } from "tsc-prog";
|
|
3
|
+
import { DiagnosticCategory } from "typescript";
|
|
4
|
+
import { getCompilerOptions } from "./getCompilerOptions";
|
|
5
|
+
const packageCompileTscNoEmit = (params) => {
|
|
6
|
+
const pkg = process.env.INIT_CWD;
|
|
7
|
+
if (params?.verbose) {
|
|
8
|
+
console.log(`Compiling with NoEmit TSC [${pkg}]`);
|
|
9
|
+
}
|
|
10
|
+
const result = createProgramFromConfig({
|
|
11
|
+
basePath: pkg ?? cwd(),
|
|
12
|
+
compilerOptions: getCompilerOptions({
|
|
13
|
+
declaration: true,
|
|
14
|
+
declarationMap: true,
|
|
15
|
+
esModuleInterop: true,
|
|
16
|
+
noEmit: true,
|
|
17
|
+
outDir: "dist",
|
|
18
|
+
skipLibCheck: true,
|
|
19
|
+
sourceMap: true
|
|
20
|
+
}),
|
|
21
|
+
configFilePath: "tsconfig.json",
|
|
22
|
+
exclude: ["dist", "docs", "**/*.spec.*", "src/**/spec/**/*"],
|
|
23
|
+
include: ["src"]
|
|
24
|
+
}).emit();
|
|
25
|
+
return result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
packageCompileTscNoEmit
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=tscNoEmit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscNoEmit = (params?: CompileParams): number => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions: getCompilerOptions({\n declaration: true,\n declarationMap: true,\n esModuleInterop: true,\n noEmit: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }) as TsConfigCompilerOptions,\n configFilePath: 'tsconfig.json',\n exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n return result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n}\n"],"mappings":"AAAA,SAAS,WAAW;AACpB,SAAS,+BAAwD;AACjE,SAAS,0BAA0B;AAGnC,SAAS,0BAA0B;AAE5B,MAAM,0BAA0B,CAAC,WAAmC;AACzE,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,8BAA8B,GAAG,GAAG;AAAA,EAClD;AAEA,QAAM,SAAS,wBAAwB;AAAA,IACrC,UAAU,OAAO,IAAI;AAAA,IACrB,iBAAiB,mBAAmB;AAAA,MAClC,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,IACb,CAAC;AAAA,IACD,gBAAgB;AAAA,IAChB,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB;AAAA,IAC3D,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,SAAO,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,mBAAmB,KAAK,EAAE;AACxF;","names":[]}
|
|
@@ -24,13 +24,11 @@ module.exports = __toCommonJS(tscTypes_exports);
|
|
|
24
24
|
var import_process = require("process");
|
|
25
25
|
var import_tsc_prog = require("tsc-prog");
|
|
26
26
|
var import_typescript = require("typescript");
|
|
27
|
-
var import_lib = require("../../../lib");
|
|
28
27
|
var import_copyTypeFiles = require("./copyTypeFiles");
|
|
29
28
|
var import_getCompilerOptions = require("./getCompilerOptions");
|
|
30
|
-
const packageCompileTscTypes = async (params) => {
|
|
29
|
+
const packageCompileTscTypes = async (params, compilerOptions, generateMts = true) => {
|
|
31
30
|
const pkg = process.env.INIT_CWD;
|
|
32
|
-
|
|
33
|
-
if (config.verbose) {
|
|
31
|
+
if (params?.verbose) {
|
|
34
32
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
35
33
|
}
|
|
36
34
|
const result = (0, import_tsc_prog.createProgramFromConfig)({
|
|
@@ -42,14 +40,18 @@ const packageCompileTscTypes = async (params) => {
|
|
|
42
40
|
esModuleInterop: true,
|
|
43
41
|
outDir: "dist",
|
|
44
42
|
skipLibCheck: true,
|
|
45
|
-
sourceMap: true
|
|
43
|
+
sourceMap: true,
|
|
44
|
+
...compilerOptions ?? {}
|
|
46
45
|
}),
|
|
47
46
|
configFilePath: "tsconfig.json",
|
|
48
47
|
exclude: ["dist", "docs", "**/*.spec.*", "src/**/spec/**/*"],
|
|
49
48
|
include: ["src"]
|
|
50
49
|
}).emit();
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const diagResults = result.diagnostics.map((value) => value.category === import_typescript.DiagnosticCategory.Error).length;
|
|
51
|
+
if (generateMts) {
|
|
52
|
+
await (0, import_copyTypeFiles.copyTypeFiles)();
|
|
53
|
+
}
|
|
54
|
+
return diagResults;
|
|
53
55
|
};
|
|
54
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
57
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { DiagnosticCategory } from 'typescript'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptions?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions: getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n ...(compilerOptions ?? {}),\n }) as TsConfigCompilerOptions,\n configFilePath: 'tsconfig.json',\n exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n if (generateMts) {\n await copyTypeFiles()\n }\n return diagResults\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAiE;AACjE,wBAAoD;AAGpD,2BAA8B;AAC9B,gCAAmC;AAE5B,MAAM,yBAAyB,OAAO,QAAwB,iBAAmC,cAAc,SAA0B;AAC9I,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,aAAS,yCAAwB;AAAA,IACrC,UAAU,WAAO,oBAAI;AAAA,IACrB,qBAAiB,8CAAmB;AAAA,MAClC,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,MACX,GAAI,mBAAmB,CAAC;AAAA,IAC1B,CAAC;AAAA,IACD,gBAAgB;AAAA,IAChB,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB;AAAA,IAC3D,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,QAAM,cAAc,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,qCAAmB,KAAK,EAAE;AACnG,MAAI,aAAa;AACf,cAAM,oCAAc;AAAA,EACtB;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { cwd } from "process";
|
|
2
2
|
import { createProgramFromConfig } from "tsc-prog";
|
|
3
3
|
import { DiagnosticCategory } from "typescript";
|
|
4
|
-
import { loadConfig } from "../../../lib";
|
|
5
4
|
import { copyTypeFiles } from "./copyTypeFiles";
|
|
6
5
|
import { getCompilerOptions } from "./getCompilerOptions";
|
|
7
|
-
const packageCompileTscTypes = async (params) => {
|
|
6
|
+
const packageCompileTscTypes = async (params, compilerOptions, generateMts = true) => {
|
|
8
7
|
const pkg = process.env.INIT_CWD;
|
|
9
|
-
|
|
10
|
-
if (config.verbose) {
|
|
8
|
+
if (params?.verbose) {
|
|
11
9
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
12
10
|
}
|
|
13
11
|
const result = createProgramFromConfig({
|
|
@@ -19,14 +17,18 @@ const packageCompileTscTypes = async (params) => {
|
|
|
19
17
|
esModuleInterop: true,
|
|
20
18
|
outDir: "dist",
|
|
21
19
|
skipLibCheck: true,
|
|
22
|
-
sourceMap: true
|
|
20
|
+
sourceMap: true,
|
|
21
|
+
...compilerOptions ?? {}
|
|
23
22
|
}),
|
|
24
23
|
configFilePath: "tsconfig.json",
|
|
25
24
|
exclude: ["dist", "docs", "**/*.spec.*", "src/**/spec/**/*"],
|
|
26
25
|
include: ["src"]
|
|
27
26
|
}).emit();
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length;
|
|
28
|
+
if (generateMts) {
|
|
29
|
+
await copyTypeFiles();
|
|
30
|
+
}
|
|
31
|
+
return diagResults;
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
34
|
packageCompileTscTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { DiagnosticCategory } from 'typescript'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptions?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions: getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n ...(compilerOptions ?? {}),\n }) as TsConfigCompilerOptions,\n configFilePath: 'tsconfig.json',\n exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n if (generateMts) {\n await copyTypeFiles()\n }\n return diagResults\n}\n"],"mappings":"AAAA,SAAS,WAAW;AACpB,SAAS,+BAAwD;AACjE,SAA0B,0BAA0B;AAGpD,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAE5B,MAAM,yBAAyB,OAAO,QAAwB,iBAAmC,cAAc,SAA0B;AAC9I,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,SAAS,wBAAwB;AAAA,IACrC,UAAU,OAAO,IAAI;AAAA,IACrB,iBAAiB,mBAAmB;AAAA,MAClC,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,MACX,GAAI,mBAAmB,CAAC;AAAA,IAC1B,CAAC;AAAA,IACD,gBAAgB;AAAA,IAChB,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB;AAAA,IAC3D,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,QAAM,cAAc,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,mBAAmB,KAAK,EAAE;AACnG,MAAI,aAAa;AACf,UAAM,cAAc;AAAA,EACtB;AACA,SAAO;AACT;","names":[]}
|
|
@@ -25,21 +25,23 @@ var import_tsup = require("tsup");
|
|
|
25
25
|
var import_lib = require("../../../lib");
|
|
26
26
|
var import_publint = require("../publint");
|
|
27
27
|
var import_inputs = require("./inputs");
|
|
28
|
+
var import_tscNoEmit = require("./tscNoEmit");
|
|
28
29
|
var import_tscTypes = require("./tscTypes");
|
|
29
|
-
const compileSubDir = async (subDir, options,
|
|
30
|
+
const compileSubDir = async (subDir, options, _verbose) => {
|
|
30
31
|
const dir = subDir === "." ? void 0 : subDir;
|
|
31
32
|
const input = await (0, import_inputs.getInputs)(dir);
|
|
32
33
|
if (input.length === 0) {
|
|
33
34
|
return 0;
|
|
34
35
|
}
|
|
35
36
|
const optionsResult = (0, import_tsup.defineConfig)({
|
|
36
|
-
bundle:
|
|
37
|
+
bundle: false,
|
|
37
38
|
cjsInterop: true,
|
|
38
39
|
clean: true,
|
|
39
40
|
dts: false,
|
|
40
41
|
entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
|
|
41
42
|
format: ["cjs", "esm"],
|
|
42
43
|
outDir: subDir ? `dist/${subDir}` : "dist",
|
|
44
|
+
silent: true,
|
|
43
45
|
sourcemap: true,
|
|
44
46
|
splitting: false,
|
|
45
47
|
tsconfig: "tsconfig.json",
|
|
@@ -52,25 +54,28 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
52
54
|
}).flat()
|
|
53
55
|
)).flat();
|
|
54
56
|
await Promise.all(optionsList.map((options2) => (0, import_tsup.build)(options2)));
|
|
55
|
-
return
|
|
57
|
+
return 0;
|
|
56
58
|
};
|
|
57
59
|
const packageCompileTsup = async (params) => {
|
|
58
|
-
const
|
|
59
|
-
const publint =
|
|
60
|
-
if (
|
|
61
|
-
console.log(`Compiling with TSUP [Depth: ${
|
|
60
|
+
const { verbose, compile } = await (0, import_lib.loadConfig)(params);
|
|
61
|
+
const publint = compile?.publint ?? true;
|
|
62
|
+
if (verbose) {
|
|
63
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
64
|
+
}
|
|
65
|
+
const inputDirs = await (0, import_inputs.getInputDirs)(compile?.depth);
|
|
66
|
+
const noEmitResult = await (0, import_tscNoEmit.packageCompileTscNoEmit)({ verbose });
|
|
67
|
+
if (noEmitResult) {
|
|
68
|
+
return noEmitResult;
|
|
62
69
|
}
|
|
63
|
-
const inputDirs = await (0, import_inputs.getInputDirs)(config.compile?.depth);
|
|
64
70
|
if (inputDirs.length) {
|
|
65
71
|
const result = (await Promise.all(
|
|
66
72
|
inputDirs.map(async (inputDir) => {
|
|
67
|
-
return await compileSubDir(inputDir,
|
|
73
|
+
return await compileSubDir(inputDir, compile?.tsup?.options, verbose);
|
|
68
74
|
})
|
|
69
75
|
)).reduce((prev, result2) => prev + result2, 0);
|
|
70
|
-
return result
|
|
76
|
+
return result || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }) || (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
71
77
|
} else {
|
|
72
|
-
|
|
73
|
-
return result + (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
78
|
+
return (0, import_tscNoEmit.packageCompileTscNoEmit)({ verbose }) || await compileSubDir(void 0, compile?.tsup?.options, verbose) || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }) || (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
74
79
|
}
|
|
75
80
|
};
|
|
76
81
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options,
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, _verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n if (input.length === 0) {\n return 0\n }\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: subDir ? `dist/${subDir}` : 'dist',\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])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n const inputDirs = await getInputDirs(compile?.depth)\n\n const noEmitResult = await packageCompileTscNoEmit({ verbose })\n\n if (noEmitResult) {\n return noEmitResult\n }\n\n if (inputDirs.length) {\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, compile?.tsup?.options, verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result || (await packageCompileTscTypes({ verbose })) || (publint ? await packagePublint() : 0)\n } else {\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (await compileSubDir(undefined, compile?.tsup?.options, verbose)) ||\n (await packageCompileTscTypes({ verbose })) ||\n (publint ? await packagePublint() : 0)\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAE7C,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAAwC;AACxC,uBAAwC;AACxC,sBAAuC;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,aAAuB;AACtF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,UAAM,yBAAU,GAAG;AACjC,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AACA,QAAM,oBAAgB,0BAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ,SAAS,QAAQ,MAAM,KAAK;AAAA,IACpC,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,iBAAY,mBAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO;AACT;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,EAAE,SAAS,QAAQ,IAAI,UAAM,uBAAW,MAAM;AACpD,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,YAAQ,IAAI,+BAA+B,SAAS,KAAK,GAAG;AAAA,EAC9D;AACA,QAAM,YAAY,UAAM,4BAAa,SAAS,KAAK;AAEnD,QAAM,eAAe,UAAM,0CAAwB,EAAE,QAAQ,CAAC;AAE9D,MAAI,cAAc;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,QAAQ;AACpB,UAAM,UACJ,MAAM,QAAQ;AAAA,MACZ,UAAU,IAAI,OAAO,aAAa;AAChC,eAAO,MAAM,cAAc,UAAU,SAAS,MAAM,SAAS,OAAO;AAAA,MACtE,CAAC;AAAA,IACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,WAAO,UAAW,UAAM,wCAAuB,EAAE,QAAQ,CAAC,MAAO,UAAU,UAAM,+BAAe,IAAI;AAAA,EACtG,OAAO;AACL,eACE,0CAAwB,EAAE,QAAQ,CAAC,KAClC,MAAM,cAAc,QAAW,SAAS,MAAM,SAAS,OAAO,KAC9D,UAAM,wCAAuB,EAAE,QAAQ,CAAC,MACxC,UAAU,UAAM,+BAAe,IAAI;AAAA,EAExC;AACF;","names":["options","result"]}
|
|
@@ -2,21 +2,23 @@ import { build, defineConfig } from "tsup";
|
|
|
2
2
|
import { loadConfig } from "../../../lib";
|
|
3
3
|
import { packagePublint } from "../publint";
|
|
4
4
|
import { getInputDirs, getInputs } from "./inputs";
|
|
5
|
+
import { packageCompileTscNoEmit } from "./tscNoEmit";
|
|
5
6
|
import { packageCompileTscTypes } from "./tscTypes";
|
|
6
|
-
const compileSubDir = async (subDir, options,
|
|
7
|
+
const compileSubDir = async (subDir, options, _verbose) => {
|
|
7
8
|
const dir = subDir === "." ? void 0 : subDir;
|
|
8
9
|
const input = await getInputs(dir);
|
|
9
10
|
if (input.length === 0) {
|
|
10
11
|
return 0;
|
|
11
12
|
}
|
|
12
13
|
const optionsResult = defineConfig({
|
|
13
|
-
bundle:
|
|
14
|
+
bundle: false,
|
|
14
15
|
cjsInterop: true,
|
|
15
16
|
clean: true,
|
|
16
17
|
dts: false,
|
|
17
18
|
entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
|
|
18
19
|
format: ["cjs", "esm"],
|
|
19
20
|
outDir: subDir ? `dist/${subDir}` : "dist",
|
|
21
|
+
silent: true,
|
|
20
22
|
sourcemap: true,
|
|
21
23
|
splitting: false,
|
|
22
24
|
tsconfig: "tsconfig.json",
|
|
@@ -29,25 +31,28 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
29
31
|
}).flat()
|
|
30
32
|
)).flat();
|
|
31
33
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
32
|
-
return
|
|
34
|
+
return 0;
|
|
33
35
|
};
|
|
34
36
|
const packageCompileTsup = async (params) => {
|
|
35
|
-
const
|
|
36
|
-
const publint =
|
|
37
|
-
if (
|
|
38
|
-
console.log(`Compiling with TSUP [Depth: ${
|
|
37
|
+
const { verbose, compile } = await loadConfig(params);
|
|
38
|
+
const publint = compile?.publint ?? true;
|
|
39
|
+
if (verbose) {
|
|
40
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
41
|
+
}
|
|
42
|
+
const inputDirs = await getInputDirs(compile?.depth);
|
|
43
|
+
const noEmitResult = await packageCompileTscNoEmit({ verbose });
|
|
44
|
+
if (noEmitResult) {
|
|
45
|
+
return noEmitResult;
|
|
39
46
|
}
|
|
40
|
-
const inputDirs = await getInputDirs(config.compile?.depth);
|
|
41
47
|
if (inputDirs.length) {
|
|
42
48
|
const result = (await Promise.all(
|
|
43
49
|
inputDirs.map(async (inputDir) => {
|
|
44
|
-
return await compileSubDir(inputDir,
|
|
50
|
+
return await compileSubDir(inputDir, compile?.tsup?.options, verbose);
|
|
45
51
|
})
|
|
46
52
|
)).reduce((prev, result2) => prev + result2, 0);
|
|
47
|
-
return result
|
|
53
|
+
return result || await packageCompileTscTypes({ verbose }) || (publint ? await packagePublint() : 0);
|
|
48
54
|
} else {
|
|
49
|
-
|
|
50
|
-
return result + (publint ? await packagePublint() : 0);
|
|
55
|
+
return packageCompileTscNoEmit({ verbose }) || await compileSubDir(void 0, compile?.tsup?.options, verbose) || await packageCompileTscTypes({ verbose }) || (publint ? await packagePublint() : 0);
|
|
51
56
|
}
|
|
52
57
|
};
|
|
53
58
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options,
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, _verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n if (input.length === 0) {\n return 0\n }\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: subDir ? `dist/${subDir}` : 'dist',\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])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n const inputDirs = await getInputDirs(compile?.depth)\n\n const noEmitResult = await packageCompileTscNoEmit({ verbose })\n\n if (noEmitResult) {\n return noEmitResult\n }\n\n if (inputDirs.length) {\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, compile?.tsup?.options, verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result || (await packageCompileTscTypes({ verbose })) || (publint ? await packagePublint() : 0)\n } else {\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (await compileSubDir(undefined, compile?.tsup?.options, verbose)) ||\n (await packageCompileTscTypes({ verbose })) ||\n (publint ? await packagePublint() : 0)\n )\n }\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,cAAc,iBAAiB;AACxC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,aAAuB;AACtF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,MAAM,UAAU,GAAG;AACjC,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AACA,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ,SAAS,QAAQ,MAAM,KAAK;AAAA,IACpC,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,aAAY,MAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO;AACT;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,EAAE,SAAS,QAAQ,IAAI,MAAM,WAAW,MAAM;AACpD,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,YAAQ,IAAI,+BAA+B,SAAS,KAAK,GAAG;AAAA,EAC9D;AACA,QAAM,YAAY,MAAM,aAAa,SAAS,KAAK;AAEnD,QAAM,eAAe,MAAM,wBAAwB,EAAE,QAAQ,CAAC;AAE9D,MAAI,cAAc;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,QAAQ;AACpB,UAAM,UACJ,MAAM,QAAQ;AAAA,MACZ,UAAU,IAAI,OAAO,aAAa;AAChC,eAAO,MAAM,cAAc,UAAU,SAAS,MAAM,SAAS,OAAO;AAAA,MACtE,CAAC;AAAA,IACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,WAAO,UAAW,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAO,UAAU,MAAM,eAAe,IAAI;AAAA,EACtG,OAAO;AACL,WACE,wBAAwB,EAAE,QAAQ,CAAC,KAClC,MAAM,cAAc,QAAW,SAAS,MAAM,SAAS,OAAO,KAC9D,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MACxC,UAAU,MAAM,eAAe,IAAI;AAAA,EAExC;AACF;","names":["options","result"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tsup2_exports = {};
|
|
20
|
+
__export(tsup2_exports, {
|
|
21
|
+
packageCompileTsup2: () => packageCompileTsup2
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tsup2_exports);
|
|
24
|
+
var import_tsup = require("tsup");
|
|
25
|
+
var import_lib = require("../../../lib");
|
|
26
|
+
var import_publint = require("../publint");
|
|
27
|
+
var import_tscNoEmit = require("./tscNoEmit");
|
|
28
|
+
var import_tscTypes = require("./tscTypes");
|
|
29
|
+
const compileFolder = async (options, _verbose) => {
|
|
30
|
+
const optionsResult = (0, import_tsup.defineConfig)({
|
|
31
|
+
bundle: false,
|
|
32
|
+
cjsInterop: true,
|
|
33
|
+
clean: true,
|
|
34
|
+
dts: false,
|
|
35
|
+
entry: ["src"],
|
|
36
|
+
format: ["cjs", "esm"],
|
|
37
|
+
outDir: "dist",
|
|
38
|
+
silent: true,
|
|
39
|
+
sourcemap: true,
|
|
40
|
+
splitting: false,
|
|
41
|
+
tsconfig: "tsconfig.json",
|
|
42
|
+
...options
|
|
43
|
+
});
|
|
44
|
+
const optionsList = (await Promise.all(
|
|
45
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).map(async (options2) => {
|
|
46
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
47
|
+
return Array.isArray(result) ? result : [result];
|
|
48
|
+
}).flat()
|
|
49
|
+
)).flat();
|
|
50
|
+
await Promise.all(optionsList.map((options2) => (0, import_tsup.build)(options2)));
|
|
51
|
+
return 0;
|
|
52
|
+
};
|
|
53
|
+
const packageCompileTsup2 = async (params) => {
|
|
54
|
+
const { verbose, compile } = await (0, import_lib.loadConfig)(params);
|
|
55
|
+
const publint = compile?.publint ?? true;
|
|
56
|
+
if (verbose) {
|
|
57
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
58
|
+
}
|
|
59
|
+
return (0, import_tscNoEmit.packageCompileTscNoEmit)({ verbose }) || await compileFolder(compile?.tsup?.options, verbose) || await compileFolder({ ...compile?.tsup?.options ?? {}, clean: false, legacyOutput: true }, verbose) || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }) || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }, { outDir: "dist/esm" }, false) || (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
packageCompileTsup2
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=tsup2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (options?: Options, _verbose?: boolean) => {\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry: ['src'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\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])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (await compileFolder(compile?.tsup?.options, verbose)) ||\n (await compileFolder({ ...(compile?.tsup?.options ?? {}), clean: false, legacyOutput: true }, verbose)) ||\n (await packageCompileTscTypes({ verbose })) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/esm' }, false)) ||\n (publint ? await packagePublint() : 0)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAE7C,iBAA2B;AAC3B,qBAA+B;AAE/B,uBAAwC;AACxC,sBAAuC;AAYvC,MAAM,gBAAgB,OAAO,SAAmB,aAAuB;AACrE,QAAM,oBAAgB,0BAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO,CAAC,KAAK;AAAA,IACb,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,iBAAY,mBAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO;AACT;AAEO,MAAM,sBAAsB,OAAO,WAAuC;AAC/E,QAAM,EAAE,SAAS,QAAQ,IAAI,UAAM,uBAAW,MAAM;AACpD,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,YAAQ,IAAI,+BAA+B,SAAS,KAAK,GAAG;AAAA,EAC9D;AAEA,aACE,0CAAwB,EAAE,QAAQ,CAAC,KAClC,MAAM,cAAc,SAAS,MAAM,SAAS,OAAO,KACnD,MAAM,cAAc,EAAE,GAAI,SAAS,MAAM,WAAW,CAAC,GAAI,OAAO,OAAO,cAAc,KAAK,GAAG,OAAO,KACpG,UAAM,wCAAuB,EAAE,QAAQ,CAAC,KACxC,UAAM,wCAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,WAAW,GAAG,KAAK,MACvE,UAAU,UAAM,+BAAe,IAAI;AAExC;","names":["options"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { build, defineConfig } from "tsup";
|
|
2
|
+
import { loadConfig } from "../../../lib";
|
|
3
|
+
import { packagePublint } from "../publint";
|
|
4
|
+
import { packageCompileTscNoEmit } from "./tscNoEmit";
|
|
5
|
+
import { packageCompileTscTypes } from "./tscTypes";
|
|
6
|
+
const compileFolder = async (options, _verbose) => {
|
|
7
|
+
const optionsResult = defineConfig({
|
|
8
|
+
bundle: false,
|
|
9
|
+
cjsInterop: true,
|
|
10
|
+
clean: true,
|
|
11
|
+
dts: false,
|
|
12
|
+
entry: ["src"],
|
|
13
|
+
format: ["cjs", "esm"],
|
|
14
|
+
outDir: "dist",
|
|
15
|
+
silent: true,
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
splitting: false,
|
|
18
|
+
tsconfig: "tsconfig.json",
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
const optionsList = (await Promise.all(
|
|
22
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).map(async (options2) => {
|
|
23
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
24
|
+
return Array.isArray(result) ? result : [result];
|
|
25
|
+
}).flat()
|
|
26
|
+
)).flat();
|
|
27
|
+
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
28
|
+
return 0;
|
|
29
|
+
};
|
|
30
|
+
const packageCompileTsup2 = async (params) => {
|
|
31
|
+
const { verbose, compile } = await loadConfig(params);
|
|
32
|
+
const publint = compile?.publint ?? true;
|
|
33
|
+
if (verbose) {
|
|
34
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
35
|
+
}
|
|
36
|
+
return packageCompileTscNoEmit({ verbose }) || await compileFolder(compile?.tsup?.options, verbose) || await compileFolder({ ...compile?.tsup?.options ?? {}, clean: false, legacyOutput: true }, verbose) || await packageCompileTscTypes({ verbose }) || await packageCompileTscTypes({ verbose }, { outDir: "dist/esm" }, false) || (publint ? await packagePublint() : 0);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
packageCompileTsup2
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=tsup2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (options?: Options, _verbose?: boolean) => {\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry: ['src'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\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])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (await compileFolder(compile?.tsup?.options, verbose)) ||\n (await compileFolder({ ...(compile?.tsup?.options ?? {}), clean: false, legacyOutput: true }, verbose)) ||\n (await packageCompileTscTypes({ verbose })) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/esm' }, false)) ||\n (publint ? await packagePublint() : 0)\n )\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAYvC,MAAM,gBAAgB,OAAO,SAAmB,aAAuB;AACrE,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO,CAAC,KAAK;AAAA,IACb,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,aAAY,MAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO;AACT;AAEO,MAAM,sBAAsB,OAAO,WAAuC;AAC/E,QAAM,EAAE,SAAS,QAAQ,IAAI,MAAM,WAAW,MAAM;AACpD,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,YAAQ,IAAI,+BAA+B,SAAS,KAAK,GAAG;AAAA,EAC9D;AAEA,SACE,wBAAwB,EAAE,QAAQ,CAAC,KAClC,MAAM,cAAc,SAAS,MAAM,SAAS,OAAO,KACnD,MAAM,cAAc,EAAE,GAAI,SAAS,MAAM,WAAW,CAAC,GAAI,OAAO,OAAO,cAAc,KAAK,GAAG,OAAO,KACpG,MAAM,uBAAuB,EAAE,QAAQ,CAAC,KACxC,MAAM,uBAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,WAAW,GAAG,KAAK,MACvE,UAAU,MAAM,eAAe,IAAI;AAExC;","names":["options"]}
|
|
@@ -46,10 +46,11 @@ const packagePublint = async (params) => {
|
|
|
46
46
|
strict: true
|
|
47
47
|
});
|
|
48
48
|
const { formatMessage } = await import("publint/utils");
|
|
49
|
-
messages.
|
|
49
|
+
const validMessages = messages.filter((message) => !(message.code === "FILE_INVALID_FORMAT" && message.args.actualFilePath?.includes("/dist/esm")));
|
|
50
|
+
validMessages.forEach((message) => {
|
|
50
51
|
switch (message.type) {
|
|
51
52
|
case "error":
|
|
52
|
-
console.error(import_chalk.default.red(formatMessage(message, pkg)));
|
|
53
|
+
console.error(import_chalk.default.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
53
54
|
break;
|
|
54
55
|
case "warning":
|
|
55
56
|
console.warn(import_chalk.default.yellow(formatMessage(message, pkg)));
|
|
@@ -60,9 +61,9 @@ const packagePublint = async (params) => {
|
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
if (params?.verbose) {
|
|
63
|
-
console.log(import_chalk.default.gray(`Publint [Finish]: ${pkgDir} [${
|
|
64
|
+
console.log(import_chalk.default.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
64
65
|
}
|
|
65
|
-
return
|
|
66
|
+
return validMessages.length;
|
|
66
67
|
};
|
|
67
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
69
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\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\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\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 messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\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\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\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 //we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter((message) => !(message.code === 'FILE_INVALID_FORMAT' && message.args.actualFilePath?.includes('/dist/esm')))\n validMessages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,gBAA+B;AAOxB,MAAM,iBAAiB,OAAO,WAAkC;AACrE,QAAM,SAAS,QAAQ,IAAI;AAE3B,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,aAAAA,QAAM,KAAK,oBAAoB,MAAM,EAAE,CAAC;AAAA,EACtD;AAEA,QAAM,MAAM,KAAK,MAAM,MAAM,UAAAC,SAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAGtD,QAAM,gBAAgB,SAAS,OAAO,CAAC,YAAY,EAAE,QAAQ,SAAS,yBAAyB,QAAQ,KAAK,gBAAgB,SAAS,WAAW,EAAE;AAClJ,gBAAc,QAAQ,CAAC,YAAqB;AAC1C,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,aAAAD,QAAM,IAAI,IAAI,QAAQ,IAAI,KAAK,cAAc,SAAS,GAAG,CAAC,EAAE,CAAC;AAC3E;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,aAAAA,QAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,aAAAA,QAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,aAAAA,QAAM,KAAK,qBAAqB,MAAM,KAAK,cAAc,MAAM,GAAG,CAAC;AAAA,EACjF;AAEA,SAAO,cAAc;AACvB;","names":["chalk","fs"]}
|
|
@@ -13,10 +13,11 @@ const packagePublint = async (params) => {
|
|
|
13
13
|
strict: true
|
|
14
14
|
});
|
|
15
15
|
const { formatMessage } = await import("publint/utils");
|
|
16
|
-
messages.
|
|
16
|
+
const validMessages = messages.filter((message) => !(message.code === "FILE_INVALID_FORMAT" && message.args.actualFilePath?.includes("/dist/esm")));
|
|
17
|
+
validMessages.forEach((message) => {
|
|
17
18
|
switch (message.type) {
|
|
18
19
|
case "error":
|
|
19
|
-
console.error(chalk.red(formatMessage(message, pkg)));
|
|
20
|
+
console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
20
21
|
break;
|
|
21
22
|
case "warning":
|
|
22
23
|
console.warn(chalk.yellow(formatMessage(message, pkg)));
|
|
@@ -27,9 +28,9 @@ const packagePublint = async (params) => {
|
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
if (params?.verbose) {
|
|
30
|
-
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${
|
|
31
|
+
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return validMessages.length;
|
|
33
34
|
};
|
|
34
35
|
export {
|
|
35
36
|
packagePublint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\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\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\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 messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\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\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\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 //we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter((message) => !(message.code === 'FILE_INVALID_FORMAT' && message.args.actualFilePath?.includes('/dist/esm')))\n validMessages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.length\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,YAAY,UAAU;AAOxB,MAAM,iBAAiB,OAAO,WAAkC;AACrE,QAAM,SAAS,QAAQ,IAAI;AAE3B,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,MAAM,KAAK,oBAAoB,MAAM,EAAE,CAAC;AAAA,EACtD;AAEA,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAGtD,QAAM,gBAAgB,SAAS,OAAO,CAAC,YAAY,EAAE,QAAQ,SAAS,yBAAyB,QAAQ,KAAK,gBAAgB,SAAS,WAAW,EAAE;AAClJ,gBAAc,QAAQ,CAAC,YAAqB;AAC1C,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI,KAAK,cAAc,SAAS,GAAG,CAAC,EAAE,CAAC;AAC3E;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,MAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,MAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,MAAM,KAAK,qBAAqB,MAAM,KAAK,cAAc,MAAM,GAAG,CAAC;AAAA,EACjF;AAEA,SAAO,cAAc;AACvB;","names":[]}
|
|
@@ -24,8 +24,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
var import_chalk = __toESM(require("chalk"));
|
|
26
26
|
var import_actions = require("../../actions");
|
|
27
|
-
(0, import_actions.packageCompile)({ verbose:
|
|
27
|
+
(0, import_actions.packageCompile)({ verbose: false }).then((value) => {
|
|
28
|
+
if (value) {
|
|
29
|
+
process.exit(value);
|
|
30
|
+
}
|
|
31
|
+
}).catch((reason) => {
|
|
28
32
|
console.error(import_chalk.default.red(reason));
|
|
29
|
-
process.
|
|
33
|
+
process.exit(-1);
|
|
30
34
|
});
|
|
31
35
|
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/package/compile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompile } from '../../actions'\n\npackageCompile({verbose:
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/package/compile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompile } from '../../actions'\n\npackageCompile({verbose: false}).then((value) => {\n if (value) {\n process.exit(value)\n }\n}).catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n})"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,mBAAkB;AAClB,qBAA+B;AAAA,IAE/B,+BAAe,EAAC,SAAS,MAAK,CAAC,EAAE,KAAK,CAAC,UAAU;AAC/C,MAAI,OAAO;AACT,YAAQ,KAAK,KAAK;AAAA,EACpB;AACF,CAAC,EAAE,MAAM,CAAC,WAAW;AACnB,UAAQ,MAAM,aAAAA,QAAM,IAAI,MAAM,CAAC;AAC/B,UAAQ,KAAK,EAAE;AACjB,CAAC;","names":["chalk"]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { packageCompile } from "../../actions";
|
|
4
|
-
packageCompile({ verbose:
|
|
4
|
+
packageCompile({ verbose: false }).then((value) => {
|
|
5
|
+
if (value) {
|
|
6
|
+
process.exit(value);
|
|
7
|
+
}
|
|
8
|
+
}).catch((reason) => {
|
|
5
9
|
console.error(chalk.red(reason));
|
|
6
|
-
process.
|
|
10
|
+
process.exit(-1);
|
|
7
11
|
});
|
|
8
12
|
//# sourceMappingURL=compile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/package/compile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompile } from '../../actions'\n\npackageCompile({verbose:
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/package/compile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompile } from '../../actions'\n\npackageCompile({verbose: false}).then((value) => {\n if (value) {\n process.exit(value)\n }\n}).catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n})"],"mappings":";AAEA,OAAO,WAAW;AAClB,SAAS,sBAAsB;AAE/B,eAAe,EAAC,SAAS,MAAK,CAAC,EAAE,KAAK,CAAC,UAAU;AAC/C,MAAI,OAAO;AACT,YAAQ,KAAK,KAAK;AAAA,EACpB;AACF,CAAC,EAAE,MAAM,CAAC,WAAW;AACnB,UAAQ,MAAM,MAAM,IAAI,MAAM,CAAC;AAC/B,UAAQ,KAAK,EAAE;AACjB,CAAC;","names":[]}
|
package/dist/lib/loadConfig.js
CHANGED
|
@@ -39,7 +39,7 @@ const loadConfig = async (params) => {
|
|
|
39
39
|
if (config) {
|
|
40
40
|
return (0, import_merge.default)({}, config, params);
|
|
41
41
|
}
|
|
42
|
-
const cosmicConfigResult = await (0, import_cosmiconfig.cosmiconfig)("xy").search();
|
|
42
|
+
const cosmicConfigResult = await (0, import_cosmiconfig.cosmiconfig)("xy", { cache: true }).search();
|
|
43
43
|
config = cosmicConfigResult?.config;
|
|
44
44
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
45
45
|
if (configFilePath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet config: Record<string, any>\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').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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,yBAA4B;AAE5B,mBAAkB;AAGlB,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,eAAO,aAAAA,SAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,UAAM,gCAAY,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet config: Record<string, any>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,yBAA4B;AAE5B,mBAAkB;AAGlB,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,eAAO,aAAAA,SAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,UAAM,gCAAY,MAAM,EAAE,OAAO,KAAK,CAAC,EAAE,OAAO;AAC3E,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,aAAAC,QAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,aAAO,aAAAD,SAAM,CAAC,GAAG,QAAQ,MAAM;AACjC;","names":["merge","chalk"]}
|
package/dist/lib/loadConfig.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const loadConfig = async (params) => {
|
|
|
6
6
|
if (config) {
|
|
7
7
|
return merge({}, config, params);
|
|
8
8
|
}
|
|
9
|
-
const cosmicConfigResult = await cosmiconfig("xy").search();
|
|
9
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true }).search();
|
|
10
10
|
config = cosmicConfigResult?.config;
|
|
11
11
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
12
12
|
if (configFilePath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet config: Record<string, any>\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').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"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAE5B,OAAO,WAAW;AAGlB,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,WAAO,MAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,MAAM,YAAY,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet config: Record<string, any>\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"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAE5B,OAAO,WAAW;AAGlB,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,WAAO,MAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,MAAM,YAAY,MAAM,EAAE,OAAO,KAAK,CAAC,EAAE,OAAO;AAC3E,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,MAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,SAAO,MAAM,CAAC,GAAG,QAAQ,MAAM;AACjC;","names":[]}
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/yargs": "^17.0.24",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
68
68
|
"@typescript-eslint/parser": "^6.7.0",
|
|
69
|
-
"@xylabs/tsconfig": "~3.0.
|
|
69
|
+
"@xylabs/tsconfig": "~3.0.30",
|
|
70
70
|
"chalk": "^4.1.2",
|
|
71
71
|
"cosmiconfig": "^8.3.6",
|
|
72
72
|
"cpy": "^8.1.2",
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"@types/license-checker": "^25.0.4",
|
|
111
111
|
"@types/lodash": "^4.14.198",
|
|
112
112
|
"@types/parse-git-config": "^3.0.1",
|
|
113
|
-
"@xylabs/eslint-config": "^3.0.
|
|
114
|
-
"@xylabs/tsconfig": "^3.0.
|
|
113
|
+
"@xylabs/eslint-config": "^3.0.30",
|
|
114
|
+
"@xylabs/tsconfig": "^3.0.30",
|
|
115
115
|
"publint": "^0.2.2",
|
|
116
116
|
"typescript": "^5.2.2"
|
|
117
117
|
},
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"package-clean": "echo Not cleaning..."
|
|
169
169
|
},
|
|
170
170
|
"sideEffects": false,
|
|
171
|
-
"version": "3.0.
|
|
171
|
+
"version": "3.0.30"
|
|
172
172
|
}
|
package/src/actions/compile.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const compileAll = ({ jobs, verbose, target, incremental }: CompileParams
|
|
|
35
35
|
const start = Date.now()
|
|
36
36
|
const verboseOptions = verbose ? ['-v'] : []
|
|
37
37
|
const targetOptions = target ? ['-t', target] : []
|
|
38
|
-
const incrementalOptions = incremental ? ['--since', '-
|
|
38
|
+
const incrementalOptions = incremental ? ['--since', '-ptAi'] : ['-ptAi']
|
|
39
39
|
const jobsOptions = jobs ? ['-j', `${jobs}`] : []
|
|
40
40
|
if (jobs) {
|
|
41
41
|
console.log(chalk.blue(`Jobs set to [${jobs}]`))
|
|
@@ -7,7 +7,7 @@ import { packagePublint } from '../publint'
|
|
|
7
7
|
import { CompileParams } from './CompileParams'
|
|
8
8
|
import { packageCompileRollup } from './rollup'
|
|
9
9
|
import { packageCompileTsc } from './tsc'
|
|
10
|
-
import {
|
|
10
|
+
import { packageCompileTsup2 } from './tsup2'
|
|
11
11
|
|
|
12
12
|
export type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'
|
|
13
13
|
|
|
@@ -50,7 +50,7 @@ export const packageCompile = async (params?: PackageCompileParams): Promise<num
|
|
|
50
50
|
break
|
|
51
51
|
}
|
|
52
52
|
case 'tsup': {
|
|
53
|
-
result += await
|
|
53
|
+
result += await packageCompileTsup2(
|
|
54
54
|
merge({}, params, {
|
|
55
55
|
compile: {
|
|
56
56
|
publint: false,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cwd } from 'process'
|
|
2
|
+
import { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'
|
|
3
|
+
import { DiagnosticCategory } from 'typescript'
|
|
4
|
+
|
|
5
|
+
import { CompileParams } from './CompileParams'
|
|
6
|
+
import { getCompilerOptions } from './getCompilerOptions'
|
|
7
|
+
|
|
8
|
+
export const packageCompileTscNoEmit = (params?: CompileParams): number => {
|
|
9
|
+
const pkg = process.env.INIT_CWD
|
|
10
|
+
|
|
11
|
+
if (params?.verbose) {
|
|
12
|
+
console.log(`Compiling with NoEmit TSC [${pkg}]`)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const result = createProgramFromConfig({
|
|
16
|
+
basePath: pkg ?? cwd(),
|
|
17
|
+
compilerOptions: getCompilerOptions({
|
|
18
|
+
declaration: true,
|
|
19
|
+
declarationMap: true,
|
|
20
|
+
esModuleInterop: true,
|
|
21
|
+
noEmit: true,
|
|
22
|
+
outDir: 'dist',
|
|
23
|
+
skipLibCheck: true,
|
|
24
|
+
sourceMap: true,
|
|
25
|
+
}) as TsConfigCompilerOptions,
|
|
26
|
+
configFilePath: 'tsconfig.json',
|
|
27
|
+
exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],
|
|
28
|
+
include: ['src'],
|
|
29
|
+
}).emit()
|
|
30
|
+
|
|
31
|
+
return result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length
|
|
32
|
+
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { cwd } from 'process'
|
|
2
2
|
import { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'
|
|
3
|
-
import { DiagnosticCategory } from 'typescript'
|
|
3
|
+
import { CompilerOptions, DiagnosticCategory } from 'typescript'
|
|
4
4
|
|
|
5
|
-
import { loadConfig } from '../../../lib'
|
|
6
5
|
import { CompileParams } from './CompileParams'
|
|
7
6
|
import { copyTypeFiles } from './copyTypeFiles'
|
|
8
7
|
import { getCompilerOptions } from './getCompilerOptions'
|
|
9
8
|
|
|
10
|
-
export const packageCompileTscTypes = async (params?: CompileParams): Promise<number> => {
|
|
9
|
+
export const packageCompileTscTypes = async (params?: CompileParams, compilerOptions?: CompilerOptions, generateMts = true): Promise<number> => {
|
|
11
10
|
const pkg = process.env.INIT_CWD
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
if (config.verbose) {
|
|
12
|
+
if (params?.verbose) {
|
|
15
13
|
console.log(`Compiling types with TSC [${pkg}]`)
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -25,12 +23,16 @@ export const packageCompileTscTypes = async (params?: CompileParams): Promise<nu
|
|
|
25
23
|
outDir: 'dist',
|
|
26
24
|
skipLibCheck: true,
|
|
27
25
|
sourceMap: true,
|
|
26
|
+
...(compilerOptions ?? {}),
|
|
28
27
|
}) as TsConfigCompilerOptions,
|
|
29
28
|
configFilePath: 'tsconfig.json',
|
|
30
29
|
exclude: ['dist', 'docs', '**/*.spec.*', 'src/**/spec/**/*'],
|
|
31
30
|
include: ['src'],
|
|
32
31
|
}).emit()
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length
|
|
34
|
+
if (generateMts) {
|
|
35
|
+
await copyTypeFiles()
|
|
36
|
+
}
|
|
37
|
+
return diagResults
|
|
36
38
|
}
|
|
@@ -4,6 +4,7 @@ import { loadConfig } from '../../../lib'
|
|
|
4
4
|
import { packagePublint } from '../publint'
|
|
5
5
|
import { CompileParams } from './CompileParams'
|
|
6
6
|
import { getInputDirs, getInputs } from './inputs'
|
|
7
|
+
import { packageCompileTscNoEmit } from './tscNoEmit'
|
|
7
8
|
import { packageCompileTscTypes } from './tscTypes'
|
|
8
9
|
|
|
9
10
|
export type PackageCompileTsupParams = Partial<
|
|
@@ -16,20 +17,21 @@ export type PackageCompileTsupParams = Partial<
|
|
|
16
17
|
}
|
|
17
18
|
>
|
|
18
19
|
|
|
19
|
-
const compileSubDir = async (subDir?: string, options?: Options,
|
|
20
|
+
const compileSubDir = async (subDir?: string, options?: Options, _verbose?: boolean) => {
|
|
20
21
|
const dir = subDir === '.' ? undefined : subDir
|
|
21
22
|
const input = await getInputs(dir)
|
|
22
23
|
if (input.length === 0) {
|
|
23
24
|
return 0
|
|
24
25
|
}
|
|
25
26
|
const optionsResult = defineConfig({
|
|
26
|
-
bundle:
|
|
27
|
+
bundle: false,
|
|
27
28
|
cjsInterop: true,
|
|
28
29
|
clean: true,
|
|
29
30
|
dts: false,
|
|
30
31
|
entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],
|
|
31
32
|
format: ['cjs', 'esm'],
|
|
32
33
|
outDir: subDir ? `dist/${subDir}` : 'dist',
|
|
34
|
+
silent: true,
|
|
33
35
|
sourcemap: true,
|
|
34
36
|
splitting: false,
|
|
35
37
|
tsconfig: 'tsconfig.json',
|
|
@@ -47,28 +49,38 @@ const compileSubDir = async (subDir?: string, options?: Options, verbose?: boole
|
|
|
47
49
|
).flat()
|
|
48
50
|
await Promise.all(optionsList.map((options) => build(options)))
|
|
49
51
|
|
|
50
|
-
return
|
|
52
|
+
return 0
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export const packageCompileTsup = async (params?: PackageCompileTsupParams) => {
|
|
54
|
-
const
|
|
55
|
-
const publint =
|
|
56
|
-
if (
|
|
57
|
-
console.log(`Compiling with TSUP [Depth: ${
|
|
56
|
+
const { verbose, compile } = await loadConfig(params)
|
|
57
|
+
const publint = compile?.publint ?? true
|
|
58
|
+
if (verbose) {
|
|
59
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)
|
|
60
|
+
}
|
|
61
|
+
const inputDirs = await getInputDirs(compile?.depth)
|
|
62
|
+
|
|
63
|
+
const noEmitResult = await packageCompileTscNoEmit({ verbose })
|
|
64
|
+
|
|
65
|
+
if (noEmitResult) {
|
|
66
|
+
return noEmitResult
|
|
58
67
|
}
|
|
59
|
-
const inputDirs = await getInputDirs(config.compile?.depth)
|
|
60
68
|
|
|
61
69
|
if (inputDirs.length) {
|
|
62
70
|
const result = (
|
|
63
71
|
await Promise.all(
|
|
64
72
|
inputDirs.map(async (inputDir) => {
|
|
65
|
-
return await compileSubDir(inputDir,
|
|
73
|
+
return await compileSubDir(inputDir, compile?.tsup?.options, verbose)
|
|
66
74
|
}),
|
|
67
75
|
)
|
|
68
76
|
).reduce((prev, result) => prev + result, 0)
|
|
69
|
-
return result
|
|
77
|
+
return result || (await packageCompileTscTypes({ verbose })) || (publint ? await packagePublint() : 0)
|
|
70
78
|
} else {
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
return (
|
|
80
|
+
packageCompileTscNoEmit({ verbose }) ||
|
|
81
|
+
(await compileSubDir(undefined, compile?.tsup?.options, verbose)) ||
|
|
82
|
+
(await packageCompileTscTypes({ verbose })) ||
|
|
83
|
+
(publint ? await packagePublint() : 0)
|
|
84
|
+
)
|
|
73
85
|
}
|
|
74
86
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { build, defineConfig, Options } from 'tsup'
|
|
2
|
+
|
|
3
|
+
import { loadConfig } from '../../../lib'
|
|
4
|
+
import { packagePublint } from '../publint'
|
|
5
|
+
import { CompileParams } from './CompileParams'
|
|
6
|
+
import { packageCompileTscNoEmit } from './tscNoEmit'
|
|
7
|
+
import { packageCompileTscTypes } from './tscTypes'
|
|
8
|
+
|
|
9
|
+
export type PackageCompileTsup2Params = Partial<
|
|
10
|
+
CompileParams & {
|
|
11
|
+
compile?: {
|
|
12
|
+
tsup?: {
|
|
13
|
+
options?: Options
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
const compileFolder = async (options?: Options, _verbose?: boolean) => {
|
|
20
|
+
const optionsResult = defineConfig({
|
|
21
|
+
bundle: false,
|
|
22
|
+
cjsInterop: true,
|
|
23
|
+
clean: true,
|
|
24
|
+
dts: false,
|
|
25
|
+
entry: ['src'],
|
|
26
|
+
format: ['cjs', 'esm'],
|
|
27
|
+
outDir: 'dist',
|
|
28
|
+
silent: true,
|
|
29
|
+
sourcemap: true,
|
|
30
|
+
splitting: false,
|
|
31
|
+
tsconfig: 'tsconfig.json',
|
|
32
|
+
...options,
|
|
33
|
+
})
|
|
34
|
+
const optionsList = (
|
|
35
|
+
await Promise.all(
|
|
36
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult])
|
|
37
|
+
.map<Promise<Options[]>>(async (options) => {
|
|
38
|
+
const result = typeof options === 'function' ? await options({}) : [options]
|
|
39
|
+
return Array.isArray(result) ? result : [result]
|
|
40
|
+
})
|
|
41
|
+
.flat(),
|
|
42
|
+
)
|
|
43
|
+
).flat()
|
|
44
|
+
await Promise.all(optionsList.map((options) => build(options)))
|
|
45
|
+
|
|
46
|
+
return 0
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) => {
|
|
50
|
+
const { verbose, compile } = await loadConfig(params)
|
|
51
|
+
const publint = compile?.publint ?? true
|
|
52
|
+
if (verbose) {
|
|
53
|
+
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
packageCompileTscNoEmit({ verbose }) ||
|
|
58
|
+
(await compileFolder(compile?.tsup?.options, verbose)) ||
|
|
59
|
+
(await compileFolder({ ...(compile?.tsup?.options ?? {}), clean: false, legacyOutput: true }, verbose)) ||
|
|
60
|
+
(await packageCompileTscTypes({ verbose })) ||
|
|
61
|
+
(await packageCompileTscTypes({ verbose }, { outDir: 'dist/esm' }, false)) ||
|
|
62
|
+
(publint ? await packagePublint() : 0)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -26,10 +26,12 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
26
26
|
// eslint-disable-next-line import/no-internal-modules
|
|
27
27
|
const { formatMessage } = await import('publint/utils')
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
//we filter out invalid file formats for the esm folder since it is intentionally done
|
|
30
|
+
const validMessages = messages.filter((message) => !(message.code === 'FILE_INVALID_FORMAT' && message.args.actualFilePath?.includes('/dist/esm')))
|
|
31
|
+
validMessages.forEach((message: Message) => {
|
|
30
32
|
switch (message.type) {
|
|
31
33
|
case 'error':
|
|
32
|
-
console.error(chalk.red(formatMessage(message, pkg)))
|
|
34
|
+
console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))
|
|
33
35
|
break
|
|
34
36
|
case 'warning':
|
|
35
37
|
console.warn(chalk.yellow(formatMessage(message, pkg)))
|
|
@@ -41,8 +43,8 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
41
43
|
})
|
|
42
44
|
|
|
43
45
|
if (params?.verbose) {
|
|
44
|
-
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${
|
|
46
|
+
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
return
|
|
49
|
+
return validMessages.length
|
|
48
50
|
}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import { packageCompile } from '../../actions'
|
|
5
5
|
|
|
6
|
-
packageCompile({verbose:
|
|
6
|
+
packageCompile({verbose: false}).then((value) => {
|
|
7
|
+
if (value) {
|
|
8
|
+
process.exit(value)
|
|
9
|
+
}
|
|
10
|
+
}).catch((reason) => {
|
|
7
11
|
console.error(chalk.red(reason))
|
|
8
|
-
process.
|
|
12
|
+
process.exit(-1)
|
|
9
13
|
})
|
package/src/lib/loadConfig.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const loadConfig = async <T extends object>(params?: T): Promise<T> => {
|
|
|
11
11
|
return merge({}, config, params)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const cosmicConfigResult = await cosmiconfig('xy').search()
|
|
14
|
+
const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()
|
|
15
15
|
config = cosmicConfigResult?.config
|
|
16
16
|
const configFilePath = cosmicConfigResult?.filepath
|
|
17
17
|
if (configFilePath) {
|