@xylabs/ts-scripts-yarn3 7.0.0-rc.9 → 7.0.0
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/build.mjs +87 -39
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +22 -8
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +11 -5
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +29 -16
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +63 -32
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile.mjs +76 -50
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +38 -23
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +57 -28
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +31 -16
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +74 -50
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +7 -7
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +6 -10
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +4 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +74 -50
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +89 -62
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +20 -4
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +8 -1
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getBasePackageName.mjs +4 -0
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +4 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +24 -12
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +16 -9
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +89 -62
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +57 -26
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +57 -26
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +57 -26
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +57 -26
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +37 -26
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +54 -36
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +65 -25
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +44 -28
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +14 -5
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +7 -4
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +1480 -898
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +31 -16
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +51 -37
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +48 -33
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +44 -28
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +16 -6
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +16 -6
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +29 -12
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +36 -8
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +346 -141
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +23 -20
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +5 -0
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +9 -23
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +346 -223
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +26 -3
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +57 -96
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +94 -25
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +321 -123
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +21 -12
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +16 -9
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +12 -11
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +466 -301
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +39 -16
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +7 -4
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +374 -155
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +71 -37
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +29 -17
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +67 -50
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +43 -25
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +63 -40
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +35 -17
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +32 -16
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +46 -27
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +30 -16
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +27 -16
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +33 -18
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +53 -19
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +31 -16
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +23 -12
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +349 -145
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +351 -145
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +15 -6
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +15 -6
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +28 -12
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +348 -144
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +323 -126
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +349 -145
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +23 -13
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +23 -13
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +17 -11
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +38 -16
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +38 -16
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +6 -4
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +375 -157
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +38 -16
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1319 -1056
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +9 -26
- package/dist/index.mjs +1847 -1407
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +5 -2
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +24 -9
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +6 -2
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +9 -3
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +23 -12
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +33 -22
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +33 -22
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +3 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +13 -12
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +15 -14
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +8 -3
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +43 -27
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +166 -106
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +5 -2
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +20 -10
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +5 -2
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +9 -6
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +19 -13
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +31 -19
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +5 -2
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +13 -10
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +5 -2
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +9 -3
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +7 -1
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +7 -4
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +5 -2
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +30 -11
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +15 -4
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +16 -5
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +16 -5
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +14 -3
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +5 -2
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +8 -3
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1320 -1056
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +9 -3
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1320 -1056
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +324 -305
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +336 -251
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +161 -99
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +193 -145
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +405 -302
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +5 -2
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +10 -9
- package/dist/actions/compile-types.mjs +0 -153
- package/dist/actions/compile-types.mjs.map +0 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
4
|
|
|
3
5
|
// src/bin/package/recompile.ts
|
|
4
|
-
import
|
|
6
|
+
import chalk10 from "chalk";
|
|
5
7
|
|
|
6
8
|
// src/lib/deleteGlob.ts
|
|
7
9
|
import fs from "fs";
|
|
8
10
|
import { glob } from "glob";
|
|
9
|
-
var deleteGlob = (globPath) => {
|
|
11
|
+
var deleteGlob = /* @__PURE__ */ __name((globPath) => {
|
|
10
12
|
const files = glob.sync(globPath);
|
|
11
13
|
for (const file of files) {
|
|
12
|
-
fs.rmSync(file, {
|
|
14
|
+
fs.rmSync(file, {
|
|
15
|
+
recursive: true,
|
|
16
|
+
force: true
|
|
17
|
+
});
|
|
13
18
|
}
|
|
14
|
-
};
|
|
19
|
+
}, "deleteGlob");
|
|
15
20
|
|
|
16
21
|
// src/lib/loadConfig.ts
|
|
17
22
|
import chalk from "chalk";
|
|
@@ -19,60 +24,78 @@ import { cosmiconfig } from "cosmiconfig";
|
|
|
19
24
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
20
25
|
import deepmerge from "deepmerge";
|
|
21
26
|
var config;
|
|
22
|
-
var loadConfig = async (params) => {
|
|
23
|
-
if (config) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
28
|
+
if (config === void 0) {
|
|
29
|
+
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
30
|
+
cache: true,
|
|
31
|
+
loaders: {
|
|
32
|
+
".ts": TypeScriptLoader()
|
|
33
|
+
}
|
|
34
|
+
}).search();
|
|
35
|
+
config = cosmicConfigResult?.config;
|
|
36
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
37
|
+
if (configFilePath !== void 0) {
|
|
38
|
+
console.log(chalk.green(`Loaded config from ${configFilePath}`));
|
|
39
|
+
if (config.verbose) {
|
|
40
|
+
console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
31
43
|
}
|
|
32
44
|
return deepmerge(config, params ?? {});
|
|
33
|
-
};
|
|
45
|
+
}, "loadConfig");
|
|
34
46
|
|
|
35
47
|
// src/actions/package/clean-outputs.ts
|
|
36
48
|
import path from "path";
|
|
37
49
|
import chalk2 from "chalk";
|
|
38
|
-
var packageCleanOutputs = () => {
|
|
50
|
+
var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
39
51
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
40
52
|
const pkgName = process.env.npm_package_name;
|
|
41
|
-
const folders = [
|
|
53
|
+
const folders = [
|
|
54
|
+
path.join(pkg, "dist"),
|
|
55
|
+
path.join(pkg, "build"),
|
|
56
|
+
path.join(pkg, "docs")
|
|
57
|
+
];
|
|
42
58
|
console.log(chalk2.green(`Cleaning Outputs [${pkgName}]`));
|
|
43
59
|
for (let folder of folders) {
|
|
44
60
|
deleteGlob(folder);
|
|
45
61
|
}
|
|
46
62
|
return 0;
|
|
47
|
-
};
|
|
63
|
+
}, "packageCleanOutputs");
|
|
48
64
|
|
|
49
65
|
// src/actions/package/clean-typescript.ts
|
|
50
66
|
import path2 from "path";
|
|
51
67
|
import chalk3 from "chalk";
|
|
52
|
-
var packageCleanTypescript = () => {
|
|
68
|
+
var packageCleanTypescript = /* @__PURE__ */ __name(() => {
|
|
53
69
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
54
70
|
const pkgName = process.env.npm_package_name;
|
|
55
71
|
console.log(chalk3.green(`Cleaning Typescript [${pkgName}]`));
|
|
56
|
-
const files = [
|
|
72
|
+
const files = [
|
|
73
|
+
path2.join(pkg, "*.tsbuildinfo"),
|
|
74
|
+
path2.join(pkg, ".tsconfig.*"),
|
|
75
|
+
path2.join(pkg, ".eslintcache")
|
|
76
|
+
];
|
|
57
77
|
for (let file of files) {
|
|
58
78
|
deleteGlob(file);
|
|
59
79
|
}
|
|
60
80
|
return 0;
|
|
61
|
-
};
|
|
81
|
+
}, "packageCleanTypescript");
|
|
62
82
|
|
|
63
83
|
// src/actions/package/clean.ts
|
|
64
|
-
var packageClean = async () => {
|
|
65
|
-
return (await Promise.all([
|
|
66
|
-
|
|
84
|
+
var packageClean = /* @__PURE__ */ __name(async () => {
|
|
85
|
+
return (await Promise.all([
|
|
86
|
+
packageCleanOutputs(),
|
|
87
|
+
packageCleanTypescript()
|
|
88
|
+
])).reduce((prev, value) => prev + value, 0);
|
|
89
|
+
}, "packageClean");
|
|
67
90
|
|
|
68
91
|
// src/actions/package/compile/compile.ts
|
|
69
|
-
import
|
|
92
|
+
import chalk9 from "chalk";
|
|
70
93
|
|
|
71
94
|
// src/actions/package/publint.ts
|
|
72
95
|
import { promises as fs2 } from "fs";
|
|
73
96
|
import chalk4 from "chalk";
|
|
74
97
|
import sortPackageJson from "sort-package-json";
|
|
75
|
-
var packagePublint = async (params) => {
|
|
98
|
+
var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
76
99
|
const pkgDir = process.env.INIT_CWD;
|
|
77
100
|
const sortedPkg = sortPackageJson(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
78
101
|
await fs2.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
@@ -86,9 +109,9 @@ var packagePublint = async (params) => {
|
|
|
86
109
|
strict: true
|
|
87
110
|
});
|
|
88
111
|
const { formatMessage } = await import("publint/utils");
|
|
89
|
-
const validMessage = (_message) => {
|
|
112
|
+
const validMessage = /* @__PURE__ */ __name((_message) => {
|
|
90
113
|
return true;
|
|
91
|
-
};
|
|
114
|
+
}, "validMessage");
|
|
92
115
|
const validMessages = messages.filter(validMessage);
|
|
93
116
|
for (const message of validMessages) {
|
|
94
117
|
switch (message.type) {
|
|
@@ -110,27 +133,51 @@ var packagePublint = async (params) => {
|
|
|
110
133
|
console.log(chalk4.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
111
134
|
}
|
|
112
135
|
return validMessages.filter((message) => message.type === "error").length;
|
|
113
|
-
};
|
|
136
|
+
}, "packagePublint");
|
|
114
137
|
|
|
115
138
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
139
|
+
import chalk8 from "chalk";
|
|
116
140
|
import { build, defineConfig } from "tsup";
|
|
117
141
|
|
|
118
142
|
// src/actions/package/compile/inputs.ts
|
|
143
|
+
import chalk5 from "chalk";
|
|
119
144
|
import { glob as glob2 } from "glob";
|
|
120
|
-
var getAllInputs = (
|
|
121
|
-
return
|
|
122
|
-
}
|
|
145
|
+
var getAllInputs = /* @__PURE__ */ __name((srcDir, verbose = false) => {
|
|
146
|
+
return [
|
|
147
|
+
...glob2.sync(`${srcDir}/**/*.ts`, {
|
|
148
|
+
posix: true
|
|
149
|
+
}).map((file) => {
|
|
150
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
151
|
+
if (verbose) {
|
|
152
|
+
console.log(chalk5.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
}),
|
|
156
|
+
...glob2.sync(`${srcDir}/**/*.tsx`, {
|
|
157
|
+
posix: true
|
|
158
|
+
}).map((file) => {
|
|
159
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
160
|
+
if (verbose) {
|
|
161
|
+
console.log(chalk5.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
})
|
|
165
|
+
];
|
|
166
|
+
}, "getAllInputs");
|
|
123
167
|
|
|
124
168
|
// src/actions/package/compile/buildEntries.ts
|
|
125
|
-
var buildEntries = (
|
|
169
|
+
var buildEntries = /* @__PURE__ */ __name((srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
126
170
|
let entries = [];
|
|
127
171
|
switch (entryMode) {
|
|
128
172
|
case "platform": {
|
|
129
|
-
entries = [
|
|
173
|
+
entries = [
|
|
174
|
+
"index-node.ts",
|
|
175
|
+
"index-browser.ts"
|
|
176
|
+
];
|
|
130
177
|
break;
|
|
131
178
|
}
|
|
132
179
|
case "all": {
|
|
133
|
-
entries = excludeSpecAndStories ? getAllInputs(
|
|
180
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
134
181
|
break;
|
|
135
182
|
}
|
|
136
183
|
case "custom": {
|
|
@@ -138,7 +185,9 @@ var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories
|
|
|
138
185
|
break;
|
|
139
186
|
}
|
|
140
187
|
default: {
|
|
141
|
-
entries = [
|
|
188
|
+
entries = [
|
|
189
|
+
"index.ts"
|
|
190
|
+
];
|
|
142
191
|
break;
|
|
143
192
|
}
|
|
144
193
|
}
|
|
@@ -147,7 +196,7 @@ var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories
|
|
|
147
196
|
}
|
|
148
197
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
149
198
|
return entries;
|
|
150
|
-
};
|
|
199
|
+
}, "buildEntries");
|
|
151
200
|
|
|
152
201
|
// src/actions/package/compile/deepMerge.ts
|
|
153
202
|
function deepMerge(target, source) {
|
|
@@ -164,6 +213,7 @@ function deepMerge(target, source) {
|
|
|
164
213
|
}
|
|
165
214
|
return target;
|
|
166
215
|
}
|
|
216
|
+
__name(deepMerge, "deepMerge");
|
|
167
217
|
function deepMergeObjects(objects) {
|
|
168
218
|
const result = {};
|
|
169
219
|
for (const obj of objects) {
|
|
@@ -171,167 +221,335 @@ function deepMergeObjects(objects) {
|
|
|
171
221
|
}
|
|
172
222
|
return result;
|
|
173
223
|
}
|
|
224
|
+
__name(deepMergeObjects, "deepMergeObjects");
|
|
174
225
|
|
|
175
|
-
// src/actions/package/compile/
|
|
226
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
227
|
+
import { cwd as cwd2 } from "process";
|
|
228
|
+
import chalk6 from "chalk";
|
|
229
|
+
import { createProgramFromConfig } from "tsc-prog";
|
|
230
|
+
import ts, { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys } from "typescript";
|
|
231
|
+
|
|
232
|
+
// src/actions/package/compile/getCompilerOptions.ts
|
|
176
233
|
import { cwd } from "process";
|
|
234
|
+
import deepmerge2 from "deepmerge";
|
|
235
|
+
import { getTsconfig } from "get-tsconfig";
|
|
236
|
+
var getCompilerOptions = /* @__PURE__ */ __name((options = {}, fileName = "tsconfig.json") => {
|
|
237
|
+
const resolvedTsConfigCompilerOptions = getTsconfig(cwd(), fileName)?.config?.compilerOptions ?? {};
|
|
238
|
+
return deepmerge2(resolvedTsConfigCompilerOptions, options);
|
|
239
|
+
}, "getCompilerOptions");
|
|
240
|
+
|
|
241
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
242
|
+
var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
243
|
+
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
244
|
+
if (verbose) {
|
|
245
|
+
console.log(chalk6.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
246
|
+
}
|
|
247
|
+
const configFilePath = ts.findConfigFile("./", ts.sys.fileExists, "tsconfig.json");
|
|
248
|
+
if (configFilePath === void 0) {
|
|
249
|
+
throw new Error("Could not find tsconfig.json");
|
|
250
|
+
}
|
|
251
|
+
const compilerOptions = {
|
|
252
|
+
...getCompilerOptions({
|
|
253
|
+
removeComments: false,
|
|
254
|
+
skipDefaultLibCheck: true,
|
|
255
|
+
skipLibCheck: true,
|
|
256
|
+
sourceMap: false
|
|
257
|
+
}),
|
|
258
|
+
...compilerOptionsParam,
|
|
259
|
+
outDir: `${outDir}/${platform}`,
|
|
260
|
+
emitDeclarationOnly: true,
|
|
261
|
+
noEmit: false
|
|
262
|
+
};
|
|
263
|
+
console.log(chalk6.cyan(`Validating Files: ${entries.length}`));
|
|
264
|
+
if (verbose) {
|
|
265
|
+
for (const entry of entries) {
|
|
266
|
+
console.log(chalk6.grey(`Validating: ${entry}`));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
if (entries.length > 0) {
|
|
271
|
+
const program = createProgramFromConfig({
|
|
272
|
+
configFilePath,
|
|
273
|
+
basePath: pkg ?? cwd2(),
|
|
274
|
+
compilerOptions,
|
|
275
|
+
files: entries.map((entry) => `${srcDir}/${entry}`),
|
|
276
|
+
include: [
|
|
277
|
+
`${srcDir}/**/*.*`
|
|
278
|
+
]
|
|
279
|
+
});
|
|
280
|
+
const diagnostics = getPreEmitDiagnostics(program);
|
|
281
|
+
if (diagnostics.length > 0) {
|
|
282
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
283
|
+
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
284
|
+
getCurrentDirectory: /* @__PURE__ */ __name(() => srcDir, "getCurrentDirectory"),
|
|
285
|
+
getNewLine: /* @__PURE__ */ __name(() => sys.newLine, "getNewLine")
|
|
286
|
+
});
|
|
287
|
+
console.error(formattedDiagnostics);
|
|
288
|
+
}
|
|
289
|
+
program.emit();
|
|
290
|
+
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
291
|
+
}
|
|
292
|
+
return 0;
|
|
293
|
+
} finally {
|
|
294
|
+
if (verbose) {
|
|
295
|
+
console.log(chalk6.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}, "packageCompileTsc");
|
|
299
|
+
|
|
300
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
301
|
+
import path3 from "path";
|
|
302
|
+
import { cwd as cwd3 } from "process";
|
|
303
|
+
import chalk7 from "chalk";
|
|
177
304
|
import { rollup } from "rollup";
|
|
178
305
|
import dts from "rollup-plugin-dts";
|
|
179
306
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
307
|
+
var ignoredWarningCodes = /* @__PURE__ */ new Set([
|
|
308
|
+
"EMPTY_BUNDLE",
|
|
309
|
+
"UNRESOLVED_IMPORT"
|
|
310
|
+
]);
|
|
311
|
+
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
312
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
313
|
+
const tsconfigPath = path3.resolve(pkg, "tsconfig.json");
|
|
314
|
+
const nodePlugIns = platform === "node" ? [
|
|
315
|
+
nodeExternals()
|
|
316
|
+
] : [];
|
|
317
|
+
try {
|
|
318
|
+
const bundle = await rollup({
|
|
319
|
+
input: inputPath,
|
|
320
|
+
plugins: [
|
|
321
|
+
dts({
|
|
322
|
+
...options,
|
|
323
|
+
tsconfig: tsconfigPath,
|
|
324
|
+
compilerOptions: {
|
|
325
|
+
emitDeclarationOnly: true,
|
|
326
|
+
noEmit: false,
|
|
327
|
+
declarationMap: true
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
330
|
+
...nodePlugIns
|
|
331
|
+
],
|
|
332
|
+
onwarn(warning, warn) {
|
|
333
|
+
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
console.warn(chalk7.yellow(`[${warning.code}] ${warning.message}`));
|
|
337
|
+
console.warn(chalk7.gray(inputPath));
|
|
338
|
+
warn(warning);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
await bundle.write({
|
|
342
|
+
file: outputPath,
|
|
343
|
+
format: "es"
|
|
344
|
+
});
|
|
345
|
+
} catch (ex) {
|
|
346
|
+
const error = ex;
|
|
347
|
+
console.warn(chalk7.red(error));
|
|
348
|
+
console.warn(chalk7.gray(inputPath));
|
|
349
|
+
}
|
|
350
|
+
if (verbose) {
|
|
351
|
+
console.log(`Bundled declarations written to ${outputPath}`);
|
|
352
|
+
}
|
|
195
353
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
354
|
+
__name(bundleDts, "bundleDts");
|
|
355
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
356
|
+
if (verbose) {
|
|
357
|
+
console.log(chalk7.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
358
|
+
console.log(`Entries: ${entries.join(", ")}`);
|
|
359
|
+
}
|
|
360
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
361
|
+
const srcRoot = `${pkg}/${srcDir}/${platform}`;
|
|
362
|
+
const entryNameToTypeName = /* @__PURE__ */ __name((entry) => {
|
|
200
363
|
const splitEntryName = entry.split(".");
|
|
201
364
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
202
|
-
return [
|
|
203
|
-
|
|
204
|
-
|
|
365
|
+
return [
|
|
366
|
+
...splitEntryName.slice(0, -1),
|
|
367
|
+
newEntryExtension
|
|
368
|
+
].join(".");
|
|
369
|
+
}, "entryNameToTypeName");
|
|
370
|
+
const compilerOptions = getCompilerOptions({
|
|
371
|
+
removeComments: false,
|
|
372
|
+
skipDefaultLibCheck: true,
|
|
373
|
+
skipLibCheck: true,
|
|
374
|
+
declarationMap: true,
|
|
375
|
+
emitDeclarationOnly: true,
|
|
376
|
+
noEmit: true
|
|
377
|
+
});
|
|
378
|
+
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
205
379
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
206
|
-
|
|
380
|
+
const entryTypeName = entryNameToTypeName(entryName);
|
|
381
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, {
|
|
382
|
+
compilerOptions
|
|
383
|
+
}, verbose);
|
|
207
384
|
}));
|
|
385
|
+
if (verbose) {
|
|
386
|
+
console.log(chalk7.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
387
|
+
}
|
|
208
388
|
return 0;
|
|
209
|
-
};
|
|
389
|
+
}, "packageCompileTscTypes");
|
|
210
390
|
|
|
211
391
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
212
|
-
var compileFolder = async (
|
|
392
|
+
var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, options, bundleTypes = false, verbose) => {
|
|
213
393
|
const outDir = options?.outDir ?? "dist";
|
|
214
394
|
if (verbose) {
|
|
215
|
-
console.log(`compileFolder [${
|
|
395
|
+
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
216
396
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
397
|
+
if (entries.length === 0) {
|
|
398
|
+
console.warn(chalk8.yellow(`No entries found in ${srcDir} to compile`));
|
|
399
|
+
return 0;
|
|
400
|
+
}
|
|
401
|
+
if (verbose) {
|
|
402
|
+
console.log(chalk8.gray(`buildDir [${buildDir}]`));
|
|
403
|
+
}
|
|
404
|
+
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
405
|
+
if (validationResult !== 0) {
|
|
406
|
+
console.error(chalk8.red(`Compile:Validation had ${validationResult} errors`));
|
|
407
|
+
return validationResult;
|
|
408
|
+
}
|
|
409
|
+
const optionsParams = tsupOptions([
|
|
410
|
+
{
|
|
411
|
+
bundle: true,
|
|
412
|
+
cjsInterop: true,
|
|
413
|
+
clean: false,
|
|
414
|
+
dts: false,
|
|
415
|
+
format: [
|
|
416
|
+
"esm"
|
|
417
|
+
],
|
|
418
|
+
outDir,
|
|
419
|
+
silent: true,
|
|
420
|
+
sourcemap: true,
|
|
421
|
+
splitting: false,
|
|
422
|
+
tsconfig: "tsconfig.json",
|
|
423
|
+
...options,
|
|
424
|
+
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
425
|
+
}
|
|
426
|
+
]);
|
|
427
|
+
const optionsResult = defineConfig(optionsParams);
|
|
428
|
+
const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
|
|
429
|
+
optionsResult
|
|
430
|
+
]).flatMap(async (options2) => {
|
|
431
|
+
const result = typeof options2 === "function" ? await options2({}) : [
|
|
432
|
+
options2
|
|
433
|
+
];
|
|
434
|
+
return Array.isArray(result) ? result : [
|
|
435
|
+
result
|
|
436
|
+
];
|
|
437
|
+
}))).flat();
|
|
237
438
|
if (verbose) {
|
|
238
|
-
console.log(`TSUP:build:start [${
|
|
439
|
+
console.log(chalk8.cyan(`TSUP:build:start [${srcDir}]`));
|
|
440
|
+
console.log(chalk8.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
239
441
|
}
|
|
240
442
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
241
443
|
if (verbose) {
|
|
242
|
-
console.log(`TSUP:build:stop [${
|
|
444
|
+
console.log(chalk8.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
445
|
+
}
|
|
446
|
+
if (bundleTypes) {
|
|
447
|
+
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
243
448
|
}
|
|
244
|
-
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", folder);
|
|
245
449
|
return 0;
|
|
246
|
-
};
|
|
247
|
-
var tsupOptions = (options = []) => {
|
|
450
|
+
}, "compileFolder");
|
|
451
|
+
var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
248
452
|
const standardLoaders = {
|
|
249
453
|
".gif": "copy",
|
|
250
454
|
".html": "copy",
|
|
251
455
|
".jpg": "copy",
|
|
252
456
|
".json": "json",
|
|
253
457
|
".png": "copy",
|
|
254
|
-
".svg": "
|
|
458
|
+
".svg": "text",
|
|
255
459
|
".webp": "copy"
|
|
256
460
|
};
|
|
257
461
|
const standardOptions = {
|
|
258
462
|
bundle: true,
|
|
259
|
-
format: [
|
|
463
|
+
format: [
|
|
464
|
+
"esm"
|
|
465
|
+
],
|
|
260
466
|
loader: standardLoaders,
|
|
261
|
-
outExtension: ({ format }) => format === "esm" ? {
|
|
467
|
+
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
468
|
+
js: ".mjs"
|
|
469
|
+
} : {
|
|
470
|
+
js: ".cjs"
|
|
471
|
+
}, "outExtension"),
|
|
262
472
|
skipNodeModulesBundle: true,
|
|
263
473
|
sourcemap: true,
|
|
264
474
|
target: "esnext"
|
|
265
475
|
};
|
|
266
|
-
return deepMergeObjects([
|
|
267
|
-
|
|
268
|
-
|
|
476
|
+
return deepMergeObjects([
|
|
477
|
+
standardOptions,
|
|
478
|
+
...options
|
|
479
|
+
]);
|
|
480
|
+
}, "tsupOptions");
|
|
481
|
+
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
269
482
|
const compile = config2?.compile;
|
|
270
483
|
const verbose = config2?.verbose ?? false;
|
|
484
|
+
const outDirAsBuildDir = compile?.outDirAsBuildDir ?? true;
|
|
485
|
+
const bundleTypes = compile?.bundleTypes ?? false;
|
|
271
486
|
if (verbose) {
|
|
272
|
-
console.log(
|
|
273
|
-
}
|
|
274
|
-
const compileForNode = compile?.node ?? { src: {} };
|
|
275
|
-
const compileForBrowser = compile?.browser ?? { src: {} };
|
|
276
|
-
const compileForNeutral = compile?.neutral ?? { src: {} };
|
|
277
|
-
if (verbose) {
|
|
278
|
-
console.log("Calling packageCompileTscTypes");
|
|
487
|
+
console.log("Compiling with TSUP");
|
|
279
488
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
489
|
+
const compileForNode = compile?.node ?? {
|
|
490
|
+
src: {}
|
|
491
|
+
};
|
|
492
|
+
const compileForBrowser = compile?.browser ?? {
|
|
493
|
+
src: {}
|
|
494
|
+
};
|
|
495
|
+
const compileForNeutral = compile?.neutral ?? {
|
|
496
|
+
src: {}
|
|
497
|
+
};
|
|
498
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([srcDir, options]) => {
|
|
499
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
500
|
+
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
501
|
+
const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose);
|
|
502
|
+
const platform = "node";
|
|
503
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
504
|
+
const outDir = rootOutDir + "/" + platform;
|
|
505
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
506
|
+
inEsBuildOptions,
|
|
507
|
+
compile?.tsup?.options ?? {},
|
|
508
|
+
typeof options === "object" ? options : {},
|
|
509
|
+
{
|
|
510
|
+
platform: "node",
|
|
511
|
+
outDir
|
|
512
|
+
}
|
|
513
|
+
]), bundleTypes, verbose) : 0;
|
|
514
|
+
}))).reduce((prev, value) => prev + value, 0) + (await Promise.all(Object.entries(compileForBrowser).map(async ([srcDir, options]) => {
|
|
515
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
516
|
+
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
|
|
517
|
+
const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose);
|
|
518
|
+
const platform = "browser";
|
|
519
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
520
|
+
const outDir = rootOutDir + "/" + platform;
|
|
521
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
522
|
+
inEsBuildOptions,
|
|
523
|
+
compile?.tsup?.options ?? {},
|
|
524
|
+
typeof options === "object" ? options : {},
|
|
525
|
+
{
|
|
526
|
+
platform: "browser",
|
|
527
|
+
outDir
|
|
528
|
+
}
|
|
529
|
+
]), bundleTypes, verbose) : 0;
|
|
530
|
+
}))).reduce((prev, value) => prev + value, 0) + (await Promise.all(Object.entries(compileForNeutral).map(async ([srcDir, options]) => {
|
|
531
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
532
|
+
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
|
|
533
|
+
const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose);
|
|
534
|
+
const platform = "neutral";
|
|
535
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
536
|
+
const outDir = rootOutDir + "/" + platform;
|
|
537
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
538
|
+
inEsBuildOptions,
|
|
539
|
+
compile?.tsup?.options ?? {},
|
|
540
|
+
typeof options === "object" ? options : {},
|
|
541
|
+
{
|
|
542
|
+
platform: "neutral",
|
|
543
|
+
outDir
|
|
544
|
+
}
|
|
545
|
+
]), bundleTypes, verbose) : 0;
|
|
546
|
+
}))).reduce((prev, value) => prev + value, 0) + 0;
|
|
547
|
+
}, "packageCompileTsup");
|
|
330
548
|
|
|
331
549
|
// src/actions/package/compile/compile.ts
|
|
332
|
-
var packageCompile = async (inConfig = {}) => {
|
|
550
|
+
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
333
551
|
const pkg = process.env.INIT_CWD;
|
|
334
|
-
console.log(
|
|
552
|
+
console.log(chalk9.green(`Compiling ${pkg}`));
|
|
335
553
|
const config2 = await loadConfig(inConfig);
|
|
336
554
|
const publint = config2.publint;
|
|
337
555
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -339,16 +557,16 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
339
557
|
return tsupResults;
|
|
340
558
|
}
|
|
341
559
|
return publint ? await packagePublint(config2) : 0;
|
|
342
|
-
};
|
|
560
|
+
}, "packageCompile");
|
|
343
561
|
|
|
344
562
|
// src/actions/package/recompile.ts
|
|
345
|
-
var packageRecompile = async () => {
|
|
563
|
+
var packageRecompile = /* @__PURE__ */ __name(async () => {
|
|
346
564
|
return await packageClean() || await packageCompile();
|
|
347
|
-
};
|
|
565
|
+
}, "packageRecompile");
|
|
348
566
|
|
|
349
567
|
// src/bin/package/recompile.ts
|
|
350
568
|
packageRecompile().then((value) => process.exitCode = value).catch((reason) => {
|
|
351
|
-
console.error(
|
|
569
|
+
console.error(chalk10.red(reason));
|
|
352
570
|
process.exitCode = 1;
|
|
353
571
|
});
|
|
354
572
|
//# sourceMappingURL=recompile.mjs.map
|