dcp-client 5.4.0 → 5.4.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/build/all +1 -0
- package/build/generate-sandbox-definitions-json +15 -4
- package/build/generate-worktimes-json +41 -0
- package/dist/dcp-client-bundle.js +1 -1
- package/dist/dcp-client-bundle.js.map +1 -1
- package/generated/sandbox-definitions.json +1 -1
- package/generated/worktimes.json +1 -0
- package/lib/get-worktime-info.js +44 -0
- package/libexec/sandbox/bootstrap.js +6 -2
- package/libexec/sandbox/bravojs-env.js +17 -382
- package/libexec/sandbox/calculate-capabilities.js +1 -1
- package/libexec/sandbox/map-basic-worktime.js +53 -0
- package/libexec/sandbox/pyodide-worktime.js +197 -0
- package/libexec/sandbox/worktimes.js +277 -49
- package/npm-hooks/prepublish +22 -0
- package/package.json +19 -19
package/build/all
CHANGED
|
@@ -15,9 +15,11 @@ const path = require('path');
|
|
|
15
15
|
|
|
16
16
|
var o = {};
|
|
17
17
|
const target = '../generated/sandbox-definitions.json';
|
|
18
|
-
|
|
18
|
+
if (!process.env.CONSOLE_RESULTS)
|
|
19
|
+
console.log(`Generating sandbox definitions in ${target}`);
|
|
19
20
|
|
|
20
21
|
/** All sandbox types use the base files */
|
|
22
|
+
const worktimes = ['pyodide-worktime', 'map-basic-worktime'];
|
|
21
23
|
const base = [
|
|
22
24
|
'script-load-wrapper',
|
|
23
25
|
'timer-classes',
|
|
@@ -26,7 +28,6 @@ const base = [
|
|
|
26
28
|
'lift-webgl',
|
|
27
29
|
'lift-wasm',
|
|
28
30
|
'lift-webgpu',
|
|
29
|
-
'worktimes',
|
|
30
31
|
'url',
|
|
31
32
|
'polyfills',
|
|
32
33
|
'access-lists',
|
|
@@ -34,7 +35,9 @@ const base = [
|
|
|
34
35
|
'bravojs-init',
|
|
35
36
|
'bravojs/bravo.js',
|
|
36
37
|
'bravojs-env',
|
|
38
|
+
'worktimes',
|
|
37
39
|
'pyodide-core',
|
|
40
|
+
...worktimes,
|
|
38
41
|
'calculate-capabilities',
|
|
39
42
|
];
|
|
40
43
|
|
|
@@ -62,5 +65,13 @@ o.nodeTesting = o.node.concat(['testing.js']);
|
|
|
62
65
|
*/
|
|
63
66
|
o.testing = o.native.concat(['testing.js']);
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/** Distinguish worktime scripts to allow for the scheduler to run them and acquire their version */
|
|
69
|
+
o.worktimes = worktimes;
|
|
70
|
+
|
|
71
|
+
if (process.env.CONSOLE_RESULTS)
|
|
72
|
+
console.log(JSON.stringify(o))
|
|
73
|
+
else
|
|
74
|
+
{
|
|
75
|
+
fs.writeFileSync(path.resolve(__dirname, target), JSON.stringify(o), 'utf-8');
|
|
76
|
+
console.log(`Done - ${Object.keys(o).join(', ')}.`);
|
|
77
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file generate-worktimes-json
|
|
4
|
+
* Source of authority for worktimes and their versions this dcp-client version supports
|
|
5
|
+
*
|
|
6
|
+
* @author Severn Lortie <severn@distributive.network>
|
|
7
|
+
* Ryan Saweczko <ryansaweczko@distributive.network>
|
|
8
|
+
* @date February 2024
|
|
9
|
+
* December 2025
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const semver = require('semver');
|
|
16
|
+
|
|
17
|
+
const worktimeScripts = require('../generated/sandbox-definitions.json').worktimes;
|
|
18
|
+
const worktimes = [];
|
|
19
|
+
function wrapScriptLoading(_, fn)
|
|
20
|
+
{
|
|
21
|
+
fn(protectedStorage);
|
|
22
|
+
}
|
|
23
|
+
function registerWorktime(worktime)
|
|
24
|
+
{
|
|
25
|
+
worktimes.push({ name: worktime.name, version: worktime.version })
|
|
26
|
+
}
|
|
27
|
+
const protectedStorage = {};
|
|
28
|
+
protectedStorage.worktimes = {};
|
|
29
|
+
protectedStorage.worktimes.registerWorktime = registerWorktime;
|
|
30
|
+
globalThis.self = {};
|
|
31
|
+
globalThis.self.wrapScriptLoading = wrapScriptLoading;
|
|
32
|
+
for (const script of worktimeScripts)
|
|
33
|
+
require(`../libexec/sandbox/${script}`);
|
|
34
|
+
worktimes.sort((a, b) => semver.compare(b.version, a.version, true));
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const target = '../generated/worktimes.json';
|
|
38
|
+
if (process.env.CONSOLE_RESULTS)
|
|
39
|
+
console.log(JSON.stringify(worktimes))
|
|
40
|
+
else
|
|
41
|
+
fs.writeFileSync(path.resolve(__dirname, target), JSON.stringify(worktimes), 'utf-8');
|