@xylabs/ts-scripts-yarn3 3.15.16 → 4.0.0-rc.10
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.mjs +3 -2
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/index.mjs +96 -287
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +57 -259
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +57 -259
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -36
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +54 -339
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +72 -277
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +58 -263
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/recompile.mjs +14 -1
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +59 -261
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +56 -341
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +59 -261
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +60 -265
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy-ts.mjs +17 -3
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.mjs +17 -3
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +106 -297
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +17 -3
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +17 -3
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +17 -3
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/package.json +10 -20
- package/src/actions/compile.ts +2 -2
- package/src/actions/package/compile/XyConfig.ts +2 -2
- package/src/actions/package/compile/packageCompileTsc.ts +1 -1
- package/src/actions/package/compile/packageCompileTscTypes.ts +3 -8
- package/src/actions/package/compile/packageCompileTsup.ts +54 -130
- package/src/actions/package/recompile.ts +1 -1
- package/src/actions/recompile.ts +2 -1
- package/tsup.config.ts +1 -1
- package/dist/actions/build.cjs +0 -208
- package/dist/actions/build.cjs.map +0 -1
- package/dist/actions/clean-docs.cjs +0 -74
- package/dist/actions/clean-docs.cjs.map +0 -1
- package/dist/actions/clean-eslint.cjs +0 -53
- package/dist/actions/clean-eslint.cjs.map +0 -1
- package/dist/actions/clean-jest.cjs +0 -147
- package/dist/actions/clean-jest.cjs.map +0 -1
- package/dist/actions/clean.cjs +0 -192
- package/dist/actions/clean.cjs.map +0 -1
- package/dist/actions/compile.cjs +0 -217
- package/dist/actions/compile.cjs.map +0 -1
- package/dist/actions/copy-assets.cjs +0 -121
- package/dist/actions/copy-assets.cjs.map +0 -1
- package/dist/actions/cycle.cjs +0 -156
- package/dist/actions/cycle.cjs.map +0 -1
- package/dist/actions/dead.cjs +0 -148
- package/dist/actions/dead.cjs.map +0 -1
- package/dist/actions/deploy-major.cjs +0 -160
- package/dist/actions/deploy-major.cjs.map +0 -1
- package/dist/actions/deploy-minor.cjs +0 -160
- package/dist/actions/deploy-minor.cjs.map +0 -1
- package/dist/actions/deploy-next.cjs +0 -160
- package/dist/actions/deploy-next.cjs.map +0 -1
- package/dist/actions/deploy.cjs +0 -160
- package/dist/actions/deploy.cjs.map +0 -1
- package/dist/actions/deps.cjs +0 -205
- package/dist/actions/deps.cjs.map +0 -1
- package/dist/actions/dupdeps.cjs +0 -226
- package/dist/actions/dupdeps.cjs.map +0 -1
- package/dist/actions/fix.cjs +0 -149
- package/dist/actions/fix.cjs.map +0 -1
- package/dist/actions/gen-docs.cjs +0 -186
- package/dist/actions/gen-docs.cjs.map +0 -1
- package/dist/actions/gitignore-gen.cjs +0 -138
- package/dist/actions/gitignore-gen.cjs.map +0 -1
- package/dist/actions/gitlint-fix.cjs +0 -69
- package/dist/actions/gitlint-fix.cjs.map +0 -1
- package/dist/actions/gitlint.cjs +0 -84
- package/dist/actions/gitlint.cjs.map +0 -1
- package/dist/actions/index.cjs +0 -2600
- package/dist/actions/index.cjs.map +0 -1
- package/dist/actions/license.cjs +0 -133
- package/dist/actions/license.cjs.map +0 -1
- package/dist/actions/lint-clean.cjs +0 -227
- package/dist/actions/lint-clean.cjs.map +0 -1
- package/dist/actions/lint-profile.cjs +0 -153
- package/dist/actions/lint-profile.cjs.map +0 -1
- package/dist/actions/lint.cjs +0 -217
- package/dist/actions/lint.cjs.map +0 -1
- package/dist/actions/npmignore-gen.cjs +0 -138
- package/dist/actions/npmignore-gen.cjs.map +0 -1
- package/dist/actions/package/clean-outputs.cjs +0 -56
- package/dist/actions/package/clean-outputs.cjs.map +0 -1
- package/dist/actions/package/clean-typescript.cjs +0 -56
- package/dist/actions/package/clean-typescript.cjs.map +0 -1
- package/dist/actions/package/clean.cjs +0 -83
- package/dist/actions/package/clean.cjs.map +0 -1
- package/dist/actions/package/compile/XyConfig.cjs +0 -19
- package/dist/actions/package/compile/XyConfig.cjs.map +0 -1
- package/dist/actions/package/compile/buildEntries.cjs +0 -68
- package/dist/actions/package/compile/buildEntries.cjs.map +0 -1
- package/dist/actions/package/compile/compile.cjs +0 -565
- package/dist/actions/package/compile/compile.cjs.map +0 -1
- package/dist/actions/package/compile/copyTypeFiles.cjs +0 -60
- package/dist/actions/package/compile/copyTypeFiles.cjs.map +0 -1
- package/dist/actions/package/compile/getCompilerOptions.cjs +0 -67
- package/dist/actions/package/compile/getCompilerOptions.cjs.map +0 -1
- package/dist/actions/package/compile/index.cjs +0 -571
- package/dist/actions/package/compile/index.cjs.map +0 -1
- package/dist/actions/package/compile/inputs.cjs +0 -79
- package/dist/actions/package/compile/inputs.cjs.map +0 -1
- package/dist/actions/package/compile/packageCompileTsc.cjs +0 -164
- package/dist/actions/package/compile/packageCompileTsc.cjs.map +0 -1
- package/dist/actions/package/compile/packageCompileTscTypes.cjs +0 -199
- package/dist/actions/package/compile/packageCompileTscTypes.cjs.map +0 -1
- package/dist/actions/package/compile/packageCompileTsup.cjs +0 -521
- package/dist/actions/package/compile/packageCompileTsup.cjs.map +0 -1
- package/dist/actions/package/copy-assets.cjs +0 -88
- package/dist/actions/package/copy-assets.cjs.map +0 -1
- package/dist/actions/package/deps.cjs +0 -214
- package/dist/actions/package/deps.cjs.map +0 -1
- package/dist/actions/package/gen-docs.cjs +0 -148
- package/dist/actions/package/gen-docs.cjs.map +0 -1
- package/dist/actions/package/index.cjs +0 -968
- package/dist/actions/package/index.cjs.map +0 -1
- package/dist/actions/package/publint.cjs +0 -80
- package/dist/actions/package/publint.cjs.map +0 -1
- package/dist/actions/package/recompile.cjs +0 -617
- package/dist/actions/package/recompile.cjs.map +0 -1
- package/dist/actions/publint.cjs +0 -237
- package/dist/actions/publint.cjs.map +0 -1
- package/dist/actions/rebuild.cjs +0 -148
- package/dist/actions/rebuild.cjs.map +0 -1
- package/dist/actions/recompile.cjs +0 -232
- package/dist/actions/recompile.cjs.map +0 -1
- package/dist/actions/reinstall.cjs +0 -183
- package/dist/actions/reinstall.cjs.map +0 -1
- package/dist/actions/relint.cjs +0 -185
- package/dist/actions/relint.cjs.map +0 -1
- package/dist/actions/retest.cjs +0 -154
- package/dist/actions/retest.cjs.map +0 -1
- package/dist/actions/sonar.cjs +0 -149
- package/dist/actions/sonar.cjs.map +0 -1
- package/dist/actions/statics.cjs +0 -234
- package/dist/actions/statics.cjs.map +0 -1
- package/dist/actions/test.cjs +0 -147
- package/dist/actions/test.cjs.map +0 -1
- package/dist/actions/up.cjs +0 -144
- package/dist/actions/up.cjs.map +0 -1
- package/dist/actions/updo.cjs +0 -152
- package/dist/actions/updo.cjs.map +0 -1
- package/dist/actions/upplug.cjs +0 -172
- package/dist/actions/upplug.cjs.map +0 -1
- package/dist/actions/upyarn.cjs +0 -148
- package/dist/actions/upyarn.cjs.map +0 -1
- package/dist/actions/yarn3only.cjs +0 -106
- package/dist/actions/yarn3only.cjs.map +0 -1
- package/dist/bin/build.cjs +0 -39
- package/dist/bin/build.cjs.map +0 -1
- package/dist/bin/clean.cjs +0 -39
- package/dist/bin/clean.cjs.map +0 -1
- package/dist/bin/compile-only.cjs +0 -39
- package/dist/bin/compile-only.cjs.map +0 -1
- package/dist/bin/compile.cjs +0 -39
- package/dist/bin/compile.cjs.map +0 -1
- package/dist/bin/cycle.cjs +0 -39
- package/dist/bin/cycle.cjs.map +0 -1
- package/dist/bin/dead.cjs +0 -39
- package/dist/bin/dead.cjs.map +0 -1
- package/dist/bin/deploy-major.cjs +0 -39
- package/dist/bin/deploy-major.cjs.map +0 -1
- package/dist/bin/deploy-minor.cjs +0 -39
- package/dist/bin/deploy-minor.cjs.map +0 -1
- package/dist/bin/deploy-next.cjs +0 -39
- package/dist/bin/deploy-next.cjs.map +0 -1
- package/dist/bin/deploy.cjs +0 -39
- package/dist/bin/deploy.cjs.map +0 -1
- package/dist/bin/deps.cjs +0 -39
- package/dist/bin/deps.cjs.map +0 -1
- package/dist/bin/fix.cjs +0 -39
- package/dist/bin/fix.cjs.map +0 -1
- package/dist/bin/gen-docs.cjs +0 -39
- package/dist/bin/gen-docs.cjs.map +0 -1
- package/dist/bin/gitlint-fix.cjs +0 -39
- package/dist/bin/gitlint-fix.cjs.map +0 -1
- package/dist/bin/gitlint.cjs +0 -39
- package/dist/bin/gitlint.cjs.map +0 -1
- package/dist/bin/license.cjs +0 -39
- package/dist/bin/license.cjs.map +0 -1
- package/dist/bin/lint-clean.cjs +0 -39
- package/dist/bin/lint-clean.cjs.map +0 -1
- package/dist/bin/lint-fast.cjs +0 -39
- package/dist/bin/lint-fast.cjs.map +0 -1
- package/dist/bin/lint-profile.cjs +0 -39
- package/dist/bin/lint-profile.cjs.map +0 -1
- package/dist/bin/lint.cjs +0 -39
- package/dist/bin/lint.cjs.map +0 -1
- package/dist/bin/package/clean-outputs.cjs +0 -51
- package/dist/bin/package/clean-outputs.cjs.map +0 -1
- package/dist/bin/package/clean-typescript.cjs +0 -51
- package/dist/bin/package/clean-typescript.cjs.map +0 -1
- package/dist/bin/package/clean.cjs +0 -76
- package/dist/bin/package/clean.cjs.map +0 -1
- package/dist/bin/package/compile-only.cjs +0 -564
- package/dist/bin/package/compile-only.cjs.map +0 -1
- package/dist/bin/package/compile-tsup.cjs +0 -519
- package/dist/bin/package/compile-tsup.cjs.map +0 -1
- package/dist/bin/package/compile.cjs +0 -567
- package/dist/bin/package/compile.cjs.map +0 -1
- package/dist/bin/package/copy-assets-cjs.cjs +0 -86
- package/dist/bin/package/copy-assets-cjs.cjs.map +0 -1
- package/dist/bin/package/copy-assets-esm.cjs +0 -86
- package/dist/bin/package/copy-assets-esm.cjs.map +0 -1
- package/dist/bin/package/deps.cjs +0 -208
- package/dist/bin/package/deps.cjs.map +0 -1
- package/dist/bin/package/gen-docs.cjs +0 -143
- package/dist/bin/package/gen-docs.cjs.map +0 -1
- package/dist/bin/package/publint.cjs +0 -77
- package/dist/bin/package/publint.cjs.map +0 -1
- package/dist/bin/package/recompile.cjs +0 -611
- package/dist/bin/package/recompile.cjs.map +0 -1
- package/dist/bin/publint.cjs +0 -39
- package/dist/bin/publint.cjs.map +0 -1
- package/dist/bin/rebuild.cjs +0 -39
- package/dist/bin/rebuild.cjs.map +0 -1
- package/dist/bin/recompile.cjs +0 -39
- package/dist/bin/recompile.cjs.map +0 -1
- package/dist/bin/reinstall.cjs +0 -39
- package/dist/bin/reinstall.cjs.map +0 -1
- package/dist/bin/relint.cjs +0 -39
- package/dist/bin/relint.cjs.map +0 -1
- package/dist/bin/sonar.cjs +0 -39
- package/dist/bin/sonar.cjs.map +0 -1
- package/dist/bin/test.cjs +0 -39
- package/dist/bin/test.cjs.map +0 -1
- package/dist/bin/up.cjs +0 -39
- package/dist/bin/up.cjs.map +0 -1
- package/dist/bin/updo.cjs +0 -39
- package/dist/bin/updo.cjs.map +0 -1
- package/dist/bin/upplug.cjs +0 -39
- package/dist/bin/upplug.cjs.map +0 -1
- package/dist/bin/upyarn.cjs +0 -39
- package/dist/bin/upyarn.cjs.map +0 -1
- package/dist/bin/xy-ts.cjs +0 -1890
- package/dist/bin/xy-ts.cjs.map +0 -1
- package/dist/bin/xy.cjs +0 -1890
- package/dist/bin/xy.cjs.map +0 -1
- package/dist/bin/yarn3only.cjs +0 -39
- package/dist/bin/yarn3only.cjs.map +0 -1
- package/dist/index.cjs +0 -3129
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -359
- package/dist/lib/checkResult.cjs +0 -52
- package/dist/lib/checkResult.cjs.map +0 -1
- package/dist/lib/createBuildConfig.cjs +0 -93
- package/dist/lib/createBuildConfig.cjs.map +0 -1
- package/dist/lib/defaultBuildConfig.cjs +0 -52
- package/dist/lib/defaultBuildConfig.cjs.map +0 -1
- package/dist/lib/dependencies/DuplicateDetector.cjs +0 -124
- package/dist/lib/dependencies/DuplicateDetector.cjs.map +0 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.cjs +0 -207
- package/dist/lib/dependencies/detectDuplicateDependencies.cjs.map +0 -1
- package/dist/lib/dependencies/index.cjs +0 -211
- package/dist/lib/dependencies/index.cjs.map +0 -1
- package/dist/lib/file/ReadFileSyncOptions.cjs +0 -33
- package/dist/lib/file/ReadFileSyncOptions.cjs.map +0 -1
- package/dist/lib/file/constants.cjs +0 -34
- package/dist/lib/file/constants.cjs.map +0 -1
- package/dist/lib/file/fileLines.cjs +0 -58
- package/dist/lib/file/fileLines.cjs.map +0 -1
- package/dist/lib/file/index.cjs +0 -74
- package/dist/lib/file/index.cjs.map +0 -1
- package/dist/lib/file/tryReadFileSync.cjs +0 -42
- package/dist/lib/file/tryReadFileSync.cjs.map +0 -1
- package/dist/lib/generateIgnoreFiles.cjs +0 -132
- package/dist/lib/generateIgnoreFiles.cjs.map +0 -1
- package/dist/lib/index.cjs +0 -614
- package/dist/lib/index.cjs.map +0 -1
- package/dist/lib/jsonFormatters.cjs +0 -37
- package/dist/lib/jsonFormatters.cjs.map +0 -1
- package/dist/lib/loadConfig.cjs +0 -59
- package/dist/lib/loadConfig.cjs.map +0 -1
- package/dist/lib/parsedPackageJSON.cjs +0 -37
- package/dist/lib/parsedPackageJSON.cjs.map +0 -1
- package/dist/lib/processEx.cjs +0 -72
- package/dist/lib/processEx.cjs.map +0 -1
- package/dist/lib/runSteps.cjs +0 -134
- package/dist/lib/runSteps.cjs.map +0 -1
- package/dist/lib/runStepsAsync.cjs +0 -147
- package/dist/lib/runStepsAsync.cjs.map +0 -1
- package/dist/lib/runXy.cjs +0 -150
- package/dist/lib/runXy.cjs.map +0 -1
- package/dist/lib/runXyWithWarning.cjs +0 -49
- package/dist/lib/runXyWithWarning.cjs.map +0 -1
- package/dist/lib/safeExit.cjs +0 -100
- package/dist/lib/safeExit.cjs.map +0 -1
- package/dist/lib/string/empty.cjs +0 -35
- package/dist/lib/string/empty.cjs.map +0 -1
- package/dist/lib/string/index.cjs +0 -45
- package/dist/lib/string/index.cjs.map +0 -1
- package/dist/lib/string/union.cjs +0 -35
- package/dist/lib/string/union.cjs.map +0 -1
- package/dist/lib/withErrnoException.cjs +0 -41
- package/dist/lib/withErrnoException.cjs.map +0 -1
- package/dist/lib/withError.cjs +0 -34
- package/dist/lib/withError.cjs.map +0 -1
- package/dist/lib/yarn/index.cjs +0 -93
- package/dist/lib/yarn/index.cjs.map +0 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.cjs +0 -52
- package/dist/lib/yarn/isYarnVersionOrGreater.cjs.map +0 -1
- package/dist/lib/yarn/workspace/Workspace.cjs +0 -19
- package/dist/lib/yarn/workspace/Workspace.cjs.map +0 -1
- package/dist/lib/yarn/workspace/index.cjs +0 -60
- package/dist/lib/yarn/workspace/index.cjs.map +0 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.cjs +0 -58
- package/dist/lib/yarn/workspace/yarnWorkspace.cjs.map +0 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.cjs +0 -49
- package/dist/lib/yarn/workspace/yarnWorkspaces.cjs.map +0 -1
- package/dist/lib/yarn/yarnInitCwd.cjs +0 -35
- package/dist/lib/yarn/yarnInitCwd.cjs.map +0 -1
- package/dist/loadPackageConfig.cjs +0 -39
- package/dist/loadPackageConfig.cjs.map +0 -1
- package/dist/types.d.cjs +0 -2
- package/dist/types.d.cjs.map +0 -1
- package/dist/xy/index.cjs +0 -1909
- package/dist/xy/index.cjs.map +0 -1
- package/dist/xy/param.cjs +0 -36
- package/dist/xy/param.cjs.map +0 -1
- package/dist/xy/xy.cjs +0 -1895
- package/dist/xy/xy.cjs.map +0 -1
- package/dist/xy/xyBuildCommands.cjs +0 -595
- package/dist/xy/xyBuildCommands.cjs.map +0 -1
- package/dist/xy/xyCommonCommands.cjs +0 -723
- package/dist/xy/xyCommonCommands.cjs.map +0 -1
- package/dist/xy/xyDeployCommands.cjs +0 -263
- package/dist/xy/xyDeployCommands.cjs.map +0 -1
- package/dist/xy/xyInstallCommands.cjs +0 -508
- package/dist/xy/xyInstallCommands.cjs.map +0 -1
- package/dist/xy/xyLintCommands.cjs +0 -466
- package/dist/xy/xyLintCommands.cjs.map +0 -1
- package/dist/xy/xyParseOptions.cjs +0 -84
- package/dist/xy/xyParseOptions.cjs.map +0 -1
|
@@ -43,37 +43,6 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
43
43
|
}
|
|
44
44
|
}, "buildEntries");
|
|
45
45
|
|
|
46
|
-
// src/actions/package/compile/copyTypeFiles.ts
|
|
47
|
-
import { copyFile, readdir } from "node:fs/promises";
|
|
48
|
-
import { Mutex } from "async-mutex";
|
|
49
|
-
var copyFileMutex = new Mutex();
|
|
50
|
-
var getDistTypeFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
51
|
-
const outDir = compilerOptions.outDir ?? "dist";
|
|
52
|
-
return (await readdir(outDir, {
|
|
53
|
-
recursive: true
|
|
54
|
-
})).filter((file) => file.endsWith("d.ts")).map((file) => `${outDir}/${file}`);
|
|
55
|
-
}, "getDistTypeFiles");
|
|
56
|
-
var getDistTypeMapFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
57
|
-
const outDir = compilerOptions.outDir ?? "dist";
|
|
58
|
-
return (await readdir(outDir, {
|
|
59
|
-
recursive: true
|
|
60
|
-
})).filter((file) => file.endsWith("d.ts.map")).map((file) => `${outDir}/${file}`);
|
|
61
|
-
}, "getDistTypeMapFiles");
|
|
62
|
-
var copyTypeFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
63
|
-
await copyFileMutex.runExclusive(async () => {
|
|
64
|
-
const distTypeFiles = await getDistTypeFiles(compilerOptions);
|
|
65
|
-
await Promise.all(distTypeFiles.map(async (file) => {
|
|
66
|
-
await copyFile(file, file.replace("d.ts", "d.mts"));
|
|
67
|
-
await copyFile(file, file.replace("d.ts", "d.cts"));
|
|
68
|
-
}));
|
|
69
|
-
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
70
|
-
await Promise.all(distTypeMapFiles.map(async (file) => {
|
|
71
|
-
await copyFile(file, file.replace("d.ts.map", "d.mts.map"));
|
|
72
|
-
await copyFile(file, file.replace("d.ts.map", "d.cts.map"));
|
|
73
|
-
}));
|
|
74
|
-
});
|
|
75
|
-
}, "copyTypeFiles");
|
|
76
|
-
|
|
77
46
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
78
47
|
import { createRequire } from "node:module";
|
|
79
48
|
import merge from "lodash/merge.js";
|
|
@@ -100,13 +69,13 @@ var getCompilerOptions = /* @__PURE__ */ __name((options, tsconfig = "tsconfig.j
|
|
|
100
69
|
}, "getCompilerOptions");
|
|
101
70
|
|
|
102
71
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
103
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name(
|
|
72
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
104
73
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
105
74
|
if (verbose) {
|
|
106
75
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
107
76
|
}
|
|
108
77
|
const compilerOptions = {
|
|
109
|
-
...
|
|
78
|
+
...getCompilerOptions({
|
|
110
79
|
declaration: true,
|
|
111
80
|
emitDeclarationOnly: true,
|
|
112
81
|
outDir: "dist",
|
|
@@ -153,9 +122,6 @@ var packageCompileTscTypes = /* @__PURE__ */ __name(async (folder = "src", { ver
|
|
|
153
122
|
}
|
|
154
123
|
}
|
|
155
124
|
}
|
|
156
|
-
if (generateMts) {
|
|
157
|
-
await copyTypeFiles(compilerOptions);
|
|
158
|
-
}
|
|
159
125
|
return diagResults;
|
|
160
126
|
}, "packageCompileTscTypes");
|
|
161
127
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/copyTypeFiles.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { copyTypeFiles } from './copyTypeFiles.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = async (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n generateMts = true,\n): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(await getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n if (generateMts) {\n await copyTypeFiles(compilerOptions)\n }\n return diagResults\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n","import { copyFile, readdir } from 'node:fs/promises'\n\nimport { Mutex } from 'async-mutex'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n // using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n // hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAW;AAEpB,OAAOC,WAAW;AAClB,SAASC,+BAAwD;AACjE,SAA0BC,0BAA0B;;;ACFpD,SAASC,YAAY;AAoCd,IAAMC,gBAAgB,wBAACC,WAAAA;AAE5B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,QAAQ;MAAC;MAAe;MAAkB;;IAAiBC,OAAO;EAAK,CAAA;AAChH,GAH6B;;;ACnCtB,IAAMC,eAAe,wBAACC,QAAgBC,WAAuBC,UAAU,UAAK;AACjF,UAAQD,WAAAA;IACN,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cnC,eAAAA;EACtB;AACA,SAAOgB;AACT,GA9DsC;","names":["cwd","chalk","createProgramFromConfig","DiagnosticCategory","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","copyFile","readdir","Mutex","copyFileMutex","Mutex","getDistTypeFiles","compilerOptions","outDir","readdir","recursive","filter","file","endsWith","map","getDistTypeMapFiles","copyTypeFiles","runExclusive","distTypeFiles","Promise","all","copyFile","replace","distTypeMapFiles","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTscTypes","folder","verbose","compilerOptionsParam","generateMts","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","copyTypeFiles"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAW;AAEp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gBAAQyB,MAAMC,MAAMI,KAAKT,KAAKU,MAAMC,QAAAA,CAAAA;AACpC;MACF;MACA,KAAKT,mBAAmBY,YAAY;AAClCnC,gBAAQyB,MAAMC,MAAMU,MAAMf,KAAKO,WAAW,CAAA;AAC1C5B,gBAAQyB,MAAMC,MAAMG,KAAKlC,GAAAA,CAAAA;AACzBK,gBAAQyB,MAAMC,MAAMI,KAAKT,KAAKU,MAAMC,QAAAA,CAAAA;AACpC;MACF;IACF;EACF;AACA,SAAOd;AACT,GA1DsC;","names":["cwd","chalk","createProgramFromConfig","DiagnosticCategory","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTscTypes","folder","verbose","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white"]}
|
|
@@ -2,7 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
5
|
-
import merge2 from "lodash/merge.js";
|
|
6
5
|
import { build, defineConfig } from "tsup";
|
|
7
6
|
|
|
8
7
|
// src/actions/package/publint.ts
|
|
@@ -82,206 +81,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
82
81
|
}
|
|
83
82
|
}, "buildEntries");
|
|
84
83
|
|
|
85
|
-
// src/actions/package/compile/packageCompileTsc.ts
|
|
86
|
-
import { cwd } from "node:process";
|
|
87
|
-
import chalk2 from "chalk";
|
|
88
|
-
import { createProgramFromConfig } from "tsc-prog";
|
|
89
|
-
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getLineAndCharacterOfPosition, getPreEmitDiagnostics } from "typescript";
|
|
90
|
-
|
|
91
|
-
// src/actions/package/compile/getCompilerOptions.ts
|
|
92
|
-
import { createRequire } from "node:module";
|
|
93
|
-
import merge from "lodash/merge.js";
|
|
94
|
-
import { findConfigFile, readConfigFile, sys } from "typescript";
|
|
95
|
-
var getNested = /* @__PURE__ */ __name((config) => {
|
|
96
|
-
if (config.extends) {
|
|
97
|
-
const require2 = createRequire(import.meta.url);
|
|
98
|
-
const opts = require2(config.extends);
|
|
99
|
-
return {
|
|
100
|
-
...getNested(opts),
|
|
101
|
-
...config.compilerOptions
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return config.compilerOptions;
|
|
105
|
-
}, "getNested");
|
|
106
|
-
var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename) => {
|
|
107
|
-
const config = readConfigFile(filename, sys.readFile).config;
|
|
108
|
-
return getNested(config);
|
|
109
|
-
}, "getCompilerOptionsJSONFollowExtends");
|
|
110
|
-
var getCompilerOptions = /* @__PURE__ */ __name((options, tsconfig = "tsconfig.json") => {
|
|
111
|
-
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
112
|
-
const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
|
|
113
|
-
return merge({}, configFileCompilerOptions, options);
|
|
114
|
-
}, "getCompilerOptions");
|
|
115
|
-
|
|
116
|
-
// src/actions/package/compile/packageCompileTsc.ts
|
|
117
|
-
var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config, compilerOptionsParam) => {
|
|
118
|
-
const pkg = process.env.INIT_CWD ?? cwd();
|
|
119
|
-
const publint = config?.publint ?? true;
|
|
120
|
-
const verbose = config?.verbose ?? false;
|
|
121
|
-
const formatHost = {
|
|
122
|
-
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
123
|
-
getCurrentDirectory: /* @__PURE__ */ __name(() => pkg, "getCurrentDirectory"),
|
|
124
|
-
getNewLine: /* @__PURE__ */ __name(() => "\n", "getNewLine")
|
|
125
|
-
};
|
|
126
|
-
if (verbose) {
|
|
127
|
-
console.log(`Compiling with NoEmit TSC [${pkg}]`);
|
|
128
|
-
}
|
|
129
|
-
const compilerOptions = {
|
|
130
|
-
...await getCompilerOptions({
|
|
131
|
-
outDir: "dist",
|
|
132
|
-
removeComments: true,
|
|
133
|
-
rootDir: "src"
|
|
134
|
-
}),
|
|
135
|
-
...compilerOptionsParam,
|
|
136
|
-
...noEmit === void 0 ? {} : {
|
|
137
|
-
noEmit
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const program = createProgramFromConfig({
|
|
141
|
-
basePath: pkg ?? cwd(),
|
|
142
|
-
compilerOptions,
|
|
143
|
-
exclude: [
|
|
144
|
-
"dist",
|
|
145
|
-
"docs",
|
|
146
|
-
"**/*.spec.*",
|
|
147
|
-
"**/*.stories.*",
|
|
148
|
-
"src/**/spec/**/*"
|
|
149
|
-
],
|
|
150
|
-
include: [
|
|
151
|
-
"src"
|
|
152
|
-
]
|
|
153
|
-
});
|
|
154
|
-
const results = getPreEmitDiagnostics(program);
|
|
155
|
-
for (const diag of results) {
|
|
156
|
-
const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : {
|
|
157
|
-
character: 0,
|
|
158
|
-
line: 0
|
|
159
|
-
};
|
|
160
|
-
console.log(chalk2.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
|
|
161
|
-
console.log(formatDiagnosticsWithColorAndContext([
|
|
162
|
-
diag
|
|
163
|
-
], formatHost));
|
|
164
|
-
}
|
|
165
|
-
return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory.Error ? 1 : 0, 0) || (publint ? await packagePublint() : 0);
|
|
166
|
-
}, "packageCompileTsc");
|
|
167
|
-
|
|
168
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
169
|
-
import { cwd as cwd2 } from "node:process";
|
|
170
|
-
import chalk3 from "chalk";
|
|
171
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
172
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
173
|
-
|
|
174
|
-
// src/actions/package/compile/copyTypeFiles.ts
|
|
175
|
-
import { copyFile, readdir } from "node:fs/promises";
|
|
176
|
-
import { Mutex } from "async-mutex";
|
|
177
|
-
var copyFileMutex = new Mutex();
|
|
178
|
-
var getDistTypeFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
179
|
-
const outDir = compilerOptions.outDir ?? "dist";
|
|
180
|
-
return (await readdir(outDir, {
|
|
181
|
-
recursive: true
|
|
182
|
-
})).filter((file) => file.endsWith("d.ts")).map((file) => `${outDir}/${file}`);
|
|
183
|
-
}, "getDistTypeFiles");
|
|
184
|
-
var getDistTypeMapFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
185
|
-
const outDir = compilerOptions.outDir ?? "dist";
|
|
186
|
-
return (await readdir(outDir, {
|
|
187
|
-
recursive: true
|
|
188
|
-
})).filter((file) => file.endsWith("d.ts.map")).map((file) => `${outDir}/${file}`);
|
|
189
|
-
}, "getDistTypeMapFiles");
|
|
190
|
-
var copyTypeFiles = /* @__PURE__ */ __name(async (compilerOptions) => {
|
|
191
|
-
await copyFileMutex.runExclusive(async () => {
|
|
192
|
-
const distTypeFiles = await getDistTypeFiles(compilerOptions);
|
|
193
|
-
await Promise.all(distTypeFiles.map(async (file) => {
|
|
194
|
-
await copyFile(file, file.replace("d.ts", "d.mts"));
|
|
195
|
-
await copyFile(file, file.replace("d.ts", "d.cts"));
|
|
196
|
-
}));
|
|
197
|
-
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
198
|
-
await Promise.all(distTypeMapFiles.map(async (file) => {
|
|
199
|
-
await copyFile(file, file.replace("d.ts.map", "d.mts.map"));
|
|
200
|
-
await copyFile(file, file.replace("d.ts.map", "d.cts.map"));
|
|
201
|
-
}));
|
|
202
|
-
});
|
|
203
|
-
}, "copyTypeFiles");
|
|
204
|
-
|
|
205
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
206
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name(async (folder = "src", { verbose } = {}, compilerOptionsParam, generateMts = true) => {
|
|
207
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
208
|
-
if (verbose) {
|
|
209
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
210
|
-
}
|
|
211
|
-
const compilerOptions = {
|
|
212
|
-
...await getCompilerOptions({
|
|
213
|
-
declaration: true,
|
|
214
|
-
emitDeclarationOnly: true,
|
|
215
|
-
outDir: "dist",
|
|
216
|
-
removeComments: true,
|
|
217
|
-
skipDefaultLibCheck: true,
|
|
218
|
-
skipLibCheck: true,
|
|
219
|
-
sourceMap: true
|
|
220
|
-
}),
|
|
221
|
-
...compilerOptionsParam
|
|
222
|
-
};
|
|
223
|
-
const files = buildEntries(folder, "all");
|
|
224
|
-
const result = createProgramFromConfig2({
|
|
225
|
-
basePath: pkg ?? cwd2(),
|
|
226
|
-
compilerOptions,
|
|
227
|
-
exclude: [
|
|
228
|
-
"dist",
|
|
229
|
-
"docs",
|
|
230
|
-
"**/*.spec.*",
|
|
231
|
-
"**/*.stories.*",
|
|
232
|
-
"src/**/spec/**/*"
|
|
233
|
-
],
|
|
234
|
-
files
|
|
235
|
-
}).emit();
|
|
236
|
-
const diagResults = result.diagnostics.length;
|
|
237
|
-
for (const diag of result.diagnostics) {
|
|
238
|
-
switch (diag.category) {
|
|
239
|
-
case DiagnosticCategory2.Error: {
|
|
240
|
-
console.error(chalk3.red(diag.messageText));
|
|
241
|
-
console.error(chalk3.grey(pkg));
|
|
242
|
-
console.error(chalk3.blue(diag.file?.fileName));
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
case DiagnosticCategory2.Warning: {
|
|
246
|
-
console.error(chalk3.yellow(diag.messageText));
|
|
247
|
-
console.error(chalk3.grey(pkg));
|
|
248
|
-
console.error(chalk3.blue(diag.file?.fileName));
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
case DiagnosticCategory2.Suggestion: {
|
|
252
|
-
console.error(chalk3.white(diag.messageText));
|
|
253
|
-
console.error(chalk3.grey(pkg));
|
|
254
|
-
console.error(chalk3.blue(diag.file?.fileName));
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (generateMts) {
|
|
260
|
-
await copyTypeFiles(compilerOptions);
|
|
261
|
-
}
|
|
262
|
-
return diagResults;
|
|
263
|
-
}, "packageCompileTscTypes");
|
|
264
|
-
|
|
265
84
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
266
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
85
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
267
86
|
const outDir = options?.outDir ?? "dist";
|
|
268
87
|
const entry = buildEntries(folder, entryMode);
|
|
269
88
|
const optionsResult = defineConfig({
|
|
270
89
|
bundle: true,
|
|
271
90
|
cjsInterop: true,
|
|
272
91
|
clean: true,
|
|
273
|
-
dts:
|
|
92
|
+
dts: true,
|
|
274
93
|
entry,
|
|
275
94
|
format: [
|
|
276
|
-
"cjs",
|
|
277
95
|
"esm"
|
|
278
96
|
],
|
|
279
|
-
// minify: true,
|
|
280
97
|
outDir,
|
|
281
98
|
silent: true,
|
|
282
99
|
sourcemap: true,
|
|
283
100
|
splitting: false,
|
|
284
|
-
// terserOptions: { format: { comments: false } },
|
|
285
101
|
tsconfig: "tsconfig.json",
|
|
286
102
|
...options
|
|
287
103
|
});
|
|
@@ -296,11 +112,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
296
112
|
];
|
|
297
113
|
}))).flat();
|
|
298
114
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
299
|
-
await packageCompileTscTypes(folder, {
|
|
300
|
-
verbose
|
|
301
|
-
}, {
|
|
302
|
-
outDir
|
|
303
|
-
});
|
|
304
115
|
return 0;
|
|
305
116
|
}, "compileFolder");
|
|
306
117
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config) => {
|
|
@@ -319,165 +130,69 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config) => {
|
|
|
319
130
|
const compileForNeutral = compile?.neutral ?? {
|
|
320
131
|
src: {}
|
|
321
132
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
133
|
+
const standardLoaders = {
|
|
134
|
+
".gif": "copy",
|
|
135
|
+
".html": "copy",
|
|
136
|
+
".jpg": "copy",
|
|
137
|
+
".json": "json",
|
|
138
|
+
".png": "copy",
|
|
139
|
+
".svg": "copy",
|
|
140
|
+
".webp": "copy"
|
|
141
|
+
};
|
|
142
|
+
const standardOptions = {
|
|
143
|
+
bundle: true,
|
|
144
|
+
format: [
|
|
145
|
+
"esm"
|
|
146
|
+
],
|
|
147
|
+
loader: standardLoaders,
|
|
148
|
+
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
149
|
+
js: ".mjs"
|
|
150
|
+
} : {
|
|
151
|
+
js: ".cjs"
|
|
152
|
+
}, "outExtension"),
|
|
153
|
+
skipNodeModulesBundle: true,
|
|
154
|
+
sourcemap: true,
|
|
155
|
+
target: "esnext"
|
|
156
|
+
};
|
|
157
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
326
158
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
327
159
|
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
loader: merge2({}, {
|
|
334
|
-
".gif": "copy",
|
|
335
|
-
".html": "copy",
|
|
336
|
-
".jpg": "copy",
|
|
337
|
-
".json": "json",
|
|
338
|
-
".png": "copy",
|
|
339
|
-
".svg": "copy",
|
|
340
|
-
".webp": "copy"
|
|
341
|
-
}, inEsBuildOptions?.loader),
|
|
342
|
-
// minify: true,
|
|
160
|
+
...standardOptions,
|
|
161
|
+
loader: {
|
|
162
|
+
...standardOptions.loader,
|
|
163
|
+
...inEsBuildOptions?.loader
|
|
164
|
+
},
|
|
343
165
|
outDir: "dist/node",
|
|
344
|
-
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
345
|
-
js: ".mjs"
|
|
346
|
-
} : {
|
|
347
|
-
js: ".cjs"
|
|
348
|
-
}, "outExtension"),
|
|
349
166
|
platform: "node",
|
|
350
|
-
skipNodeModulesBundle: true,
|
|
351
|
-
sourcemap: true,
|
|
352
|
-
target: "node16",
|
|
353
|
-
// terserOptions: { format: { comments: false } },
|
|
354
167
|
...compile?.tsup?.options,
|
|
355
168
|
...typeof options === "object" ? options : {}
|
|
356
169
|
}, verbose) : 0;
|
|
357
170
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
358
171
|
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
|
|
359
|
-
return folder ?
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
".png": "copy",
|
|
371
|
-
".svg": "copy",
|
|
372
|
-
".webp": "copy"
|
|
373
|
-
}, inEsBuildOptions?.loader),
|
|
374
|
-
// minify: true,
|
|
375
|
-
outDir: "dist/browser",
|
|
376
|
-
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
377
|
-
js: ".mjs"
|
|
378
|
-
} : {
|
|
379
|
-
js: ".cjs"
|
|
380
|
-
}, "outExtension"),
|
|
381
|
-
platform: "browser",
|
|
382
|
-
skipNodeModulesBundle: true,
|
|
383
|
-
sourcemap: true,
|
|
384
|
-
target: "esnext",
|
|
385
|
-
// terserOptions: { format: { comments: false } },
|
|
386
|
-
...compile?.tsup?.options,
|
|
387
|
-
...typeof options === "object" ? options : {}
|
|
388
|
-
}, verbose),
|
|
389
|
-
compileFolder(folder, compile?.entryMode, {
|
|
390
|
-
bundle: true,
|
|
391
|
-
format: [
|
|
392
|
-
"esm"
|
|
393
|
-
],
|
|
394
|
-
loader: merge2({}, {
|
|
395
|
-
".gif": "copy",
|
|
396
|
-
".html": "copy",
|
|
397
|
-
".jpg": "copy",
|
|
398
|
-
".json": "json",
|
|
399
|
-
".png": "copy",
|
|
400
|
-
".svg": "copy",
|
|
401
|
-
".webp": "copy"
|
|
402
|
-
}, inEsBuildOptions?.loader),
|
|
403
|
-
// minify: true,
|
|
404
|
-
outDir: "dist/browser",
|
|
405
|
-
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
406
|
-
js: ".mjs"
|
|
407
|
-
} : {
|
|
408
|
-
js: ".cjs"
|
|
409
|
-
}, "outExtension"),
|
|
410
|
-
platform: "browser",
|
|
411
|
-
skipNodeModulesBundle: true,
|
|
412
|
-
sourcemap: true,
|
|
413
|
-
target: "esnext",
|
|
414
|
-
// terserOptions: { format: { comments: false } },
|
|
415
|
-
...compile?.tsup?.options,
|
|
416
|
-
...typeof options === "object" ? options : {}
|
|
417
|
-
}, verbose)
|
|
418
|
-
])).reduce((prev, value) => prev + value, 0) : 0;
|
|
172
|
+
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
173
|
+
...standardOptions,
|
|
174
|
+
loader: {
|
|
175
|
+
...standardOptions.loader,
|
|
176
|
+
...inEsBuildOptions?.loader
|
|
177
|
+
},
|
|
178
|
+
outDir: "dist/browser",
|
|
179
|
+
platform: "browser",
|
|
180
|
+
...compile?.tsup?.options,
|
|
181
|
+
...typeof options === "object" ? options : {}
|
|
182
|
+
}, verbose) : 0;
|
|
419
183
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
420
184
|
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
|
|
421
|
-
return folder ?
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
".png": "copy",
|
|
433
|
-
".svg": "copy",
|
|
434
|
-
".webp": "copy"
|
|
435
|
-
}, inEsBuildOptions?.loader),
|
|
436
|
-
// minify: true,
|
|
437
|
-
outDir: "dist/neutral",
|
|
438
|
-
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
439
|
-
js: ".mjs"
|
|
440
|
-
} : {
|
|
441
|
-
js: ".cjs"
|
|
442
|
-
}, "outExtension"),
|
|
443
|
-
platform: "neutral",
|
|
444
|
-
skipNodeModulesBundle: true,
|
|
445
|
-
sourcemap: true,
|
|
446
|
-
target: "esnext",
|
|
447
|
-
// terserOptions: { format: { comments: false } },
|
|
448
|
-
...compile?.tsup?.options,
|
|
449
|
-
...typeof options === "object" ? options : {}
|
|
450
|
-
}, verbose),
|
|
451
|
-
compileFolder(folder, compile?.entryMode, {
|
|
452
|
-
bundle: true,
|
|
453
|
-
format: [
|
|
454
|
-
"esm"
|
|
455
|
-
],
|
|
456
|
-
loader: merge2({}, {
|
|
457
|
-
".gif": "copy",
|
|
458
|
-
".html": "copy",
|
|
459
|
-
".jpg": "copy",
|
|
460
|
-
".json": "json",
|
|
461
|
-
".png": "copy",
|
|
462
|
-
".svg": "copy",
|
|
463
|
-
".webp": "copy"
|
|
464
|
-
}, inEsBuildOptions?.loader),
|
|
465
|
-
// minify: true,
|
|
466
|
-
outDir: "dist/neutral",
|
|
467
|
-
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
468
|
-
js: ".mjs"
|
|
469
|
-
} : {
|
|
470
|
-
js: ".cjs"
|
|
471
|
-
}, "outExtension"),
|
|
472
|
-
platform: "neutral",
|
|
473
|
-
skipNodeModulesBundle: true,
|
|
474
|
-
sourcemap: true,
|
|
475
|
-
target: "esnext",
|
|
476
|
-
// terserOptions: { format: { comments: false } },
|
|
477
|
-
...compile?.tsup?.options,
|
|
478
|
-
...typeof options === "object" ? options : {}
|
|
479
|
-
}, verbose)
|
|
480
|
-
])).reduce((prev, value) => prev + value, 0) : 0;
|
|
185
|
+
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
186
|
+
...standardOptions,
|
|
187
|
+
loader: {
|
|
188
|
+
...standardOptions.loader,
|
|
189
|
+
...inEsBuildOptions?.loader
|
|
190
|
+
},
|
|
191
|
+
outDir: "dist/neutral",
|
|
192
|
+
platform: "neutral",
|
|
193
|
+
...compile?.tsup?.options,
|
|
194
|
+
...typeof options === "object" ? options : {}
|
|
195
|
+
}, verbose) : 0;
|
|
481
196
|
}))).reduce((prev, value) => prev + value, 0) || (publint ? await packagePublint() : 0);
|
|
482
197
|
}, "packageCompileTsup");
|
|
483
198
|
export {
|