rapier-math 0.0.0-stage → 1.0.2
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/LICENSE +484 -0
- package/LICENSE-MIT +21 -0
- package/README.md +110 -2
- package/check.mjs +97 -0
- package/index.mjs +2953 -0
- package/math-LICENSE.txt +21 -0
- package/math-components.json +71 -0
- package/math-font-LICENSE.txt +457 -0
- package/package.json +44 -4
- package/rapier-math-1.0.2.js +2952 -0
- package/src/math/FONT-LICENSE.txt +457 -0
- package/src/math/FONT-SOURCE.md +143 -0
- package/src/math/LICENSE-MIT +21 -0
- package/src/math/api.js +87 -0
- package/src/math/browser.js +181 -0
- package/src/math/build-font.py +622 -0
- package/src/math/fallbacks.js +111 -0
- package/src/math/font.js +547 -0
- package/src/math/layout.js +580 -0
- package/src/math/package-build.mjs +27 -0
- package/src/math/package-verify.mjs +40 -0
- package/src/math/parser.js +1064 -0
- package/src/math/responsive.js +251 -0
- package/src/math/symbols.js +98 -0
- package/src/package.json +9 -0
- package/src/shell/math-resources.json +105 -0
- package/src/tools/build-math.mjs +95 -0
- package/verify.mjs +40 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Verify a standalone package and rebuild its payload from the carried source.
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import {readFile} from 'node:fs/promises';
|
|
5
|
+
import {createHash} from 'node:crypto';
|
|
6
|
+
import {dirname, resolve} from 'node:path';
|
|
7
|
+
import {fileURLToPath} from 'node:url';
|
|
8
|
+
|
|
9
|
+
const root = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const source = resolve(root, 'src');
|
|
11
|
+
const read = path => readFile(resolve(root, path));
|
|
12
|
+
const hash = (bytes, algorithm = 'sha256', encoding = 'hex') => createHash(algorithm).update(bytes).digest(encoding);
|
|
13
|
+
const resources = JSON.parse(await read('src/shell/math-resources.json'));
|
|
14
|
+
const payload = await read(resources.bundle);
|
|
15
|
+
assert.equal(payload.length, resources.bytes, 'payload length');
|
|
16
|
+
assert.equal(hash(payload), resources.sha256, 'payload SHA-256');
|
|
17
|
+
assert.equal(hash(payload, 'sha384', 'base64'), resources.sha384, 'payload SHA-384');
|
|
18
|
+
for (const input of [...resources.sources, ...resources.recipe]) {
|
|
19
|
+
const bytes = await read('src/' + input.file);
|
|
20
|
+
assert.equal(bytes.length, input.bytes, input.file + ': length');
|
|
21
|
+
assert.equal(hash(bytes), input.sha256, input.file + ': SHA-256');
|
|
22
|
+
}
|
|
23
|
+
const rendererLicense = await read('src/math/LICENSE-MIT');
|
|
24
|
+
for (const file of ['LICENSE-MIT', 'math-LICENSE.txt']) assert.deepEqual(await read(file), rendererLicense, file);
|
|
25
|
+
const fontLicense = await read('src/' + resources.font.licenseFile);
|
|
26
|
+
assert.equal(hash(fontLicense), resources.font.licenseSha256, 'font license SHA-256');
|
|
27
|
+
assert.deepEqual(await read('math-font-LICENSE.txt'), fontLicense, 'font license bytes');
|
|
28
|
+
assert(payload.includes(rendererLicense.toString('utf8').trim()), 'payload renderer license');
|
|
29
|
+
assert(payload.includes(fontLicense.toString('utf8').trim()), 'payload font license');
|
|
30
|
+
const sbom = JSON.parse(await read('math-components.json'));
|
|
31
|
+
const font = sbom.packages.find(item => item.name === resources.font.name);
|
|
32
|
+
assert.equal(font?.copyrightText, resources.font.copyright, 'font copyright');
|
|
33
|
+
assert.equal(font.licenseDeclared, resources.font.license, 'font license identity');
|
|
34
|
+
assert.equal(sbom.hasExtractedLicensingInfos.find(item => item.licenseId === resources.font.license)?.extractedText,
|
|
35
|
+
fontLicense.toString('utf8'), 'complete extracted font license');
|
|
36
|
+
const {buildMath} = await import('./src/tools/build-math.mjs');
|
|
37
|
+
await buildMath({root: source, updatePins: false});
|
|
38
|
+
assert.deepEqual(await read('src/shell/vendor/' + resources.bundle), payload, 'rebuilt payload bytes');
|
|
39
|
+
console.log(JSON.stringify({file: resources.bundle, bytes: payload.length, sha256: resources.sha256,
|
|
40
|
+
sources: resources.sources.length + resources.recipe.length, rebuild: 'exact', licenses: 'complete'}));
|