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