smartbundle 0.14.1 → 0.15.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/__compiled__/cjs/src/errors.js +0 -4
- package/__compiled__/cjs/src/errors.js.map +1 -1
- package/__compiled__/cjs/src/tasks/buildTypesTask/buildTypesTask.js +1 -3
- package/__compiled__/cjs/src/tasks/buildTypesTask/buildTypesTask.js.map +1 -1
- package/__compiled__/cjs/src/writePackageJson.js +33 -0
- package/__compiled__/cjs/src/writePackageJson.js.map +1 -1
- package/__compiled__/esm/src/errors.mjs +0 -4
- package/__compiled__/esm/src/errors.mjs.map +1 -1
- package/__compiled__/esm/src/tasks/buildTypesTask/buildTypesTask.mjs +1 -3
- package/__compiled__/esm/src/tasks/buildTypesTask/buildTypesTask.mjs.map +1 -1
- package/__compiled__/esm/src/writePackageJson.mjs +33 -0
- package/__compiled__/esm/src/writePackageJson.mjs.map +1 -1
- package/package.json +12 -12
@@ -13,13 +13,9 @@ const errors = {
|
|
13
13
|
dependenciesInvalid: "The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies",
|
14
14
|
binFiled: "The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin",
|
15
15
|
rollupError: "An error occurred while building the package. Please, report it to the issues on GitHub",
|
16
|
-
typescriptNotFound: "The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0",
|
17
16
|
optionalDependenciesInvalid: "The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies",
|
18
|
-
repositoryInvalid: "The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository",
|
19
17
|
keywordsInvalid: "The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords",
|
20
|
-
authorInvalid: "The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors",
|
21
18
|
contributorsInvalid: "The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors",
|
22
|
-
licenseInvalid: "The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license",
|
23
19
|
devDependenciesInvalid: "The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies",
|
24
20
|
peerDependenciesInvalid: "The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies",
|
25
21
|
enginesInvalid: "The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EAGF,6BACE;AAAA,EAGF,iBACE;AAAA,EAGF,qBACE;AAAA,EAGF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;;"}
|
@@ -13,7 +13,6 @@ async function buildTypesTask({
|
|
13
13
|
packageJson,
|
14
14
|
modules
|
15
15
|
}) {
|
16
|
-
const { outDir } = dirs;
|
17
16
|
const tsEntrypoints = [...entrypoints.values()].filter(
|
18
17
|
(entry) => entry.endsWith(".ts") || entry.endsWith(".tsx")
|
19
18
|
);
|
@@ -32,8 +31,7 @@ async function buildTypesTask({
|
|
32
31
|
ts: modules.ts,
|
33
32
|
dirs,
|
34
33
|
packageJson,
|
35
|
-
tsEntrypoints
|
36
|
-
outDir
|
34
|
+
tsEntrypoints
|
37
35
|
});
|
38
36
|
for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {
|
39
37
|
const entrypoints2 = reversedEntrypoints.get(source);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buildTypesTask.js","sources":["../../../../../../src/tasks/buildTypesTask/buildTypesTask.ts"],"sourcesContent":["import { callTypescript } from \"./callTypescript.js\";\nimport { reverseMap } from \"../utils.js\";\nimport { okLog } from \"../../log.js\";\nimport type { DetectedModules } from \"../../detectModules.js\";\nimport { type PackageJson } from \"../../packageJson.js\";\nimport { type Dirs } from \"../../resolveDirs.js\";\n\ntype BuildTypesTaskOption = {\n entrypoints: Map<string, string>;\n dirs: Dirs;\n modules: DetectedModules;\n packageJson: PackageJson;\n};\n\nexport async function buildTypesTask({\n entrypoints,\n dirs,\n packageJson,\n modules,\n}: BuildTypesTaskOption) {\n const { outDir } = dirs;\n const tsEntrypoints = [...entrypoints.values()].filter((entry) =>\n entry.endsWith(\".ts\") || entry.endsWith(\".tsx\"),\n );\n const reversedEntrypoints = reverseMap(entrypoints);\n\n const entrypointToEsDtsMap = new Map<string, string>();\n const entrypointToCjsDtsMap = new Map<string, string>();\n if (tsEntrypoints.length > 0 && modules.ts == null) {\n throw new Error(\n 'smartbundle found the .ts entrypoint but required \"typescript\" to build .d.ts files. Please install the \"typescript\" dependency.',\n );\n }\n if (tsEntrypoints.length === 0 || modules.ts == null) {\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n }\n\n const dtsMap = await callTypescript({\n ts: modules.ts,\n dirs,\n packageJson,\n tsEntrypoints,\n outDir,\n });\n\n for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToEsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n for (const [source, dts] of dtsMap.sourceToCjsDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToCjsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n okLog(\".d.ts\");\n\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n}\n"],"names":["reverseMap","callTypescript","entrypoints","okLog"],"mappings":";;;;;;;;;AAcA,eAAsB,eAAe;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;
|
1
|
+
{"version":3,"file":"buildTypesTask.js","sources":["../../../../../../src/tasks/buildTypesTask/buildTypesTask.ts"],"sourcesContent":["import { callTypescript } from \"./callTypescript.js\";\nimport { reverseMap } from \"../utils.js\";\nimport { okLog } from \"../../log.js\";\nimport type { DetectedModules } from \"../../detectModules.js\";\nimport { type PackageJson } from \"../../packageJson.js\";\nimport { type Dirs } from \"../../resolveDirs.js\";\n\ntype BuildTypesTaskOption = {\n entrypoints: Map<string, string>;\n dirs: Dirs;\n modules: DetectedModules;\n packageJson: PackageJson;\n};\n\nexport async function buildTypesTask({\n entrypoints,\n dirs,\n packageJson,\n modules,\n}: BuildTypesTaskOption) {\n const { outDir } = dirs;\n const tsEntrypoints = [...entrypoints.values()].filter((entry) =>\n entry.endsWith(\".ts\") || entry.endsWith(\".tsx\"),\n );\n const reversedEntrypoints = reverseMap(entrypoints);\n\n const entrypointToEsDtsMap = new Map<string, string>();\n const entrypointToCjsDtsMap = new Map<string, string>();\n if (tsEntrypoints.length > 0 && modules.ts == null) {\n throw new Error(\n 'smartbundle found the .ts entrypoint but required \"typescript\" to build .d.ts files. Please install the \"typescript\" dependency.',\n );\n }\n if (tsEntrypoints.length === 0 || modules.ts == null) {\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n }\n\n const dtsMap = await callTypescript({\n ts: modules.ts,\n dirs,\n packageJson,\n tsEntrypoints,\n outDir,\n });\n\n for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToEsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n for (const [source, dts] of dtsMap.sourceToCjsDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToCjsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n okLog(\".d.ts\");\n\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n}\n"],"names":["reverseMap","callTypescript","entrypoints","okLog"],"mappings":";;;;;;;;;AAcA,eAAsB,eAAe;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AAEvB,QAAM,gBAAgB,CAAC,GAAG,YAAY,OAAA,CAAQ,EAAE;AAAA,IAAO,CAAC,UACtD,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,MAAM;AAAA,EAChD;AACM,QAAA,sBAAsBA,iBAAW,WAAW;AAE5C,QAAA,2CAA2B,IAAoB;AAC/C,QAAA,4CAA4B,IAAoB;AACtD,MAAI,cAAc,SAAS,KAAK,QAAQ,MAAM,MAAM;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAEF,MAAI,cAAc,WAAW,KAAK,QAAQ,MAAM,MAAM;AAC7C,WAAA,EAAE,sBAAsB,sBAAsB;AAAA,EAAA;AAGjD,QAAA,SAAS,MAAMC,8BAAe;AAAA,IAClC,IAAI,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EAEF,CAAC;AAED,aAAW,CAAC,QAAQ,GAAG,KAAK,OAAO,mBAAmB;AAC9CC,UAAAA,eAAc,oBAAoB,IAAI,MAAM;AAClD,QAAIA,cAAa;AACf,iBAAW,cAAcA,cAAa;AACf,6BAAA,IAAI,YAAY,GAAG;AAAA,MAAA;AAAA,IAC1C;AAAA,EACF;AAGF,aAAW,CAAC,QAAQ,GAAG,KAAK,OAAO,mBAAmB;AAC9CA,UAAAA,eAAc,oBAAoB,IAAI,MAAM;AAClD,QAAIA,cAAa;AACf,iBAAW,cAAcA,cAAa;AACd,8BAAA,IAAI,YAAY,GAAG;AAAA,MAAA;AAAA,IAC3C;AAAA,EACF;AAGFC,MAAAA,MAAM,OAAO;AAEN,SAAA,EAAE,sBAAsB,sBAAsB;AACvD;;"}
|
@@ -13,6 +13,28 @@ function extractValue(value) {
|
|
13
13
|
}
|
14
14
|
return value.default;
|
15
15
|
}
|
16
|
+
const monorepoPostfix = "-sbsources";
|
17
|
+
const monorepoPostfixRegex = new RegExp(`${monorepoPostfix}$`);
|
18
|
+
function walkOverMonorepoDepsToRemovePostfix(deps) {
|
19
|
+
if (!deps) {
|
20
|
+
return void 0;
|
21
|
+
}
|
22
|
+
const res = {};
|
23
|
+
for (const [key, value] of Object.entries(deps)) {
|
24
|
+
if (key.endsWith(monorepoPostfix)) {
|
25
|
+
res[key.replace(monorepoPostfixRegex, "")] = value;
|
26
|
+
} else {
|
27
|
+
res[key] = value;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return res;
|
31
|
+
}
|
32
|
+
const allDepsClauses = [
|
33
|
+
"dependencies",
|
34
|
+
"optionalDependencies",
|
35
|
+
"peerDependencies",
|
36
|
+
"devDependencies"
|
37
|
+
];
|
16
38
|
async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
17
39
|
const allExports = {};
|
18
40
|
for (const [key, value] of exportsMap) {
|
@@ -38,6 +60,17 @@ async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
|
38
60
|
allExports["./package.json"] = "./package.json";
|
39
61
|
const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : void 0;
|
40
62
|
const rootExport = typeof allExports["."] === "object" ? allExports["."] : void 0;
|
63
|
+
if (parsed.name.endsWith(monorepoPostfix)) {
|
64
|
+
const originalName = parsed.name;
|
65
|
+
parsed.name = parsed.name.replace(monorepoPostfix, "");
|
66
|
+
for (const depClause of allDepsClauses) {
|
67
|
+
parsed[depClause] = walkOverMonorepoDepsToRemovePostfix(
|
68
|
+
parsed[depClause]
|
69
|
+
);
|
70
|
+
}
|
71
|
+
parsed.devDependencies = parsed.devDependencies ?? {};
|
72
|
+
parsed.devDependencies[originalName] = "*";
|
73
|
+
}
|
41
74
|
const res = {
|
42
75
|
name: parsed.name,
|
43
76
|
type: "commonjs",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"writePackageJson.js","sources":["../../../../src/writePackageJson.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { type PackageJson } from \"./packageJson.js\";\nimport { okLog } from \"./log.js\";\n\nexport type ExportsObject = {\n mjs?: string;\n dmts?: string;\n dcts?: string;\n cjs?: string;\n raw?: string;\n};\n\ntype BuildResult = {\n exportsMap: Map<string, ExportsObject>;\n binsMap: Map<string, string>;\n};\n\ntype ExportsPackageJsonObj =\n | {\n import?: ExportsPackageJsonObj;\n require?: ExportsPackageJsonObj;\n types?: string;\n default?: string;\n }\n | string;\n\nfunction extractValue(value?: ExportsPackageJsonObj) {\n if (!value) {\n return undefined;\n }\n if (typeof value === \"string\") {\n return value;\n }\n return value.default;\n}\n\nexport async function writePackageJson(\n outDir: string,\n parsed: PackageJson,\n { exportsMap, binsMap }: BuildResult,\n) {\n // we always want to have `exports` property in the target package.json\n // If you want to export something, please, specify them\n const allExports: Record<string, ExportsPackageJsonObj> = {};\n for (const [key, value] of exportsMap) {\n const anExport: ExportsPackageJsonObj = {};\n\n if (value.mjs) {\n anExport.import = {};\n if (value.dmts) {\n anExport.import.types = value.dmts;\n }\n anExport.import.default = value.mjs;\n }\n if (value.cjs) {\n anExport.require = {};\n if (value.dcts) {\n anExport.require.types = value.dcts;\n }\n anExport.require.default = value.cjs;\n }\n\n // should be first for correct resolving\n anExport.types = value.dcts ?? value.dmts;\n // because we need to have default and types key on the end\n // JSON.stringify will put it on the end if we put value at the last step\n anExport.default = value.cjs;\n\n allExports[key] = anExport;\n }\n allExports[\"./package.json\"] = \"./package.json\";\n\n const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : undefined;\n\n const rootExport =\n typeof allExports[\".\"] === \"object\" ? allExports[\".\"] : undefined;\n const res = {\n name: parsed.name,\n type: \"commonjs\",\n version: parsed.version,\n bin,\n types: rootExport?.types,\n module: extractValue(rootExport?.import),\n main: extractValue(rootExport?.require),\n description: parsed.description ?? \"\",\n exports: allExports,\n dependencies: parsed.dependencies ?? undefined,\n optionalDependencies: parsed.optionalDependencies ?? undefined,\n repository: parsed.repository,\n keywords: parsed.keywords,\n author: parsed.author,\n contributors: parsed.contributors,\n license: parsed.license,\n peerDependencies: parsed.peerDependencies,\n engines: parsed.engines,\n browser: parsed.browser,\n funding: parsed.funding,\n os: parsed.os,\n cpu: parsed.cpu,\n maintainers: parsed.maintainers,\n bugs: parsed.bugs,\n sideEffects: parsed.sideEffects,\n unpkg: parsed.unpkg,\n homepage: parsed.homepage,\n devDependencies: parsed.devDependencies,\n peerDependenciesMeta: parsed.peerDependenciesMeta,\n };\n\n await writeFile(`${outDir}/package.json`, JSON.stringify(res, null, 2));\n\n okLog(\"package.json\");\n}\n"],"names":["writeFile","okLog"],"mappings":";;;;;;AA0BA,SAAS,aAAa,OAA+B;AACnD,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EAAA;AAEL,MAAA,OAAO,UAAU,UAAU;AACtB,WAAA;AAAA,EAAA;AAET,SAAO,MAAM;AACf;AAEA,eAAsB,iBACpB,QACA,QACA,EAAE,YAAY,WACd;AAGA,QAAM,aAAoD,CAAC;AAC3D,aAAW,CAAC,KAAK,KAAK,KAAK,YAAY;AACrC,UAAM,WAAkC,CAAC;AAEzC,QAAI,MAAM,KAAK;AACb,eAAS,SAAS,CAAC;AACnB,UAAI,MAAM,MAAM;AACL,iBAAA,OAAO,QAAQ,MAAM;AAAA,MAAA;AAEvB,eAAA,OAAO,UAAU,MAAM;AAAA,IAAA;AAElC,QAAI,MAAM,KAAK;AACb,eAAS,UAAU,CAAC;AACpB,UAAI,MAAM,MAAM;AACL,iBAAA,QAAQ,QAAQ,MAAM;AAAA,MAAA;AAExB,eAAA,QAAQ,UAAU,MAAM;AAAA,IAAA;AAI1B,aAAA,QAAQ,MAAM,QAAQ,MAAM;AAGrC,aAAS,UAAU,MAAM;AAEzB,eAAW,GAAG,IAAI;AAAA,EAAA;AAEpB,aAAW,gBAAgB,IAAI;AAE/B,QAAM,MAAM,QAAQ,OAAO,IAAI,OAAO,YAAY,OAAO,IAAI;AAEvD,QAAA,aACJ,OAAO,WAAW,GAAG,MAAM,WAAW,WAAW,GAAG,IAAI;
|
1
|
+
{"version":3,"file":"writePackageJson.js","sources":["../../../../src/writePackageJson.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { type PackageJson } from \"./packageJson.js\";\nimport { okLog } from \"./log.js\";\n\nexport type ExportsObject = {\n mjs?: string;\n dmts?: string;\n dcts?: string;\n cjs?: string;\n raw?: string;\n};\n\ntype BuildResult = {\n exportsMap: Map<string, ExportsObject>;\n binsMap: Map<string, string>;\n};\n\ntype ExportsPackageJsonObj =\n | {\n import?: ExportsPackageJsonObj;\n require?: ExportsPackageJsonObj;\n types?: string;\n default?: string;\n }\n | string;\n\nfunction extractValue(value?: ExportsPackageJsonObj) {\n if (!value) {\n return undefined;\n }\n if (typeof value === \"string\") {\n return value;\n }\n return value.default;\n}\n\nconst monorepoPostfix = \"-sbsources\";\nconst monorepoPostfixRegex = new RegExp(`${monorepoPostfix}$`);\n\nfunction walkOverMonorepoDepsToRemovePostfix(\n deps: Record<string, string> | undefined,\n) {\n if (!deps) {\n return undefined;\n }\n\n const res: Record<string, string> = {};\n for (const [key, value] of Object.entries(deps)) {\n if (key.endsWith(monorepoPostfix)) {\n res[key.replace(monorepoPostfixRegex, \"\")] = value;\n } else {\n res[key] = value;\n }\n }\n return res;\n}\n\nconst allDepsClauses = [\n \"dependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n \"devDependencies\",\n] as const;\n\nexport async function writePackageJson(\n outDir: string,\n parsed: PackageJson,\n { exportsMap, binsMap }: BuildResult,\n) {\n // we always want to have `exports` property in the target package.json\n // If you want to export something, please, specify them\n const allExports: Record<string, ExportsPackageJsonObj> = {};\n for (const [key, value] of exportsMap) {\n const anExport: ExportsPackageJsonObj = {};\n\n if (value.mjs) {\n anExport.import = {};\n if (value.dmts) {\n anExport.import.types = value.dmts;\n }\n anExport.import.default = value.mjs;\n }\n if (value.cjs) {\n anExport.require = {};\n if (value.dcts) {\n anExport.require.types = value.dcts;\n }\n anExport.require.default = value.cjs;\n }\n\n // should be first for correct resolving\n anExport.types = value.dcts ?? value.dmts;\n // because we need to have default and types key on the end\n // JSON.stringify will put it on the end if we put value at the last step\n anExport.default = value.cjs;\n\n allExports[key] = anExport;\n }\n allExports[\"./package.json\"] = \"./package.json\";\n\n const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : undefined;\n\n const rootExport =\n typeof allExports[\".\"] === \"object\" ? allExports[\".\"] : undefined;\n\n if (parsed.name.endsWith(monorepoPostfix)) {\n const originalName = parsed.name;\n parsed.name = parsed.name.replace(monorepoPostfix, \"\");\n\n for (const depClause of allDepsClauses) {\n parsed[depClause] = walkOverMonorepoDepsToRemovePostfix(\n parsed[depClause],\n );\n }\n\n // add the sources to the devDeps to create a wire between source and dist\n parsed.devDependencies = parsed.devDependencies ?? {};\n parsed.devDependencies[originalName] = \"*\";\n }\n const res = {\n name: parsed.name,\n type: \"commonjs\",\n version: parsed.version,\n bin,\n types: rootExport?.types,\n module: extractValue(rootExport?.import),\n main: extractValue(rootExport?.require),\n description: parsed.description ?? \"\",\n exports: allExports,\n dependencies: parsed.dependencies ?? undefined,\n optionalDependencies: parsed.optionalDependencies ?? undefined,\n repository: parsed.repository,\n keywords: parsed.keywords,\n author: parsed.author,\n contributors: parsed.contributors,\n license: parsed.license,\n peerDependencies: parsed.peerDependencies,\n engines: parsed.engines,\n browser: parsed.browser,\n funding: parsed.funding,\n os: parsed.os,\n cpu: parsed.cpu,\n maintainers: parsed.maintainers,\n bugs: parsed.bugs,\n sideEffects: parsed.sideEffects,\n unpkg: parsed.unpkg,\n homepage: parsed.homepage,\n devDependencies: parsed.devDependencies,\n peerDependenciesMeta: parsed.peerDependenciesMeta,\n };\n\n await writeFile(`${outDir}/package.json`, JSON.stringify(res, null, 2));\n\n okLog(\"package.json\");\n}\n"],"names":["writeFile","okLog"],"mappings":"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"}
|
@@ -11,13 +11,9 @@ const errors = {
|
|
11
11
|
dependenciesInvalid: "The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies",
|
12
12
|
binFiled: "The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin",
|
13
13
|
rollupError: "An error occurred while building the package. Please, report it to the issues on GitHub",
|
14
|
-
typescriptNotFound: "The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0",
|
15
14
|
optionalDependenciesInvalid: "The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies",
|
16
|
-
repositoryInvalid: "The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository",
|
17
15
|
keywordsInvalid: "The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords",
|
18
|
-
authorInvalid: "The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors",
|
19
16
|
contributorsInvalid: "The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors",
|
20
|
-
licenseInvalid: "The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license",
|
21
17
|
devDependenciesInvalid: "The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies",
|
22
18
|
peerDependenciesInvalid: "The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies",
|
23
19
|
enginesInvalid: "The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.mjs","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,
|
1
|
+
{"version":3,"file":"errors.mjs","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EAGF,6BACE;AAAA,EAGF,iBACE;AAAA,EAGF,qBACE;AAAA,EAGF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;"}
|
@@ -11,7 +11,6 @@ async function buildTypesTask({
|
|
11
11
|
packageJson,
|
12
12
|
modules
|
13
13
|
}) {
|
14
|
-
const { outDir } = dirs;
|
15
14
|
const tsEntrypoints = [...entrypoints.values()].filter(
|
16
15
|
(entry) => entry.endsWith(".ts") || entry.endsWith(".tsx")
|
17
16
|
);
|
@@ -30,8 +29,7 @@ async function buildTypesTask({
|
|
30
29
|
ts: modules.ts,
|
31
30
|
dirs,
|
32
31
|
packageJson,
|
33
|
-
tsEntrypoints
|
34
|
-
outDir
|
32
|
+
tsEntrypoints
|
35
33
|
});
|
36
34
|
for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {
|
37
35
|
const entrypoints2 = reversedEntrypoints.get(source);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buildTypesTask.mjs","sources":["../../../../../../src/tasks/buildTypesTask/buildTypesTask.ts"],"sourcesContent":["import { callTypescript } from \"./callTypescript.js\";\nimport { reverseMap } from \"../utils.js\";\nimport { okLog } from \"../../log.js\";\nimport type { DetectedModules } from \"../../detectModules.js\";\nimport { type PackageJson } from \"../../packageJson.js\";\nimport { type Dirs } from \"../../resolveDirs.js\";\n\ntype BuildTypesTaskOption = {\n entrypoints: Map<string, string>;\n dirs: Dirs;\n modules: DetectedModules;\n packageJson: PackageJson;\n};\n\nexport async function buildTypesTask({\n entrypoints,\n dirs,\n packageJson,\n modules,\n}: BuildTypesTaskOption) {\n const { outDir } = dirs;\n const tsEntrypoints = [...entrypoints.values()].filter((entry) =>\n entry.endsWith(\".ts\") || entry.endsWith(\".tsx\"),\n );\n const reversedEntrypoints = reverseMap(entrypoints);\n\n const entrypointToEsDtsMap = new Map<string, string>();\n const entrypointToCjsDtsMap = new Map<string, string>();\n if (tsEntrypoints.length > 0 && modules.ts == null) {\n throw new Error(\n 'smartbundle found the .ts entrypoint but required \"typescript\" to build .d.ts files. Please install the \"typescript\" dependency.',\n );\n }\n if (tsEntrypoints.length === 0 || modules.ts == null) {\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n }\n\n const dtsMap = await callTypescript({\n ts: modules.ts,\n dirs,\n packageJson,\n tsEntrypoints,\n outDir,\n });\n\n for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToEsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n for (const [source, dts] of dtsMap.sourceToCjsDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToCjsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n okLog(\".d.ts\");\n\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n}\n"],"names":["entrypoints"],"mappings":";;;;;;;AAcA,eAAsB,eAAe;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;
|
1
|
+
{"version":3,"file":"buildTypesTask.mjs","sources":["../../../../../../src/tasks/buildTypesTask/buildTypesTask.ts"],"sourcesContent":["import { callTypescript } from \"./callTypescript.js\";\nimport { reverseMap } from \"../utils.js\";\nimport { okLog } from \"../../log.js\";\nimport type { DetectedModules } from \"../../detectModules.js\";\nimport { type PackageJson } from \"../../packageJson.js\";\nimport { type Dirs } from \"../../resolveDirs.js\";\n\ntype BuildTypesTaskOption = {\n entrypoints: Map<string, string>;\n dirs: Dirs;\n modules: DetectedModules;\n packageJson: PackageJson;\n};\n\nexport async function buildTypesTask({\n entrypoints,\n dirs,\n packageJson,\n modules,\n}: BuildTypesTaskOption) {\n const { outDir } = dirs;\n const tsEntrypoints = [...entrypoints.values()].filter((entry) =>\n entry.endsWith(\".ts\") || entry.endsWith(\".tsx\"),\n );\n const reversedEntrypoints = reverseMap(entrypoints);\n\n const entrypointToEsDtsMap = new Map<string, string>();\n const entrypointToCjsDtsMap = new Map<string, string>();\n if (tsEntrypoints.length > 0 && modules.ts == null) {\n throw new Error(\n 'smartbundle found the .ts entrypoint but required \"typescript\" to build .d.ts files. Please install the \"typescript\" dependency.',\n );\n }\n if (tsEntrypoints.length === 0 || modules.ts == null) {\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n }\n\n const dtsMap = await callTypescript({\n ts: modules.ts,\n dirs,\n packageJson,\n tsEntrypoints,\n outDir,\n });\n\n for (const [source, dts] of dtsMap.sourceToEsmDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToEsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n for (const [source, dts] of dtsMap.sourceToCjsDtsMap) {\n const entrypoints = reversedEntrypoints.get(source);\n if (entrypoints) {\n for (const entrypoint of entrypoints) {\n entrypointToCjsDtsMap.set(entrypoint, dts);\n }\n }\n }\n\n okLog(\".d.ts\");\n\n return { entrypointToEsDtsMap, entrypointToCjsDtsMap };\n}\n"],"names":["entrypoints"],"mappings":";;;;;;;AAcA,eAAsB,eAAe;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AAEvB,QAAM,gBAAgB,CAAC,GAAG,YAAY,OAAA,CAAQ,EAAE;AAAA,IAAO,CAAC,UACtD,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,MAAM;AAAA,EAChD;AACM,QAAA,sBAAsB,WAAW,WAAW;AAE5C,QAAA,2CAA2B,IAAoB;AAC/C,QAAA,4CAA4B,IAAoB;AACtD,MAAI,cAAc,SAAS,KAAK,QAAQ,MAAM,MAAM;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAEF,MAAI,cAAc,WAAW,KAAK,QAAQ,MAAM,MAAM;AAC7C,WAAA,EAAE,sBAAsB,sBAAsB;AAAA,EAAA;AAGjD,QAAA,SAAS,MAAM,eAAe;AAAA,IAClC,IAAI,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EAEF,CAAC;AAED,aAAW,CAAC,QAAQ,GAAG,KAAK,OAAO,mBAAmB;AAC9CA,UAAAA,eAAc,oBAAoB,IAAI,MAAM;AAClD,QAAIA,cAAa;AACf,iBAAW,cAAcA,cAAa;AACf,6BAAA,IAAI,YAAY,GAAG;AAAA,MAAA;AAAA,IAC1C;AAAA,EACF;AAGF,aAAW,CAAC,QAAQ,GAAG,KAAK,OAAO,mBAAmB;AAC9CA,UAAAA,eAAc,oBAAoB,IAAI,MAAM;AAClD,QAAIA,cAAa;AACf,iBAAW,cAAcA,cAAa;AACd,8BAAA,IAAI,YAAY,GAAG;AAAA,MAAA;AAAA,IAC3C;AAAA,EACF;AAGF,QAAM,OAAO;AAEN,SAAA,EAAE,sBAAsB,sBAAsB;AACvD;"}
|
@@ -11,6 +11,28 @@ function extractValue(value) {
|
|
11
11
|
}
|
12
12
|
return value.default;
|
13
13
|
}
|
14
|
+
const monorepoPostfix = "-sbsources";
|
15
|
+
const monorepoPostfixRegex = new RegExp(`${monorepoPostfix}$`);
|
16
|
+
function walkOverMonorepoDepsToRemovePostfix(deps) {
|
17
|
+
if (!deps) {
|
18
|
+
return void 0;
|
19
|
+
}
|
20
|
+
const res = {};
|
21
|
+
for (const [key, value] of Object.entries(deps)) {
|
22
|
+
if (key.endsWith(monorepoPostfix)) {
|
23
|
+
res[key.replace(monorepoPostfixRegex, "")] = value;
|
24
|
+
} else {
|
25
|
+
res[key] = value;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return res;
|
29
|
+
}
|
30
|
+
const allDepsClauses = [
|
31
|
+
"dependencies",
|
32
|
+
"optionalDependencies",
|
33
|
+
"peerDependencies",
|
34
|
+
"devDependencies"
|
35
|
+
];
|
14
36
|
async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
15
37
|
const allExports = {};
|
16
38
|
for (const [key, value] of exportsMap) {
|
@@ -36,6 +58,17 @@ async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
|
36
58
|
allExports["./package.json"] = "./package.json";
|
37
59
|
const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : void 0;
|
38
60
|
const rootExport = typeof allExports["."] === "object" ? allExports["."] : void 0;
|
61
|
+
if (parsed.name.endsWith(monorepoPostfix)) {
|
62
|
+
const originalName = parsed.name;
|
63
|
+
parsed.name = parsed.name.replace(monorepoPostfix, "");
|
64
|
+
for (const depClause of allDepsClauses) {
|
65
|
+
parsed[depClause] = walkOverMonorepoDepsToRemovePostfix(
|
66
|
+
parsed[depClause]
|
67
|
+
);
|
68
|
+
}
|
69
|
+
parsed.devDependencies = parsed.devDependencies ?? {};
|
70
|
+
parsed.devDependencies[originalName] = "*";
|
71
|
+
}
|
39
72
|
const res = {
|
40
73
|
name: parsed.name,
|
41
74
|
type: "commonjs",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"writePackageJson.mjs","sources":["../../../../src/writePackageJson.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { type PackageJson } from \"./packageJson.js\";\nimport { okLog } from \"./log.js\";\n\nexport type ExportsObject = {\n mjs?: string;\n dmts?: string;\n dcts?: string;\n cjs?: string;\n raw?: string;\n};\n\ntype BuildResult = {\n exportsMap: Map<string, ExportsObject>;\n binsMap: Map<string, string>;\n};\n\ntype ExportsPackageJsonObj =\n | {\n import?: ExportsPackageJsonObj;\n require?: ExportsPackageJsonObj;\n types?: string;\n default?: string;\n }\n | string;\n\nfunction extractValue(value?: ExportsPackageJsonObj) {\n if (!value) {\n return undefined;\n }\n if (typeof value === \"string\") {\n return value;\n }\n return value.default;\n}\n\nexport async function writePackageJson(\n outDir: string,\n parsed: PackageJson,\n { exportsMap, binsMap }: BuildResult,\n) {\n // we always want to have `exports` property in the target package.json\n // If you want to export something, please, specify them\n const allExports: Record<string, ExportsPackageJsonObj> = {};\n for (const [key, value] of exportsMap) {\n const anExport: ExportsPackageJsonObj = {};\n\n if (value.mjs) {\n anExport.import = {};\n if (value.dmts) {\n anExport.import.types = value.dmts;\n }\n anExport.import.default = value.mjs;\n }\n if (value.cjs) {\n anExport.require = {};\n if (value.dcts) {\n anExport.require.types = value.dcts;\n }\n anExport.require.default = value.cjs;\n }\n\n // should be first for correct resolving\n anExport.types = value.dcts ?? value.dmts;\n // because we need to have default and types key on the end\n // JSON.stringify will put it on the end if we put value at the last step\n anExport.default = value.cjs;\n\n allExports[key] = anExport;\n }\n allExports[\"./package.json\"] = \"./package.json\";\n\n const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : undefined;\n\n const rootExport =\n typeof allExports[\".\"] === \"object\" ? allExports[\".\"] : undefined;\n const res = {\n name: parsed.name,\n type: \"commonjs\",\n version: parsed.version,\n bin,\n types: rootExport?.types,\n module: extractValue(rootExport?.import),\n main: extractValue(rootExport?.require),\n description: parsed.description ?? \"\",\n exports: allExports,\n dependencies: parsed.dependencies ?? undefined,\n optionalDependencies: parsed.optionalDependencies ?? undefined,\n repository: parsed.repository,\n keywords: parsed.keywords,\n author: parsed.author,\n contributors: parsed.contributors,\n license: parsed.license,\n peerDependencies: parsed.peerDependencies,\n engines: parsed.engines,\n browser: parsed.browser,\n funding: parsed.funding,\n os: parsed.os,\n cpu: parsed.cpu,\n maintainers: parsed.maintainers,\n bugs: parsed.bugs,\n sideEffects: parsed.sideEffects,\n unpkg: parsed.unpkg,\n homepage: parsed.homepage,\n devDependencies: parsed.devDependencies,\n peerDependenciesMeta: parsed.peerDependenciesMeta,\n };\n\n await writeFile(`${outDir}/package.json`, JSON.stringify(res, null, 2));\n\n okLog(\"package.json\");\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAS,aAAa,OAA+B;AACnD,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EAAA;AAEL,MAAA,OAAO,UAAU,UAAU;AACtB,WAAA;AAAA,EAAA;AAET,SAAO,MAAM;AACf;AAEA,eAAsB,iBACpB,QACA,QACA,EAAE,YAAY,WACd;AAGA,QAAM,aAAoD,CAAC;AAC3D,aAAW,CAAC,KAAK,KAAK,KAAK,YAAY;AACrC,UAAM,WAAkC,CAAC;AAEzC,QAAI,MAAM,KAAK;AACb,eAAS,SAAS,CAAC;AACnB,UAAI,MAAM,MAAM;AACL,iBAAA,OAAO,QAAQ,MAAM;AAAA,MAAA;AAEvB,eAAA,OAAO,UAAU,MAAM;AAAA,IAAA;AAElC,QAAI,MAAM,KAAK;AACb,eAAS,UAAU,CAAC;AACpB,UAAI,MAAM,MAAM;AACL,iBAAA,QAAQ,QAAQ,MAAM;AAAA,MAAA;AAExB,eAAA,QAAQ,UAAU,MAAM;AAAA,IAAA;AAI1B,aAAA,QAAQ,MAAM,QAAQ,MAAM;AAGrC,aAAS,UAAU,MAAM;AAEzB,eAAW,GAAG,IAAI;AAAA,EAAA;AAEpB,aAAW,gBAAgB,IAAI;AAE/B,QAAM,MAAM,QAAQ,OAAO,IAAI,OAAO,YAAY,OAAO,IAAI;AAEvD,QAAA,aACJ,OAAO,WAAW,GAAG,MAAM,WAAW,WAAW,GAAG,IAAI;
|
1
|
+
{"version":3,"file":"writePackageJson.mjs","sources":["../../../../src/writePackageJson.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { type PackageJson } from \"./packageJson.js\";\nimport { okLog } from \"./log.js\";\n\nexport type ExportsObject = {\n mjs?: string;\n dmts?: string;\n dcts?: string;\n cjs?: string;\n raw?: string;\n};\n\ntype BuildResult = {\n exportsMap: Map<string, ExportsObject>;\n binsMap: Map<string, string>;\n};\n\ntype ExportsPackageJsonObj =\n | {\n import?: ExportsPackageJsonObj;\n require?: ExportsPackageJsonObj;\n types?: string;\n default?: string;\n }\n | string;\n\nfunction extractValue(value?: ExportsPackageJsonObj) {\n if (!value) {\n return undefined;\n }\n if (typeof value === \"string\") {\n return value;\n }\n return value.default;\n}\n\nconst monorepoPostfix = \"-sbsources\";\nconst monorepoPostfixRegex = new RegExp(`${monorepoPostfix}$`);\n\nfunction walkOverMonorepoDepsToRemovePostfix(\n deps: Record<string, string> | undefined,\n) {\n if (!deps) {\n return undefined;\n }\n\n const res: Record<string, string> = {};\n for (const [key, value] of Object.entries(deps)) {\n if (key.endsWith(monorepoPostfix)) {\n res[key.replace(monorepoPostfixRegex, \"\")] = value;\n } else {\n res[key] = value;\n }\n }\n return res;\n}\n\nconst allDepsClauses = [\n \"dependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n \"devDependencies\",\n] as const;\n\nexport async function writePackageJson(\n outDir: string,\n parsed: PackageJson,\n { exportsMap, binsMap }: BuildResult,\n) {\n // we always want to have `exports` property in the target package.json\n // If you want to export something, please, specify them\n const allExports: Record<string, ExportsPackageJsonObj> = {};\n for (const [key, value] of exportsMap) {\n const anExport: ExportsPackageJsonObj = {};\n\n if (value.mjs) {\n anExport.import = {};\n if (value.dmts) {\n anExport.import.types = value.dmts;\n }\n anExport.import.default = value.mjs;\n }\n if (value.cjs) {\n anExport.require = {};\n if (value.dcts) {\n anExport.require.types = value.dcts;\n }\n anExport.require.default = value.cjs;\n }\n\n // should be first for correct resolving\n anExport.types = value.dcts ?? value.dmts;\n // because we need to have default and types key on the end\n // JSON.stringify will put it on the end if we put value at the last step\n anExport.default = value.cjs;\n\n allExports[key] = anExport;\n }\n allExports[\"./package.json\"] = \"./package.json\";\n\n const bin = binsMap.size > 0 ? Object.fromEntries(binsMap) : undefined;\n\n const rootExport =\n typeof allExports[\".\"] === \"object\" ? allExports[\".\"] : undefined;\n\n if (parsed.name.endsWith(monorepoPostfix)) {\n const originalName = parsed.name;\n parsed.name = parsed.name.replace(monorepoPostfix, \"\");\n\n for (const depClause of allDepsClauses) {\n parsed[depClause] = walkOverMonorepoDepsToRemovePostfix(\n parsed[depClause],\n );\n }\n\n // add the sources to the devDeps to create a wire between source and dist\n parsed.devDependencies = parsed.devDependencies ?? {};\n parsed.devDependencies[originalName] = \"*\";\n }\n const res = {\n name: parsed.name,\n type: \"commonjs\",\n version: parsed.version,\n bin,\n types: rootExport?.types,\n module: extractValue(rootExport?.import),\n main: extractValue(rootExport?.require),\n description: parsed.description ?? \"\",\n exports: allExports,\n dependencies: parsed.dependencies ?? undefined,\n optionalDependencies: parsed.optionalDependencies ?? undefined,\n repository: parsed.repository,\n keywords: parsed.keywords,\n author: parsed.author,\n contributors: parsed.contributors,\n license: parsed.license,\n peerDependencies: parsed.peerDependencies,\n engines: parsed.engines,\n browser: parsed.browser,\n funding: parsed.funding,\n os: parsed.os,\n cpu: parsed.cpu,\n maintainers: parsed.maintainers,\n bugs: parsed.bugs,\n sideEffects: parsed.sideEffects,\n unpkg: parsed.unpkg,\n homepage: parsed.homepage,\n devDependencies: parsed.devDependencies,\n peerDependenciesMeta: parsed.peerDependenciesMeta,\n };\n\n await writeFile(`${outDir}/package.json`, JSON.stringify(res, null, 2));\n\n okLog(\"package.json\");\n}\n"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "smartbundle",
|
3
3
|
"type": "commonjs",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.15.0-alpha.0",
|
5
5
|
"bin": {
|
6
6
|
"smartbundle": "__bin__/smartbundle.js"
|
7
7
|
},
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"./package.json": "./package.json"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"semver": "^7.
|
29
|
-
"vite": "^6.
|
28
|
+
"semver": "^7.7.1",
|
29
|
+
"vite": "^6.2.4",
|
30
30
|
"yargs": "^17.7.2",
|
31
|
-
"youch": "4.1.0-beta.
|
32
|
-
"zod": "^3.24.
|
31
|
+
"youch": "4.1.0-beta.6",
|
32
|
+
"zod": "^3.24.2"
|
33
33
|
},
|
34
34
|
"repository": {
|
35
35
|
"type": "git",
|
@@ -60,14 +60,14 @@
|
|
60
60
|
"homepage": "https://github.com/xavescor/smartbundle",
|
61
61
|
"devDependencies": {
|
62
62
|
"@types/babel__core": "^7.20.5",
|
63
|
-
"@types/node": "^22.
|
64
|
-
"@types/semver": "^7.
|
63
|
+
"@types/node": "^22.13.14",
|
64
|
+
"@types/semver": "^7.7.0",
|
65
65
|
"@types/yargs": "^17.0.33",
|
66
|
-
"prettier": "^3.
|
67
|
-
"typescript": "^5.
|
68
|
-
"vitest": "^3.
|
69
|
-
"vitest-directory-snapshot": "^0.
|
70
|
-
"zx": "^8.
|
66
|
+
"prettier": "^3.5.3",
|
67
|
+
"typescript": "^5.8.2",
|
68
|
+
"vitest": "^3.1.1",
|
69
|
+
"vitest-directory-snapshot": "^0.5.0",
|
70
|
+
"zx": "^8.4.1"
|
71
71
|
},
|
72
72
|
"peerDependenciesMeta": {
|
73
73
|
"@babel/core": {
|