Skip to content

Commit a6ad964

Browse files
authored
Upgrade node (#4945)
* Upgrade node to v18
1 parent 8936d1c commit a6ad964

File tree

12 files changed

+372
-43
lines changed

12 files changed

+372
-43
lines changed

Diff for: .circleci/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@ orbs:
1919
executors:
2020
rsp:
2121
docker:
22-
- image: cimg/node:16.20.0
22+
- image: cimg/node:18.17.1
2323
environment:
2424
CACHE_VERSION: v1
2525
working_directory: ~/react-spectrum
2626

2727
rsp-large:
2828
docker:
29-
- image: cimg/node:16.20.0
29+
- image: cimg/node:18.17.1
3030
resource_class: large
3131
environment:
3232
CACHE_VERSION: v1
3333
working_directory: ~/react-spectrum
3434

3535
rsp-xlarge:
3636
docker:
37-
- image: cimg/node:16.20.0
37+
- image: cimg/node:18.17.1
3838
resource_class: xlarge
3939
environment:
4040
CACHE_VERSION: v1
4141
working_directory: ~/react-spectrum
4242

4343
rsp-xlarge-nodeupdate:
4444
docker:
45-
- image: cimg/node:16.18.0
45+
- image: cimg/node:18.17.1
4646
resource_class: xlarge
4747
environment:
4848
CACHE_VERSION: v1

Diff for: .nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.*
1+
18.*

Diff for: examples/rsp-webpack-4/package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "webpack --mode production",
88
"start": "webpack-dev-server --mode development --open",
99
"test": "test",
10-
"install-17": "yarn add -W react@^17 react-dom@^17"
10+
"install-17": "yarn add -W react@^17 react-dom@^17",
11+
"postinstall": "patch-package"
1112
},
1213
"private": true,
1314
"workspaces": [
@@ -26,12 +27,16 @@
2627
"@babel/cli": "^7.1.0",
2728
"@babel/preset-env": "^7.1.0",
2829
"@babel/preset-react": "^7.0.0",
29-
"webpack": "^4.46.0",
30+
"webpack": "4.46.0",
3031
"webpack-cli": "3.1.1",
3132
"webpack-dev-server": "3.1.8",
3233
"style-loader": "0.23.0",
3334
"css-loader": "1.0.0",
3435
"babel-loader": "8.0.2",
35-
"jest": "^26"
36+
"jest": "^26",
37+
"patch-package": "^8.0.0"
38+
},
39+
"resolutions": {
40+
"terser-webpack-plugin": "4.2.3"
3641
}
3742
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/terser-webpack-plugin/dist/index.js b/node_modules/terser-webpack-plugin/dist/index.js
2+
index 3acffa7..cbbbb6f 100644
3+
--- a/node_modules/terser-webpack-plugin/dist/index.js
4+
+++ b/node_modules/terser-webpack-plugin/dist/index.js
5+
@@ -259,7 +259,7 @@ class TerserPlugin {
6+
}
7+
} = compilation;
8+
9+
- const hash = _webpack.util.createHash(hashFunction);
10+
+ const hash = _webpack.util.createHash('sha512');
11+
12+
if (hashSalt) {
13+
hash.update(hashSalt);

Diff for: examples/rsp-webpack-4/patches/webpack+4.46.0.patch

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
diff --git a/node_modules/webpack/lib/Compilation.js b/node_modules/webpack/lib/Compilation.js
2+
index 6329174..196c4bb 100644
3+
--- a/node_modules/webpack/lib/Compilation.js
4+
+++ b/node_modules/webpack/lib/Compilation.js
5+
@@ -1915,7 +1915,7 @@ class Compilation extends Tapable {
6+
const hashFunction = outputOptions.hashFunction;
7+
const hashDigest = outputOptions.hashDigest;
8+
const hashDigestLength = outputOptions.hashDigestLength;
9+
- const hash = createHash(hashFunction);
10+
+ const hash = createHash('sha512');
11+
if (outputOptions.hashSalt) {
12+
hash.update(outputOptions.hashSalt);
13+
}
14+
@@ -1936,7 +1936,7 @@ class Compilation extends Tapable {
15+
const modules = this.modules;
16+
for (let i = 0; i < modules.length; i++) {
17+
const module = modules[i];
18+
- const moduleHash = createHash(hashFunction);
19+
+ const moduleHash = createHash('sha512');
20+
module.updateHash(moduleHash);
21+
module.hash = /** @type {string} */ (moduleHash.digest(hashDigest));
22+
module.renderedHash = module.hash.substr(0, hashDigestLength);
23+
@@ -1957,7 +1957,7 @@ class Compilation extends Tapable {
24+
});
25+
for (let i = 0; i < chunks.length; i++) {
26+
const chunk = chunks[i];
27+
- const chunkHash = createHash(hashFunction);
28+
+ const chunkHash = createHash('sha512');
29+
try {
30+
if (outputOptions.hashSalt) {
31+
chunkHash.update(outputOptions.hashSalt);
32+
@@ -1994,7 +1994,7 @@ class Compilation extends Tapable {
33+
const hashFunction = outputOptions.hashFunction;
34+
const hashDigest = outputOptions.hashDigest;
35+
const hashDigestLength = outputOptions.hashDigestLength;
36+
- const hash = createHash(hashFunction);
37+
+ const hash = createHash('sha512');
38+
hash.update(this.fullHash);
39+
hash.update(update);
40+
this.fullHash = /** @type {string} */ (hash.digest(hashDigest));
41+
diff --git a/node_modules/webpack/lib/HashedModuleIdsPlugin.js b/node_modules/webpack/lib/HashedModuleIdsPlugin.js
42+
index 7a860f7..2e0d9c6 100644
43+
--- a/node_modules/webpack/lib/HashedModuleIdsPlugin.js
44+
+++ b/node_modules/webpack/lib/HashedModuleIdsPlugin.js
45+
@@ -43,7 +43,7 @@ class HashedModuleIdsPlugin {
46+
const id = module.libIdent({
47+
context: this.options.context || compiler.options.context
48+
});
49+
- const hash = createHash(options.hashFunction);
50+
+ const hash = createHash('sha512');
51+
hash.update(id);
52+
const hashId = /** @type {string} */ (hash.digest(
53+
options.hashDigest
54+
diff --git a/node_modules/webpack/lib/JavascriptModulesPlugin.js b/node_modules/webpack/lib/JavascriptModulesPlugin.js
55+
index 2c1bbe4..61fe7bd 100644
56+
--- a/node_modules/webpack/lib/JavascriptModulesPlugin.js
57+
+++ b/node_modules/webpack/lib/JavascriptModulesPlugin.js
58+
@@ -130,7 +130,7 @@ class JavascriptModulesPlugin {
59+
hashDigestLength,
60+
hashFunction
61+
} = outputOptions;
62+
- const hash = createHash(hashFunction);
63+
+ const hash = createHash('sha512');
64+
if (hashSalt) hash.update(hashSalt);
65+
const template = chunk.hasRuntime()
66+
? compilation.mainTemplate
67+
diff --git a/node_modules/webpack/lib/ModuleFilenameHelpers.js b/node_modules/webpack/lib/ModuleFilenameHelpers.js
68+
index bd0742b..9ad4687 100644
69+
--- a/node_modules/webpack/lib/ModuleFilenameHelpers.js
70+
+++ b/node_modules/webpack/lib/ModuleFilenameHelpers.js
71+
@@ -42,7 +42,7 @@ const getBefore = (str, token) => {
72+
};
73+
74+
const getHash = str => {
75+
- const hash = createHash("md4");
76+
+ const hash = createHash("sha512");
77+
hash.update(str);
78+
const digest = /** @type {string} */ (hash.digest("hex"));
79+
return digest.substr(0, 4);
80+
diff --git a/node_modules/webpack/lib/NamedModulesPlugin.js b/node_modules/webpack/lib/NamedModulesPlugin.js
81+
index 2d84aaf..102b244 100644
82+
--- a/node_modules/webpack/lib/NamedModulesPlugin.js
83+
+++ b/node_modules/webpack/lib/NamedModulesPlugin.js
84+
@@ -8,7 +8,7 @@ const createHash = require("./util/createHash");
85+
const RequestShortener = require("./RequestShortener");
86+
87+
const getHash = str => {
88+
- const hash = createHash("md4");
89+
+ const hash = createHash("sha512");
90+
hash.update(str);
91+
const digest = /** @type {string} */ (hash.digest("hex"));
92+
return digest.substr(0, 4);
93+
diff --git a/node_modules/webpack/lib/NormalModule.js b/node_modules/webpack/lib/NormalModule.js
94+
index 76aa1bd..a952cc2 100644
95+
--- a/node_modules/webpack/lib/NormalModule.js
96+
+++ b/node_modules/webpack/lib/NormalModule.js
97+
@@ -414,7 +414,7 @@ class NormalModule extends Module {
98+
}
99+
100+
_initBuildHash(compilation) {
101+
- const hash = createHash(compilation.outputOptions.hashFunction);
102+
+ const hash = createHash('sha512');
103+
if (this._source) {
104+
hash.update("source");
105+
this._source.updateHash(hash);
106+
diff --git a/node_modules/webpack/lib/SourceMapDevToolPlugin.js b/node_modules/webpack/lib/SourceMapDevToolPlugin.js
107+
index 3018eb2..cb714bd 100644
108+
--- a/node_modules/webpack/lib/SourceMapDevToolPlugin.js
109+
+++ b/node_modules/webpack/lib/SourceMapDevToolPlugin.js
110+
@@ -346,7 +346,7 @@ class SourceMapDevToolPlugin {
111+
: filename,
112+
query,
113+
basename: basename(filename),
114+
- contentHash: createHash("md4")
115+
+ contentHash: createHash("sha512")
116+
.update(sourceMapString)
117+
.digest("hex")
118+
};
119+
diff --git a/node_modules/webpack/lib/optimize/ConcatenatedModule.js b/node_modules/webpack/lib/optimize/ConcatenatedModule.js
120+
index df4d216..ea8cecb 100644
121+
--- a/node_modules/webpack/lib/optimize/ConcatenatedModule.js
122+
+++ b/node_modules/webpack/lib/optimize/ConcatenatedModule.js
123+
@@ -560,7 +560,7 @@ class ConcatenatedModule extends Module {
124+
orderedConcatenationListIdentifiers += " ";
125+
}
126+
}
127+
- const hash = createHash("md4");
128+
+ const hash = createHash("sha512");
129+
hash.update(orderedConcatenationListIdentifiers);
130+
return this.rootModule.identifier() + " " + hash.digest("hex");
131+
}
132+
diff --git a/node_modules/webpack/lib/optimize/SplitChunksPlugin.js b/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
133+
index e7d560b..8243e8c 100644
134+
--- a/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
135+
+++ b/node_modules/webpack/lib/optimize/SplitChunksPlugin.js
136+
@@ -22,7 +22,7 @@ const deterministicGroupingForModules = /** @type {function(DeterministicGroupin
137+
138+
const hashFilename = name => {
139+
return crypto
140+
- .createHash("md4")
141+
+ .createHash("sha512")
142+
.update(name)
143+
.digest("hex")
144+
.slice(0, 8);

Diff for: packages/@internationalized/number/test/NumberParser.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ describe('NumberParser', function () {
232232
expect(new NumberParser('en-US', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber('-$10')).toBe(true);
233233

234234
// typing latin characters in arabic locale should work
235-
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber('(')).toBe(true);
236-
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber('(10)')).toBe(true);
235+
// 1564 is the character code for the arabic letter mark, an invisible character that marks bidi text for printing, you can find this included in chrome too
236+
// TODO: we should still support just typing the '(' character, but this isn't a regression
237+
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber(`(${String.fromCharCode(1564)}`)).toBe(true);
238+
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber(`(${String.fromCharCode(1564)}10)`)).toBe(true);
237239
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber('-')).toBe(true);
238240
expect(new NumberParser('ar-AE', {style: 'currency', currency: 'USD', currencySign: 'accounting'}).isValidPartialNumber('-10')).toBe(true);
239241
});

Diff for: packages/@react-spectrum/datepicker/test/DatePicker.test.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function getTextValue(el) {
3333
}
3434

3535
function expectPlaceholder(el, placeholder) {
36-
expect(getTextValue(el)).toBe(placeholder);
36+
expect(getTextValue(el).replace(' ', ' ')).toBe(placeholder);
3737
}
3838

3939
function render(el) {
@@ -433,7 +433,7 @@ describe('DatePicker', function () {
433433
);
434434

435435
let combobox = getAllByRole('group')[0];
436-
expect(getTextValue(combobox)).toBe('2/3/2019, 8:45 AM');
436+
expect(getTextValue(combobox)).toBe('2/3/2019, 8:45AM');
437437

438438
let button = getByRole('button');
439439
triggerPress(button);
@@ -446,15 +446,15 @@ describe('DatePicker', function () {
446446
expect(selected.children[0]).toHaveAttribute('aria-label', 'Sunday, February 3, 2019 selected');
447447

448448
let timeField = getAllByLabelText('Time')[0];
449-
expect(getTextValue(timeField)).toBe('8:45 AM');
449+
expect(getTextValue(timeField)).toBe('8:45AM');
450450

451451
// selecting a date should not close the popover
452452
triggerPress(selected.nextSibling.children[0]);
453453

454454
expect(dialog).toBeVisible();
455455
expect(onChange).toHaveBeenCalledTimes(1);
456456
expect(onChange).toHaveBeenCalledWith(new CalendarDateTime(2019, 2, 4, 8, 45));
457-
expect(getTextValue(combobox)).toBe('2/4/2019, 8:45 AM');
457+
expect(getTextValue(combobox)).toBe('2/4/2019, 8:45AM');
458458

459459
let hour = within(timeField).getByLabelText('hour,');
460460
expect(hour).toHaveAttribute('role', 'spinbutton');
@@ -469,7 +469,7 @@ describe('DatePicker', function () {
469469
expect(dialog).toBeVisible();
470470
expect(onChange).toHaveBeenCalledTimes(2);
471471
expect(onChange).toHaveBeenCalledWith(new CalendarDateTime(2019, 2, 4, 9, 45));
472-
expect(getTextValue(combobox)).toBe('2/4/2019, 9:45 AM');
472+
expect(getTextValue(combobox)).toBe('2/4/2019, 9:45AM');
473473
});
474474

475475
it('should not throw error when deleting values from time field when CalendarDateTime value is used', function () {
@@ -481,7 +481,7 @@ describe('DatePicker', function () {
481481
);
482482

483483
let combobox = getAllByRole('group')[0];
484-
expect(getTextValue(combobox)).toBe('2/3/2019, 10:45 AM');
484+
expect(getTextValue(combobox)).toBe('2/3/2019, 10:45AM');
485485

486486
let button = getByRole('button');
487487
triggerPress(button);
@@ -494,15 +494,15 @@ describe('DatePicker', function () {
494494
expect(selected.children[0]).toHaveAttribute('aria-label', 'Sunday, February 3, 2019 selected');
495495

496496
let timeField = getAllByLabelText('Time')[0];
497-
expect(getTextValue(timeField)).toBe('10:45 AM');
497+
expect(getTextValue(timeField)).toBe('10:45AM');
498498

499499
// selecting a date should not close the popover
500500
triggerPress(selected.nextSibling.children[0]);
501501

502502
expect(dialog).toBeVisible();
503503
expect(onChange).toHaveBeenCalledTimes(1);
504504
expect(onChange).toHaveBeenCalledWith(new CalendarDateTime(2019, 2, 4, 10, 45));
505-
expect(getTextValue(combobox)).toBe('2/4/2019, 10:45 AM');
505+
expect(getTextValue(combobox)).toBe('2/4/2019, 10:45AM');
506506

507507
let hour = within(timeField).getByLabelText('hour,');
508508
expect(hour).toHaveAttribute('role', 'spinbutton');
@@ -518,7 +518,7 @@ describe('DatePicker', function () {
518518
expect(dialog).toBeVisible();
519519
expect(onChange).toHaveBeenCalledTimes(2);
520520
expect(onChange).toHaveBeenCalledWith(new CalendarDateTime(2019, 2, 4, 1, 45));
521-
expect(getTextValue(combobox)).toBe('2/4/2019, 1:45 AM');
521+
expect(getTextValue(combobox)).toBe('2/4/2019, 1:45AM');
522522
});
523523

524524
it('should fire onChange until both date and time are selected', function () {
@@ -584,6 +584,7 @@ describe('DatePicker', function () {
584584
let month = parts.find(p => p.type === 'month').value;
585585
let day = parts.find(p => p.type === 'day').value;
586586
let year = parts.find(p => p.type === 'year').value;
587+
// eslint-disable-next-line no-irregular-whitespace
587588
expectPlaceholder(combobox, `${month}/${day}/${year}, 12:00 AM`);
588589

589590
fireEvent.keyDown(hour, {key: 'ArrowRight'});

0 commit comments

Comments
 (0)