@xylabs/ts-scripts-yarn3 3.0.58 → 3.0.60
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/package/compile/inputs.js +11 -1
- package/dist/actions/package/compile/inputs.js.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +10 -1
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/tscTypes.js +1 -1
- package/dist/actions/package/compile/tscTypes.js.map +1 -1
- package/dist/actions/package/compile/tscTypes.mjs +1 -1
- package/dist/actions/package/compile/tscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/tsup2.js +14 -5
- package/dist/actions/package/compile/tsup2.js.map +1 -1
- package/dist/actions/package/compile/tsup2.mjs +14 -5
- package/dist/actions/package/compile/tsup2.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/inputs.ts +10 -1
- package/src/actions/package/compile/tscTypes.ts +13 -11
- package/src/actions/package/compile/tsup2.ts +18 -9
|
@@ -19,13 +19,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var inputs_exports = {};
|
|
20
20
|
__export(inputs_exports, {
|
|
21
21
|
getAllInputs: () => getAllInputs,
|
|
22
|
+
getAllInputs2: () => getAllInputs2,
|
|
22
23
|
getInputDirs: () => getInputDirs,
|
|
23
24
|
getInputs: () => getInputs
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(inputs_exports);
|
|
26
27
|
var import_promises = require("fs/promises");
|
|
28
|
+
var import_glob = require("glob");
|
|
27
29
|
const getInputs = async (subDir) => {
|
|
28
|
-
return (await (0, import_promises.readdir)(subDir ? `src/${subDir}` : "src", { recursive: false })).filter(
|
|
30
|
+
return (await (0, import_promises.readdir)(subDir ? `src/${subDir}` : "src", { recursive: false })).filter(
|
|
31
|
+
(file) => (file.endsWith(".ts") || file.endsWith(".tsx")) && !file.endsWith("d.ts") && !file.includes(".spec.") && !file.includes(".stories.")
|
|
32
|
+
).map((file) => subDir ? `${subDir}/${file}` : file);
|
|
29
33
|
};
|
|
30
34
|
const getInputDirs = async (depth = 0) => {
|
|
31
35
|
if (depth === 0) {
|
|
@@ -49,9 +53,15 @@ const getAllInputs = async (depth = 100) => {
|
|
|
49
53
|
const dirs = await getInputDirs(depth);
|
|
50
54
|
return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat();
|
|
51
55
|
};
|
|
56
|
+
const getAllInputs2 = () => {
|
|
57
|
+
const globItems = import_glob.glob.sync("src/**/*.*", { ignore: ["**/*.spec.*", "**/*.stories.*", "**/spec/**/*"] });
|
|
58
|
+
console.log(JSON.stringify(globItems, null, 2));
|
|
59
|
+
return globItems;
|
|
60
|
+
};
|
|
52
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
62
|
0 && (module.exports = {
|
|
54
63
|
getAllInputs,
|
|
64
|
+
getAllInputs2,
|
|
55
65
|
getInputDirs,
|
|
56
66
|
getInputs
|
|
57
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts"],"sourcesContent":["import { readdir } from 'fs/promises'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter((file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'))\n .map((file) => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter((file) => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts"],"sourcesContent":["import { readdir } from 'fs/promises'\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n (file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map((file) => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter((file) => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = () => {\n const globItems = glob.sync('src/**/*.*', { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'] })\n console.log(JSON.stringify(globItems, null, 2))\n return globItems\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAwB;AACxB,kBAAqB;AAEd,MAAM,YAAY,OAAO,WAAoB;AAClD,UAAQ,UAAM,yBAAQ,SAAS,OAAO,MAAM,KAAK,OAAO,EAAE,WAAW,MAAM,CAAC,GACzE;AAAA,IACC,CAAC,UAAU,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,KAAK,CAAC,KAAK,SAAS,QAAQ,KAAK,CAAC,KAAK,SAAS,WAAW;AAAA,EAC/I,EACC,IAAI,CAAC,SAAU,SAAS,GAAG,MAAM,IAAI,IAAI,KAAK,IAAK;AACxD;AAEO,MAAM,eAAe,OAAO,QAAgB,MAAM;AACvD,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AACA,SAAO;AAAA,IACL;AAAA,IACA,IAAI,UAAM,yBAAQ,OAAO,EAAE,WAAW,MAAM,eAAe,KAAK,CAAC,GAC9D,OAAO,CAAC,SAAS,KAAK,YAAY,CAAC,EACnC,IAAI,CAAC,SAAS;AACb,YAAM,YAAY,KAAK,MAAM,MAAM,GAAG,KAAK,CAAC;AAC5C,gBAAU,MAAM;AAChB,UAAI,UAAU,QAAQ;AACpB,cAAM,OAAO,UAAU,KAAK,GAAG;AAC/B,eAAO,GAAG,IAAI,IAAI,KAAK,IAAI;AAAA,MAC7B,OAAO;AACL,eAAO,KAAK;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACL;AACF;AAEO,MAAM,eAAe,OAAO,QAAQ,QAAQ;AACjD,QAAM,OAAO,MAAM,aAAa,KAAK;AACrC,UAAQ,MAAM,QAAQ,IAAI,KAAK,IAAI,OAAO,QAAQ,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,KAAK;AACjF;AAEO,MAAM,gBAAgB,MAAM;AACjC,QAAM,YAAY,iBAAK,KAAK,cAAc,EAAE,QAAQ,CAAC,eAAe,kBAAkB,cAAc,EAAE,CAAC;AACvG,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAC9C,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readdir } from "fs/promises";
|
|
2
|
+
import { glob } from "glob";
|
|
2
3
|
const getInputs = async (subDir) => {
|
|
3
|
-
return (await readdir(subDir ? `src/${subDir}` : "src", { recursive: false })).filter(
|
|
4
|
+
return (await readdir(subDir ? `src/${subDir}` : "src", { recursive: false })).filter(
|
|
5
|
+
(file) => (file.endsWith(".ts") || file.endsWith(".tsx")) && !file.endsWith("d.ts") && !file.includes(".spec.") && !file.includes(".stories.")
|
|
6
|
+
).map((file) => subDir ? `${subDir}/${file}` : file);
|
|
4
7
|
};
|
|
5
8
|
const getInputDirs = async (depth = 0) => {
|
|
6
9
|
if (depth === 0) {
|
|
@@ -24,8 +27,14 @@ const getAllInputs = async (depth = 100) => {
|
|
|
24
27
|
const dirs = await getInputDirs(depth);
|
|
25
28
|
return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat();
|
|
26
29
|
};
|
|
30
|
+
const getAllInputs2 = () => {
|
|
31
|
+
const globItems = glob.sync("src/**/*.*", { ignore: ["**/*.spec.*", "**/*.stories.*", "**/spec/**/*"] });
|
|
32
|
+
console.log(JSON.stringify(globItems, null, 2));
|
|
33
|
+
return globItems;
|
|
34
|
+
};
|
|
27
35
|
export {
|
|
28
36
|
getAllInputs,
|
|
37
|
+
getAllInputs2,
|
|
29
38
|
getInputDirs,
|
|
30
39
|
getInputs
|
|
31
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts"],"sourcesContent":["import { readdir } from 'fs/promises'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter((file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'))\n .map((file) => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter((file) => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()\n}\n"],"mappings":"AAAA,SAAS,eAAe;
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts"],"sourcesContent":["import { readdir } from 'fs/promises'\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n (file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map((file) => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter((file) => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = () => {\n const globItems = glob.sync('src/**/*.*', { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'] })\n console.log(JSON.stringify(globItems, null, 2))\n return globItems\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AAEd,MAAM,YAAY,OAAO,WAAoB;AAClD,UAAQ,MAAM,QAAQ,SAAS,OAAO,MAAM,KAAK,OAAO,EAAE,WAAW,MAAM,CAAC,GACzE;AAAA,IACC,CAAC,UAAU,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,KAAK,CAAC,KAAK,SAAS,QAAQ,KAAK,CAAC,KAAK,SAAS,WAAW;AAAA,EAC/I,EACC,IAAI,CAAC,SAAU,SAAS,GAAG,MAAM,IAAI,IAAI,KAAK,IAAK;AACxD;AAEO,MAAM,eAAe,OAAO,QAAgB,MAAM;AACvD,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AACA,SAAO;AAAA,IACL;AAAA,IACA,IAAI,MAAM,QAAQ,OAAO,EAAE,WAAW,MAAM,eAAe,KAAK,CAAC,GAC9D,OAAO,CAAC,SAAS,KAAK,YAAY,CAAC,EACnC,IAAI,CAAC,SAAS;AACb,YAAM,YAAY,KAAK,MAAM,MAAM,GAAG,KAAK,CAAC;AAC5C,gBAAU,MAAM;AAChB,UAAI,UAAU,QAAQ;AACpB,cAAM,OAAO,UAAU,KAAK,GAAG;AAC/B,eAAO,GAAG,IAAI,IAAI,KAAK,IAAI;AAAA,MAC7B,OAAO;AACL,eAAO,KAAK;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACL;AACF;AAEO,MAAM,eAAe,OAAO,QAAQ,QAAQ;AACjD,QAAM,OAAO,MAAM,aAAa,KAAK;AACrC,UAAQ,MAAM,QAAQ,IAAI,KAAK,IAAI,OAAO,QAAQ,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,KAAK;AACjF;AAEO,MAAM,gBAAgB,MAAM;AACjC,QAAM,YAAY,KAAK,KAAK,cAAc,EAAE,QAAQ,CAAC,eAAe,kBAAkB,cAAc,EAAE,CAAC;AACvG,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAC9C,SAAO;AACT;","names":[]}
|
|
@@ -31,12 +31,12 @@ __export(tscTypes_exports, {
|
|
|
31
31
|
packageCompileTscTypes: () => packageCompileTscTypes
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(tscTypes_exports);
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
34
35
|
var import_process = require("process");
|
|
35
36
|
var import_tsc_prog = require("tsc-prog");
|
|
36
37
|
var import_typescript = require("typescript");
|
|
37
38
|
var import_copyTypeFiles = require("./copyTypeFiles");
|
|
38
39
|
var import_getCompilerOptions = require("./getCompilerOptions");
|
|
39
|
-
var import_chalk = __toESM(require("chalk"));
|
|
40
40
|
const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts = true) => {
|
|
41
41
|
const pkg = process.env.INIT_CWD;
|
|
42
42
|
if (params?.verbose) {
|
|
@@ -1 +1 @@
|
|
|
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'\
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { 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, compilerOptionsParam?: 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 compilerOptions = {\n ...getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n result.diagnostics.forEach((diag) => {\n switch (diag.category) {\n case DiagnosticCategory.Error:\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Warning:\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Suggestion:\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n })\n if (generateMts) {\n await copyTypeFiles(compilerOptions)\n }\n return diagResults\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,qBAAoB;AACpB,sBAAiE;AACjE,wBAAoD;AAGpD,2BAA8B;AAC9B,gCAAmC;AAE5B,MAAM,yBAAyB,OAAO,QAAwB,sBAAwC,cAAc,SAA0B;AACnJ,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,kBAAkB;AAAA,IACtB,OAAG,8CAAmB;AAAA,MACpB,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,IACb,CAAC;AAAA,IACD,GAAI,wBAAwB,CAAC;AAAA,EAC/B;AAEA,QAAM,aAAS,yCAAwB;AAAA,IACrC,UAAU,WAAO,oBAAI;AAAA,IACrB;AAAA,IACA,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB,kBAAkB;AAAA,IAC7E,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,QAAM,cAAc,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,qCAAmB,KAAK,EAAE;AACnG,SAAO,YAAY,QAAQ,CAAC,SAAS;AACnC,YAAQ,KAAK,UAAU;AAAA,MACrB,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,IAAI,KAAK,WAAW,CAAC;AACzC,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,OAAO,KAAK,WAAW,CAAC;AAC5C,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,MAAM,KAAK,WAAW,CAAC;AAC3C,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,IACJ;AAAA,EACF,CAAC;AACD,MAAI,aAAa;AACf,cAAM,oCAAc,eAAe;AAAA,EACrC;AACA,SAAO;AACT;","names":["chalk"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
1
2
|
import { cwd } from "process";
|
|
2
3
|
import { createProgramFromConfig } from "tsc-prog";
|
|
3
4
|
import { DiagnosticCategory } from "typescript";
|
|
4
5
|
import { copyTypeFiles } from "./copyTypeFiles";
|
|
5
6
|
import { getCompilerOptions } from "./getCompilerOptions";
|
|
6
|
-
import chalk from "chalk";
|
|
7
7
|
const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts = true) => {
|
|
8
8
|
const pkg = process.env.INIT_CWD;
|
|
9
9
|
if (params?.verbose) {
|
|
@@ -1 +1 @@
|
|
|
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'\
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { 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, compilerOptionsParam?: 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 compilerOptions = {\n ...getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.map((value) => value.category === DiagnosticCategory.Error).length\n result.diagnostics.forEach((diag) => {\n switch (diag.category) {\n case DiagnosticCategory.Error:\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Warning:\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Suggestion:\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n })\n if (generateMts) {\n await copyTypeFiles(compilerOptions)\n }\n return diagResults\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,WAAW;AACpB,SAAS,+BAAwD;AACjE,SAA0B,0BAA0B;AAGpD,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAE5B,MAAM,yBAAyB,OAAO,QAAwB,sBAAwC,cAAc,SAA0B;AACnJ,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,kBAAkB;AAAA,IACtB,GAAG,mBAAmB;AAAA,MACpB,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,WAAW;AAAA,IACb,CAAC;AAAA,IACD,GAAI,wBAAwB,CAAC;AAAA,EAC/B;AAEA,QAAM,SAAS,wBAAwB;AAAA,IACrC,UAAU,OAAO,IAAI;AAAA,IACrB;AAAA,IACA,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB,kBAAkB;AAAA,IAC7E,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,QAAM,cAAc,OAAO,YAAY,IAAI,CAAC,UAAU,MAAM,aAAa,mBAAmB,KAAK,EAAE;AACnG,SAAO,YAAY,QAAQ,CAAC,SAAS;AACnC,YAAQ,KAAK,UAAU;AAAA,MACrB,KAAK,mBAAmB;AACtB,gBAAQ,MAAM,MAAM,IAAI,KAAK,WAAW,CAAC;AACzC,gBAAQ,MAAM,MAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,mBAAmB;AACtB,gBAAQ,MAAM,MAAM,OAAO,KAAK,WAAW,CAAC;AAC5C,gBAAQ,MAAM,MAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,mBAAmB;AACtB,gBAAQ,MAAM,MAAM,MAAM,KAAK,WAAW,CAAC;AAC3C,gBAAQ,MAAM,MAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC7C;AAAA,IACJ;AAAA,EACF,CAAC;AACD,MAAI,aAAa;AACf,UAAM,cAAc,eAAe;AAAA,EACrC;AACA,SAAO;AACT;","names":[]}
|
|
@@ -24,20 +24,20 @@ module.exports = __toCommonJS(tsup2_exports);
|
|
|
24
24
|
var import_tsup = require("tsup");
|
|
25
25
|
var import_lib = require("../../../lib");
|
|
26
26
|
var import_publint = require("../publint");
|
|
27
|
+
var import_inputs = require("./inputs");
|
|
27
28
|
var import_tscNoEmit = require("./tscNoEmit");
|
|
28
29
|
var import_tscTypes = require("./tscTypes");
|
|
29
|
-
var import_inputs = require("./inputs");
|
|
30
30
|
const compileFolder = async (options, _verbose) => {
|
|
31
31
|
const outDir = options?.outDir ?? "dist";
|
|
32
|
-
const entry = (
|
|
32
|
+
const entry = (0, import_inputs.getAllInputs2)().filter((entry2) => !entry2.includes(".spec.") && !entry2.includes(".story."));
|
|
33
33
|
const optionsResult = (0, import_tsup.defineConfig)({
|
|
34
34
|
bundle: false,
|
|
35
35
|
cjsInterop: true,
|
|
36
36
|
clean: true,
|
|
37
37
|
dts: false,
|
|
38
|
-
entry
|
|
38
|
+
entry,
|
|
39
39
|
format: ["cjs", "esm"],
|
|
40
|
-
loader: { ".
|
|
40
|
+
loader: { ".gif": "copy", ".jpg": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
41
41
|
outDir,
|
|
42
42
|
silent: true,
|
|
43
43
|
sourcemap: true,
|
|
@@ -60,7 +60,16 @@ const packageCompileTsup2 = async (params) => {
|
|
|
60
60
|
if (verbose) {
|
|
61
61
|
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
62
62
|
}
|
|
63
|
-
return (0, import_tscNoEmit.packageCompileTscNoEmit)({ verbose }) || await compileFolder({ ...compile?.tsup?.options ?? {}, outDir: "dist/node", platform: "node" }, verbose) || await compileFolder(
|
|
63
|
+
return (0, import_tscNoEmit.packageCompileTscNoEmit)({ verbose }) || await compileFolder({ ...compile?.tsup?.options ?? {}, outDir: "dist/node", platform: "node" }, verbose) || await compileFolder(
|
|
64
|
+
{
|
|
65
|
+
...compile?.tsup?.options ?? {},
|
|
66
|
+
format: ["esm"],
|
|
67
|
+
outDir: "dist/browser",
|
|
68
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".js" } : { js: ".cjs" },
|
|
69
|
+
platform: "browser"
|
|
70
|
+
},
|
|
71
|
+
verbose
|
|
72
|
+
) || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }, { outDir: "dist/node" }) || await (0, import_tscTypes.packageCompileTscTypes)({ verbose }, { outDir: "dist/browser" }) || (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
64
73
|
};
|
|
65
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
75
|
0 && (module.exports = {
|
|
@@ -1 +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 {
|
|
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 { getAllInputs, getAllInputs2 } from './inputs'\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 outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2().filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n loader: { '.gif': 'copy', '.jpg': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\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 ?? {}), outDir: 'dist/node', platform: 'node' }, verbose)) ||\n (await compileFolder(\n {\n ...(compile?.tsup?.options ?? {}),\n format: ['esm'],\n outDir: 'dist/browser',\n outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),\n platform: 'browser',\n },\n verbose,\n )) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/node' })) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/browser' })) ||\n (publint ? await packagePublint() : 0)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAE7C,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAA4C;AAC5C,uBAAwC;AACxC,sBAAuC;AAYvC,MAAM,gBAAgB,OAAO,SAAmB,aAAuB;AACrE,QAAM,SAAS,SAAS,UAAU;AAClC,QAAM,YAAQ,6BAAc,EAAE,OAAO,CAACA,WAAU,CAACA,OAAM,SAAS,QAAQ,KAAK,CAACA,OAAM,SAAS,SAAS,CAAC;AACvG,QAAM,oBAAgB,0BAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,SAAS,OAAO;AAAA,IAC1F;AAAA,IACA,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,OAAOC,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,EAAE,GAAI,SAAS,MAAM,WAAW,CAAC,GAAI,QAAQ,aAAa,UAAU,OAAO,GAAG,OAAO,KACzG,MAAM;AAAA,IACL;AAAA,MACE,GAAI,SAAS,MAAM,WAAW,CAAC;AAAA,MAC/B,QAAQ,CAAC,KAAK;AAAA,MACd,QAAQ;AAAA,MACR,cAAc,CAAC,EAAE,OAAO,MAAO,WAAW,QAAQ,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,OAAO;AAAA,MAC/E,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,EACF,KACC,UAAM,wCAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,KACjE,UAAM,wCAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,eAAe,CAAC,MACpE,UAAU,UAAM,+BAAe,IAAI;AAExC;","names":["entry","options"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { build, defineConfig } from "tsup";
|
|
2
2
|
import { loadConfig } from "../../../lib";
|
|
3
3
|
import { packagePublint } from "../publint";
|
|
4
|
+
import { getAllInputs2 } from "./inputs";
|
|
4
5
|
import { packageCompileTscNoEmit } from "./tscNoEmit";
|
|
5
6
|
import { packageCompileTscTypes } from "./tscTypes";
|
|
6
|
-
import { getAllInputs } from "./inputs";
|
|
7
7
|
const compileFolder = async (options, _verbose) => {
|
|
8
8
|
const outDir = options?.outDir ?? "dist";
|
|
9
|
-
const entry = (
|
|
9
|
+
const entry = getAllInputs2().filter((entry2) => !entry2.includes(".spec.") && !entry2.includes(".story."));
|
|
10
10
|
const optionsResult = defineConfig({
|
|
11
11
|
bundle: false,
|
|
12
12
|
cjsInterop: true,
|
|
13
13
|
clean: true,
|
|
14
14
|
dts: false,
|
|
15
|
-
entry
|
|
15
|
+
entry,
|
|
16
16
|
format: ["cjs", "esm"],
|
|
17
|
-
loader: { ".
|
|
17
|
+
loader: { ".gif": "copy", ".jpg": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
18
18
|
outDir,
|
|
19
19
|
silent: true,
|
|
20
20
|
sourcemap: true,
|
|
@@ -37,7 +37,16 @@ const packageCompileTsup2 = async (params) => {
|
|
|
37
37
|
if (verbose) {
|
|
38
38
|
console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`);
|
|
39
39
|
}
|
|
40
|
-
return packageCompileTscNoEmit({ verbose }) || await compileFolder({ ...compile?.tsup?.options ?? {}, outDir: "dist/node", platform: "node" }, verbose) || await compileFolder(
|
|
40
|
+
return packageCompileTscNoEmit({ verbose }) || await compileFolder({ ...compile?.tsup?.options ?? {}, outDir: "dist/node", platform: "node" }, verbose) || await compileFolder(
|
|
41
|
+
{
|
|
42
|
+
...compile?.tsup?.options ?? {},
|
|
43
|
+
format: ["esm"],
|
|
44
|
+
outDir: "dist/browser",
|
|
45
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".js" } : { js: ".cjs" },
|
|
46
|
+
platform: "browser"
|
|
47
|
+
},
|
|
48
|
+
verbose
|
|
49
|
+
) || await packageCompileTscTypes({ verbose }, { outDir: "dist/node" }) || await packageCompileTscTypes({ verbose }, { outDir: "dist/browser" }) || (publint ? await packagePublint() : 0);
|
|
41
50
|
};
|
|
42
51
|
export {
|
|
43
52
|
packageCompileTsup2
|
|
@@ -1 +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 {
|
|
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 { getAllInputs, getAllInputs2 } from './inputs'\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 outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2().filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: false,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n loader: { '.gif': 'copy', '.jpg': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\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 ?? {}), outDir: 'dist/node', platform: 'node' }, verbose)) ||\n (await compileFolder(\n {\n ...(compile?.tsup?.options ?? {}),\n format: ['esm'],\n outDir: 'dist/browser',\n outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),\n platform: 'browser',\n },\n verbose,\n )) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/node' })) ||\n (await packageCompileTscTypes({ verbose }, { outDir: 'dist/browser' })) ||\n (publint ? await packagePublint() : 0)\n )\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAuB,qBAAqB;AAC5C,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAYvC,MAAM,gBAAgB,OAAO,SAAmB,aAAuB;AACrE,QAAM,SAAS,SAAS,UAAU;AAClC,QAAM,QAAQ,cAAc,EAAE,OAAO,CAACA,WAAU,CAACA,OAAM,SAAS,QAAQ,KAAK,CAACA,OAAM,SAAS,SAAS,CAAC;AACvG,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,SAAS,OAAO;AAAA,IAC1F;AAAA,IACA,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,OAAOC,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,EAAE,GAAI,SAAS,MAAM,WAAW,CAAC,GAAI,QAAQ,aAAa,UAAU,OAAO,GAAG,OAAO,KACzG,MAAM;AAAA,IACL;AAAA,MACE,GAAI,SAAS,MAAM,WAAW,CAAC;AAAA,MAC/B,QAAQ,CAAC,KAAK;AAAA,MACd,QAAQ;AAAA,MACR,cAAc,CAAC,EAAE,OAAO,MAAO,WAAW,QAAQ,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,OAAO;AAAA,MAC/E,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,EACF,KACC,MAAM,uBAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,KACjE,MAAM,uBAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,eAAe,CAAC,MACpE,UAAU,MAAM,eAAe,IAAI;AAExC;","names":["entry","options"]}
|
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.60",
|
|
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.60",
|
|
114
|
+
"@xylabs/tsconfig": "^3.0.60",
|
|
115
115
|
"publint": "^0.2.2",
|
|
116
116
|
"typescript": "^5.2.2"
|
|
117
117
|
},
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"package-clean": "echo Not cleaning..."
|
|
170
170
|
},
|
|
171
171
|
"sideEffects": false,
|
|
172
|
-
"version": "3.0.
|
|
172
|
+
"version": "3.0.60"
|
|
173
173
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { readdir } from 'fs/promises'
|
|
2
|
+
import { glob } from 'glob'
|
|
2
3
|
|
|
3
4
|
export const getInputs = async (subDir?: string) => {
|
|
4
5
|
return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))
|
|
5
|
-
.filter(
|
|
6
|
+
.filter(
|
|
7
|
+
(file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),
|
|
8
|
+
)
|
|
6
9
|
.map((file) => (subDir ? `${subDir}/${file}` : file))
|
|
7
10
|
}
|
|
8
11
|
|
|
@@ -31,3 +34,9 @@ export const getAllInputs = async (depth = 100) => {
|
|
|
31
34
|
const dirs = await getInputDirs(depth)
|
|
32
35
|
return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()
|
|
33
36
|
}
|
|
37
|
+
|
|
38
|
+
export const getAllInputs2 = () => {
|
|
39
|
+
const globItems = glob.sync('src/**/*.*', { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'] })
|
|
40
|
+
console.log(JSON.stringify(globItems, null, 2))
|
|
41
|
+
return globItems
|
|
42
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
1
2
|
import { cwd } from 'process'
|
|
2
3
|
import { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'
|
|
3
4
|
import { CompilerOptions, DiagnosticCategory } from 'typescript'
|
|
@@ -5,7 +6,6 @@ import { CompilerOptions, DiagnosticCategory } from 'typescript'
|
|
|
5
6
|
import { CompileParams } from './CompileParams'
|
|
6
7
|
import { copyTypeFiles } from './copyTypeFiles'
|
|
7
8
|
import { getCompilerOptions } from './getCompilerOptions'
|
|
8
|
-
import chalk from 'chalk'
|
|
9
9
|
|
|
10
10
|
export const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {
|
|
11
11
|
const pkg = process.env.INIT_CWD
|
|
@@ -14,16 +14,18 @@ export const packageCompileTscTypes = async (params?: CompileParams, compilerOpt
|
|
|
14
14
|
console.log(`Compiling types with TSC [${pkg}]`)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const compilerOptions = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const compilerOptions = {
|
|
18
|
+
...getCompilerOptions({
|
|
19
|
+
declaration: true,
|
|
20
|
+
declarationMap: true,
|
|
21
|
+
emitDeclarationOnly: true,
|
|
22
|
+
esModuleInterop: true,
|
|
23
|
+
outDir: 'dist',
|
|
24
|
+
skipLibCheck: true,
|
|
25
|
+
sourceMap: true,
|
|
26
|
+
}),
|
|
27
|
+
...(compilerOptionsParam ?? {}),
|
|
28
|
+
} as TsConfigCompilerOptions
|
|
27
29
|
|
|
28
30
|
const result = createProgramFromConfig({
|
|
29
31
|
basePath: pkg ?? cwd(),
|
|
@@ -3,9 +3,9 @@ import { build, defineConfig, Options } from 'tsup'
|
|
|
3
3
|
import { loadConfig } from '../../../lib'
|
|
4
4
|
import { packagePublint } from '../publint'
|
|
5
5
|
import { CompileParams } from './CompileParams'
|
|
6
|
+
import { getAllInputs, getAllInputs2 } from './inputs'
|
|
6
7
|
import { packageCompileTscNoEmit } from './tscNoEmit'
|
|
7
8
|
import { packageCompileTscTypes } from './tscTypes'
|
|
8
|
-
import { getAllInputs } from './inputs'
|
|
9
9
|
|
|
10
10
|
export type PackageCompileTsup2Params = Partial<
|
|
11
11
|
CompileParams & {
|
|
@@ -19,15 +19,15 @@ export type PackageCompileTsup2Params = Partial<
|
|
|
19
19
|
|
|
20
20
|
const compileFolder = async (options?: Options, _verbose?: boolean) => {
|
|
21
21
|
const outDir = options?.outDir ?? 'dist'
|
|
22
|
-
const entry = (
|
|
22
|
+
const entry = getAllInputs2().filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))
|
|
23
23
|
const optionsResult = defineConfig({
|
|
24
24
|
bundle: false,
|
|
25
25
|
cjsInterop: true,
|
|
26
26
|
clean: true,
|
|
27
27
|
dts: false,
|
|
28
|
-
entry
|
|
28
|
+
entry,
|
|
29
29
|
format: ['cjs', 'esm'],
|
|
30
|
-
loader: {'.
|
|
30
|
+
loader: { '.gif': 'copy', '.jpg': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
|
|
31
31
|
outDir,
|
|
32
32
|
silent: true,
|
|
33
33
|
sourcemap: true,
|
|
@@ -59,10 +59,19 @@ export const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) =>
|
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
packageCompileTscNoEmit({ verbose }) ||
|
|
62
|
-
(await compileFolder({ ...(compile?.tsup?.options ?? {}), outDir: 'dist/node', platform: 'node' }, verbose))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
(await compileFolder({ ...(compile?.tsup?.options ?? {}), outDir: 'dist/node', platform: 'node' }, verbose)) ||
|
|
63
|
+
(await compileFolder(
|
|
64
|
+
{
|
|
65
|
+
...(compile?.tsup?.options ?? {}),
|
|
66
|
+
format: ['esm'],
|
|
67
|
+
outDir: 'dist/browser',
|
|
68
|
+
outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),
|
|
69
|
+
platform: 'browser',
|
|
70
|
+
},
|
|
71
|
+
verbose,
|
|
72
|
+
)) ||
|
|
73
|
+
(await packageCompileTscTypes({ verbose }, { outDir: 'dist/node' })) ||
|
|
74
|
+
(await packageCompileTscTypes({ verbose }, { outDir: 'dist/browser' })) ||
|
|
75
|
+
(publint ? await packagePublint() : 0)
|
|
67
76
|
)
|
|
68
77
|
}
|