@coralogix/esbuild-plugin 0.10.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.12.0 (2025-12-20)
2
+
3
+ - Add output path config
4
+
5
+ ## 0.11.0 (2025-10-24)
6
+
7
+ This was a version bump only for esbuild-plugin to align it with other projects, there were no code changes.
8
+
1
9
  ## 0.10.0 (2024-12-21)
2
10
 
3
11
  ### 🚀 Features
@@ -30,4 +38,4 @@ This was a version bump only for esbuild-plugin to align it with other projects,
30
38
 
31
39
  ### 🚀 Features
32
40
 
33
- - **plugins:** create esbuild plugin ([1b90f04](https://github.com/coralogix/coralogix-javascript-bundler-plugins/commit/1b90f04))
41
+ - **plugins:** create esbuild plugin ([1b90f04](https://github.com/coralogix/coralogix-javascript-bundler-plugins/commit/1b90f04))
package/index.cjs.js CHANGED
@@ -1,30 +1,31 @@
1
1
  'use strict';
2
2
 
3
- const MFE_METADATA_KEY = 'cx-metadata.json';
4
- function addMetadata(result, metadata) {
3
+ const METADATA_FILENAME = 'cx-metadata.json';
4
+ function addMetadata(result, metadata, outputPath) {
5
5
  const metadataJson = JSON.stringify(metadata, null, 2);
6
6
  // Add the metadata file to output files
7
7
  result.outputFiles = result.outputFiles || [];
8
8
  result.outputFiles.push({
9
- path: MFE_METADATA_KEY,
9
+ path: outputPath,
10
10
  contents: new TextEncoder().encode(metadataJson),
11
11
  text: metadataJson,
12
- hash: ''
12
+ hash: '',
13
13
  });
14
14
  }
15
15
  function coralogixEsbuildPlugin(options) {
16
- const { app, version } = options;
16
+ const { app, version, outputDir } = options;
17
+ const filePath = outputDir ? `${outputDir}/${METADATA_FILENAME}` : METADATA_FILENAME;
17
18
  return {
18
19
  name: 'coralogixEsbuildPluginWithOptions',
19
- setup (build) {
20
- build.onEnd((result)=>{
20
+ setup(build) {
21
+ build.onEnd((result) => {
21
22
  const metadata = {
22
23
  app,
23
- version
24
+ version,
24
25
  };
25
- addMetadata(result, metadata);
26
+ addMetadata(result, metadata, filePath);
26
27
  });
27
- }
28
+ },
28
29
  };
29
30
  }
30
31
 
package/index.esm.js CHANGED
@@ -1,28 +1,29 @@
1
- const MFE_METADATA_KEY = 'cx-metadata.json';
2
- function addMetadata(result, metadata) {
1
+ const METADATA_FILENAME = 'cx-metadata.json';
2
+ function addMetadata(result, metadata, outputPath) {
3
3
  const metadataJson = JSON.stringify(metadata, null, 2);
4
4
  // Add the metadata file to output files
5
5
  result.outputFiles = result.outputFiles || [];
6
6
  result.outputFiles.push({
7
- path: MFE_METADATA_KEY,
7
+ path: outputPath,
8
8
  contents: new TextEncoder().encode(metadataJson),
9
9
  text: metadataJson,
10
- hash: ''
10
+ hash: '',
11
11
  });
12
12
  }
13
13
  function coralogixEsbuildPlugin(options) {
14
- const { app, version } = options;
14
+ const { app, version, outputDir } = options;
15
+ const filePath = outputDir ? `${outputDir}/${METADATA_FILENAME}` : METADATA_FILENAME;
15
16
  return {
16
17
  name: 'coralogixEsbuildPluginWithOptions',
17
- setup (build) {
18
- build.onEnd((result)=>{
18
+ setup(build) {
19
+ build.onEnd((result) => {
19
20
  const metadata = {
20
21
  app,
21
- version
22
+ version,
22
23
  };
23
- addMetadata(result, metadata);
24
+ addMetadata(result, metadata, filePath);
24
25
  });
25
- }
26
+ },
26
27
  };
27
28
  }
28
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/esbuild-plugin",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Official Coralogix Esbuild plugin",
5
5
  "author": "Coralogix",
6
6
  "license": "Apache-2.0",
@@ -2,6 +2,8 @@ import type { Plugin } from 'esbuild';
2
2
  interface CoralogixEsbuildPluginOptions {
3
3
  app: string;
4
4
  version: string;
5
+ /** Directory for the metadata file (relative to output directory). Defaults to root of output directory. */
6
+ outputDir?: string;
5
7
  }
6
8
  export declare function coralogixEsbuildPlugin(options: CoralogixEsbuildPluginOptions): Plugin;
7
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAe,MAAM,SAAS,CAAC;AAIhE,UAAU,6BAA6B;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAgBrF"}
1
+ {"version":3,"file":"esbuild-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAe,MAAM,SAAS,CAAC;AAIhE,UAAU,6BAA6B;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,4GAA4G;IAC5G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAeD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAiBrF"}