@pob/rollup-esbuild 1.0.0 → 1.0.2

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.0.2](https://github.com/christophehurpeau/pob/compare/@pob/rollup-esbuild@1.0.1...@pob/rollup-esbuild@1.0.2) (2024-05-05)
7
+
8
+ Note: no notable changes
9
+
10
+ Version bump for dependency: rollup
11
+
12
+
13
+ ## [1.0.1](https://github.com/christophehurpeau/pob/compare/@pob/rollup-esbuild@1.0.0...@pob/rollup-esbuild@1.0.1) (2024-04-22)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **rollup-esbuild:** configure node target ([840c9df](https://github.com/christophehurpeau/pob/commit/840c9df8b0d07e5624494661884f559aee70e4db))
19
+
20
+
21
+
22
+
6
23
  ## 1.0.0 (2024-04-21)
7
24
 
8
25
 
package/README.md CHANGED
@@ -22,16 +22,16 @@ npm install --save rollup-esbuild
22
22
  ## Usage
23
23
 
24
24
  ```js
25
- import { dirname } from 'node:path';
26
- import { fileURLToPath } from 'node:url';
27
- import createRollupConfig from '@pob/rollup-esbuild/createRollupConfig.js';
28
- import run from '@pob/rollup-esbuild/plugin-run.cjs';
25
+ import { dirname } from "node:path";
26
+ import { fileURLToPath } from "node:url";
27
+ import createRollupConfig from "@pob/rollup-esbuild/createRollupConfig.js";
28
+ import run from "@pob/rollup-esbuild/plugin-run.cjs";
29
29
 
30
- const watch = process.env.ROLLUP_WATCH === 'true';
30
+ const watch = process.env.ROLLUP_WATCH === "true";
31
31
 
32
32
  export default createRollupConfig({
33
33
  cwd: dirname(fileURLToPath(import.meta.url)),
34
- outDirectory: 'build',
35
- plugins: [watch && run({ execArgv: ['--enable-source-maps'] })],
34
+ outDirectory: "build",
35
+ plugins: [watch && run({ execArgv: ["--enable-source-maps"] })],
36
36
  });
37
37
  ```
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import '@pob/rollup/bin/pob-rollup-clean-out.js';
3
+ import "@pob/rollup/bin/pob-rollup-clean-out.js";
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 +1 @@
1
- export { default } from './lib/createRollupConfig.js';
1
+ export { default } from "./lib/createRollupConfig.js";
@@ -1,21 +1,21 @@
1
- import { readFileSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { nodeFormatToExt, resolveEntry } from '@pob/rollup';
4
- import { nodeResolve } from '@rollup/plugin-node-resolve';
5
- import configExternalDependencies from 'rollup-config-external-dependencies';
6
- import esbuild from 'rollup-plugin-esbuild';
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { nodeFormatToExt, resolveEntry } from "@pob/rollup";
4
+ import { nodeResolve } from "@rollup/plugin-node-resolve";
5
+ import configExternalDependencies from "rollup-config-external-dependencies";
6
+ import esbuild from "rollup-plugin-esbuild";
7
7
 
8
8
  export default function createRollupConfig({
9
9
  cwd = process.cwd(),
10
- outDirectory = 'dist',
11
- pkg = JSON.parse(readFileSync(path.join(cwd, 'package.json'))),
10
+ outDirectory = "dist",
11
+ pkg = JSON.parse(readFileSync(path.join(cwd, "package.json"))),
12
12
  plugins = [],
13
13
  }) {
14
14
  const pobConfig = pkg.pob;
15
15
 
16
16
  if (pobConfig.babelEnvs) {
17
17
  throw new Error(
18
- '@pob/rollup-esbuild does not supports babel, use `pob-babel` package instead.',
18
+ "@pob/rollup-esbuild does not supports babel, use `pob-babel` package instead."
19
19
  );
20
20
  }
21
21
 
@@ -23,28 +23,28 @@ export default function createRollupConfig({
23
23
  const externalByPackageJson = configExternalDependencies(pkg);
24
24
 
25
25
  const createConfigForEnv = (entry, entryPath, env) => {
26
- const extensions = ['.ts', jsx && '.tsx', '.json'].filter(Boolean);
26
+ const extensions = [".ts", jsx && ".tsx", ".json"].filter(Boolean);
27
27
  const preferConst = true;
28
28
 
29
29
  return {
30
30
  input: entryPath,
31
- output: (env.formats || ['es']).map((format) => ({
31
+ output: (env.formats || ["es"]).map((format) => ({
32
32
  file: path.relative(
33
33
  process.cwd(),
34
34
  path.join(
35
35
  cwd,
36
36
  `${outDirectory}/${entry}-${env.target}${
37
- env.omitVersionInFileName ? '' : env.version || ''
37
+ env.omitVersionInFileName ? "" : env.version || ""
38
38
  }${
39
- env.target === 'node'
39
+ env.target === "node"
40
40
  ? nodeFormatToExt(format, pkg.type)
41
41
  : `.${format}.js`
42
- }`,
43
- ),
42
+ }`
43
+ )
44
44
  ),
45
45
  format,
46
46
  sourcemap: true,
47
- exports: 'named',
47
+ exports: "named",
48
48
  generatedCode: {
49
49
  constBindings: preferConst,
50
50
  },
@@ -56,13 +56,14 @@ export default function createRollupConfig({
56
56
  esbuild({
57
57
  sourceMap: true,
58
58
  minify: false,
59
- tsconfig: path.resolve(cwd, env.tsconfig || 'tsconfig.json'),
59
+ tsconfig: path.resolve(cwd, env.tsconfig || "tsconfig.json"),
60
+ target: env.target === "node" ? `node${env.version}` : undefined,
60
61
  }),
61
62
 
62
63
  nodeResolve({
63
64
  extensions,
64
65
  customResolveOptions: {
65
- moduleDirectories: ['src'], // don't resolve node_modules, but allow src (see baseUrl in tsconfig)
66
+ moduleDirectories: ["src"], // don't resolve node_modules, but allow src (see baseUrl in tsconfig)
66
67
  },
67
68
  }),
68
69
 
@@ -72,12 +73,12 @@ export default function createRollupConfig({
72
73
  };
73
74
 
74
75
  return pobConfig.entries.flatMap((entry) => {
75
- const entryName = typeof entry === 'string' ? entry : entry.name;
76
+ const entryName = typeof entry === "string" ? entry : entry.name;
76
77
  const envs = entry.envs ||
77
78
  pobConfig.envs || [
78
79
  {
79
- target: 'node',
80
- version: '18',
80
+ target: "node",
81
+ version: "18",
81
82
  },
82
83
  ];
83
84
  const entryPath = resolveEntry(cwd, entryName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/rollup-esbuild",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "rollup configuration with typescript for pob",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -54,7 +54,7 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@pob/rollup": "1.1.0",
57
+ "@pob/rollup": "1.1.1",
58
58
  "@rollup/plugin-node-resolve": "15.2.3",
59
59
  "@rollup/plugin-run": "3.0.2",
60
60
  "esbuild": "0.20.2",
package/plugin-run.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- module.exports = require('@rollup/plugin-run');
3
+ module.exports = require("@rollup/plugin-run");