File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const path = require ( 'node:path' )
4+ const pkg = require ( '../pkg' )
5+
6+ const CURRENT_WORKING_DIRECTORY = process . cwd ( )
7+ const ENTRYPOINT_PATH = require . main ?. filename || ''
8+
9+ module . exports = function processTags ( ) {
10+ return {
11+ // last segment of the current working directory, e.g. /foo/bar/baz/ -> baz
12+ 'entrypoint.workdir' : path . basename ( CURRENT_WORKING_DIRECTORY ) ,
13+
14+ // the entrypoint script filename without the extension, e.g. /foo/bar/baz/banana.js -> banana
15+ 'entrypoint.name' : path . basename ( ENTRYPOINT_PATH , path . extname ( ENTRYPOINT_PATH ) ) ,
16+
17+ // always script for JavaScript applications
18+ 'entrypoint.type' : 'script' ,
19+
20+ // the immediate parent directory name of the entrypoint script, e.g. /foo/bar/baz/banana.js -> baz
21+ 'entrypoint.basedir' : path . basename ( path . dirname ( ENTRYPOINT_PATH ) ) ,
22+
23+ // the .name field from the application's package.json
24+ 'package.json.name' : pkg . name
25+ }
26+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const {
1818 removeBaggageItem,
1919 removeAllBaggageItems
2020} = require ( './baggage' )
21+ const getProcessTags = require ( './process-tags' )
2122
2223class LazyModule {
2324 constructor ( provider ) {
@@ -78,6 +79,7 @@ class Tracer extends NoopProxy {
7879 this . getAllBaggageItems = getAllBaggageItems
7980 this . removeBaggageItem = removeBaggageItem
8081 this . removeAllBaggageItems = removeAllBaggageItems
82+ this . processTags = getProcessTags ( )
8183
8284 // these requires must work with esm bundler
8385 this . _modules = {
You can’t perform that action at this time.
0 commit comments