Skip to content

Commit 6239b2d

Browse files
authored
Add JSDoc and comment changes (NR-85069) (#389)
Adds JSDoc blocks and comments, primarily related to architectural changes from PR 358.
1 parent f05e865 commit 6239b2d

34 files changed

+449
-63
lines changed

babel-env-vars.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1+
/**
2+
* @file Derives a "version" for injection into the bundle. Used to configure Babel for NPM, Webpack, and test server.
3+
*/
4+
15
const pkg = require('./package.json')
26
const fs = require('fs')
37

48
const VERSION = fs.readFileSync('./VERSION', 'utf-8')
59

10+
/*
11+
* Version injection is currently complicated by the fact that NPM will build with package.json.version while CDN will
12+
* build with the value in the VERSION file, as well as subversion attributes such as PROD, DEV, LOCAL, etc. Once
13+
* aligned, this process will be simpler.
14+
*/
15+
16+
/**
17+
* Derives a build version based on the specified source and subversion and assigns the value to a process environment
18+
* variable called `BUILD_VERSION`.
19+
* @param {string} source - The desired source of the version number. Can be `VERSION` or `PACKAGE`.
20+
* @param {string} subversion - A build classification suffix (e.g. `PROD` or a PR number).
21+
* @returns {Array} - A configuration array with plugin configuration for
22+
* `babel-plugin-transform-inline-environment-variables`.
23+
* @see https://babeljs.io/docs/en/babel-plugin-transform-inline-environment-variables
24+
*/
625
module.exports = (source, subversion) => {
726
if (!process.env['BUILD_VERSION']) {
827
if (source === 'VERSION') process.env['BUILD_VERSION'] = `${VERSION}.${subversion || 'LOCAL'}`

babel.npm.cjs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @file Provides Babel configuration for compiling src/index.js into NPM package output (CommonJS).
3+
*/
4+
15
const babelEnv = require('./babel-env-vars')
26

37
const presets = [

babel.npm.esm.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @file Provides Babel configuration for compiling src/index.js into NPM package output (ES modules).
3+
*/
4+
15
const babelEnv = require('./babel-env-vars')
26

37
const presets = []

src/cdn/lite.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @file Creates a "Lite" agent loader bundle composed of the core Agent and a subset of available feature modules.
3+
*/
4+
15
import { Agent } from '../loaders/agent'
26

37
import { Instrument as InstrumentPageViewEvent } from '../features/page_view_event/instrument'

src/cdn/polyfills.js

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
/** IE9, IE10, IE11, and pre es6 browsers require some or all of the following polyfills. **/
1+
/**
2+
* @file Selectively imports {@link https://github.com/zloirock/core-js core-js}
3+
* polyfills needed for pre-ES6 browsers and IE 11.
4+
*/
5+
26
import 'core-js/stable/promise'
37
import 'core-js/stable/array/includes'
48
import 'core-js/stable/array/from'
@@ -10,29 +14,3 @@ import 'core-js/stable/object/values'
1014
import 'core-js/stable/map'
1115
import 'core-js/stable/reflect'
1216
import 'core-js/stable/set'
13-
14-
// promise
15-
// ie - none
16-
// safari - 7+
17-
// ios - 8+
18-
// chrome - 33+
19-
// edge - 12+
20-
// ff - 29+
21-
22-
// not in use currently.... but be aware this feature of promises has much different benchmark support
23-
// promise.any, promise.allSettled
24-
// ie - none
25-
// safari - 14+
26-
// ios - 14+
27-
// chrome - 85+
28-
// edge - 105+
29-
// ff - 79+
30-
31-
// making note because this feature of promises has different benchmark support
32-
// promise.any
33-
// ie - none
34-
// safari - 8
35-
// ios - 8+
36-
// chrome - 32+
37-
// edge - 12+
38-
// ff - 29+

src/cdn/polyfills/lite.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
/**
2+
* @file Creates a version of the "Lite" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
3+
* polyfills for pre-ES6 browsers and IE 11.
4+
*/
5+
16
import '../polyfills.js'
27
import '../lite'

src/cdn/polyfills/pro.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
/**
2+
* @file Creates a version of the "Pro" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
3+
* polyfills for pre-ES6 browsers and IE 11.
4+
*/
5+
16
import '../polyfills.js'
27
import '../pro'

src/cdn/polyfills/spa.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
/**
2+
* @file Creates a version of the "SPA" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
3+
* polyfills for pre-ES6 browsers and IE 11.
4+
*/
5+
16
import '../polyfills.js'
27
import '../spa'

src/cdn/pro.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* @file Creates a "Pro" agent loader bundle composed of the core Agent and all available feature modules except `spa`.
3+
* This excludes collection of BrowserInteraction and BrowserTiming events.
4+
*/
5+
16
import { Agent } from '../loaders/agent'
27

38
import { Instrument as InstrumentPageViewEvent } from '../features/page_view_event/instrument'

src/cdn/spa.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @file Creates a "SPA" agent loader bundle composed of the core agent and all available feature modules.
3+
*/
4+
15
import { Agent } from '../loaders/agent'
26

37
import { Instrument as InstrumentPageViewEvent } from '../features/page_view_event/instrument'

0 commit comments

Comments
 (0)