smartbundle 0.7.3 → 0.8.0-alpha.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.
Files changed (60) hide show
  1. package/README.md +62 -28
  2. package/__bin__/smartbundle.js +1 -1
  3. package/__do_not_import_directly__/args.js +23 -6
  4. package/__do_not_import_directly__/args.mjs +18 -0
  5. package/__do_not_import_directly__/buildVite.js +7 -7
  6. package/__do_not_import_directly__/buildVite.mjs +20 -0
  7. package/__do_not_import_directly__/createViteConfig.js +14 -14
  8. package/__do_not_import_directly__/{createViteConfig.cjs → createViteConfig.mjs} +14 -14
  9. package/__do_not_import_directly__/error.js +3 -3
  10. package/__do_not_import_directly__/error.mjs +9 -0
  11. package/__do_not_import_directly__/errors.js +3 -3
  12. package/__do_not_import_directly__/{errors.cjs → errors.mjs} +3 -3
  13. package/__do_not_import_directly__/packageJson.js +52 -35
  14. package/__do_not_import_directly__/packageJson.mjs +129 -0
  15. package/__do_not_import_directly__/resolveDirs.js +6 -6
  16. package/__do_not_import_directly__/{resolveDirs.cjs → resolveDirs.mjs} +6 -6
  17. package/__do_not_import_directly__/smartbundle.js +4 -3
  18. package/__do_not_import_directly__/smartbundle.mjs +3 -0
  19. package/__do_not_import_directly__/tasks/binsTask.js +16 -13
  20. package/__do_not_import_directly__/tasks/{binsTask.cjs → binsTask.mjs} +16 -13
  21. package/__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.js +34 -12
  22. package/__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.mjs +40 -0
  23. package/__do_not_import_directly__/tasks/buildTypesTask/callTypescript.js +33 -12
  24. package/__do_not_import_directly__/tasks/buildTypesTask/callTypescript.mjs +53 -0
  25. package/__do_not_import_directly__/tasks/copyStaticFilesTask.js +9 -9
  26. package/__do_not_import_directly__/tasks/{copyStaticFilesTask.cjs → copyStaticFilesTask.mjs} +9 -9
  27. package/__do_not_import_directly__/tasks/jsFilesTask.js +6 -6
  28. package/__do_not_import_directly__/tasks/{jsFilesTask.cjs → jsFilesTask.mjs} +6 -6
  29. package/__do_not_import_directly__/tasks/utils.js +3 -3
  30. package/__do_not_import_directly__/tasks/{utils.cjs → utils.mjs} +3 -3
  31. package/__do_not_import_directly__/writePackageJson.js +23 -15
  32. package/__do_not_import_directly__/{writePackageJson.cjs → writePackageJson.mjs} +23 -15
  33. package/package.json +9 -8
  34. package/src/args.d.cts +9 -0
  35. package/src/buildVite.d.cts +16 -0
  36. package/src/createViteConfig.d.cts +12 -0
  37. package/src/error.d.cts +4 -0
  38. package/src/errors.d.cts +28 -0
  39. package/src/index.d.cts +9 -0
  40. package/src/index.js +48 -43
  41. package/src/index.mjs +105 -0
  42. package/src/packageJson.d.cts +89 -0
  43. package/src/resolveDirs.d.cts +12 -0
  44. package/src/run.d.cts +1 -0
  45. package/src/tasks/binsTask.d.cts +9 -0
  46. package/src/tasks/buildTypesTask/buildTypesTask.d.cts +9 -0
  47. package/src/tasks/buildTypesTask/callTypescript.d.cts +8 -0
  48. package/src/tasks/copyStaticFilesTask.d.cts +1 -0
  49. package/src/tasks/jsFilesTask.d.cts +7 -0
  50. package/src/tasks/utils.d.cts +1 -0
  51. package/src/writePackageJson.d.cts +14 -0
  52. package/src/writePackageJson.d.ts +1 -0
  53. package/__do_not_import_directly__/args.cjs +0 -35
  54. package/__do_not_import_directly__/buildVite.cjs +0 -20
  55. package/__do_not_import_directly__/error.cjs +0 -9
  56. package/__do_not_import_directly__/packageJson.cjs +0 -146
  57. package/__do_not_import_directly__/smartbundle.cjs +0 -4
  58. package/__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.cjs +0 -62
  59. package/__do_not_import_directly__/tasks/buildTypesTask/callTypescript.cjs +0 -68
  60. package/src/index.cjs +0 -100
