mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 18:11:20 -08:00
build(site): [SITE-07] deliver original Monaco language service notices
This commit is contained in:
1 parent
0d3ddbf355
commit
11c9fefadd
42 files changed
+3141
-19
No files matched your search
@@ -21,13 +21,17 @@ test('mobile vConsole shows logs and upstream site notice texts are served uncha
|
||||
notices.push({ component: group.name, version: group.version, url: response.url(), sha256: notice.sha256 })
|
||||
}
|
||||
}
|
||||
const attributionPath = '/licenses/console/react-pure-render/ATTRIBUTION.md'
|
||||
const attribution = await request.get(attributionPath)
|
||||
expect(attribution.status()).toBe(200)
|
||||
const localLinks = [...(await attribution.text()).matchAll(/\]\((\.\.?\/[^)]+)\)/g)]
|
||||
expect(localLinks).toHaveLength(2)
|
||||
for (const [, target] of localLinks)
|
||||
expect(notices.map(notice => notice.url)).toContain(new URL(target, attribution.url()).href)
|
||||
for (const { path, count } of [
|
||||
{ path: '/licenses/console/react-pure-render/ATTRIBUTION.md', count: 2 },
|
||||
{ path: '/licenses/monaco-editor/language-services/ATTRIBUTION.md', count: 12 },
|
||||
]) {
|
||||
const attribution = await request.get(path)
|
||||
expect(attribution.status()).toBe(200)
|
||||
const localLinks = [...(await attribution.text()).matchAll(/\]\((\.\.?\/[^)]+)\)/g)]
|
||||
expect(localLinks).toHaveLength(count)
|
||||
for (const [, target] of localLinks)
|
||||
expect(notices.map(notice => notice.url)).toContain(new URL(target, attribution.url()).href)
|
||||
}
|
||||
await testInfo.attach('verified-vendor-notices', { contentType: 'application/json', body: JSON.stringify(notices) })
|
||||
const provenance = JSON.parse(fs.readFileSync('refactor/baselines/site-codicons-provenance.json', 'utf8'))
|
||||
const font = await request.get(`/${provenance.fontPath.slice('docs/'.length)}`)
|
||||
@@ -37,6 +41,10 @@ test('mobile vConsole shows logs and upstream site notice texts are served uncha
|
||||
expect(index.status()).toBe(200)
|
||||
expect(await index.text()).toContain('Included component: @vscode/codicons 0.0.26')
|
||||
expect(await index.text()).toContain('Included component: typescript (Monaco worker) 4.4.4')
|
||||
expect(await index.text()).toContain('Included component: vscode-html-languageservice 4.1.1')
|
||||
expect(await index.text()).toContain('Included component: vscode-json-languageservice 4.1.9')
|
||||
expect(await index.text()).toContain('Included component: js-beautify (Monaco HTML embedded)')
|
||||
expect(await index.text()).toContain('Included component: glob-to-regexp (Monaco JSON fork)')
|
||||
expect(await index.text()).toContain('Included component: console-feed 3.2.2')
|
||||
expect(await index.text()).toContain('Included component: react-pure-render (shallowequal origin) source commit 729cdbd')
|
||||
expect(await index.text()).toContain('Included component: chromium-string-utils')
|
||||
|
||||
@@ -8,9 +8,38 @@ import process from 'node:process'
|
||||
// eslint-disable-next-line test/no-import-node-test -- Verify real notice bytes and failure-before-write behavior.
|
||||
import test from 'node:test'
|
||||
import { verifyConsoleNoticeSources } from '../scripts/site-vendor/console/notices.ts'
|
||||
import { verifyMonacoLanguageNoticeArchives, verifyMonacoLanguageNotices } from '../scripts/site-vendor/monaco/notices.ts'
|
||||
import { generateNotices, writeOrCheckNotices } from '../scripts/site-vendor/notices.ts'
|
||||
|
||||
const hash = bytes => createHash('sha256').update(bytes).digest('hex')
|
||||
test('Monaco language notices bind full original terms to their actual worker sources', () => {
|
||||
const original = JSON.parse(fs.readFileSync('scripts/site-vendor/manifest.json', 'utf8'))
|
||||
assert.equal(verifyMonacoLanguageNotices(process.cwd(), original), 12)
|
||||
const manifest = structuredClone(original)
|
||||
const group = manifest.groups.find(group => group.name === 'monaco-editor')
|
||||
const json = group.components.find(item => item.name === 'vscode-json-languageservice')
|
||||
const css = group.components.find(item => item.name === 'vscode-css-languageservice')
|
||||
json.notices = [...css.notices]
|
||||
// All files still exist: a count/hash-only generator accepts this wrong license.
|
||||
assert.doesNotThrow(() => generateNotices(process.cwd(), manifest))
|
||||
assert.throws(() => verifyMonacoLanguageNotices(process.cwd(), manifest), /Wrong Monaco language notice binding/)
|
||||
json.notices = original.groups.find(group => group.name === 'monaco-editor').components.find(item => item.name === json.name).notices
|
||||
json.assets = [...css.assets]
|
||||
assert.throws(() => verifyMonacoLanguageNotices(process.cwd(), manifest), /Wrong Monaco language asset/)
|
||||
assert.throws(() => verifyMonacoLanguageNoticeArchives(process.cwd(), { read: () => Buffer.from('unrelated archive notice') }), /differs from archive/)
|
||||
})
|
||||
|
||||
test('Monaco language delivery cannot omit a third-party notice or embedded author header', () => {
|
||||
const original = JSON.parse(fs.readFileSync('scripts/site-vendor/manifest.json', 'utf8'))
|
||||
const record = JSON.parse(fs.readFileSync('refactor/baselines/monaco-language-notices.json', 'utf8'))
|
||||
for (const notice of record.notices) {
|
||||
const manifest = structuredClone(original)
|
||||
const group = manifest.groups.find(group => group.name === 'monaco-editor')
|
||||
group.notices = group.notices.filter(item => item.target !== notice.target)
|
||||
assert.throws(() => verifyMonacoLanguageNotices(process.cwd(), manifest), /Missing Monaco language notice/)
|
||||
}
|
||||
})
|
||||
|
||||
test('Console notices retain the verified owner and license association', () => {
|
||||
const manifest = JSON.parse(fs.readFileSync('scripts/site-vendor/manifest.json', 'utf8'))
|
||||
assert.deepEqual(verifyConsoleNoticeSources(process.cwd(), manifest), { components: 44, upstreamNotices: 46 })
|
||||
|
||||
Reference in new issue
Block a user