@openedx/frontend-build 13.0.15
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/.eslintignore +5 -0
- package/.eslintrc.js +10 -0
- package/.github/workflows/add-depr-ticket-to-depr-board.yml +19 -0
- package/.github/workflows/add-remove-label-on-comment.yml +20 -0
- package/.github/workflows/ci.yml +30 -0
- package/.github/workflows/commitlint.yml +10 -0
- package/.github/workflows/lockfileversion-check.yml +13 -0
- package/.github/workflows/release.yml +34 -0
- package/.github/workflows/self-assign-issue.yml +12 -0
- package/.github/workflows/sync-master-alpha.yml +35 -0
- package/.nvmrc +1 -0
- package/LICENSE +661 -0
- package/README.md +295 -0
- package/bin/fedx-scripts.js +88 -0
- package/config/.eslintrc.js +45 -0
- package/config/babel-preserve-modules.config.js +30 -0
- package/config/babel-typescript.config.js +5 -0
- package/config/babel.config.js +41 -0
- package/config/getLocalAliases.js +67 -0
- package/config/jest/fallback.env.config.js +12 -0
- package/config/jest/fileMock.js +1 -0
- package/config/jest/setupTest.js +10 -0
- package/config/jest/svgrMock.js +4 -0
- package/config/jest.config.js +43 -0
- package/config/webpack.common.config.js +40 -0
- package/config/webpack.dev-stage.config.js +191 -0
- package/config/webpack.dev.config.js +193 -0
- package/config/webpack.prod.config.js +219 -0
- package/coverage/clover.xml +6 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/docs/0001-non-usage-of-gatsby.rst +37 -0
- package/docs/0002-js-environment-config.md +47 -0
- package/docs/0003-fedx-scripts-serve.md +37 -0
- package/example/.env +0 -0
- package/example/.env.development +3 -0
- package/example/.env.test +2 -0
- package/example/.eslintignore +5 -0
- package/example/.eslintrc.js +3 -0
- package/example/dist/6.215b56a13e78398da5e3.js +3 -0
- package/example/dist/6.215b56a13e78398da5e3.js.LICENSE.txt +41 -0
- package/example/dist/6.215b56a13e78398da5e3.js.map +1 -0
- package/example/dist/app.80862a4da69beb9b3c51.css +3 -0
- package/example/dist/app.80862a4da69beb9b3c51.css.map +1 -0
- package/example/dist/app.80862a4da69beb9b3c51.js +2 -0
- package/example/dist/app.80862a4da69beb9b3c51.js.map +1 -0
- package/example/dist/b04e4301608fdcff39abf8f70b4a7de6.jpg +0 -0
- package/example/dist/babel/App.js +85 -0
- package/example/dist/babel/App.js.map +1 -0
- package/example/dist/babel/App.test.jsx +11 -0
- package/example/dist/babel/__snapshots__/App.test.jsx.snap +108 -0
- package/example/dist/babel/apple.jpg +0 -0
- package/example/dist/babel/apple.svg +1 -0
- package/example/dist/babel/index.js +13 -0
- package/example/dist/babel/index.js.map +1 -0
- package/example/dist/babel/style.scss +9 -0
- package/example/dist/cb28cdb1468c915e27e5cec9af64f22f.svg +1 -0
- package/example/dist/index.html +4 -0
- package/example/dist/report.html +39 -0
- package/example/dist/runtime.3eabd67eaf067d6c2f46.js +2 -0
- package/example/dist/runtime.3eabd67eaf067d6c2f46.js.map +1 -0
- package/example/env.config.js +6 -0
- package/example/node_modules/.package-lock.json +98 -0
- package/example/node_modules/js-tokens/CHANGELOG.md +151 -0
- package/example/node_modules/js-tokens/LICENSE +21 -0
- package/example/node_modules/js-tokens/README.md +240 -0
- package/example/node_modules/js-tokens/index.js +23 -0
- package/example/node_modules/js-tokens/package.json +30 -0
- package/example/node_modules/loose-envify/LICENSE +21 -0
- package/example/node_modules/loose-envify/README.md +45 -0
- package/example/node_modules/loose-envify/cli.js +16 -0
- package/example/node_modules/loose-envify/custom.js +4 -0
- package/example/node_modules/loose-envify/index.js +3 -0
- package/example/node_modules/loose-envify/loose-envify.js +36 -0
- package/example/node_modules/loose-envify/package.json +36 -0
- package/example/node_modules/loose-envify/replace.js +65 -0
- package/example/node_modules/object-assign/index.js +90 -0
- package/example/node_modules/object-assign/license +21 -0
- package/example/node_modules/object-assign/package.json +42 -0
- package/example/node_modules/object-assign/readme.md +61 -0
- package/example/node_modules/prop-types/LICENSE +21 -0
- package/example/node_modules/prop-types/README.md +302 -0
- package/example/node_modules/prop-types/checkPropTypes.js +103 -0
- package/example/node_modules/prop-types/factory.js +19 -0
- package/example/node_modules/prop-types/factoryWithThrowingShims.js +65 -0
- package/example/node_modules/prop-types/factoryWithTypeCheckers.js +610 -0
- package/example/node_modules/prop-types/index.js +19 -0
- package/example/node_modules/prop-types/lib/ReactPropTypesSecret.js +12 -0
- package/example/node_modules/prop-types/lib/has.js +1 -0
- package/example/node_modules/prop-types/package.json +60 -0
- package/example/node_modules/prop-types/prop-types.js +1315 -0
- package/example/node_modules/prop-types/prop-types.min.js +1 -0
- package/example/node_modules/react/LICENSE +21 -0
- package/example/node_modules/react/README.md +13 -0
- package/example/node_modules/react/build-info.json +8 -0
- package/example/node_modules/react/cjs/react-jsx-dev-runtime.development.js +889 -0
- package/example/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +9 -0
- package/example/node_modules/react/cjs/react-jsx-runtime.development.js +911 -0
- package/example/node_modules/react/cjs/react-jsx-runtime.production.min.js +10 -0
- package/example/node_modules/react/cjs/react.development.js +1912 -0
- package/example/node_modules/react/cjs/react.production.min.js +25 -0
- package/example/node_modules/react/index.js +7 -0
- package/example/node_modules/react/jsx-dev-runtime.js +7 -0
- package/example/node_modules/react/jsx-runtime.js +7 -0
- package/example/node_modules/react/package.json +44 -0
- package/example/node_modules/react/umd/react.development.js +3318 -0
- package/example/node_modules/react/umd/react.production.min.js +32 -0
- package/example/node_modules/react/umd/react.profiling.min.js +39 -0
- package/example/node_modules/react-dom/LICENSE +21 -0
- package/example/node_modules/react-dom/README.md +54 -0
- package/example/node_modules/react-dom/build-info.json +8 -0
- package/example/node_modules/react-dom/cjs/react-dom-server.browser.development.js +4043 -0
- package/example/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +54 -0
- package/example/node_modules/react-dom/cjs/react-dom-server.node.development.js +4085 -0
- package/example/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +55 -0
- package/example/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1480 -0
- package/example/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +35 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.development.js +141 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js +11 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.development.js +162 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +12 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js +1629 -0
- package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js +31 -0
- package/example/node_modules/react-dom/cjs/react-dom.development.js +25012 -0
- package/example/node_modules/react-dom/cjs/react-dom.production.min.js +292 -0
- package/example/node_modules/react-dom/cjs/react-dom.profiling.min.js +299 -0
- package/example/node_modules/react-dom/index.js +38 -0
- package/example/node_modules/react-dom/package.json +60 -0
- package/example/node_modules/react-dom/profiling.js +38 -0
- package/example/node_modules/react-dom/server.browser.js +7 -0
- package/example/node_modules/react-dom/server.js +3 -0
- package/example/node_modules/react-dom/server.node.js +7 -0
- package/example/node_modules/react-dom/test-utils.js +7 -0
- package/example/node_modules/react-dom/umd/react-dom-server.browser.development.js +4147 -0
- package/example/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +45 -0
- package/example/node_modules/react-dom/umd/react-dom-test-utils.development.js +1499 -0
- package/example/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +30 -0
- package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.development.js +141 -0
- package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.production.min.js +10 -0
- package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.development.js +1628 -0
- package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.production.min.js +28 -0
- package/example/node_modules/react-dom/umd/react-dom.development.js +25147 -0
- package/example/node_modules/react-dom/umd/react-dom.production.min.js +239 -0
- package/example/node_modules/react-dom/umd/react-dom.profiling.min.js +247 -0
- package/example/node_modules/react-dom/unstable-fizz.browser.js +7 -0
- package/example/node_modules/react-dom/unstable-fizz.js +3 -0
- package/example/node_modules/react-dom/unstable-fizz.node.js +7 -0
- package/example/node_modules/react-dom/unstable-native-dependencies.js +7 -0
- package/example/node_modules/react-is/LICENSE +21 -0
- package/example/node_modules/react-is/README.md +104 -0
- package/example/node_modules/react-is/build-info.json +8 -0
- package/example/node_modules/react-is/cjs/react-is.development.js +181 -0
- package/example/node_modules/react-is/cjs/react-is.production.min.js +15 -0
- package/example/node_modules/react-is/index.js +7 -0
- package/example/node_modules/react-is/package.json +27 -0
- package/example/node_modules/react-is/umd/react-is.development.js +181 -0
- package/example/node_modules/react-is/umd/react-is.production.min.js +13 -0
- package/example/node_modules/react-test-renderer/LICENSE +21 -0
- package/example/node_modules/react-test-renderer/README.md +26 -0
- package/example/node_modules/react-test-renderer/build-info.json +8 -0
- package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js +1019 -0
- package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.production.min.js +35 -0
- package/example/node_modules/react-test-renderer/cjs/react-test-renderer.development.js +15596 -0
- package/example/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js +181 -0
- package/example/node_modules/react-test-renderer/index.js +7 -0
- package/example/node_modules/react-test-renderer/package.json +41 -0
- package/example/node_modules/react-test-renderer/shallow.js +7 -0
- package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.development.js +1176 -0
- package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.production.min.js +31 -0
- package/example/node_modules/react-test-renderer/umd/react-test-renderer.development.js +15709 -0
- package/example/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js +151 -0
- package/example/node_modules/scheduler/LICENSE +21 -0
- package/example/node_modules/scheduler/README.md +9 -0
- package/example/node_modules/scheduler/build-info.json +8 -0
- package/example/node_modules/scheduler/cjs/scheduler-tracing.development.js +349 -0
- package/example/node_modules/scheduler/cjs/scheduler-tracing.production.min.js +10 -0
- package/example/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js +17 -0
- package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +857 -0
- package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
- package/example/node_modules/scheduler/cjs/scheduler.development.js +858 -0
- package/example/node_modules/scheduler/cjs/scheduler.production.min.js +21 -0
- package/example/node_modules/scheduler/index.js +7 -0
- package/example/node_modules/scheduler/package.json +39 -0
- package/example/node_modules/scheduler/tracing-profiling.js +7 -0
- package/example/node_modules/scheduler/tracing.js +7 -0
- package/example/node_modules/scheduler/umd/scheduler-tracing.development.js +80 -0
- package/example/node_modules/scheduler/umd/scheduler-tracing.production.min.js +80 -0
- package/example/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js +80 -0
- package/example/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +857 -0
- package/example/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +17 -0
- package/example/node_modules/scheduler/umd/scheduler.development.js +152 -0
- package/example/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
- package/example/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
- package/example/node_modules/scheduler/unstable_mock.js +7 -0
- package/example/package-lock.json +110 -0
- package/example/package.json +24 -0
- package/example/public/index.html +13 -0
- package/example/src/App.jsx +40 -0
- package/example/src/App.test.jsx +11 -0
- package/example/src/__snapshots__/App.test.jsx.snap +108 -0
- package/example/src/apple.jpg +0 -0
- package/example/src/apple.svg +1 -0
- package/example/src/index.jsx +13 -0
- package/example/src/style.scss +9 -0
- package/index.js +7 -0
- package/lib/ConfigPreset.js +28 -0
- package/lib/createConfig.js +7 -0
- package/lib/formatter.js +10 -0
- package/lib/getBaseConfig.js +9 -0
- package/lib/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.js +86 -0
- package/lib/plugins/html-webpack-new-relic-plugin/LICENSE +21 -0
- package/lib/plugins/html-webpack-new-relic-plugin/README.md +7 -0
- package/lib/plugins/html-webpack-new-relic-plugin/index.js +3 -0
- package/lib/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.js +80 -0
- package/lib/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +1 -0
- package/lib/presets.js +75 -0
- package/lib/resolveFilepaths.js +14 -0
- package/lib/resolvePrivateEnvConfig.js +15 -0
- package/lib/scripts/serve.js +78 -0
- package/openedx.yaml +10 -0
- package/package.json +95 -0
- package/renovate.json +22 -0
- package/smoke-test.sh +11 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Basic test should render 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<h1>
|
|
6
|
+
Test page
|
|
7
|
+
</h1>
|
|
8
|
+
<h2>
|
|
9
|
+
SCSS parsing tests
|
|
10
|
+
</h2>
|
|
11
|
+
<h3>
|
|
12
|
+
The Apples
|
|
13
|
+
</h3>
|
|
14
|
+
("The Apples" should be red)
|
|
15
|
+
<h2>
|
|
16
|
+
ES6 parsing tests
|
|
17
|
+
</h2>
|
|
18
|
+
<ul>
|
|
19
|
+
<li>
|
|
20
|
+
macintosh
|
|
21
|
+
</li>
|
|
22
|
+
<li>
|
|
23
|
+
granny smith
|
|
24
|
+
</li>
|
|
25
|
+
<li>
|
|
26
|
+
fuji
|
|
27
|
+
</li>
|
|
28
|
+
<li>
|
|
29
|
+
golden delicious
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
<h2>
|
|
33
|
+
JSX parsing tests
|
|
34
|
+
</h2>
|
|
35
|
+
<IconMock
|
|
36
|
+
style={
|
|
37
|
+
Object {
|
|
38
|
+
"width": "10rem",
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/>
|
|
42
|
+
<h2>
|
|
43
|
+
Asset import tests
|
|
44
|
+
</h2>
|
|
45
|
+
<img
|
|
46
|
+
alt="apple"
|
|
47
|
+
src="icon/mock/path"
|
|
48
|
+
style={
|
|
49
|
+
Object {
|
|
50
|
+
"width": "10rem",
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/>
|
|
54
|
+
<img
|
|
55
|
+
alt="apple"
|
|
56
|
+
src="icon/mock/path"
|
|
57
|
+
style={
|
|
58
|
+
Object {
|
|
59
|
+
"width": "10rem",
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/>
|
|
63
|
+
<br />
|
|
64
|
+
<img
|
|
65
|
+
alt="apple"
|
|
66
|
+
src="test-file-stub"
|
|
67
|
+
style={
|
|
68
|
+
Object {
|
|
69
|
+
"width": "10rem",
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
<p>
|
|
74
|
+
Photo by Louis Hansel @shotsoflouis on Unsplash
|
|
75
|
+
</p>
|
|
76
|
+
<h2>
|
|
77
|
+
process.env tests
|
|
78
|
+
</h2>
|
|
79
|
+
<p>
|
|
80
|
+
Test process.env variable:
|
|
81
|
+
foo
|
|
82
|
+
</p>
|
|
83
|
+
<p>
|
|
84
|
+
Non-existent process.env variable (nothing here is good):
|
|
85
|
+
</p>
|
|
86
|
+
<h2>
|
|
87
|
+
env.config.js tests
|
|
88
|
+
</h2>
|
|
89
|
+
<p>
|
|
90
|
+
<span>
|
|
91
|
+
env.config.js boolean test:
|
|
92
|
+
</span>
|
|
93
|
+
Good, false meant false. We did not cast a boolean to a string.
|
|
94
|
+
</p>
|
|
95
|
+
<p>
|
|
96
|
+
env.config.js integer test:
|
|
97
|
+
It was an integer. Great.
|
|
98
|
+
</p>
|
|
99
|
+
<h2>
|
|
100
|
+
Right-to-left language handling tests
|
|
101
|
+
</h2>
|
|
102
|
+
<p
|
|
103
|
+
className="text-align-right"
|
|
104
|
+
>
|
|
105
|
+
I'm aligned right, but left in RTL.
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
`;
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" data-name="Слой 1" viewBox="0 0 100 125" x="0px" y="0px"><title>Безымянный-1</title><g><path d="M48.29173,20.91309c.44045,2.67407.81828,4.968,1.25786,7.63686a29.75307,29.75307,0,0,0,3.91278-.37779c2.38512-.53346,4.71271-1.32728,7.10142-1.83905.66415-.14232,1.45907.32571,2.194.51374-.51414.48731-.94651,1.22009-1.55542,1.4231a42.59057,42.59057,0,0,1-15.1772,2.408,20.86177,20.86177,0,0,1-11.07629-3.71148,2.81986,2.81986,0,0,1-.51721-.49108,1.71988,1.71988,0,0,1-.175-.42192c.86026-1.19467,1.8261-.49218,2.778-.1154a46.95591,46.95591,0,0,0,5.50622,2.10209c2.1421.54764,2.49613.11136,2.15817-2.0335-.15791-1.00211-.45371-1.98313-.69919-2.9707a2.10178,2.10178,0,0,0-2.20542-1.71675,16.69777,16.69777,0,0,0-8.17976,1.66586c-1.21465.59569-2.44545,1.79479-4.57394.26q.91125-.52011,1.8225-1.04022a19.5657,19.5657,0,0,1,8.76662-2.94536c3.64447-.18813,3.3542-.397,4.83215-3.62009A43.17637,43.17637,0,0,1,49.38579,8.1986,27.03146,27.03146,0,0,1,52.78013,4.7669c.88679-.82751,2.099-1.13929,2.86044-.14869a2.95022,2.95022,0,0,1,.25154,2.67767A17.62547,17.62547,0,0,1,52.64,11.07318a11.939,11.939,0,0,0-3.691,7.01548,9.58451,9.58451,0,0,0-.00957,1.43118c4.67257-.53271,8.678,1.549,12.91179,2.71,1.42367.39039,3.072-.10087,4.61592-.07659,7.75187.12182,15.0069,1.70433,20.62774,7.56383a16.18131,16.18131,0,0,1,2.4769,3.90158,33.47619,33.47619,0,0,1,3.61715,18.76,57.39218,57.39218,0,0,1-3.11865,15.24337c-2.93307,7.71726-6.35779,15.17206-13.49812,20.07157a43.38827,43.38827,0,0,1-12.24457,6.25692c-1.14482.33576-2.26435.75733-3.39644,1.13692-4.80036,1.60938-9.57586.76787-14.37288-.07461-3.17591-.55779-6.3808-.95626-9.57884-1.38046a29.929,29.929,0,0,1-10.19653-3.69123c-4.50508-2.4015-8.054-5.78138-11.4774-9.37706A25.717,25.717,0,0,1,8.50666,67.54893,80.91649,80.91649,0,0,1,6.94228,44.17515c.52046-5.42775,2.03161-10.59663,5.905-14.45175,2.29913-2.28824,5.55312-3.65369,8.46933-5.26865a12.9111,12.9111,0,0,1,4.2301-1.42657c.71509-.1093,1.55884.62326,2.34436.97484a7.64709,7.64709,0,0,1-1.97233,1.10934c-4.79315,1.02586-9.26319,2.8239-12.29393,6.77242a24.38788,24.38788,0,0,0-4.743,13.48973,78.54727,78.54727,0,0,0,.41718,16.10944c1.07008,7.83658,3.75794,14.71927,10.052,20.00759a65.57961,65.57961,0,0,0,10.197,7.57349c4.09212,2.26826,8.61029,2.83369,13.1209,3.43065,3.11373.41208,6.235.427,9.37842,1.052,2.95178.58686,6.32407-.08449,9.33969-.86514A43.9325,43.9325,0,0,0,75.82337,85.6054a23.05284,23.05284,0,0,0,8.21682-10.00235c1.84358-4.47166,3.65114-8.96041,5.35771-13.48574,1.72782-4.58158,1.36369-9.43433,1.628-14.20465.26085-4.70673-1.32794-8.91356-3.338-13.02592-2.8196-5.76882-7.84365-8.5485-13.77934-9.91386a63.14758,63.14758,0,0,0-7.30061-.85715c-.29677-.03236-.66318-.13762-.88784-.01256-3.43263,1.91081-6.27313-.39109-9.33231-1.23972C53.881,22.16813,51.32861,21.63726,48.29173,20.91309Z"/><path d="M18.80551,79.4219A93.68635,93.68635,0,0,1,14.374,70.982c-2.23379-5.47935-2.67758-11.37723-3.2698-17.1937-.46425-4.55984.35623-9.05636,1.40022-13.49426a1.91994,1.91994,0,0,1,.54725-1.10293,5.32017,5.32017,0,0,1,1.50175-.48028c.06886.48819.37168,1.12159.17205,1.44313-3.97083,6.39657-2.75908,13.27394-2.04558,20.14746a39.84049,39.84049,0,0,0,4.424,14.10224c.79439,1.55454,1.70279,3.05071,2.5591,4.57359Q19.23423,79.19954,18.80551,79.4219Z"/><path d="M71.06622,81.56681c-1.856,2.46258-3.67635,4.95383-5.60617,7.35713-.29422.36637-1.09582.32535-1.66274.47277.11409-.534.05832-1.21408.37081-1.5775,1.6291-1.89438,3.327-3.73212,5.05971-5.533a7.53926,7.53926,0,0,1,1.615-.99912Z"/><path d="M64.62508,58.93776q-.52275,5.53883-1.04549,11.07761l-.56253-.02587c.04734-.932.14044-1.8643.13306-2.79584-.01888-2.38011-.12981-4.76066-.091-7.13914.00834-.51317.49166-1.01857.75619-1.52757Z"/><path d="M16.30692,54.97435c-.11374-.165-.33251-.33506-.33708-.51076-.08414-3.19571-.15835-6.392-.18637-9.58855a2.17449,2.17449,0,0,1,.44159-1.14816.8251.8251,0,0,1,.7359-.271.78393.78393,0,0,1,.38091.67113c-1.24846,3.49986-1.023,7.10006-.7936,10.70382C16.54985,54.8553,16.4593,54.88569,16.30692,54.97435Z"/><path d="M73.75838,52.91472c-.48393-1.65238-1.01168-3.29426-1.409-4.96718-.06771-.28473.42368-.70226.65677-1.05845.35052.25786.97181.48331,1.0072.77894.205,1.71337.272,3.44317.38582,5.16743Z"/><path d="M53.80963,71.39829l.79387-7.98009.47277.04527c.72984,2.75575-.035,5.37953-.74609,8.008Z"/><path d="M50.79682,89.66423l1.35754-1.74481a6.14642,6.14642,0,0,1,1.01616,1.95995c.0628.54677-.47954,1.163-.75338,1.74846C51.92847,91.03561,51.43971,90.44339,50.79682,89.66423Z"/><path d="M79.7083,75.52546c.48577-1.448.84059-2.5057,1.24187-3.70182C81.85567,73.925,81.65841,74.73756,79.7083,75.52546Z"/><path d="M44.12531,88.24508a9.73247,9.73247,0,0,1,1.02187-.91533,6.00615,6.00615,0,0,1,1.23774,1.3077c.06464.099-.56824.82452-.61532.79773A16.2951,16.2951,0,0,1,44.12531,88.24508Z"/><path d="M52.80279,79.59158l.46926-4.3877.68426.08313-.57913,4.42907Z"/></g><text x="0" y="115" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Roman</text><text x="0" y="120" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ReactDOM from 'react-dom';
|
|
2
|
+
import App from './App';
|
|
3
|
+
|
|
4
|
+
// This line is to emulate what frontend-platform does when i18n initializes.
|
|
5
|
+
// It's necessary because our stylesheet is generated with `[dir="ltr"]` as a prefix on all
|
|
6
|
+
// direction-sensitive CSS classes. Without this line, those classes wouldn't be applied to the
|
|
7
|
+
// document. See: https://github.com/openedx/frontend-platform/blob/master/src/i18n/lib.js#L186
|
|
8
|
+
global.document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');
|
|
9
|
+
|
|
10
|
+
ReactDOM.render(
|
|
11
|
+
<App />,
|
|
12
|
+
document.getElementById('root'),
|
|
13
|
+
);
|
package/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const resolveFilepaths = require('./resolveFilepaths');
|
|
3
|
+
|
|
4
|
+
const defaultConfigDir = path.resolve(__dirname, '../config');
|
|
5
|
+
|
|
6
|
+
function ConfigPreset({
|
|
7
|
+
defaultDir = defaultConfigDir,
|
|
8
|
+
defaultFilename,
|
|
9
|
+
searchFilenames,
|
|
10
|
+
searchFilepaths,
|
|
11
|
+
}) {
|
|
12
|
+
return {
|
|
13
|
+
defaultFilename,
|
|
14
|
+
getDefault: () => require(require.resolve(`./${defaultFilename}`, { paths: [defaultDir] })),
|
|
15
|
+
get defaultFilepath() {
|
|
16
|
+
console.log('getting default filepath', defaultFilename, defaultDir);
|
|
17
|
+
return require.resolve(`./${defaultFilename}`, { paths: [defaultDir] });
|
|
18
|
+
},
|
|
19
|
+
get resolvedFilepath() {
|
|
20
|
+
return resolveFilepaths(
|
|
21
|
+
searchFilenames.map(filename => `./${filename}`),
|
|
22
|
+
[...searchFilepaths, defaultDir],
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = ConfigPreset;
|
package/lib/formatter.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// This class comes from https://github.com/victorrodrigues/html-webpack-new-relic-plugin.
|
|
2
|
+
// We're bringing it in so that we can more easily maintain the new relic snippet, and haven't found
|
|
3
|
+
// much value in having it in a separate package.
|
|
4
|
+
|
|
5
|
+
/* eslint no-useless-escape: [0] */
|
|
6
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
7
|
+
|
|
8
|
+
class HtmlWebpackNewRelicPlugin {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = {
|
|
11
|
+
accountID: undefined,
|
|
12
|
+
agentID: undefined,
|
|
13
|
+
applicationID: undefined,
|
|
14
|
+
licenseKey: undefined,
|
|
15
|
+
trustKey: undefined,
|
|
16
|
+
...options,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//
|
|
20
|
+
/**
|
|
21
|
+
* New Relic Pro+SPA snippet (version 1212)
|
|
22
|
+
*
|
|
23
|
+
***********************************************************************************************
|
|
24
|
+
* READ THIS BEFORE UPDATING BELOW
|
|
25
|
+
***********************************************************************************************
|
|
26
|
+
*
|
|
27
|
+
* If you update this to the latest version, there are three things you must do:
|
|
28
|
+
*
|
|
29
|
+
* 1. Update the version number above. You can find the version number by searching for
|
|
30
|
+
* 'js-agent.newrelic.com/nr-spa' in the new snippet and copying the number up above.
|
|
31
|
+
*
|
|
32
|
+
* 2. Replace the hard-coded values for accountID, agentID, applicationID, licenseKey, and trustKey
|
|
33
|
+
* with the options above, via string interpolation: ${this.options.accountId} for instance.
|
|
34
|
+
*
|
|
35
|
+
* 3. Because this snippet is in a string here, you need to ensure that it is escaped properly.
|
|
36
|
+
* As of this writing, that means escaping any backslashes ('\') in it.
|
|
37
|
+
* There are a number of them in regexes that will get stripped out unless they're escaped.
|
|
38
|
+
*
|
|
39
|
+
* As an example, this is original code from New Relic's snippet:
|
|
40
|
+
*
|
|
41
|
+
* a=/Version\/(\S+)\s+Safari/
|
|
42
|
+
*
|
|
43
|
+
* If that's put directly into the string below, it'll become this when dumped into the page:
|
|
44
|
+
*
|
|
45
|
+
* a=/Version/(\S+)s+Safari/
|
|
46
|
+
*
|
|
47
|
+
* Which is NOT the correct regex.
|
|
48
|
+
*
|
|
49
|
+
* Instead, EDIT THE SNIPPET YOU GET FROM NEW RELIC to escape backslashes:
|
|
50
|
+
*
|
|
51
|
+
* a=/Version\\/(\\S+)\\s+Safari/
|
|
52
|
+
*
|
|
53
|
+
* The above is an example of the correct escaping.
|
|
54
|
+
*/
|
|
55
|
+
this.newRelicString = `
|
|
56
|
+
;window.NREUM||(NREUM={});NREUM.init={privacy:{cookies_enabled:true},ajax:{deny_list:["bam-cell.nr-data.net"]}};
|
|
57
|
+
window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o||e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,n){function r(t){try{s.console&&console.log(t)}catch(e){}}var o,i=t("ee"),a=t(32),s={};try{o=localStorage.getItem("__nr_flags").split(","),console&&"function"==typeof console.log&&(s.console=!0,o.indexOf("dev")!==-1&&(s.dev=!0),o.indexOf("nr_dev")!==-1&&(s.nrDev=!0))}catch(c){}s.nrDev&&i.on("internal-error",function(t){r(t.stack)}),s.dev&&i.on("fn-err",function(t,e,n){r(n.stack)}),s.dev&&(r("NR AGENT IN DEVELOPMENT MODE"),r("flags: "+a(s,function(t,e){return t}).join(", ")))},{}],2:[function(t,e,n){function r(t,e,n,r,s){try{l?l-=1:o(s||new UncaughtException(t,e,n),!0)}catch(f){try{i("ierr",[f,c.now(),!0])}catch(d){}}return"function"==typeof u&&u.apply(this,a(arguments))}function UncaughtException(t,e,n){this.message=t||"Uncaught error with no additional information",this.sourceURL=e,this.line=n}function o(t,e){var n=e?null:c.now();i("err",[t,n])}var i=t("handle"),a=t(33),s=t("ee"),c=t("loader"),f=t("gos"),u=window.onerror,d=!1,p="nr@seenError";if(!c.disabled){var l=0;c.features.err=!0,t(1),window.onerror=r;try{throw new Error}catch(h){"stack"in h&&(t(14),t(13),"addEventListener"in window&&t(7),c.xhrWrappable&&t(15),d=!0)}s.on("fn-start",function(t,e,n){d&&(l+=1)}),s.on("fn-err",function(t,e,n){d&&!n[p]&&(f(n,p,function(){return!0}),this.thrown=!0,o(n))}),s.on("fn-end",function(){d&&!this.thrown&&l>0&&(l-=1)}),s.on("internal-error",function(t){i("ierr",[t,c.now(),!0])})}},{}],3:[function(t,e,n){var r=t("loader");r.disabled||(r.features.ins=!0)},{}],4:[function(t,e,n){function r(){U++,L=g.hash,this[u]=y.now()}function o(){U--,g.hash!==L&&i(0,!0);var t=y.now();this[h]=~~this[h]+t-this[u],this[d]=t}function i(t,e){E.emit("newURL",[""+g,e])}function a(t,e){t.on(e,function(){this[e]=y.now()})}var s="-start",c="-end",f="-body",u="fn"+s,d="fn"+c,p="cb"+s,l="cb"+c,h="jsTime",m="fetch",v="addEventListener",w=window,g=w.location,y=t("loader");if(w[v]&&y.xhrWrappable&&!y.disabled){var x=t(11),b=t(12),E=t(9),R=t(7),O=t(14),T=t(8),P=t(15),S=t(10),M=t("ee"),N=M.get("tracer"),C=t(23);t(17),y.features.spa=!0;var L,U=0;M.on(u,r),b.on(p,r),S.on(p,r),M.on(d,o),b.on(l,o),S.on(l,o),M.buffer([u,d,"xhr-resolved"]),R.buffer([u]),O.buffer(["setTimeout"+c,"clearTimeout"+s,u]),P.buffer([u,"new-xhr","send-xhr"+s]),T.buffer([m+s,m+"-done",m+f+s,m+f+c]),E.buffer(["newURL"]),x.buffer([u]),b.buffer(["propagate",p,l,"executor-err","resolve"+s]),N.buffer([u,"no-"+u]),S.buffer(["new-jsonp","cb-start","jsonp-error","jsonp-end"]),a(T,m+s),a(T,m+"-done"),a(S,"new-jsonp"),a(S,"jsonp-end"),a(S,"cb-start"),E.on("pushState-end",i),E.on("replaceState-end",i),w[v]("hashchange",i,C(!0)),w[v]("load",i,C(!0)),w[v]("popstate",function(){i(0,U>1)},C(!0))}},{}],5:[function(t,e,n){function r(){var t=new PerformanceObserver(function(t,e){var n=t.getEntries();s(v,[n])});try{t.observe({entryTypes:["resource"]})}catch(e){}}function o(t){if(s(v,[window.performance.getEntriesByType(w)]),window.performance["c"+p])try{window.performance[h](m,o,!1)}catch(t){}else try{window.performance[h]("webkit"+m,o,!1)}catch(t){}}function i(t){}if(window.performance&&window.performance.timing&&window.performance.getEntriesByType){var a=t("ee"),s=t("handle"),c=t(14),f=t(13),u=t(6),d=t(23),p="learResourceTimings",l="addEventListener",h="removeEventListener",m="resourcetimingbufferfull",v="bstResource",w="resource",g="-start",y="-end",x="fn"+g,b="fn"+y,E="bstTimer",R="pushState",O=t("loader");if(!O.disabled){O.features.stn=!0,t(9),"addEventListener"in window&&t(7);var T=NREUM.o.EV;a.on(x,function(t,e){var n=t[0];n instanceof T&&(this.bstStart=O.now())}),a.on(b,function(t,e){var n=t[0];n instanceof T&&s("bst",[n,e,this.bstStart,O.now()])}),c.on(x,function(t,e,n){this.bstStart=O.now(),this.bstType=n}),c.on(b,function(t,e){s(E,[e,this.bstStart,O.now(),this.bstType])}),f.on(x,function(){this.bstStart=O.now()}),f.on(b,function(t,e){s(E,[e,this.bstStart,O.now(),"requestAnimationFrame"])}),a.on(R+g,function(t){this.time=O.now(),this.startPath=location.pathname+location.hash}),a.on(R+y,function(t){s("bstHist",[location.pathname+location.hash,this.startPath,this.time])}),u()?(s(v,[window.performance.getEntriesByType("resource")]),r()):l in window.performance&&(window.performance["c"+p]?window.performance[l](m,o,d(!1)):window.performance[l]("webkit"+m,o,d(!1))),document[l]("scroll",i,d(!1)),document[l]("keypress",i,d(!1)),document[l]("click",i,d(!1))}}},{}],6:[function(t,e,n){e.exports=function(){return"PerformanceObserver"in window&&"function"==typeof window.PerformanceObserver}},{}],7:[function(t,e,n){function r(t){for(var e=t;e&&!e.hasOwnProperty(u);)e=Object.getPrototypeOf(e);e&&o(e)}function o(t){s.inPlace(t,[u,d],"-",i)}function i(t,e){return t[1]}var a=t("ee").get("events"),s=t("wrap-function")(a,!0),c=t("gos"),f=XMLHttpRequest,u="addEventListener",d="removeEventListener";e.exports=a,"getPrototypeOf"in Object?(r(document),r(window),r(f.prototype)):f.prototype.hasOwnProperty(u)&&(o(window),o(f.prototype)),a.on(u+"-start",function(t,e){var n=t[1];if(null!==n&&("function"==typeof n||"object"==typeof n)){var r=c(n,"nr@wrapped",function(){function t(){if("function"==typeof n.handleEvent)return n.handleEvent.apply(n,arguments)}var e={object:t,"function":n}[typeof n];return e?s(e,"fn-",null,e.name||"anonymous"):n});this.wrapped=t[1]=r}}),a.on(d+"-start",function(t){t[1]=this.wrapped||t[1]})},{}],8:[function(t,e,n){function r(t,e,n){var r=t[e];"function"==typeof r&&(t[e]=function(){var t=i(arguments),e={};o.emit(n+"before-start",[t],e);var a;e[m]&&e[m].dt&&(a=e[m].dt);var s=r.apply(this,t);return o.emit(n+"start",[t,a],s),s.then(function(t){return o.emit(n+"end",[null,t],s),t},function(t){throw o.emit(n+"end",[t],s),t})})}var o=t("ee").get("fetch"),i=t(33),a=t(32);e.exports=o;var s=window,c="fetch-",f=c+"body-",u=["arrayBuffer","blob","json","text","formData"],d=s.Request,p=s.Response,l=s.fetch,h="prototype",m="nr@context";d&&p&&l&&(a(u,function(t,e){r(d[h],e,f),r(p[h],e,f)}),r(s,"fetch",c),o.on(c+"end",function(t,e){var n=this;if(e){var r=e.headers.get("content-length");null!==r&&(n.rxSize=r),o.emit(c+"done",[null,e],n)}else o.emit(c+"done",[t],n)}))},{}],9:[function(t,e,n){var r=t("ee").get("history"),o=t("wrap-function")(r);e.exports=r;var i=window.history&&window.history.constructor&&window.history.constructor.prototype,a=window.history;i&&i.pushState&&i.replaceState&&(a=i),o.inPlace(a,["pushState","replaceState"],"-")},{}],10:[function(t,e,n){function r(t){function e(){f.emit("jsonp-end",[],l),t.removeEventListener("load",e,c(!1)),t.removeEventListener("error",n,c(!1))}function n(){f.emit("jsonp-error",[],l),f.emit("jsonp-end",[],l),t.removeEventListener("load",e,c(!1)),t.removeEventListener("error",n,c(!1))}var r=t&&"string"==typeof t.nodeName&&"script"===t.nodeName.toLowerCase();if(r){var o="function"==typeof t.addEventListener;if(o){var a=i(t.src);if(a){var d=s(a),p="function"==typeof d.parent[d.key];if(p){var l={};u.inPlace(d.parent,[d.key],"cb-",l),t.addEventListener("load",e,c(!1)),t.addEventListener("error",n,c(!1)),f.emit("new-jsonp",[t.src],l)}}}}}function o(){return"addEventListener"in window}function i(t){var e=t.match(d);return e?e[1]:null}function a(t,e){var n=t.match(l),r=n[1],o=n[3];return o?a(o,e[r]):e[r]}function s(t){var e=t.match(p);return e&&e.length>=3?{key:e[2],parent:a(e[1],window)}:{key:t,parent:window}}var c=t(23),f=t("ee").get("jsonp"),u=t("wrap-function")(f);if(e.exports=f,o()){var d=/[?&](?:callback|cb)=([^&#]+)/,p=/(.*)\\.([^.]+)/,l=/^(\\w+)(\\.|$)(.*)$/,h=["appendChild","insertBefore","replaceChild"];Node&&Node.prototype&&Node.prototype.appendChild?u.inPlace(Node.prototype,h,"dom-"):(u.inPlace(HTMLElement.prototype,h,"dom-"),u.inPlace(HTMLHeadElement.prototype,h,"dom-"),u.inPlace(HTMLBodyElement.prototype,h,"dom-")),f.on("dom-start",function(t){r(t[0])})}},{}],11:[function(t,e,n){var r=t("ee").get("mutation"),o=t("wrap-function")(r),i=NREUM.o.MO;e.exports=r,i&&(window.MutationObserver=function(t){return this instanceof i?new i(o(t,"fn-")):i.apply(this,arguments)},MutationObserver.prototype=i.prototype)},{}],12:[function(t,e,n){function r(t){var e=i.context(),n=s(t,"executor-",e,null,!1),r=new f(n);return i.context(r).getCtx=function(){return e},r}var o=t("wrap-function"),i=t("ee").get("promise"),a=t("ee").getOrSetContext,s=o(i),c=t(32),f=NREUM.o.PR;e.exports=i,f&&(window.Promise=r,["all","race"].forEach(function(t){var e=f[t];f[t]=function(n){function r(t){return function(){i.emit("propagate",[null,!o],a,!1,!1),o=o||!t}}var o=!1;c(n,function(e,n){Promise.resolve(n).then(r("all"===t),r(!1))});var a=e.apply(f,arguments),s=f.resolve(a);return s}}),["resolve","reject"].forEach(function(t){var e=f[t];f[t]=function(t){var n=e.apply(f,arguments);return t!==n&&i.emit("propagate",[t,!0],n,!1,!1),n}}),f.prototype["catch"]=function(t){return this.then(null,t)},f.prototype=Object.create(f.prototype,{constructor:{value:r}}),c(Object.getOwnPropertyNames(f),function(t,e){try{r[e]=f[e]}catch(n){}}),o.wrapInPlace(f.prototype,"then",function(t){return function(){var e=this,n=o.argsToArray.apply(this,arguments),r=a(e);r.promise=e,n[0]=s(n[0],"cb-",r,null,!1),n[1]=s(n[1],"cb-",r,null,!1);var c=t.apply(this,n);return r.nextPromise=c,i.emit("propagate",[e,!0],c,!1,!1),c}}),i.on("executor-start",function(t){t[0]=s(t[0],"resolve-",this,null,!1),t[1]=s(t[1],"resolve-",this,null,!1)}),i.on("executor-err",function(t,e,n){t[1](n)}),i.on("cb-end",function(t,e,n){i.emit("propagate",[n,!0],this.nextPromise,!1,!1)}),i.on("propagate",function(t,e,n){this.getCtx&&!e||(this.getCtx=function(){if(t instanceof Promise)var e=i.context(t);return e&&e.getCtx?e.getCtx():this})}),r.toString=function(){return""+f})},{}],13:[function(t,e,n){var r=t("ee").get("raf"),o=t("wrap-function")(r),i="equestAnimationFrame";e.exports=r,o.inPlace(window,["r"+i,"mozR"+i,"webkitR"+i,"msR"+i],"raf-"),r.on("raf-start",function(t){t[0]=o(t[0],"fn-")})},{}],14:[function(t,e,n){function r(t,e,n){t[0]=a(t[0],"fn-",null,n)}function o(t,e,n){this.method=n,this.timerDuration=isNaN(t[1])?0:+t[1],t[0]=a(t[0],"fn-",this,n)}var i=t("ee").get("timer"),a=t("wrap-function")(i),s="setTimeout",c="setInterval",f="clearTimeout",u="-start",d="-";e.exports=i,a.inPlace(window,[s,"setImmediate"],s+d),a.inPlace(window,[c],c+d),a.inPlace(window,[f,"clearImmediate"],f+d),i.on(c+u,r),i.on(s+u,o)},{}],15:[function(t,e,n){function r(t,e){d.inPlace(e,["onreadystatechange"],"fn-",s)}function o(){var t=this,e=u.context(t);t.readyState>3&&!e.resolved&&(e.resolved=!0,u.emit("xhr-resolved",[],t)),d.inPlace(t,y,"fn-",s)}function i(t){x.push(t),m&&(E?E.then(a):w?w(a):(R=-R,O.data=R))}function a(){for(var t=0;t<x.length;t++)r([],x[t]);x.length&&(x=[])}function s(t,e){return e}function c(t,e){for(var n in t)e[n]=t[n];return e}t(7);var f=t("ee"),u=f.get("xhr"),d=t("wrap-function")(u),p=t(23),l=NREUM.o,h=l.XHR,m=l.MO,v=l.PR,w=l.SI,g="readystatechange",y=["onload","onerror","onabort","onloadstart","onloadend","onprogress","ontimeout"],x=[];e.exports=u;var b=window.XMLHttpRequest=function(t){var e=new h(t);try{u.emit("new-xhr",[e],e),e.addEventListener(g,o,p(!1))}catch(n){try{u.emit("internal-error",[n])}catch(r){}}return e};if(c(h,b),b.prototype=h.prototype,d.inPlace(b.prototype,["open","send"],"-xhr-",s),u.on("send-xhr-start",function(t,e){r(t,e),i(e)}),u.on("open-xhr-start",r),m){var E=v&&v.resolve();if(!w&&!v){var R=1,O=document.createTextNode(R);new m(a).observe(O,{characterData:!0})}}else f.on("fn-end",function(t){t[0]&&t[0].type===g||a()})},{}],16:[function(t,e,n){function r(t){if(!s(t))return null;var e=window.NREUM;if(!e.loader_config)return null;var n=(e.loader_config.accountID||"").toString()||null,r=(e.loader_config.agentID||"").toString()||null,f=(e.loader_config.trustKey||"").toString()||null;if(!n||!r)return null;var h=l.generateSpanId(),m=l.generateTraceId(),v=Date.now(),w={spanId:h,traceId:m,timestamp:v};return(t.sameOrigin||c(t)&&p())&&(w.traceContextParentHeader=o(h,m),w.traceContextStateHeader=i(h,v,n,r,f)),(t.sameOrigin&&!u()||!t.sameOrigin&&c(t)&&d())&&(w.newrelicHeader=a(h,m,v,n,r,f)),w}function o(t,e){return"00-"+e+"-"+t+"-01"}function i(t,e,n,r,o){var i=0,a="",s=1,c="",f="";return o+"@nr="+i+"-"+s+"-"+n+"-"+r+"-"+t+"-"+a+"-"+c+"-"+f+"-"+e}function a(t,e,n,r,o,i){var a="btoa"in window&&"function"==typeof window.btoa;if(!a)return null;var s={v:[0,1],d:{ty:"Browser",ac:r,ap:o,id:t,tr:e,ti:n}};return i&&r!==i&&(s.d.tk=i),btoa(JSON.stringify(s))}function s(t){return f()&&c(t)}function c(t){var e=!1,n={};if("init"in NREUM&&"distributed_tracing"in NREUM.init&&(n=NREUM.init.distributed_tracing),t.sameOrigin)e=!0;else if(n.allowed_origins instanceof Array)for(var r=0;r<n.allowed_origins.length;r++){var o=h(n.allowed_origins[r]);if(t.hostname===o.hostname&&t.protocol===o.protocol&&t.port===o.port){e=!0;break}}return e}function f(){return"init"in NREUM&&"distributed_tracing"in NREUM.init&&!!NREUM.init.distributed_tracing.enabled}function u(){return"init"in NREUM&&"distributed_tracing"in NREUM.init&&!!NREUM.init.distributed_tracing.exclude_newrelic_header}function d(){return"init"in NREUM&&"distributed_tracing"in NREUM.init&&NREUM.init.distributed_tracing.cors_use_newrelic_header!==!1}function p(){return"init"in NREUM&&"distributed_tracing"in NREUM.init&&!!NREUM.init.distributed_tracing.cors_use_tracecontext_headers}var l=t(29),h=t(18);e.exports={generateTracePayload:r,shouldGenerateTrace:s}},{}],17:[function(t,e,n){function r(t){var e=this.params,n=this.metrics;if(!this.ended){this.ended=!0;for(var r=0;r<p;r++)t.removeEventListener(d[r],this.listener,!1);e.aborted||(n.duration=a.now()-this.startTime,this.loadCaptureCalled||4!==t.readyState?null==e.status&&(e.status=0):i(this,t),n.cbTime=this.cbTime,s("xhr",[e,n,this.startTime,this.endTime,"xhr"],this))}}function o(t,e){var n=c(e),r=t.params;r.hostname=n.hostname,r.port=n.port,r.protocol=n.protocol,r.host=n.hostname+":"+n.port,r.pathname=n.pathname,t.parsedOrigin=n,t.sameOrigin=n.sameOrigin}function i(t,e){t.params.status=e.status;var n=v(e,t.lastSize);if(n&&(t.metrics.rxSize=n),t.sameOrigin){var r=e.getResponseHeader("X-NewRelic-App-Data");r&&(t.params.cat=r.split(", ").pop())}t.loadCaptureCalled=!0}var a=t("loader");if(a.xhrWrappable&&!a.disabled){var s=t("handle"),c=t(18),f=t(16).generateTracePayload,u=t("ee"),d=["load","error","abort","timeout"],p=d.length,l=t("id"),h=t(24),m=t(22),v=t(19),w=t(23),g=NREUM.o.REQ,y=window.XMLHttpRequest;a.features.xhr=!0,t(15),t(8),u.on("new-xhr",function(t){var e=this;e.totalCbs=0,e.called=0,e.cbTime=0,e.end=r,e.ended=!1,e.xhrGuids={},e.lastSize=null,e.loadCaptureCalled=!1,e.params=this.params||{},e.metrics=this.metrics||{},t.addEventListener("load",function(n){i(e,t)},w(!1)),h&&(h>34||h<10)||t.addEventListener("progress",function(t){e.lastSize=t.loaded},w(!1))}),u.on("open-xhr-start",function(t){this.params={method:t[0]},o(this,t[1]),this.metrics={}}),u.on("open-xhr-end",function(t,e){"loader_config"in NREUM&&"xpid"in NREUM.loader_config&&this.sameOrigin&&e.setRequestHeader("X-NewRelic-ID",NREUM.loader_config.xpid);var n=f(this.parsedOrigin);if(n){var r=!1;n.newrelicHeader&&(e.setRequestHeader("newrelic",n.newrelicHeader),r=!0),n.traceContextParentHeader&&(e.setRequestHeader("traceparent",n.traceContextParentHeader),n.traceContextStateHeader&&e.setRequestHeader("tracestate",n.traceContextStateHeader),r=!0),r&&(this.dt=n)}}),u.on("send-xhr-start",function(t,e){var n=this.metrics,r=t[0],o=this;if(n&&r){var i=m(r);i&&(n.txSize=i)}this.startTime=a.now(),this.listener=function(t){try{"abort"!==t.type||o.loadCaptureCalled||(o.params.aborted=!0),("load"!==t.type||o.called===o.totalCbs&&(o.onloadCalled||"function"!=typeof e.onload))&&o.end(e)}catch(n){try{u.emit("internal-error",[n])}catch(r){}}};for(var s=0;s<p;s++)e.addEventListener(d[s],this.listener,w(!1))}),u.on("xhr-cb-time",function(t,e,n){this.cbTime+=t,e?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&"function"==typeof n.onload||this.end(n)}),u.on("xhr-load-added",function(t,e){var n=""+l(t)+!!e;this.xhrGuids&&!this.xhrGuids[n]&&(this.xhrGuids[n]=!0,this.totalCbs+=1)}),u.on("xhr-load-removed",function(t,e){var n=""+l(t)+!!e;this.xhrGuids&&this.xhrGuids[n]&&(delete this.xhrGuids[n],this.totalCbs-=1)}),u.on("xhr-resolved",function(){this.endTime=a.now()}),u.on("addEventListener-end",function(t,e){e instanceof y&&"load"===t[0]&&u.emit("xhr-load-added",[t[1],t[2]],e)}),u.on("removeEventListener-end",function(t,e){e instanceof y&&"load"===t[0]&&u.emit("xhr-load-removed",[t[1],t[2]],e)}),u.on("fn-start",function(t,e,n){e instanceof y&&("onload"===n&&(this.onload=!0),("load"===(t[0]&&t[0].type)||this.onload)&&(this.xhrCbStart=a.now()))}),u.on("fn-end",function(t,e){this.xhrCbStart&&u.emit("xhr-cb-time",[a.now()-this.xhrCbStart,this.onload,e],e)}),u.on("fetch-before-start",function(t){function e(t,e){var n=!1;return e.newrelicHeader&&(t.set("newrelic",e.newrelicHeader),n=!0),e.traceContextParentHeader&&(t.set("traceparent",e.traceContextParentHeader),e.traceContextStateHeader&&t.set("tracestate",e.traceContextStateHeader),n=!0),n}var n,r=t[1]||{};"string"==typeof t[0]?n=t[0]:t[0]&&t[0].url?n=t[0].url:window.URL&&t[0]&&t[0]instanceof URL&&(n=t[0].href),n&&(this.parsedOrigin=c(n),this.sameOrigin=this.parsedOrigin.sameOrigin);var o=f(this.parsedOrigin);if(o&&(o.newrelicHeader||o.traceContextParentHeader))if("string"==typeof t[0]||window.URL&&t[0]&&t[0]instanceof URL){var i={};for(var a in r)i[a]=r[a];i.headers=new Headers(r.headers||{}),e(i.headers,o)&&(this.dt=o),t.length>1?t[1]=i:t.push(i)}else t[0]&&t[0].headers&&e(t[0].headers,o)&&(this.dt=o)}),u.on("fetch-start",function(t,e){this.params={},this.metrics={},this.startTime=a.now(),this.dt=e,t.length>=1&&(this.target=t[0]),t.length>=2&&(this.opts=t[1]);var n,r=this.opts||{},i=this.target;"string"==typeof i?n=i:"object"==typeof i&&i instanceof g?n=i.url:window.URL&&"object"==typeof i&&i instanceof URL&&(n=i.href),o(this,n);var s=(""+(i&&i instanceof g&&i.method||r.method||"GET")).toUpperCase();this.params.method=s,this.txSize=m(r.body)||0}),u.on("fetch-done",function(t,e){this.endTime=a.now(),this.params||(this.params={}),this.params.status=e?e.status:0;var n;"string"==typeof this.rxSize&&this.rxSize.length>0&&(n=+this.rxSize);var r={txSize:this.txSize,rxSize:n,duration:a.now()-this.startTime};s("xhr",[this.params,r,this.startTime,this.endTime,"fetch"],this)})}},{}],18:[function(t,e,n){var r={};e.exports=function(t){if(t in r)return r[t];var e=document.createElement("a"),n=window.location,o={};e.href=t,o.port=e.port;var i=e.href.split("://");!o.port&&i[1]&&(o.port=i[1].split("/")[0].split("@").pop().split(":")[1]),o.port&&"0"!==o.port||(o.port="https"===i[0]?"443":"80"),o.hostname=e.hostname||n.hostname,o.pathname=e.pathname,o.protocol=i[0],"/"!==o.pathname.charAt(0)&&(o.pathname="/"+o.pathname);var a=!e.protocol||":"===e.protocol||e.protocol===n.protocol,s=e.hostname===document.domain&&e.port===n.port;return o.sameOrigin=a&&(!e.hostname||s),"/"===o.pathname&&(r[t]=o),o}},{}],19:[function(t,e,n){function r(t,e){var n=t.responseType;return"json"===n&&null!==e?e:"arraybuffer"===n||"blob"===n||"json"===n?o(t.response):"text"===n||""===n||void 0===n?o(t.responseText):void 0}var o=t(22);e.exports=r},{}],20:[function(t,e,n){function r(){}function o(t,e,n,r){return function(){return u.recordSupportability("API/"+e+"/called"),i(t+e,[f.now()].concat(s(arguments)),n?null:this,r),n?void 0:this}}var i=t("handle"),a=t(32),s=t(33),c=t("ee").get("tracer"),f=t("loader"),u=t(25),d=NREUM;"undefined"==typeof window.newrelic&&(newrelic=d);var p=["setPageViewName","setCustomAttribute","setErrorHandler","finished","addToTrace","inlineHit","addRelease"],l="api-",h=l+"ixn-";a(p,function(t,e){d[e]=o(l,e,!0,"api")}),d.addPageAction=o(l,"addPageAction",!0),d.setCurrentRouteName=o(l,"routeName",!0),e.exports=newrelic,d.interaction=function(){return(new r).get()};var m=r.prototype={createTracer:function(t,e){var n={},r=this,o="function"==typeof e;return i(h+"tracer",[f.now(),t,n],r),function(){if(c.emit((o?"":"no-")+"fn-start",[f.now(),r,o],n),o)try{return e.apply(this,arguments)}catch(t){throw c.emit("fn-err",[arguments,this,t],n),t}finally{c.emit("fn-end",[f.now()],n)}}}};a("actionText,setName,setAttribute,save,ignore,onEnd,getContext,end,get".split(","),function(t,e){m[e]=o(h,e)}),newrelic.noticeError=function(t,e){"string"==typeof t&&(t=new Error(t)),u.recordSupportability("API/noticeError/called"),i("err",[t,f.now(),!1,e])}},{}],21:[function(t,e,n){function r(t){if(NREUM.init){for(var e=NREUM.init,n=t.split("."),r=0;r<n.length-1;r++)if(e=e[n[r]],"object"!=typeof e)return;return e=e[n[n.length-1]]}}e.exports={getConfiguration:r}},{}],22:[function(t,e,n){e.exports=function(t){if("string"==typeof t&&t.length)return t.length;if("object"==typeof t){if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer&&t.byteLength)return t.byteLength;if("undefined"!=typeof Blob&&t instanceof Blob&&t.size)return t.size;if(!("undefined"!=typeof FormData&&t instanceof FormData))try{return JSON.stringify(t).length}catch(e){return}}}},{}],23:[function(t,e,n){var r=!1;try{var o=Object.defineProperty({},"passive",{get:function(){r=!0}});window.addEventListener("testPassive",null,o),window.removeEventListener("testPassive",null,o)}catch(i){}e.exports=function(t){return r?{passive:!0,capture:!!t}:!!t}},{}],24:[function(t,e,n){var r=0,o=navigator.userAgent.match(/Firefox[\\/\\s](\\d+\\.\\d+)/);o&&(r=+o[1]),e.exports=r},{}],25:[function(t,e,n){function r(t,e){var n=[a,t,{name:t},e];return i("storeMetric",n,null,"api"),n}function o(t,e){var n=[s,t,{name:t},e];return i("storeEventMetrics",n,null,"api"),n}var i=t("handle"),a="sm",s="cm";e.exports={constants:{SUPPORTABILITY_METRIC:a,CUSTOM_METRIC:s},recordSupportability:r,recordCustom:o}},{}],26:[function(t,e,n){function r(){return s.exists&&performance.now?Math.round(performance.now()):(i=Math.max((new Date).getTime(),i))-a}function o(){return i}var i=(new Date).getTime(),a=i,s=t(34);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=o},{}],27:[function(t,e,n){function r(t){return!(!t||!t.protocol||"file:"===t.protocol)}e.exports=r},{}],28:[function(t,e,n){function r(t,e){var n=t.getEntries();n.forEach(function(t){"first-paint"===t.name?p("timing",["fp",Math.floor(t.startTime)]):"first-contentful-paint"===t.name&&p("timing",["fcp",Math.floor(t.startTime)])})}function o(t,e){var n=t.getEntries();if(n.length>0){var r=n[n.length-1];if(c&&c<r.startTime)return;p("lcp",[r])}}function i(t){t.getEntries().forEach(function(t){t.hadRecentInput||p("cls",[t])})}function a(t){if(t instanceof v&&!g){var e=Math.round(t.timeStamp),n={type:t.type};e<=l.now()?n.fid=l.now()-e:e>l.offset&&e<=Date.now()?(e-=l.offset,n.fid=l.now()-e):e=l.now(),g=!0,p("timing",["fi",e,n])}}function s(t){"hidden"===t&&(c=l.now(),p("pageHide",[c]))}if(!("init"in NREUM&&"page_view_timing"in NREUM.init&&"enabled"in NREUM.init.page_view_timing&&NREUM.init.page_view_timing.enabled===!1)){var c,f,u,d,p=t("handle"),l=t("loader"),h=t(31),m=t(23),v=NREUM.o.EV;if("PerformanceObserver"in window&&"function"==typeof window.PerformanceObserver){f=new PerformanceObserver(r);try{f.observe({entryTypes:["paint"]})}catch(w){}u=new PerformanceObserver(o);try{u.observe({entryTypes:["largest-contentful-paint"]})}catch(w){}d=new PerformanceObserver(i);try{d.observe({type:"layout-shift",buffered:!0})}catch(w){}}if("addEventListener"in document){var g=!1,y=["click","keydown","mousedown","pointerdown","touchstart"];y.forEach(function(t){document.addEventListener(t,a,m(!1))})}h(s)}},{}],29:[function(t,e,n){function r(){function t(){return e?15&e[n++]:16*Math.random()|0}var e=null,n=0,r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(e=r.getRandomValues(new Uint8Array(31)));for(var o,i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",a="",s=0;s<i.length;s++)o=i[s],"x"===o?a+=t().toString(16):"y"===o?(o=3&t()|8,a+=o.toString(16)):a+=o;return a}function o(){return a(16)}function i(){return a(32)}function a(t){function e(){return n?15&n[r++]:16*Math.random()|0}var n=null,r=0,o=window.crypto||window.msCrypto;o&&o.getRandomValues&&Uint8Array&&(n=o.getRandomValues(new Uint8Array(31)));for(var i=[],a=0;a<t;a++)i.push(e().toString(16));return i.join("")}e.exports={generateUuid:r,generateSpanId:o,generateTraceId:i}},{}],30:[function(t,e,n){function r(t,e){if(!o)return!1;if(t!==o)return!1;if(!e)return!0;if(!i)return!1;for(var n=i.split("."),r=e.split("."),a=0;a<r.length;a++)if(r[a]!==n[a])return!1;return!0}var o=null,i=null,a=/Version\\/(\\S+)\\s+Safari/;if(navigator.userAgent){var s=navigator.userAgent,c=s.match(a);c&&s.indexOf("Chrome")===-1&&s.indexOf("Chromium")===-1&&(o="Safari",i=c[1])}e.exports={agent:o,version:i,match:r}},{}],31:[function(t,e,n){function r(t){function e(){t(s&&document[s]?document[s]:document[i]?"hidden":"visible")}"addEventListener"in document&&a&&document.addEventListener(a,e,o(!1))}var o=t(23);e.exports=r;var i,a,s;"undefined"!=typeof document.hidden?(i="hidden",a="visibilitychange",s="visibilityState"):"undefined"!=typeof document.msHidden?(i="msHidden",a="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(i="webkitHidden",a="webkitvisibilitychange",s="webkitVisibilityState")},{}],32:[function(t,e,n){function r(t,e){var n=[],r="",i=0;for(r in t)o.call(t,r)&&(n[i]=e(r,t[r]),i+=1);return n}var o=Object.prototype.hasOwnProperty;e.exports=r},{}],33:[function(t,e,n){function r(t,e,n){e||(e=0),"undefined"==typeof n&&(n=t?t.length:0);for(var r=-1,o=n-e||0,i=Array(o<0?0:o);++r<o;)i[r]=t[e+r];return i}e.exports=r},{}],34:[function(t,e,n){e.exports={exists:"undefined"!=typeof window.performance&&window.performance.timing&&"undefined"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(t,e,n){function r(){}function o(t){function e(t){return t&&t instanceof r?t:t?f(t,c,a):a()}function n(n,r,o,i,a){if(a!==!1&&(a=!0),!l.aborted||i){t&&a&&t(n,r,o);for(var s=e(o),c=m(n),f=c.length,u=0;u<f;u++)c[u].apply(s,r);var p=d[y[n]];return p&&p.push([x,n,r,s]),s}}function i(t,e){g[t]=m(t).concat(e)}function h(t,e){var n=g[t];if(n)for(var r=0;r<n.length;r++)n[r]===e&&n.splice(r,1)}function m(t){return g[t]||[]}function v(t){return p[t]=p[t]||o(n)}function w(t,e){l.aborted||u(t,function(t,n){e=e||"feature",y[n]=e,e in d||(d[e]=[])})}var g={},y={},x={on:i,addEventListener:i,removeEventListener:h,emit:n,get:v,listeners:m,context:e,buffer:w,abort:s,aborted:!1};return x}function i(t){return f(t,c,a)}function a(){return new r}function s(){(d.api||d.feature)&&(l.aborted=!0,d=l.backlog={})}var c="nr@context",f=t("gos"),u=t(32),d={},p={},l=e.exports=o();e.exports.getOrSetContext=i,l.backlog=d},{}],gos:[function(t,e,n){function r(t,e,n){if(o.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(i){}return t[e]=r,r}var o=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){o.buffer([t],r),o.emit(t,e,n)}var o=t("ee").get("handle");e.exports=r,r.ee=o},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||"object"!==e&&"function"!==e?-1:t===window?0:a(t,i,function(){return o++})}var o=1,i="nr@id",a=t("gos");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!P++){var t=T.info=NREUM.info,e=v.getElementsByTagName("script")[0];if(setTimeout(f.abort,3e4),!(t&&t.licenseKey&&t.applicationID&&e))return f.abort();c(R,function(e,n){t[e]||(t[e]=n)});var n=a();s("mark",["onload",n+T.offset],null,"api"),s("timing",["load",n]);var r=v.createElement("script");0===t.agent.indexOf("http://")||0===t.agent.indexOf("https://")?r.src=t.agent:r.src=h+"://"+t.agent,e.parentNode.insertBefore(r,e)}}function o(){"complete"===v.readyState&&i()}function i(){s("mark",["domContent",a()+T.offset],null,"api")}var a=t(26),s=t("handle"),c=t(32),f=t("ee"),u=t(30),d=t(27),p=t(21),l=t(23),h=p.getConfiguration("ssl")===!1?"http":"https",m=window,v=m.document,w="addEventListener",g="attachEvent",y=m.XMLHttpRequest,x=y&&y.prototype,b=!d(m.location);NREUM.o={ST:setTimeout,SI:m.setImmediate,CT:clearTimeout,XHR:y,REQ:m.Request,EV:m.Event,PR:m.Promise,MO:m.MutationObserver};var E=""+location,R={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",agent:"js-agent.newrelic.com/nr-spa-1212.min.js"},O=y&&x&&x[w]&&!/CriOS/.test(navigator.userAgent),T=e.exports={offset:a.getLastTimestamp(),now:a,origin:E,features:{},xhrWrappable:O,userAgent:u,disabled:b};if(!b){t(20),t(28),v[w]?(v[w]("DOMContentLoaded",i,l(!1)),m[w]("load",r,l(!1))):(v[g]("onreadystatechange",o),m[g]("onload",r)),s("mark",["firstbyte",a.getLastTimestamp()],null,"api");var P=0}},{}],"wrap-function":[function(t,e,n){function r(t,e){function n(e,n,r,c,f){function nrWrapper(){var i,a,u,p;try{a=this,i=d(arguments),u="function"==typeof r?r(i,a):r||{}}catch(l){o([l,"",[i,a,c],u],t)}s(n+"start",[i,a,c],u,f);try{return p=e.apply(a,i)}catch(h){throw s(n+"err",[i,a,h],u,f),h}finally{s(n+"end",[i,a,p],u,f)}}return a(e)?e:(n||(n=""),nrWrapper[p]=e,i(e,nrWrapper,t),nrWrapper)}function r(t,e,r,o,i){r||(r="");var s,c,f,u="-"===r.charAt(0);for(f=0;f<e.length;f++)c=e[f],s=t[c],a(s)||(t[c]=n(s,u?c+r:r,o,c,i))}function s(n,r,i,a){if(!h||e){var s=h;h=!0;try{t.emit(n,r,i,e,a)}catch(c){o([c,n,r,i],t)}h=s}}return t||(t=u),n.inPlace=r,n.flag=p,n}function o(t,e){e||(e=u);try{e.emit("internal-error",t)}catch(n){}}function i(t,e,n){if(Object.defineProperty&&Object.keys)try{var r=Object.keys(t);return r.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(i){o([i],n)}for(var a in t)l.call(t,a)&&(e[a]=t[a]);return e}function a(t){return!(t&&t instanceof Function&&t.apply&&!t[p])}function s(t,e){var n=e(t);return n[p]=t,i(t,n,u),n}function c(t,e,n){var r=t[e];t[e]=s(r,n)}function f(){for(var t=arguments.length,e=new Array(t),n=0;n<t;++n)e[n]=arguments[n];return e}var u=t("ee"),d=t(33),p="nr@original",l=Object.prototype.hasOwnProperty,h=!1;e.exports=r,e.exports.wrapFunction=s,e.exports.wrapInPlace=c,e.exports.argsToArray=f},{}]},{},["loader",2,17,5,3,4]);
|
|
58
|
+
;NREUM.loader_config={accountID:"${this.options.accountID}",trustKey:"${this.options.trustKey}",agentID:"${this.options.agentID}",licenseKey:"${this.options.licenseKey}",applicationID:"${this.options.applicationID}"}
|
|
59
|
+
;NREUM.info={beacon:"bam-cell.nr-data.net",errorBeacon:"bam-cell.nr-data.net",licenseKey:"${this.options.licenseKey}",applicationID:"${this.options.applicationID}",sa:1}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
Object.keys(this.options).forEach((key) => {
|
|
63
|
+
if (!this.options[key]) {
|
|
64
|
+
throw new Error(`${key} argument is required`);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
apply(compiler) {
|
|
70
|
+
compiler.hooks.compilation.tap('HtmlWebpackNewRelicPlugin', (compilation) => {
|
|
71
|
+
HtmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups.tap(
|
|
72
|
+
'HtmlWebpackNewRelicPlugin',
|
|
73
|
+
(data) => {
|
|
74
|
+
const newRelicScriptTag = HtmlWebpackPlugin.createHtmlTagObject(
|
|
75
|
+
'script',
|
|
76
|
+
{ type: 'text/javascript' },
|
|
77
|
+
this.newRelicString,
|
|
78
|
+
);
|
|
79
|
+
data.headTags.unshift(newRelicScriptTag);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = HtmlWebpackNewRelicPlugin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Dineshkumar Pandiyan <flexdinesh@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# html-webpack-new-relic-plugin
|
|
2
|
+
|
|
3
|
+
This plugin comes from https://github.com/victorrodrigues/html-webpack-new-relic-plugin.
|
|
4
|
+
|
|
5
|
+
We're bringing it into frontend-build so that we can more easily maintain the new relic snippet. We
|
|
6
|
+
haven't found much value in having it as a separate package - it mostly just adds a step when we're
|
|
7
|
+
trying to keep it up to date.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
|
+
import webpack from 'webpack';
|
|
5
|
+
|
|
6
|
+
import HtmlWebpackNewRelicPlugin from '../HtmlWebpackNewRelicPlugin';
|
|
7
|
+
|
|
8
|
+
const OUTPUT_DIR = path.join(__dirname, './dist');
|
|
9
|
+
|
|
10
|
+
describe('HtmlWebpackNewRelicPlugin', () => {
|
|
11
|
+
const testPluginOptions = {
|
|
12
|
+
accountID: '121212',
|
|
13
|
+
agentID: '343434',
|
|
14
|
+
trustKey: '565656',
|
|
15
|
+
licenseKey: '123456',
|
|
16
|
+
applicationID: '654321',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
if (fs.existsSync(OUTPUT_DIR)) {
|
|
21
|
+
fs.rmdirSync(OUTPUT_DIR, { recursive: true, force: true });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should append new relic script to body', done => {
|
|
26
|
+
webpack(
|
|
27
|
+
{
|
|
28
|
+
entry: path.resolve(__dirname, 'fixtures', 'entry.js'),
|
|
29
|
+
output: {
|
|
30
|
+
path: path.resolve(__dirname, './dist'),
|
|
31
|
+
},
|
|
32
|
+
plugins: [
|
|
33
|
+
new HtmlWebpackPlugin(),
|
|
34
|
+
new HtmlWebpackNewRelicPlugin(testPluginOptions),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
(err) => {
|
|
38
|
+
const htmlFile = path.resolve(OUTPUT_DIR, 'index.html');
|
|
39
|
+
expect(err).toBeNull();
|
|
40
|
+
expect(fs.existsSync(htmlFile)).toBe(true);
|
|
41
|
+
|
|
42
|
+
const file = fs.readFileSync(
|
|
43
|
+
path.resolve(OUTPUT_DIR, htmlFile),
|
|
44
|
+
{ encoding: 'utf-8' },
|
|
45
|
+
(error, data) => data.toString(),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
Object.entries(testPluginOptions).forEach(([optionName, optionValue]) => {
|
|
49
|
+
expect(file.indexOf(`${optionName}:"${optionValue}"`)).toBeGreaterThan(-1);
|
|
50
|
+
});
|
|
51
|
+
done();
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('when its missing configuration variables', () => {
|
|
57
|
+
function testMissingOption(missingOptionName) {
|
|
58
|
+
it(`should throw error if ${missingOptionName} is missing`, done => {
|
|
59
|
+
const compiler = webpack({
|
|
60
|
+
entry: path.resolve(__dirname, 'fixtures', 'entry.js'),
|
|
61
|
+
output: {
|
|
62
|
+
path: path.resolve(__dirname, '../dist'),
|
|
63
|
+
},
|
|
64
|
+
plugins: [new HtmlWebpackPlugin()],
|
|
65
|
+
});
|
|
66
|
+
const optionsMissingOne = { ...testPluginOptions };
|
|
67
|
+
delete optionsMissingOne[missingOptionName];
|
|
68
|
+
expect(() => compiler.options.plugins.push(new HtmlWebpackNewRelicPlugin(optionsMissingOne))).toThrow(
|
|
69
|
+
`${missingOptionName} argument is required`,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
done();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Object.keys(testPluginOptions).forEach((key) => {
|
|
77
|
+
testMissingOption(key);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Hello World');
|
package/lib/presets.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const ConfigPreset = require('./ConfigPreset');
|
|
2
|
+
|
|
3
|
+
const searchFilepaths = [process.cwd()];
|
|
4
|
+
|
|
5
|
+
const babel = new ConfigPreset({
|
|
6
|
+
defaultFilename: 'babel.config.js',
|
|
7
|
+
searchFilenames: ['.babelrc', '.babelrc.js', 'babel.config.js'],
|
|
8
|
+
searchFilepaths,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const formatjs = new ConfigPreset({
|
|
12
|
+
defaultFilename: 'babel.config.js',
|
|
13
|
+
searchFilenames: ['.babelrc', '.babelrc.js', 'babel.config.js'],
|
|
14
|
+
searchFilepaths,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const babelPreserveModules = new ConfigPreset({
|
|
18
|
+
defaultFilename: 'babel-preserve-modules.config.js',
|
|
19
|
+
searchFilenames: ['.babelrc', '.babelrc.js', 'babel.config.js'],
|
|
20
|
+
searchFilepaths,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const babelTypescript = new ConfigPreset({
|
|
24
|
+
defaultFilename: 'babel-typescript.config.js',
|
|
25
|
+
searchFilenames: ['babel-typescript.config.js', '.babelrc', '.babelrc.js', 'babel.config.js'],
|
|
26
|
+
searchFilepaths,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const eslint = new ConfigPreset({
|
|
30
|
+
defaultFilename: '.eslintrc.js',
|
|
31
|
+
searchFilenames: ['.eslintrc', '.eslintrc.js'],
|
|
32
|
+
searchFilepaths,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const jest = new ConfigPreset({
|
|
36
|
+
defaultFilename: 'jest.config.js',
|
|
37
|
+
searchFilenames: ['jest.config.js'],
|
|
38
|
+
searchFilepaths,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const webpackDevServer = new ConfigPreset({
|
|
42
|
+
defaultFilename: 'webpack.dev.config.js',
|
|
43
|
+
searchFilenames: ['webpack.dev.config.js'],
|
|
44
|
+
searchFilepaths,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const webpackDevServerStage = new ConfigPreset({
|
|
48
|
+
defaultFilename: 'webpack.dev-stage.config.js',
|
|
49
|
+
searchFilenames: ['webpack.dev-stage.config.js'],
|
|
50
|
+
searchFilepaths,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const webpack = new ConfigPreset({
|
|
54
|
+
defaultFilename: 'webpack.prod.config.js',
|
|
55
|
+
searchFilenames: ['webpack.prod.config.js'],
|
|
56
|
+
searchFilepaths,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
babel,
|
|
61
|
+
formatjs,
|
|
62
|
+
babelPreserveModules,
|
|
63
|
+
'babel-preserve-modules': babelPreserveModules,
|
|
64
|
+
'babel-typescript': babelTypescript,
|
|
65
|
+
eslint,
|
|
66
|
+
jest,
|
|
67
|
+
webpack,
|
|
68
|
+
webpackDevServer,
|
|
69
|
+
'webpack-dev': webpackDevServer,
|
|
70
|
+
'webpack-dev-server': webpackDevServer,
|
|
71
|
+
webpackDevServerStage,
|
|
72
|
+
'webpack-dev-server-stage': webpackDevServerStage,
|
|
73
|
+
'webpack-dev-stage': webpackDevServerStage,
|
|
74
|
+
'webpack-prod': webpack,
|
|
75
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Resolves a filepath given an array of filepaths and an array of resolvePaths
|
|
2
|
+
// (directories to check). Useful for finding files and resolving to defaults
|
|
3
|
+
// if they don't exist.
|
|
4
|
+
module.exports = (filepaths, resolvePaths = [process.cwd()]) => {
|
|
5
|
+
// eslint-disable-next-line no-plusplus
|
|
6
|
+
for (let i = 0; i < filepaths.length; i++) {
|
|
7
|
+
try {
|
|
8
|
+
return require.resolve(filepaths[i], { paths: resolvePaths });
|
|
9
|
+
} catch (e) {
|
|
10
|
+
// Do nothing, maybe we'll find it in the next loop
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
throw new Error(`Could not resolve files:\n ${filepaths.join('\n')}\n\n in directories:\n ${resolvePaths.join(', ')}\n`);
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Allow private/local overrides of env vars from .env.development(-stage) for config settings
|
|
2
|
+
// that you'd like to persist locally during development, without the risk of checking
|
|
3
|
+
// in temporary modifications to .env.development(-stage).
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const dotenv = require('dotenv');
|
|
7
|
+
|
|
8
|
+
module.exports = (filePath) => {
|
|
9
|
+
if (fs.existsSync(filePath)) {
|
|
10
|
+
const privateEnvConfig = dotenv.parse(fs.readFileSync(filePath));
|
|
11
|
+
Object.entries(privateEnvConfig).forEach(([key, value]) => {
|
|
12
|
+
process.env[key] = value;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|