@surplus/esbuild 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/index.mjs +15 -5
  2. package/package.json +8 -1
package/index.mjs CHANGED
@@ -3,7 +3,7 @@ import fsp from "node:fs/promises";
3
3
  import { compile } from "@surplus/compiler";
4
4
 
5
5
  const BASE_RESULT = {
6
- pluginName: 'Surplus Compiler'
6
+ pluginName: "Surplus Compiler",
7
7
  };
8
8
 
9
9
  export default (opts) => ({
@@ -20,21 +20,31 @@ export default (opts) => ({
20
20
  source,
21
21
  minify: false,
22
22
  sourcemapFilename: args.path,
23
- ...opts
23
+ ...opts,
24
24
  });
25
25
 
26
+ if (result.errors.length > 0) {
27
+ return {
28
+ ...BASE_RESULT,
29
+ errors: result.errors?.map((err) => ({
30
+ text: err,
31
+ })),
32
+ };
33
+ }
34
+
26
35
  return {
27
36
  ...BASE_RESULT,
28
37
  contents: result.code,
29
- errors: result.errors?.map(err => ({text: err})),
30
- warnings: result.warnings?.map(err => ({text: err})),
38
+ warnings: result.warnings?.map((err) => ({
39
+ text: err,
40
+ })),
31
41
  loader: "default",
32
42
  };
33
43
  } catch (err) {
34
44
  // Handle any errors from the transpiler
35
45
  return {
36
46
  ...BASE_RESULT,
37
- errors: [{ text: err.message }]
47
+ errors: [{ text: err.message }],
38
48
  };
39
49
  }
40
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surplus/esbuild",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Surplus framework ESBuild plugin",
5
5
  "author": "Josh Junon (https://github.com/qix-)",
6
6
  "license": "MIT",
@@ -18,6 +18,10 @@
18
18
  "esbuild",
19
19
  "plugin"
20
20
  ],
21
+ "scripts": {
22
+ "format": "prettier -w .",
23
+ "lint": "prettier -c ."
24
+ },
21
25
  "files": [
22
26
  "index.mjs",
23
27
  "LICENSE",
@@ -31,5 +35,8 @@
31
35
  },
32
36
  "publishConfig": {
33
37
  "access": "public"
38
+ },
39
+ "devDependencies": {
40
+ "prettier": "^3.6.2"
34
41
  }
35
42
  }