@@ -0,0 +1,8 @@
1
+ type BuildTypesOptions = {
2
+ ts: typeof import("typescript");
3
+ sourceDir: string;
4
+ files: string[];
5
+ outDir: string;
6
+ };
7
+ export declare function callTypescript({ ts, sourceDir, files, outDir, }: BuildTypesOptions): Promise<Map<string, string>>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare function copyStaticFilesTask(sourceDir: string, outDir: string): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { type Rollup } from "vite";
2
+ type JsFilesTaskOption = {
3
+ buildOutput: Rollup.OutputChunk[];
4
+ entrypoints: Map<string, string>;
5
+ };
6
+ export declare function jsFilesTask({ buildOutput, entrypoints, }: JsFilesTaskOption): Promise<Map<string, string>>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare function reverseMap(map: Map<string, string>): Map<string, Array<string>>;
@@ -0,0 +1,14 @@
1
+ import { type PackageJson } from "./packageJson.js";
2
+ export type ExportsObject = {
3
+ mjs?: string;
4
+ dts?: string;
5
+ cdts?: string;
6
+ cjs?: string;
7
+ raw?: string;
8
+ };
9
+ type BuildResult = {
10
+ exportsMap: Map<string, ExportsObject>;
11
+ binsMap: Map<string, string>;
12
+ };
13
+ export declare function writePackageJson(outDir: string, parsed: PackageJson, { exportsMap, binsMap }: BuildResult): Promise<void>;
14
+ export {};
@@ -2,6 +2,7 @@ import { type PackageJson } from "./packageJson.js";
2
2
  export type ExportsObject = {
3
3
  mjs?: string;
4
4
  dts?: string;
5
+ cdts?: string;
5
6
  cjs?: string;
6
7
  raw?: string;
7
8
  };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const yargs = require("yargs");
