@datamoc/mw_games 0.17.0 → 0.18.0

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/dist/version.d.ts CHANGED
@@ -9,5 +9,5 @@
9
9
  * this from `package.json` automatically, chosen because this project's own build already
10
10
  * has no step before `tsc`/`vite` that this would need to run ahead of.
11
11
  */
12
- export declare const version = "0.17.0";
12
+ export declare const version = "0.18.0";
13
13
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -9,5 +9,5 @@
9
9
  * this from `package.json` automatically, chosen because this project's own build already
10
10
  * has no step before `tsc`/`vite` that this would need to run ahead of.
11
11
  */
12
- export const version = '0.17.0';
12
+ export const version = '0.18.0';
13
13
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datamoc/mw_games",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "A local-file game framework: renderer-free game logic, drawn through PixiJS in 2D or Babylon.js in 3D, with mobile and desktop packaging.",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
package/sbom.cdx.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bomFormat": "CycloneDX",
3
3
  "specVersion": "1.6",
4
- "serialNumber": "urn:uuid:13e7db60-e211-50ba-bee8-7124a3e3943a",
4
+ "serialNumber": "urn:uuid:41a4c04b-a4b7-51d1-8ed7-ef7398a60e44",
5
5
  "version": 1,
6
6
  "metadata": {
7
7
  "tools": {
@@ -10,16 +10,16 @@
10
10
  "type": "application",
11
11
  "group": "datamoc",
12
12
  "name": "tools/sbom.mjs",
13
- "version": "0.17.0"
13
+ "version": "0.18.0"
14
14
  }
15
15
  ]
16
16
  },
17
17
  "component": {
18
18
  "type": "library",
19
- "bom-ref": "pkg:npm/%40datamoc/mw_games@0.17.0",
19
+ "bom-ref": "pkg:npm/%40datamoc/mw_games@0.18.0",
20
20
  "name": "@datamoc/mw_games",
21
- "version": "0.17.0",
22
- "purl": "pkg:npm/%40datamoc/mw_games@0.17.0",
21
+ "version": "0.18.0",
22
+ "purl": "pkg:npm/%40datamoc/mw_games@0.18.0",
23
23
  "description": "A local-file game framework: renderer-free game logic, drawn through PixiJS in 2D or Babylon.js in 3D, with mobile and desktop packaging.",
24
24
  "licenses": [
25
25
  {
@@ -4453,7 +4453,7 @@
4453
4453
  ]
4454
4454
  },
4455
4455
  {
4456
- "ref": "pkg:npm/%40datamoc/mw_games@0.17.0",
4456
+ "ref": "pkg:npm/%40datamoc/mw_games@0.18.0",
4457
4457
  "dependsOn": [
4458
4458
  "pkg:npm/%40babylonjs/core@9.26.0",
4459
4459
  "pkg:npm/%40babylonjs/loaders@9.26.0",
package/tools/csp.mjs CHANGED
@@ -21,7 +21,16 @@ import { createHash } from 'node:crypto';
21
21
  * extra script texts to allow by hash (a single-file loader's unpacked scripts)
22
22
  */
23
23
  export function contentSecurityPolicy(html, { connect = [], eval: allowEval = true, scripts = [] } = {}) {
24
- const inline = [...html.matchAll(/<script(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi)].map((match) => match[1]);
24
+ //The HTML parser normalises newlines before it hashes an inline script: CRLF and lone CR
25
+ //become LF. A checkout with core.autocrlf=true (every Windows clone) hands the source page
26
+ //over with CRLF, so hashing the bytes on disk here would emit a policy Chrome computes
27
+ //differently from the file it just parsed, and the page refuses its own script while
28
+ //`file://` on Linux stays quiet. Hash the text the browser will see.
29
+ const inline = [...html.matchAll(/<script(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi)].map((match) =>
30
+ match[1].replace(/\r\n?/g, '\n'),
31
+ );
32
+ //`scripts` are texts the standalone page's unpacker sets on a script element at runtime
33
+ //(`s.text = code`), where no parser runs: those are hashed exactly as they are written.
25
34
  const hashes = [...new Set([...inline, ...scripts].map((text) => `'sha256-${sha256(text)}'`))];
26
35
  const directives = {
27
36
  'default-src': ["'none'"],
package/tools/sbom.mjs CHANGED
@@ -313,7 +313,9 @@ async function main(argv) {
313
313
 
314
314
  if (argv.includes('--check')) {
315
315
  const committed = await readFile(out, 'utf8').catch(() => undefined);
316
- if (committed !== json) {
316
+ //CRLF is a Windows checkout's doing, not a difference in the BOM itself (and a missing
317
+ //file still reads as out of date: '' never equals the serialized BOM)
318
+ if ((committed ?? '').replace(/\r\n/g, '\n') !== json.replace(/\r\n/g, '\n')) {
317
319
  console.error(`${name} is out of date with package-lock.json. Run "npm run sbom" and commit the result.`);
318
320
  process.exitCode = 1;
319
321
  } else {