dcp-client 4.4.14 → 4.4.16
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.
|
@@ -186,7 +186,25 @@ self.wrapScriptLoading({ scriptName: 'bootstrap', finalScript: true }, function
|
|
|
186
186
|
* `protectedStorage.dispatchSameConsoleMessage()` for the events triggering
|
|
187
187
|
* their dispatch.
|
|
188
188
|
*/
|
|
189
|
+
const consoleBuffer = [];
|
|
190
|
+
protectedStorage.emitConsoleMessages = false;
|
|
191
|
+
|
|
189
192
|
function workerBootstrap$console(level, ...args)
|
|
193
|
+
{
|
|
194
|
+
consoleBuffer.push({ level, args });
|
|
195
|
+
if (protectedStorage.emitConsoleMessages)
|
|
196
|
+
workerBootstrap$flushConsole()
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
protectedStorage.flushConsoleBuffer = workerBootstrap$flushConsole;
|
|
200
|
+
function workerBootstrap$flushConsole()
|
|
201
|
+
{
|
|
202
|
+
for (let console of consoleBuffer)
|
|
203
|
+
workerBootstrap$emitConsole(console.level, console.args);
|
|
204
|
+
consoleBuffer.length = 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function workerBootstrap$emitConsole(level, args)
|
|
190
208
|
{
|
|
191
209
|
const newConsoleLog = { level, message: args };
|
|
192
210
|
|
|
@@ -398,6 +398,8 @@ prepPyodide`);
|
|
|
398
398
|
var rejection = false;
|
|
399
399
|
var result;
|
|
400
400
|
let metrics;
|
|
401
|
+
protectedStorage.emitConsoleMessages = true;
|
|
402
|
+
protectedStorage.flushConsoleBuffer();
|
|
401
403
|
try
|
|
402
404
|
{
|
|
403
405
|
/* module.main.job is the work function; left by assign message */
|
|
@@ -408,9 +410,6 @@ prepPyodide`);
|
|
|
408
410
|
rejection = error;
|
|
409
411
|
}
|
|
410
412
|
|
|
411
|
-
|
|
412
|
-
// flush any pending console events, especially in the case of a repeating message that hasn't been emitted yet
|
|
413
|
-
try { protectedStorage.dispatchSameConsoleMessage(); } catch(e) {};
|
|
414
413
|
try {
|
|
415
414
|
// reset the device states and flush all pending tasks
|
|
416
415
|
protectedStorage.lockTimers(); // lock timers so no new timeouts will be run.
|
|
@@ -421,6 +420,11 @@ prepPyodide`);
|
|
|
421
420
|
// only the microtask could trigger new code, so waiting for a setTimeout guarantees everything's done
|
|
422
421
|
await new Promise((r) => protectedStorage.realSetTimeout.call(globalThis, r, 1));
|
|
423
422
|
|
|
423
|
+
// flush any pending console events, especially in the case of a repeating message that hasn't been emitted yet
|
|
424
|
+
// then, disable emission of any more console messages
|
|
425
|
+
try { protectedStorage.dispatchSameConsoleMessage(); } catch(e) {};
|
|
426
|
+
protectedStorage.emitConsoleMessages = false;
|
|
427
|
+
|
|
424
428
|
metrics = await protectedStorage.bigBrother.globalTrackers.getMetrics();
|
|
425
429
|
|
|
426
430
|
await protectedStorage.bigBrother.globalTrackers.reset();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
#
|
|
3
|
+
# @file post-publish
|
|
4
|
+
# Hook which tags the package in git with the package version
|
|
5
|
+
# as it gets published.
|
|
6
|
+
# @author Wes Garland, wes@distributive.network
|
|
7
|
+
# @date Nov 2022
|
|
8
|
+
#
|
|
9
|
+
cd `dirname "$0"`/..
|
|
10
|
+
PACKAGE_VERSION=$(cat package.json | egrep '^\s*"version":' | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
|
|
11
|
+
git tag v$PACKAGE_VERSION && git push --tags
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
# @file prepack
|
|
3
|
+
# Hook which generates the bundle on pack (or publish), and ensures that we only publish
|
|
4
|
+
# release packages.
|
|
5
|
+
# @author Wes Garland, wes@distributive.network
|
|
6
|
+
# @date Oct 2024
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
cd `dirname "$0"`/..
|
|
10
|
+
DCP_VERSION=$(node -p "require('./package').dcp.version")
|
|
11
|
+
|
|
12
|
+
if [ $(git rev-parse --abbrev-ref HEAD) != "release" ]; then
|
|
13
|
+
BUILD_TYPE="debug"
|
|
14
|
+
else
|
|
15
|
+
BUILD_TYPE="release"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ ! -d node_modules ]; then
|
|
19
|
+
echo "node_modules missing; please run npm ci before packing" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ ! "${NPM_PREPACK_SKIP_BUNDLE_REBUILD}" ]; then
|
|
24
|
+
if ! [ -d .dcp-build ]; then
|
|
25
|
+
git clone --filter=blob:none $(node -p "require('./package').dcp.repository") .dcp-build
|
|
26
|
+
else
|
|
27
|
+
git fetch
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
(
|
|
31
|
+
for var in $(compgen -e | grep '^npm_')
|
|
32
|
+
do
|
|
33
|
+
eval unset ${var}
|
|
34
|
+
done
|
|
35
|
+
set > /tmp/q
|
|
36
|
+
cd .dcp-build
|
|
37
|
+
git checkout "$DCP_VERSION"
|
|
38
|
+
./configure.sh --with-build="${BUILD_TYPE}" --disable-evaluator
|
|
39
|
+
npm ci
|
|
40
|
+
cd ..
|
|
41
|
+
build/bundle --no-cache --dcp=.dcp-build --build="${BUILD_TYPE}"
|
|
42
|
+
)
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
if [ "${DCP_VERSION}" != $(node -r ./index -p "require('dcp/build').version") ]; then
|
|
46
|
+
echo "Bundle built from wrong version of DCP repo!" >&2
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if [ $(node -r ./index -p "require('dcp/build').config.build") != "${BUILD_TYPE}" ]; then
|
|
51
|
+
echo "Bundle is not a ${BUILD_TYPE} build!" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
#
|
|
3
|
+
# @file pre-publish
|
|
4
|
+
# Hook which prevents package publishing if the repository
|
|
5
|
+
# isn't in a nice, clean state.
|
|
6
|
+
# @author Wes Garland, wes@distributive.network
|
|
7
|
+
# @date Nov 2022
|
|
8
|
+
#
|
|
9
|
+
cd `dirname "$0"`/..
|
|
10
|
+
|
|
11
|
+
yellow='\e[33m'
|
|
12
|
+
normal='\e[0m'
|
|
13
|
+
|
|
14
|
+
git ls-files --error-unmatch `find . -type f | egrep -v '^\./(node_modules|\.git|\.dcp-build|build)'` >/dev/null
|
|
15
|
+
if [ "$?" != "0" ]; then
|
|
16
|
+
echo
|
|
17
|
+
echo -e "${yellow}pre-publish: abort due to files in package which aren't in repo${normal}" >/dev/stderr
|
|
18
|
+
echo
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
(git status --porcelain; echo DONE DONE) \
|
|
23
|
+
| egrep -v '^ M dist/' \
|
|
24
|
+
| while read status filename
|
|
25
|
+
do
|
|
26
|
+
case "$status" in
|
|
27
|
+
"M")
|
|
28
|
+
echo "${filename} is not checked in"
|
|
29
|
+
EXITCODE=1
|
|
30
|
+
;;
|
|
31
|
+
"DONE")
|
|
32
|
+
exit $EXITCODE
|
|
33
|
+
;;
|
|
34
|
+
*)
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
done
|
|
38
|
+
if [ "$?" != "0" ]; then
|
|
39
|
+
echo
|
|
40
|
+
echo -e "${yellow}pre-publish: abort due to modified files${normal}" >/dev/stderr
|
|
41
|
+
echo
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
if [ $(git rev-parse --abbrev-ref HEAD) != "release" ]; then
|
|
46
|
+
echo "${yellow}pre-publish: this is not the release branch!" >&2
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|