4
- const process = require("node:process");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const process__namespace = /* @__PURE__ */ _interopNamespaceDefault(process);
22
- const args = yargs(process__namespace.argv.slice(2)).option("sourceDir", {
23
- alias: "s",
24
- type: "string",
25
- describe: "path to the project directory. Default: current working directory"
26
- }).option("packagePath", {
27
- alias: "p",
28
- type: "string",
29
- describe: "path to the package.json. Default: cwd()/package.json"
30
- }).option("outputDir", {
31
- alias: "o",
32
- type: "string",
33
- describe: "path to the output directory. Default: cwd()/dist"
34
- }).help("help").parseSync();
35
- exports.args = args;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vite = require("vite");
4
- const errors = require("./errors.cjs");
5
- async function buildVite({
6
- viteConfig
7
- }) {
8
- const outputs = await vite.build(viteConfig);
9
- if (!Array.isArray(outputs)) {
10
- return {
11
- error: true,
12
- errors: [errors.errors.rollupError]
13
- };
14
- }
15
- return {
16
- error: false,
17
- output: outputs.flatMap((x) => x.output.filter((x2) => x2.type === "chunk"))
18
- };
19
- }
20
- exports.buildVite = buildVite;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- class BuildError extends Error {
4
- constructor(error) {
5
- super(error);
6
- this.error = error;
7
- }
8
- }
9
- exports.BuildError = BuildError;
@@ -1,146 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const z = require("zod");
5
- const errors = require("./errors.cjs");
6
- const path = require("node:path");
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
24
- async function fileExists(filePath) {
25
- try {
26
- const stats = await fs__namespace.stat(filePath);
27
- return stats.isFile();
28
- } catch (error) {
29
- return false;
30
- }
31
- }
32
- function dependencies(errorText) {
33
- return z.record(z.string({ message: errorText }), { message: errorText }).optional();
34
- }
35
- function createPathValidator(sourceDir) {
36
- return (path$1) => {
37
- const finalPath = path.join(sourceDir, path$1);
38
- return fileExists(finalPath);
39
- };
40
- }
41
- const PackageJsonNameField = "___NAME___";
42
- function fillPackageJson(packageJson) {
43
- if (packageJson.bin) {
44
- const binName = packageJson.bin.get(PackageJsonNameField);
45
- if (binName) {
46
- packageJson.bin.set(packageJson.name, binName);
47
- packageJson.bin.delete(PackageJsonNameField);
48
- }
49
- }
50
- }
51
- function createPackageJsonSchema(sourceDir) {
52
- const pathValidator = createPathValidator(sourceDir);
53
- return z.object({
54
- exports: z.union(
55
- [
56
- z.string().transform((path2) => /* @__PURE__ */ new Map([[".", path2]])),
57
- z.record(z.string()).transform((obj) => new Map(Object.entries(obj)))
58
- ],
59
- {
60
- errorMap() {
61
- return { message: errors.errors.exportsRequired };
62
- }
63
- }
64
- ).refine(async (obj) => {
65
- for (const [key, value] of obj.entries()) {
66
- if (!await pathValidator(value)) {
67
- return false;
68
- }
69
- }
70
- return true;
71
- }, errors.errors.exportsInvalid).optional(),
72
- name: z.string({ message: errors.errors.nameRequired }).min(1, errors.errors.nameMinLength).max(214, errors.errors.nameMaxLength).refine(
73
- (name) => ["_", "."].every((start) => !name.startsWith(start)),
74
- errors.errors.nameStartsIllegalChars
75
- ),
76
- version: z.string({ message: errors.errors.versionRequired }),
77
- private: z.boolean({ message: errors.errors.privateIsTrue }).refine((value) => value, errors.errors.privateIsTrue),
78
- description: z.string({ message: errors.errors.descriptionString }).optional(),
79
- dependencies: dependencies(errors.errors.dependenciesInvalid),
80
- optionalDependencies: dependencies(errors.errors.optionalDependenciesInvalid),
81
- bin: z.union(
82
- [
83
- z.string().transform((value) => /* @__PURE__ */ new Map([[PackageJsonNameField, value]])),
84
- z.record(z.string()).transform((record) => new Map(Object.entries(record)))
85
- ],
86
- {
87
- errorMap() {
88
- return { message: errors.errors.binFiled };
89
- }
90
- }
91
- ).refine(
92
- async (map) => {
93
- for (const [key, value] of map.entries()) {
94
- if (!await pathValidator(value)) {
95
- return false;
96
- }
97
- }
98
- return true;
99
- },
100
- { message: errors.errors.binFiled }
101
- ).optional(),
102
- repository: z.any().optional(),
103
- keywords: z.array(z.string(), { message: errors.errors.keywordsInvalid }).optional(),
104
- author: z.any().optional(),
105
- maintainers: z.any().optional(),
106
- contributors: z.array(
107
- z.union([
108
- z.string({ message: errors.errors.contributorsInvalid }),
109
- z.object({}, { message: errors.errors.contributorsInvalid })
110
- ])
111
- ).optional(),
112
- license: z.any().optional(),
113
- devDependencies: dependencies(errors.errors.devDependenciesInvalid),
114
- peerDependencies: dependencies(errors.errors.peerDependenciesInvalid),
115
- engines: z.record(z.string(), { message: errors.errors.enginesInvalid }).optional(),
116
- browser: z.union([
117
- z.string({ message: errors.errors.browserInvalid }),
118
- z.record(z.string(), { message: errors.errors.browserInvalid })
119
- ]).optional(),
120
- bugs: z.any().optional(),
121
- funding: z.union([
122
- z.string({ message: errors.errors.fundingInvalid }),
123
- z.object({}, { message: errors.errors.fundingInvalid })
124
- ]).optional(),
125
- os: z.array(z.string(), { message: errors.errors.osInvalid }).optional(),
126
- cpu: z.array(z.string(), { message: errors.errors.cpuInvalid }).optional(),
127
- sideEffects: z.any().optional(),
128
- unpkg: z.any().optional(),
129
- homepage: z.any().optional()
130
- });
131
- }
132
- async function parsePackageJson({
133
- sourceDir,
134
- packagePath
135
- }) {
136
- const packageString = await fs__namespace.readFile(packagePath, "utf-8");
137
- const rawJson = JSON.parse(packageString);
138
- const packageJsonSchema = createPackageJsonSchema(sourceDir);
139
- const packageJson = await packageJsonSchema.safeParseAsync(rawJson);
140
- if (!packageJson.success) {
141
- return packageJson.error.errors.map((error) => error.message);
142
- }
143
- fillPackageJson(packageJson.data);
144
- return packageJson.data;
145
- }
146
- exports.parsePackageJson = parsePackageJson;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- const args = require("./args.cjs");
3
- const _ = require("../src/index.cjs");
4
- _.run(args.args);
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
- require("vite");
26
- const errors = require("../../errors.cjs");
27
- const callTypescript = require("./callTypescript.cjs");
28
- const utils = require("../utils.cjs");
29
- async function buildTypesTask({
30
- buildOutput,
31
- entrypoints,
32
- sourceDir,
33
- outDir
34
- }) {
35
- const reversedEntrypoints = utils.reverseMap(entrypoints);
36
- const tsEntrypoints = [...entrypoints.values()].filter(
37
- (entry) => entry.endsWith(".ts")
38
- );
39
- if (tsEntrypoints.length === 0) {
40
- return /* @__PURE__ */ new Map();
41
- }
42
- let ts;
43
- try {
44
- ts = await import("typescript");
45
- } catch {
46
- throw errors.errors.typescriptNotFound;
47
- }
48
- const files = buildOutput.map((el) => el.facadeModuleId ?? "");
49
- const dtsMap = await callTypescript.callTypescript({ ts, sourceDir, files, outDir });
50
- const result = /* @__PURE__ */ new Map();
51
- for (const [source, dts] of dtsMap) {
52
- const exportPath = reversedEntrypoints.get(source);
53
- if (!exportPath) {
54
- continue;
55
- }
56
- for (const path of exportPath) {
57
- result.set(dts, path);
58
- }
59
- }
60
- return result;
61
- }
62
- exports.buildTypesTask = buildTypesTask;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const path = require("node:path");
4
- const fs = require("node:fs");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
22
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
23
- async function callTypescript({
24
- ts,
25
- sourceDir,
26
- files,
27
- outDir
28
- }) {
29
- const configPath = path__namespace.join(sourceDir, "tsconfig.json");
30
- const configFile = ts.readConfigFile(
31
- configPath,
32
- (path2) => (
33
- // https://github.com/XaveScor/bobrik/issues/22
34
- fs__namespace.readFileSync(path2, "utf-8")
35
- )
36
- );
37
- const parsedCommandLine = ts.parseJsonConfigFileContent(
38
- configFile.config,
39
- ts.sys,
40
- sourceDir,
41
- {
42
- declaration: true,
43
- emitDeclarationOnly: true,
44
- strict: false,
45
- strictNullChecks: false,
46
- strictFunctionTypes: false,
47
- strictPropertyInitialization: false,
48
- skipLibCheck: true,
49
- skipDefaultLibCheck: true,
50
- // https://github.com/XaveScor/bobrik/issues/22#issuecomment-2308552352
51
- noEmit: false
52
- },
53
- configPath
54
- );
55
- const host = ts.createCompilerHost(parsedCommandLine.options);
56
- const sourceToDtsMap = /* @__PURE__ */ new Map();
57
- const program = ts.createProgram(files, parsedCommandLine.options, host);
58
- program.emit(void 0, (fileName, data) => {
59
- const relativePath = path__namespace.relative(sourceDir, fileName);
60
- const finalPath = path__namespace.join(outDir, relativePath);
61
- const sourceFileName = fileName.replace(/\.d\.ts$/, ".ts");
62
- sourceToDtsMap.set(sourceFileName, finalPath);
63
- fs__namespace.mkdirSync(path__namespace.dirname(finalPath), { recursive: true });
64
- fs__namespace.writeFileSync(finalPath, data);
65
- });
66
- return sourceToDtsMap;
67
- }
68
- exports.callTypescript = callTypescript;
package/src/index.cjs DELETED
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const path = require("node:path");
4
- const fs = require("node:fs/promises");
5
- const packageJson = require("../__do_not_import_directly__/packageJson.cjs");
6
- const writePackageJson = require("../__do_not_import_directly__/writePackageJson.cjs");
7
- const buildVite = require("../__do_not_import_directly__/buildVite.cjs");
8
- const resolveDirs = require("../__do_not_import_directly__/resolveDirs.cjs");
9
- const createViteConfig = require("../__do_not_import_directly__/createViteConfig.cjs");
10
- const copyStaticFilesTask = require("../__do_not_import_directly__/tasks/copyStaticFilesTask.cjs");
11
- const buildTypesTask = require("../__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.cjs");
12
- const error = require("../__do_not_import_directly__/error.cjs");
13
- const jsFilesTask = require("../__do_not_import_directly__/tasks/jsFilesTask.cjs");
14
- const binsTask = require("../__do_not_import_directly__/tasks/binsTask.cjs");
15
- function setExports(exportsMap, exportName, mapFn) {
16
- const entry = exportsMap.get(exportName) ?? {};
17
- exportsMap.set(exportName, mapFn(entry));
18
- }
19
- async function defineViteConfig(args = {}) {
20
- const dirs = resolveDirs.resolveDirs(args);
21
- const { sourceDir, outDir, packagePath } = dirs;
22
- await fs.rm(outDir, { recursive: true, force: true });
23
- await fs.mkdir(outDir, { recursive: true });
24
- const packageJson$1 = await packageJson.parsePackageJson({ sourceDir, packagePath });
25
- if (Array.isArray(packageJson$1)) {
26
- console.error(packageJson$1);
27
- throw new Error("Failed to parse package.json");
28
- }
29
- const { viteConfig } = createViteConfig.createViteConfig({ dirs, packageJson: packageJson$1 });
30
- return viteConfig;
31
- }
32
- async function run(args) {
33
- const dirs = resolveDirs.resolveDirs(args);
34
- const { sourceDir, outDir, packagePath, outBinsDir } = dirs;
35
- await fs.rm(outDir, { recursive: true, force: true });
36
- await fs.mkdir(outDir, { recursive: true });
37
- const packageJson$1 = await packageJson.parsePackageJson({ sourceDir, packagePath });
38
- if (Array.isArray(packageJson$1)) {
39
- console.log(packageJson$1);
40
- return { error: true, errors: packageJson$1 };
41
- }
42
- const { viteConfig, entrypoints, bins } = createViteConfig.createViteConfig({
43
- dirs,
44
- packageJson: packageJson$1
45
- });
46
- const outputs = await buildVite.buildVite({ viteConfig });
47
- if (outputs.error) {
48
- return { error: true, errors: outputs.errors };
49
- }
50
- const viteOutput = outputs.output;
51
- const exportsMap = /* @__PURE__ */ new Map();
52
- const binsMap = /* @__PURE__ */ new Map();
53
- const tasksRes = await Promise.allSettled([
54
- copyStaticFilesTask.copyStaticFilesTask(sourceDir, outDir),
55
- buildTypesTask.buildTypesTask({
56
- sourceDir,
57
- outDir,
58
- entrypoints,
59
- buildOutput: viteOutput
60
- }).then((res) => {
61
- for (const [value, key] of res) {
62
- setExports(exportsMap, key, (entry) => {
63
- entry.dts = "./" + path.relative(outDir, value);
64
- return entry;
65
- });
66
- }
67
- }),
68
- jsFilesTask.jsFilesTask({ buildOutput: viteOutput, entrypoints }).then((res) => {
69
- for (const [value, key] of res) {
70
- setExports(exportsMap, key, (entry) => {
71
- const format = value.endsWith(".cjs") ? "cjs" : "es";
72
- if (format === "es") {
73
- entry.mjs = "./" + value;
74
- } else if (format === "cjs") {
75
- entry.cjs = "./" + value;
76
- }
77
- return entry;
78
- });
79
- }
80
- }),
81
- binsTask.binsTask({ outBinsDir, bins, buildOutput: viteOutput, outDir }).then(
82
- (res) => {
83
- for (const [value, key] of res) {
84
- binsMap.set(key, value);
85
- }
86
- }
87
- )
88
- ]);
89
- const errors = tasksRes.filter((res) => res.status === "rejected").map((res) => res.reason).filter((res) => res instanceof error.BuildError).map((res) => res.error);
90
- if (errors.length > 0) {
91
- return { error: true, errors };
92
- }
93
- await writePackageJson.writePackageJson(outDir, packageJson$1, {
94
- exportsMap,
95
- binsMap
96
- });
97
- return { error: false };
98
- }
99
- exports.defineViteConfig = defineViteConfig;
100
- exports.run = run;