mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
build(site): [SITE-07] reproduce core outputs and validate localized editing
This commit is contained in:
1 parent
244695e726
commit
0cfdf4a7e3
24 files changed
+10598
-5
No files matched your search
@@ -4,10 +4,27 @@ import test from 'node:test'
|
||||
import ts from 'typescript'
|
||||
import { extractBasicFixtures } from '../scripts/site-vendor/monaco/basic-fixtures.ts'
|
||||
import { emitAmd } from '../scripts/site-vendor/monaco/compiler.ts'
|
||||
import { inventoryCoreMap, readCoreNls, restoreCoreMapComment } from '../scripts/site-vendor/monaco/core-build.ts'
|
||||
import { adaptCoreOrigin } from '../scripts/site-vendor/monaco/core-origins.ts'
|
||||
import { aliasModule, moduleIds, nameModule, verifyWorkerSources } from '../scripts/site-vendor/monaco/languages.ts'
|
||||
import { browserTypeScript, verifyTypeScriptSource } from '../scripts/site-vendor/monaco/typescript.ts'
|
||||
|
||||
test('Core NLS extraction accepts historical trailing commas without evaluating expressions', () => {
|
||||
assert.deepEqual(readCoreNls('define("nls", { "find": ["Find", "查找",], });'), { id: 'nls', messages: { find: ['Find', '查找'] } })
|
||||
assert.throws(() => readCoreNls('define("nls", { "find": [translate()], });'), /literal translation text/)
|
||||
assert.throws(() => readCoreNls('define("nls", { "find": [], "find": [] });'), /Repeated translation/)
|
||||
assert.throws(() => readCoreNls('run(); define("nls", {});'), /one NLS registration/)
|
||||
})
|
||||
|
||||
test('Core source inventories and map comments reject incomplete or ambiguous evidence', () => {
|
||||
assert.equal(inventoryCoreMap({ sources: ['test'], sourcesContent: ['查找'] })[0].bytes, 6)
|
||||
assert.throws(() => inventoryCoreMap({ sources: ['a'], sourcesContent: [] }), /Missing mapped/)
|
||||
assert.throws(() => inventoryCoreMap({ sources: ['a', 'a'], sourcesContent: ['', ''] }), /Repeated mapped/)
|
||||
assert.equal(restoreCoreMapComment('code;\n', 'vs/loader.js'), 'code;\n\n//# sourceMappingURL=../../min-maps/vs/loader.js.map')
|
||||
assert.throws(() => restoreCoreMapComment('code;', 'vs/loader.js'), /newline/)
|
||||
assert.throws(() => restoreCoreMapComment('code;\n', 'vs/../outside.js'), /output path/)
|
||||
})
|
||||
|
||||
test('Core origin adaptation rejects duplicate boundaries and preserves replacement bytes', () => {
|
||||
const edits = [{ before: 'export default purify;', after: 'define(factory); // $&' }]
|
||||
assert.equal(adaptCoreOrigin('export default purify;', edits), 'define(factory); // $&')
|
||||
|
||||
Reference in new issue
Block a user