Skip to content

Commit ec3a144

Browse files
authored
[security] update all package.json for security patches (#753)
* update all package.json for security patches * fixed tests
1 parent f4b036a commit ec3a144

File tree

147 files changed

+44003
-159380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+44003
-159380
lines changed

addition-rnn-webworker/.babelrc

-18
This file was deleted.

addition-rnn-webworker/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ <h1>TensorFlow.js: Addition RNN in web worker</h1>
152152
</div>
153153

154154
</body>
155-
<script src="./index.js">
155+
<script type="module" src="index.js"></script>
156156

157157
</script>

addition-rnn-webworker/index.js

+40-29
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@
2323
*/
2424

2525
import * as tfvis from '@tensorflow/tfjs-vis';
26-
const worker = new Worker('./worker.js');
26+
const worker =
27+
new Worker(new URL('./worker.js', import.meta.url), {type: 'module'});
2728

2829
async function runAdditionRNNDemo() {
2930
document.getElementById('trainModel').addEventListener('click', async () => {
3031
const digits = +(document.getElementById('digits')).value;
3132
const trainingSize = +(document.getElementById('trainingSize')).value;
3233
const rnnTypeSelect = document.getElementById('rnnType');
3334
const rnnType =
34-
rnnTypeSelect.options[rnnTypeSelect.selectedIndex].getAttribute(
35-
'value');
35+
rnnTypeSelect.options[rnnTypeSelect.selectedIndex].getAttribute(
36+
'value');
3637
const layers = +(document.getElementById('rnnLayers')).value;
3738
const hiddenSize = +(document.getElementById('rnnLayerSize')).value;
3839
const batchSize = +(document.getElementById('batchSize')).value;
@@ -48,45 +49,55 @@ async function runAdditionRNNDemo() {
4849
const trainingSizeLimit = Math.pow(Math.pow(10, digits), 2);
4950
if (trainingSize > trainingSizeLimit) {
5051
status.textContent =
51-
`With digits = ${digits}, you cannot have more than ` +
52-
`${trainingSizeLimit} examples`;
52+
`With digits = ${digits}, you cannot have more than ` +
53+
`${trainingSizeLimit} examples`;
5354
return;
5455
}
55-
worker.postMessage({ digits, trainingSize, rnnType, layers, hiddenSize, trainIterations, batchSize, numTestExamples });
56+
worker.postMessage({
57+
digits,
58+
trainingSize,
59+
rnnType,
60+
layers,
61+
hiddenSize,
62+
trainIterations,
63+
batchSize,
64+
numTestExamples
65+
});
5666
worker.addEventListener('message', (e) => {
5767
if (e.data.isPredict) {
58-
const { i, iterations, modelFitTime, lossValues, accuracyValues } = e.data;
68+
const {i, iterations, modelFitTime, lossValues, accuracyValues} =
69+
e.data;
5970
document.getElementById('trainStatus').textContent =
60-
`Iteration ${i + 1} of ${iterations}: ` +
61-
`Time per iteration: ${modelFitTime.toFixed(3)} (seconds)`;
71+
`Iteration ${i + 1} of ${iterations}: ` +
72+
`Time per iteration: ${modelFitTime.toFixed(3)} (seconds)`;
6273
const lossContainer = document.getElementById('lossChart');
6374
tfvis.render.linechart(
64-
lossContainer, { values: lossValues, series: ['train', 'validation'] },
65-
{
66-
width: 420,
67-
height: 300,
68-
xLabel: 'epoch',
69-
yLabel: 'loss',
70-
});
75+
lossContainer,
76+
{values: lossValues, series: ['train', 'validation']}, {
77+
width: 420,
78+
height: 300,
79+
xLabel: 'epoch',
80+
yLabel: 'loss',
81+
});
7182

7283
const accuracyContainer = document.getElementById('accuracyChart');
7384
tfvis.render.linechart(
74-
accuracyContainer,
75-
{ values: accuracyValues, series: ['train', 'validation'] }, {
76-
width: 420,
77-
height: 300,
78-
xLabel: 'epoch',
79-
yLabel: 'accuracy',
80-
});
85+
accuracyContainer,
86+
{values: accuracyValues, series: ['train', 'validation']}, {
87+
width: 420,
88+
height: 300,
89+
xLabel: 'epoch',
90+
yLabel: 'accuracy',
91+
});
8192
} else {
82-
const { isCorrect, examples } = e.data;
93+
const {isCorrect, examples} = e.data;
8394
const examplesDiv = document.getElementById('testExamples');
8495
const examplesContent = examples.map(
85-
(example, i) =>
86-
`<div class="${
87-
isCorrect[i] ? 'answer-correct' : 'answer-wrong'}">` +
88-
`${example}` +
89-
`</div>`);
96+
(example, i) =>
97+
`<div class="${
98+
isCorrect[i] ? 'answer-correct' : 'answer-wrong'}">` +
99+
`${example}` +
100+
`</div>`);
90101

91102
examplesDiv.innerHTML = examplesContent.join('\n');
92103
}

addition-rnn-webworker/package.json

+4-13
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,15 @@
1414
},
1515
"scripts": {
1616
"watch": "cross-env NODE_ENV=development parcel index.html --no-hmr --open",
17-
"build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./",
17+
"build": "cross-env NODE_ENV=production parcel build index.html --public-url ./",
1818
"link-local": "yalc link"
1919
},
2020
"devDependencies": {
21-
"babel-core": "^6.26.3",
22-
"babel-plugin-transform-runtime": "~6.23.0",
23-
"babel-polyfill": "~6.26.0",
24-
"babel-preset-env": "~1.6.1",
21+
"buffer": "^6.0.3",
2522
"clang-format": "~1.2.2",
2623
"cross-env": "^5.1.6",
27-
"parcel-bundler": "~1.12.5",
24+
"parcel": "~2.3.2",
25+
"process": "^0.11.10",
2826
"yalc": "~1.0.0-pre.50"
29-
},
30-
"resolutions": {
31-
"is-svg": "4.3.1",
32-
"node-fetch": "2.6.1",
33-
"vega": "5.17.3",
34-
"glob-parent": "5.1.2",
35-
"postcss": "8.2.10"
3627
}
3728
}

0 commit comments

Comments
 (0)