@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 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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { cleanOutDirectory } from '../lib/cleanOutDirectory.js';
3
+ import { cleanOutDirectory } from "../lib/cleanOutDirectory.js";
4
4
 
5
5
  cleanOutDirectory({
6
6
  outDirectory: process.argv.slice(2)[0],
package/bin/rollup.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
3
+ "use strict";
4
4
 
5
- require('rollup/dist/bin/rollup');
5
+ require("rollup/dist/bin/rollup");
@@ -1,12 +1,12 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
3
 
4
- export function cleanOutDirectory({ outDirectory = 'dist' } = {}) {
4
+ export function cleanOutDirectory({ outDirectory = "dist" } = {}) {
5
5
  if (fs.rmSync) {
6
- fs.rmSync('node_modules/.cache/tsc', { recursive: true, force: true });
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('node_modules/.cache/tsc', { recursive: true, force: true });
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/rollup",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "rollup configuration for pob",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",