@pob/rollup 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/bin/pob-rollup-clean-out.js +1 -1
- package/bin/rollup.cjs +2 -2
- package/lib/cleanOutDirectory.js +5 -5
- package/lib/index.js +33 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.1](https://github.com/christophehurpeau/pob/compare/@pob/rollup@1.1.0...@pob/rollup@1.1.1) (2024-05-05)
|
|
7
|
+
|
|
8
|
+
Note: no notable changes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [1.1.0](https://github.com/christophehurpeau/pob/compare/@pob/rollup@1.0.1...@pob/rollup@1.1.0) (2024-04-21)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* add rollup-esbuild ([a1085db](https://github.com/christophehurpeau/pob/commit/a1085dbe6ea69767596dd46813044b96fbf713dd))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [1.0.1](https://github.com/christophehurpeau/pob/compare/@pob/rollup@1.0.0...@pob/rollup@1.0.1) (2023-12-29)
|
|
7
24
|
|
|
8
25
|
Note: no notable changes
|
package/bin/rollup.cjs
CHANGED
package/lib/cleanOutDirectory.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
|
|
4
|
-
export function cleanOutDirectory({ outDirectory =
|
|
4
|
+
export function cleanOutDirectory({ outDirectory = "dist" } = {}) {
|
|
5
5
|
if (fs.rmSync) {
|
|
6
|
-
fs.rmSync(
|
|
6
|
+
fs.rmSync("node_modules/.cache/tsc", { recursive: true, force: true });
|
|
7
7
|
fs.rmSync(path.resolve(outDirectory), { recursive: true, force: true });
|
|
8
8
|
} else {
|
|
9
|
-
fs.rmdirSync(
|
|
9
|
+
fs.rmdirSync("node_modules/.cache/tsc", { recursive: true, force: true });
|
|
10
10
|
fs.rmdirSync(path.resolve(outDirectory), { recursive: true, force: true });
|
|
11
11
|
}
|
|
12
12
|
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
export const nodeFormatToExt = (format, pkgType) => {
|
|
5
|
+
if (format === "cjs" && pkgType === "module") return ".cjs";
|
|
6
|
+
if (format === "cjs") return ".cjs.js";
|
|
7
|
+
if (format === "es") return ".mjs";
|
|
8
|
+
return `.${format}.js`;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const resolveEntry = (cwd, entryName) => {
|
|
12
|
+
let entryPath;
|
|
13
|
+
["ts", "tsx", "js", "jsx"].some((extension) => {
|
|
14
|
+
const potentialEntryPath = path.resolve(
|
|
15
|
+
cwd,
|
|
16
|
+
"src",
|
|
17
|
+
`${entryName}.${extension}`
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(potentialEntryPath)) {
|
|
21
|
+
entryPath = potentialEntryPath;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (!entryPath) {
|
|
29
|
+
throw new Error(`Could not find entry "src/${entryName}" in path "${cwd}"`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return entryPath;
|
|
33
|
+
};
|