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