Skip to content
Merged

PD-3857 #2783

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions SUPPORTED_BROWSERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

> This file is auto-generated from `.browserslistrc` during the prebuild step. Do not edit manually.

| Browser | Minimum version |
| ---------------- | --------------- |
| Android WebView | 142 or newer |
| Apple Safari | 16.4 or newer |
| Google Chrome | 115 or newer |
| Microsoft Edge | 115 or newer |
| Mozilla Firefox | 116 or newer |
| Opera | 101 or newer |
| Opera Mobile | 80 or newer |
| Samsung Internet | 23 or newer |
| Browser | Minimum version |
|---------|-----------------|
| Android WebView | 145 or newer |
| Apple Safari | 17 or newer |
| Google Chrome | 117 or newer |
| Microsoft Edge | 117 or newer |
| Mozilla Firefox | 116 or newer |
| Opera | 103 or newer |
| Opera Mobile | 80 or newer |
| Samsung Internet | 24 or newer |
51 changes: 41 additions & 10 deletions scripts/new-relic.postbuild.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
import { readFileSync } from 'fs'
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'

const newRelicScript = readFileSync(
join(__dirname, 'new-relic.runtime.js'),
'utf8'
)
const newRelicSourcePath = join(__dirname, 'new-relic.runtime.js')

export function newRelic(indexHtml: string) {
let minifiedNewRelicJs: string | undefined

function getMinifiedNewRelicJs(): string {
if (minifiedNewRelicJs !== undefined) {
return minifiedNewRelicJs
}
const { minify_sync } = require('terser') as {
minify_sync: (
code: string,
options?: Record<string, unknown>
) => { code?: string; error?: Error }
}
const source = readFileSync(newRelicSourcePath, 'utf8')
const result = minify_sync(source, {
compress: true,
mangle: true,
format: { comments: false },
})
if (result.error) {
throw result.error
}
if (!result.code) {
throw new Error('terser returned empty code for new-relic.runtime.js')
}
minifiedNewRelicJs = result.code
return minifiedNewRelicJs
}

export function newRelic(
indexHtml: string,
options: { folder: string; languageCode: string }
) {
writeFileSync(
join(options.folder, 'new-relic.runtime.js'),
getMinifiedNewRelicJs(),
'utf8'
)
const src = `new-relic.runtime-${options.languageCode}.js`
return indexHtml.replace(
'<!-- NEW_RELIC_PLACEHOLDER -->',
`<script type="text/javascript">
` +
newRelicScript +
`</script>`
`<script type="text/javascript" src="${src}"></script>`
)
}
2 changes: 1 addition & 1 deletion scripts/postbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ glob.sync('./dist/*/index.html').forEach((file) => {
data = buildInfo(data, options)
// Replace all the `*.js` references to match updated JS file names with the language code.
data = addLanguageCodeToHashesOnToHTMLFiles(data, options)
data = newRelic(data, options)
data = addOneTrustNotAutoBlockForAppScripts(data)
data = newRelic(data)

// data = robotsMetadata(data, options) DISABLE robots headers, as those will be handle via nginx
save(data, options)
Expand Down
3 changes: 3 additions & 0 deletions src/app/cdk/platform-info/platform-info.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ function createServiceWithUserAgent(userAgent: string): PlatformInfoService {

// Override supported browsers with a simple known matrix for the tests.
// This avoids depending on the generated supported-browsers.json contents.
// The constructor already ran with the real JSON; recompute after overriding.
service.supportedBrowsers = {
chrome: { major: 90, minor: 0 },
firefox: { major: 88, minor: 0 },
safari: { major: 16, minor: 4 },
edge: { major: 90, minor: 0 },
}
service.platform.unsupportedBrowser = service.isUnsupportedBrowser(userAgent)
service.platformSubject.next(service.platform)

return TestBed.inject(PlatformInfoService)
}
Expand Down
14 changes: 7 additions & 7 deletions src/app/cdk/platform-info/supported-browsers.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"chrome": {
"major": 115,
"major": 117,
"minor": 0
},
"firefox": {
"major": 116,
"minor": 0
},
"android": {
"major": 142,
"major": 145,
"minor": 0
},
"edge": {
"major": 115,
"major": 117,
"minor": 0
},
"safari": {
"major": 16,
"minor": 4
"major": 17,
"minor": 0
},
"op_mob": {
"major": 80,
"minor": 0
},
"opera": {
"major": 101,
"major": 103,
"minor": 0
},
"samsung": {
"major": 23,
"major": 24,
"minor": 0
}
}
Loading
Loading