smartbundle 0.5.4 → 0.7.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.
- package/README.md +7 -1
- package/__do_not_import_directly__/createViteConfig.cjs +17 -8
- package/__do_not_import_directly__/createViteConfig.js +17 -8
- package/__do_not_import_directly__/error.cjs +9 -0
- package/__do_not_import_directly__/error.js +9 -0
- package/__do_not_import_directly__/errors.cjs +2 -2
- package/__do_not_import_directly__/errors.js +2 -2
- package/__do_not_import_directly__/packageJson.cjs +56 -4
- package/__do_not_import_directly__/packageJson.js +56 -4
- package/__do_not_import_directly__/resolveDirs.cjs +2 -1
- package/__do_not_import_directly__/resolveDirs.js +2 -1
- package/__do_not_import_directly__/smartbundle.cjs +4 -0
- package/__do_not_import_directly__/smartbundle.js +3 -0
- package/__do_not_import_directly__/tasks/binsTask.cjs +40 -0
- package/__do_not_import_directly__/tasks/binsTask.js +40 -0
- package/{src/bin.cjs → __do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.cjs} +39 -2
- package/__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.js +40 -0
- package/__do_not_import_directly__/{buildTypes.cjs → tasks/buildTypesTask/callTypescript.cjs} +3 -26
- package/__do_not_import_directly__/{buildTypes.js → tasks/buildTypesTask/callTypescript.js} +3 -4
- package/__do_not_import_directly__/{copyStaticFiles.cjs → tasks/copyStaticFilesTask.cjs} +8 -1
- package/__do_not_import_directly__/{copyStaticFiles.js → tasks/copyStaticFilesTask.js} +8 -1
- package/__do_not_import_directly__/tasks/jsFilesTask.cjs +25 -0
- package/__do_not_import_directly__/tasks/jsFilesTask.js +25 -0
- package/__do_not_import_directly__/tasks/utils.cjs +12 -0
- package/__do_not_import_directly__/tasks/utils.js +12 -0
- package/__do_not_import_directly__/writePackageJson.cjs +5 -6
- package/__do_not_import_directly__/writePackageJson.js +5 -6
- package/__smartbundle__internals__/smartbundle +2 -0
- package/package.json +13 -11
- package/src/buildVite.d.ts +1 -1
- package/src/createViteConfig.d.ts +1 -0
- package/src/error.d.ts +4 -0
- package/src/errors.d.ts +1 -1
- package/src/index.cjs +102 -0
- package/src/index.js +102 -0
- package/src/packageJson.d.ts +6 -6
- package/src/resolveDirs.d.ts +1 -0
- package/src/tasks/binsTask.d.ts +9 -0
- package/src/tasks/buildTypesTask/buildTypesTask.d.ts +9 -0
- package/src/tasks/buildTypesTask/callTypescript.d.ts +8 -0
- package/src/tasks/copyStaticFilesTask.d.ts +1 -0
- package/src/tasks/jsFilesTask.d.ts +7 -0
- package/src/tasks/utils.d.ts +1 -0
- package/src/writePackageJson.d.ts +3 -2
- package/__do_not_import_directly__/index.cjs +0 -120
- package/__do_not_import_directly__/index.js +0 -98
- package/src/bin.d.ts +0 -2
- package/src/bin.js +0 -2
- package/src/buildTypes.d.ts +0 -7
- package/src/copyStaticFiles.d.ts +0 -7
- package/src/run.cjs +0 -4
- package/src/run.js +0 -3
@@ -1,5 +1,12 @@
|
|
1
1
|
import { join } from "node:path";
|
2
2
|
import { readdir, copyFile } from "node:fs/promises";
|
3
|
+
async function copyStaticFilesTask(sourceDir, outDir) {
|
4
|
+
return copyStaticFiles({
|
5
|
+
relativeFiles: /* @__PURE__ */ new Set(["readme.md"]),
|
6
|
+
sourceDir,
|
7
|
+
outDir
|
8
|
+
});
|
9
|
+
}
|
3
10
|
async function copyStaticFiles({
|
4
11
|
sourceDir,
|
5
12
|
outDir,
|
@@ -23,5 +30,5 @@ async function copyStaticFiles({
|
|
23
30
|
}
|
24
31
|
}
|
25
32
|
export {
|
26
|
-
|
33
|
+
copyStaticFilesTask
|
27
34
|
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
require("vite");
|
4
|
+
const utils = require("./utils.cjs");
|
5
|
+
async function jsFilesTask({
|
6
|
+
buildOutput,
|
7
|
+
entrypoints
|
8
|
+
}) {
|
9
|
+
const reversedEntrypoints = utils.reverseMap(entrypoints);
|
10
|
+
const res = /* @__PURE__ */ new Map();
|
11
|
+
for (const el of buildOutput) {
|
12
|
+
if (el.facadeModuleId == null) {
|
13
|
+
continue;
|
14
|
+
}
|
15
|
+
const exportPath = reversedEntrypoints.get(el.facadeModuleId);
|
16
|
+
if (!exportPath) {
|
17
|
+
continue;
|
18
|
+
}
|
19
|
+
for (const path of exportPath) {
|
20
|
+
res.set(el.fileName, path);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return res;
|
24
|
+
}
|
25
|
+
exports.jsFilesTask = jsFilesTask;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import "vite";
|
2
|
+
import { reverseMap } from "./utils.js";
|
3
|
+
async function jsFilesTask({
|
4
|
+
buildOutput,
|
5
|
+
entrypoints
|
6
|
+
}) {
|
7
|
+
const reversedEntrypoints = reverseMap(entrypoints);
|
8
|
+
const res = /* @__PURE__ */ new Map();
|
9
|
+
for (const el of buildOutput) {
|
10
|
+
if (el.facadeModuleId == null) {
|
11
|
+
continue;
|
12
|
+
}
|
13
|
+
const exportPath = reversedEntrypoints.get(el.facadeModuleId);
|
14
|
+
if (!exportPath) {
|
15
|
+
continue;
|
16
|
+
}
|
17
|
+
for (const path of exportPath) {
|
18
|
+
res.set(el.fileName, path);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return res;
|
22
|
+
}
|
23
|
+
export {
|
24
|
+
jsFilesTask
|
25
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
function reverseMap(map) {
|
4
|
+
const reversed = /* @__PURE__ */ new Map();
|
5
|
+
for (const [key, value] of map) {
|
6
|
+
const arr = reversed.get(value) ?? [];
|
7
|
+
arr.push(key);
|
8
|
+
reversed.set(value, arr);
|
9
|
+
}
|
10
|
+
return reversed;
|
11
|
+
}
|
12
|
+
exports.reverseMap = reverseMap;
|
@@ -1,13 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const fs = require("node:fs/promises");
|
4
|
-
|
5
|
-
|
4
|
+
require("zod");
|
5
|
+
require("node:path");
|
6
|
+
async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
6
7
|
const allExports = {};
|
7
8
|
for (const [key, value] of exportsMap) {
|
8
|
-
if (key === "__bin__") {
|
9
|
-
continue;
|
10
|
-
}
|
11
9
|
const anExport = {};
|
12
10
|
if (value.dts) {
|
13
11
|
anExport.types = value.dts;
|
@@ -30,12 +28,13 @@ async function writePackageJson(outDir, parsed, { exportsMap }) {
|
|
30
28
|
allExports[key] = anExport;
|
31
29
|
}
|
32
30
|
allExports["./package.json"] = "./package.json";
|
31
|
+
const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : void 0;
|
33
32
|
const rootExport = typeof allExports["."] === "object" ? allExports["."] : void 0;
|
34
33
|
const res = {
|
35
34
|
name: parsed.name,
|
36
35
|
type: "module",
|
37
36
|
version: parsed.version,
|
38
|
-
bin
|
37
|
+
bin,
|
39
38
|
types: rootExport == null ? void 0 : rootExport.types,
|
40
39
|
module: rootExport == null ? void 0 : rootExport.default,
|
41
40
|
description: parsed.description ?? "",
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
2
|
-
|
3
|
-
|
2
|
+
import "zod";
|
3
|
+
import "node:path";
|
4
|
+
async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
4
5
|
const allExports = {};
|
5
6
|
for (const [key, value] of exportsMap) {
|
6
|
-
if (key === "__bin__") {
|
7
|
-
continue;
|
8
|
-
}
|
9
7
|
const anExport = {};
|
10
8
|
if (value.dts) {
|
11
9
|
anExport.types = value.dts;
|
@@ -28,12 +26,13 @@ async function writePackageJson(outDir, parsed, { exportsMap }) {
|
|
28
26
|
allExports[key] = anExport;
|
29
27
|
}
|
30
28
|
allExports["./package.json"] = "./package.json";
|
29
|
+
const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : void 0;
|
31
30
|
const rootExport = typeof allExports["."] === "object" ? allExports["."] : void 0;
|
32
31
|
const res = {
|
33
32
|
name: parsed.name,
|
34
33
|
type: "module",
|
35
34
|
version: parsed.version,
|
36
|
-
bin
|
35
|
+
bin,
|
37
36
|
types: rootExport == null ? void 0 : rootExport.types,
|
38
37
|
module: rootExport == null ? void 0 : rootExport.default,
|
39
38
|
description: parsed.description ?? "",
|
package/package.json
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
{
|
2
2
|
"name": "smartbundle",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
5
|
-
"bin":
|
6
|
-
|
7
|
-
|
4
|
+
"version": "0.7.0-alpha.0",
|
5
|
+
"bin": {
|
6
|
+
"smartbundle": "__smartbundle__internals__/smartbundle"
|
7
|
+
},
|
8
|
+
"types": "./src/index.d.ts",
|
9
|
+
"module": "./src/index.js",
|
8
10
|
"description": "zero-config bundler for npm packages",
|
9
11
|
"exports": {
|
10
12
|
".": {
|
11
|
-
"types": "./src/
|
13
|
+
"types": "./src/index.d.ts",
|
12
14
|
"import": {
|
13
|
-
"types": "./src/
|
14
|
-
"default": "./src/
|
15
|
+
"types": "./src/index.d.ts",
|
16
|
+
"default": "./src/index.js"
|
15
17
|
},
|
16
18
|
"require": {
|
17
|
-
"types": "./src/
|
18
|
-
"default": "./src/
|
19
|
+
"types": "./src/index.d.ts",
|
20
|
+
"default": "./src/index.cjs"
|
19
21
|
},
|
20
|
-
"default": "./src/
|
22
|
+
"default": "./src/index.js"
|
21
23
|
},
|
22
24
|
"./package.json": "./package.json"
|
23
25
|
},
|
24
26
|
"dependencies": {
|
25
|
-
"vite": "^5.
|
27
|
+
"vite": "^5.4.9",
|
26
28
|
"yargs": "^17.7.2",
|
27
29
|
"zod": "^3.23.8"
|
28
30
|
},
|
package/src/buildVite.d.ts
CHANGED
package/src/error.d.ts
ADDED
package/src/errors.d.ts
CHANGED
package/src/index.cjs
ADDED
@@ -0,0 +1,102 @@
|
|
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, outInternalsDir } = dirs;
|
22
|
+
await fs.rm(outDir, { recursive: true, force: true });
|
23
|
+
await fs.mkdir(outDir, { recursive: true });
|
24
|
+
await fs.mkdir(outInternalsDir, { recursive: true });
|
25
|
+
const packageJson$1 = await packageJson.parsePackageJson({ sourceDir, packagePath });
|
26
|
+
if (Array.isArray(packageJson$1)) {
|
27
|
+
console.error(packageJson$1);
|
28
|
+
throw new Error("Failed to parse package.json");
|
29
|
+
}
|
30
|
+
const { viteConfig } = createViteConfig.createViteConfig({ dirs, packageJson: packageJson$1 });
|
31
|
+
return viteConfig;
|
32
|
+
}
|
33
|
+
async function run(args) {
|
34
|
+
const dirs = resolveDirs.resolveDirs(args);
|
35
|
+
const { sourceDir, outDir, packagePath, outInternalsDir } = dirs;
|
36
|
+
await fs.rm(outDir, { recursive: true, force: true });
|
37
|
+
await fs.mkdir(outDir, { recursive: true });
|
38
|
+
const packageJson$1 = await packageJson.parsePackageJson({ sourceDir, packagePath });
|
39
|
+
if (Array.isArray(packageJson$1)) {
|
40
|
+
console.log(packageJson$1);
|
41
|
+
return { error: true, errors: packageJson$1 };
|
42
|
+
}
|
43
|
+
const { viteConfig, entrypoints, bins } = createViteConfig.createViteConfig({
|
44
|
+
dirs,
|
45
|
+
packageJson: packageJson$1
|
46
|
+
});
|
47
|
+
const outputs = await buildVite.buildVite({ viteConfig });
|
48
|
+
if (outputs.error) {
|
49
|
+
return { error: true, errors: outputs.errors };
|
50
|
+
}
|
51
|
+
await fs.mkdir(outInternalsDir, { recursive: true });
|
52
|
+
const viteOutput = outputs.output;
|
53
|
+
const exportsMap = /* @__PURE__ */ new Map();
|
54
|
+
const binsMap = /* @__PURE__ */ new Map();
|
55
|
+
const tasksRes = await Promise.allSettled([
|
56
|
+
copyStaticFilesTask.copyStaticFilesTask(sourceDir, outDir),
|
57
|
+
buildTypesTask.buildTypesTask({
|
58
|
+
sourceDir,
|
59
|
+
outDir,
|
60
|
+
entrypoints,
|
61
|
+
buildOutput: viteOutput
|
62
|
+
}).then((res) => {
|
63
|
+
for (const [value, key] of res) {
|
64
|
+
setExports(exportsMap, key, (entry) => {
|
65
|
+
entry.dts = "./" + path.relative(outDir, value);
|
66
|
+
return entry;
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}),
|
70
|
+
jsFilesTask.jsFilesTask({ buildOutput: viteOutput, entrypoints }).then((res) => {
|
71
|
+
for (const [value, key] of res) {
|
72
|
+
setExports(exportsMap, key, (entry) => {
|
73
|
+
const format = value.endsWith(".cjs") ? "cjs" : "es";
|
74
|
+
if (format === "es") {
|
75
|
+
entry.mjs = "./" + value;
|
76
|
+
} else if (format === "cjs") {
|
77
|
+
entry.cjs = "./" + value;
|
78
|
+
}
|
79
|
+
return entry;
|
80
|
+
});
|
81
|
+
}
|
82
|
+
}),
|
83
|
+
binsTask.binsTask({ outInternalsDir, bins, buildOutput: viteOutput, outDir }).then(
|
84
|
+
(res) => {
|
85
|
+
for (const [value, key] of res) {
|
86
|
+
binsMap.set(key, value);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
)
|
90
|
+
]);
|
91
|
+
const errors = tasksRes.filter((res) => res.status === "rejected").map((res) => res.reason).filter((res) => res instanceof error.BuildError).map((res) => res.error);
|
92
|
+
if (errors.length > 0) {
|
93
|
+
return { error: true, errors };
|
94
|
+
}
|
95
|
+
await writePackageJson.writePackageJson(outDir, packageJson$1, {
|
96
|
+
exportsMap,
|
97
|
+
binsMap
|
98
|
+
});
|
99
|
+
return { error: false };
|
100
|
+
}
|
101
|
+
exports.defineViteConfig = defineViteConfig;
|
102
|
+
exports.run = run;
|
package/src/index.js
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
import { relative } from "node:path";
|
2
|
+
import { rm, mkdir } from "node:fs/promises";
|
3
|
+
import { parsePackageJson } from "../__do_not_import_directly__/packageJson.js";
|
4
|
+
import { writePackageJson } from "../__do_not_import_directly__/writePackageJson.js";
|
5
|
+
import { buildVite } from "../__do_not_import_directly__/buildVite.js";
|
6
|
+
import { resolveDirs } from "../__do_not_import_directly__/resolveDirs.js";
|
7
|
+
import { createViteConfig } from "../__do_not_import_directly__/createViteConfig.js";
|
8
|
+
import { copyStaticFilesTask } from "../__do_not_import_directly__/tasks/copyStaticFilesTask.js";
|
9
|
+
import { buildTypesTask } from "../__do_not_import_directly__/tasks/buildTypesTask/buildTypesTask.js";
|
10
|
+
import { BuildError } from "../__do_not_import_directly__/error.js";
|
11
|
+
import { jsFilesTask } from "../__do_not_import_directly__/tasks/jsFilesTask.js";
|
12
|
+
import { binsTask } from "../__do_not_import_directly__/tasks/binsTask.js";
|
13
|
+
function setExports(exportsMap, exportName, mapFn) {
|
14
|
+
const entry = exportsMap.get(exportName) ?? {};
|
15
|
+
exportsMap.set(exportName, mapFn(entry));
|
16
|
+
}
|
17
|
+
async function defineViteConfig(args = {}) {
|
18
|
+
const dirs = resolveDirs(args);
|
19
|
+
const { sourceDir, outDir, packagePath, outInternalsDir } = dirs;
|
20
|
+
await rm(outDir, { recursive: true, force: true });
|
21
|
+
await mkdir(outDir, { recursive: true });
|
22
|
+
await mkdir(outInternalsDir, { recursive: true });
|
23
|
+
const packageJson = await parsePackageJson({ sourceDir, packagePath });
|
24
|
+
if (Array.isArray(packageJson)) {
|
25
|
+
console.error(packageJson);
|
26
|
+
throw new Error("Failed to parse package.json");
|
27
|
+
}
|
28
|
+
const { viteConfig } = createViteConfig({ dirs, packageJson });
|
29
|
+
return viteConfig;
|
30
|
+
}
|
31
|
+
async function run(args) {
|
32
|
+
const dirs = resolveDirs(args);
|
33
|
+
const { sourceDir, outDir, packagePath, outInternalsDir } = dirs;
|
34
|
+
await rm(outDir, { recursive: true, force: true });
|
35
|
+
await mkdir(outDir, { recursive: true });
|
36
|
+
const packageJson = await parsePackageJson({ sourceDir, packagePath });
|
37
|
+
if (Array.isArray(packageJson)) {
|
38
|
+
console.log(packageJson);
|
39
|
+
return { error: true, errors: packageJson };
|
40
|
+
}
|
41
|
+
const { viteConfig, entrypoints, bins } = createViteConfig({
|
42
|
+
dirs,
|
43
|
+
packageJson
|
44
|
+
});
|
45
|
+
const outputs = await buildVite({ viteConfig });
|
46
|
+
if (outputs.error) {
|
47
|
+
return { error: true, errors: outputs.errors };
|
48
|
+
}
|
49
|
+
await mkdir(outInternalsDir, { recursive: true });
|
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(sourceDir, outDir),
|
55
|
+
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 = "./" + relative(outDir, value);
|
64
|
+
return entry;
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}),
|
68
|
+
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({ outInternalsDir, 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 BuildError).map((res) => res.error);
|
90
|
+
if (errors.length > 0) {
|
91
|
+
return { error: true, errors };
|
92
|
+
}
|
93
|
+
await writePackageJson(outDir, packageJson, {
|
94
|
+
exportsMap,
|
95
|
+
binsMap
|
96
|
+
});
|
97
|
+
return { error: false };
|
98
|
+
}
|
99
|
+
export {
|
100
|
+
defineViteConfig,
|
101
|
+
run
|
102
|
+
};
|
package/src/packageJson.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import z from "zod";
|
2
2
|
declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
|
3
|
-
exports: z.ZodOptional<z.ZodEffects<z.ZodString, string, string
|
3
|
+
exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, Map<string, string>, string>, z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Map<string, string>, Record<string, string>>]>, Map<string, string>, string | Record<string, string>>>;
|
4
4
|
name: z.ZodEffects<z.ZodString, string, string>;
|
5
5
|
version: z.ZodString;
|
6
6
|
private: z.ZodEffects<z.ZodBoolean, boolean, boolean>;
|
7
7
|
description: z.ZodOptional<z.ZodString>;
|
8
8
|
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
9
9
|
optionalDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
10
|
-
bin: z.ZodOptional<z.ZodString
|
10
|
+
bin: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, Map<string, string>, string>, z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Map<string, string>, Record<string, string>>]>, Map<string, string>, string | Record<string, string>>>;
|
11
11
|
repository: z.ZodOptional<z.ZodAny>;
|
12
12
|
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
13
13
|
author: z.ZodOptional<z.ZodAny>;
|
@@ -26,14 +26,14 @@ declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
|
|
26
26
|
unpkg: z.ZodOptional<z.ZodAny>;
|
27
27
|
homepage: z.ZodOptional<z.ZodAny>;
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
29
|
-
exports?: string
|
29
|
+
exports?: Map<string, string>;
|
30
30
|
name?: string;
|
31
31
|
version?: string;
|
32
32
|
private?: boolean;
|
33
33
|
description?: string;
|
34
34
|
dependencies?: Record<string, string>;
|
35
35
|
optionalDependencies?: Record<string, string>;
|
36
|
-
bin?: string
|
36
|
+
bin?: Map<string, string>;
|
37
37
|
repository?: any;
|
38
38
|
keywords?: string[];
|
39
39
|
author?: any;
|
@@ -52,14 +52,14 @@ declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
|
|
52
52
|
unpkg?: any;
|
53
53
|
homepage?: any;
|
54
54
|
}, {
|
55
|
-
exports?: string
|
55
|
+
exports?: string | Record<string, string>;
|
56
56
|
name?: string;
|
57
57
|
version?: string;
|
58
58
|
private?: boolean;
|
59
59
|
description?: string;
|
60
60
|
dependencies?: Record<string, string>;
|
61
61
|
optionalDependencies?: Record<string, string>;
|
62
|
-
bin?: string
|
62
|
+
bin?: string | Record<string, string>;
|
63
63
|
repository?: any;
|
64
64
|
keywords?: string[];
|
65
65
|
author?: any;
|
package/src/resolveDirs.d.ts
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
import { type Rollup } from "vite";
|
2
|
+
type BinsTaskOption = {
|
3
|
+
buildOutput: Rollup.OutputChunk[];
|
4
|
+
bins: Map<string, string>;
|
5
|
+
outInternalsDir: string;
|
6
|
+
outDir: string;
|
7
|
+
};
|
8
|
+
export declare function binsTask({ buildOutput, bins, outInternalsDir, outDir, }: BinsTaskOption): Promise<Map<string, string>>;
|
9
|
+
export {};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { type Rollup } from "vite";
|
2
|
+
type BuildTypesTaskOption = {
|
3
|
+
buildOutput: Rollup.OutputChunk[];
|
4
|
+
entrypoints: Map<string, string>;
|
5
|
+
sourceDir: string;
|
6
|
+
outDir: string;
|
7
|
+
};
|
8
|
+
export declare function buildTypesTask({ buildOutput, entrypoints, sourceDir, outDir, }: BuildTypesTaskOption): Promise<Map<string, string>>;
|
9
|
+
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>>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PackageJson } from "./packageJson.js";
|
1
|
+
import { type PackageJson } from "./packageJson.js";
|
2
2
|
export type ExportsObject = {
|
3
3
|
mjs?: string;
|
4
4
|
dts?: string;
|
@@ -7,6 +7,7 @@ export type ExportsObject = {
|
|
7
7
|
};
|
8
8
|
type BuildResult = {
|
9
9
|
exportsMap: Map<string, ExportsObject>;
|
10
|
+
binsMap: Map<string, string>;
|
10
11
|
};
|
11
|
-
export declare function writePackageJson(outDir: string, parsed: PackageJson, { exportsMap }: BuildResult): Promise<void>;
|
12
|
+
export declare function writePackageJson(outDir: string, parsed: PackageJson, { exportsMap, binsMap }: BuildResult): Promise<void>;
|
12
13
|
export {};
|