Skip to content

Commit 68db937

Browse files
elbywanlambertkevin
authored andcommitted
chore: upgrade vitejs and esbuild to latest major
Interesting breaking change: evanw/esbuild#1843
1 parent a9b09ca commit 68db937

File tree

24 files changed

+2396
-1610
lines changed

24 files changed

+2396
-1610
lines changed

apps/ledger-live-desktop/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
"@types/styled-components": "^5.1.25",
187187
"@typescript-eslint/eslint-plugin": "^5.28.0",
188188
"@typescript-eslint/parser": "5.28.0",
189-
"@vitejs/plugin-react": "^2.0.0",
189+
"@vitejs/plugin-react": "^3.1.0",
190190
"allure-playwright": "^2.0.0-beta.20",
191191
"babel-cli": "^6.26.0",
192192
"babel-eslint": "^10.1.0",
@@ -200,7 +200,6 @@
200200
"electron-builder": "^23.6.0",
201201
"electron-devtools-installer": "^3.2.0",
202202
"electron-notarize": "^1.2.2",
203-
"esbuild-loader": "^2.19.0",
204203
"esbuild-utils": "workspace:*",
205204
"eslint": "^7.32.0",
206205
"eslint-config-prettier": "^7.2.0",
@@ -239,7 +238,7 @@
239238
"typescript": "^4.8.3",
240239
"url-loader": "^4.1.1",
241240
"v8-to-istanbul": "^8.1.0",
242-
"vite": "^3.2.3",
241+
"vite": "4",
243242
"vite-plugin-electron": "0.4.8",
244243
"yargs": "^15.3.1"
245244
}

apps/ledger-live-desktop/src/renderer/components/Carousel/Slide.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Wrapper, Label, IllustrationWrapper } from "~/renderer/components/Carou
1010
import { useHistory } from "react-router-dom";
1111

1212
const Layer = styled(animated.div)`
13-
background-image: url(${p => p.image});
13+
background-image: url('${p => p.image}');
1414
background-size: contain;
1515
background-position: center center;
1616
background-repeat: no-repeat;

apps/ledger-live-desktop/src/renderer/components/Carousel/banners/Swap/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import loop from "./images/loop.png";
2020
import bg from "./images/bg.png";
2121

2222
const Layer = styled(animated.div)`
23-
background-image: url(${p => p.image});
23+
background-image: url('${p => p.image}');
2424
background-size: contain;
2525
background-position: center center;
2626
background-repeat: no-repeat;

apps/ledger-live-desktop/src/renderer/components/DeviceIllustration.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ const makeAssetSelector = (lightAsset: any, darkAsset: any) => (p: ThemeProps<De
1919

2020
const NanoS = styled.div`
2121
// TODO: rendering issue in the SVG in the "hole"
22-
background: url(${p => makeAssetSelector(nanoS, nanoSDark)(p)}) no-repeat center;
22+
background: url('${p => makeAssetSelector(nanoS, nanoSDark)(p)}') no-repeat center;
2323
`;
2424

2525
const NanoSP = styled.div`
2626
// TODO: rendering issue in the SVG in the "hole"
27-
background: url(${p => makeAssetSelector(nanoS2, nanoS2Dark)(p)}) no-repeat center;
27+
background: url('${p => makeAssetSelector(nanoS2, nanoS2Dark)(p)}') no-repeat center;
2828
`;
2929

3030
const NanoX = styled.div`
31-
background: url(${p => makeAssetSelector(nanoX, nanoXDark)(p)}) no-repeat center;
31+
background: url('${p => makeAssetSelector(nanoX, nanoXDark)(p)}') no-repeat center;
3232
`;
3333

3434
const Stax = styled.div`
35-
background: url(${p => makeAssetSelector(stax, staxDark)(p)}) no-repeat center;
35+
background: url('${p => makeAssetSelector(stax, staxDark)(p)}') no-repeat center;
3636
`;
3737

3838
type Illustration = {

apps/ledger-live-desktop/src/renderer/components/Illustration.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Illustration: ThemedComponent<Props> = styled(Box).attrs((p: Props) => ({
1717
width: `${p.size}px`,
1818
height: p.height ? `${p.height}px` : `${p.size}px`,
1919
}))<Props>`
20-
background: url(${(p: Props) => defineStyleFromTheme(p.lightSource, p.darkSource)(p)});
20+
background: url('${(p: Props) => defineStyleFromTheme(p.lightSource, p.darkSource)(p)}');
2121
background-size: cover;
2222
background-repeat: no-repeat;
2323
background-position: center center;

apps/ledger-live-desktop/src/renderer/components/LinkWithExternalIcon.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Wrapper: ThemedComponent<{}> = styled(Label).attrs(props => ({
2525
}
2626
2727
&:after {
28-
-webkit-mask: url(${externalLink});
28+
-webkit-mask: url('${externalLink}');
2929
-webkit-mask-size: cover;
3030
width: 12px;
3131
height: 12px;

apps/ledger-live-desktop/src/renderer/components/Nft/Placeholder.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Props = {
1414
// TODO Figure out if we really need this once we know who creates/processes the media.
1515
const StyledPlaceholder: ThemedComponent<Props> = styled.div`
1616
--hue: ${p => (p?.tokenId || "abcdefg").substr(-8) % 360};
17-
background-image: url(${Fallback});
17+
background-image: url('${Fallback}');
1818
background-size: contain;
1919
border-radius: 4px;
2020
width: 100%;

apps/ledger-live-desktop/src/renderer/components/Onboarding/OnboardingNavHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const Logo = styled(Box).attrs({
2222
height: "25px",
2323
width: "75px",
2424
})`
25-
-webkit-mask-image: url(${ledgerLogo});
26-
mask-image: url(${ledgerLogo});
25+
-webkit-mask-image: url('${ledgerLogo}');
26+
mask-image: url('${ledgerLogo}');
2727
`;
2828

2929
interface Props {

apps/ledger-live-desktop/src/renderer/components/Onboarding/Screens/Tutorial/shared.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const AnimationContainer = styled(Flex)`
2424
`;
2525

2626
export const IllustrationContainer = styled(Flex)<{ src: string }>`
27-
background: url(${({ src }) => src}) no-repeat center;
27+
background: url('${({ src }) => src}') no-repeat center;
2828
background-size: contain;
2929
`;
3030

apps/ledger-live-desktop/src/renderer/modals/FullNode/steps/StepDisconnect.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Illustration = styled.div`
1414
margin-bottom: 24px;
1515
width: 236px;
1616
height: 64px;
17-
background: url(${fullnodeIllustration});
17+
background: url('${fullnodeIllustration}');
1818
background-size: contain;
1919
align-self: center;
2020
`;

apps/ledger-live-desktop/src/renderer/modals/FullNode/steps/StepLanding.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Illustration = styled.div`
1515
margin-bottom: 24px;
1616
width: 193px;
1717
height: 130px;
18-
background: url(${fullnodeIllustration});
18+
background: url('${fullnodeIllustration}');
1919
background-size: contain;
2020
align-self: center;
2121
`;

apps/ledger-live-desktop/src/renderer/modals/RecoverySeedWarning/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type Props = {
2020
};
2121

2222
const Illustration = styled.div`
23-
background-image: url(${p => p.image});
23+
background-image: url('${p => p.image}');
2424
background-size: contain;
2525
background-position: center center;
2626
background-repeat: no-repeat;

apps/ledger-live-desktop/src/renderer/screens/USBTroubleshooting/solutions/Intro.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { ThemedComponent } from "~/renderer/styles/StyleProvider";
99

1010
import illustration from "~/renderer/images/USBTroubleshooting/device.png";
1111
export const Illustration: ThemedComponent<{}> = styled.div`
12-
background-image: url(${p => p.image});
12+
background-image: url('${p => p.image}');
1313
background-size: contain;
1414
background-position: center center;
1515
background-repeat: no-repeat;

apps/ledger-live-desktop/src/renderer/screens/USBTroubleshooting/solutions/shared.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const Content: ThemedComponent<{}> = styled(Box).attrs({
5353
`;
5454

5555
export const Illustration: ThemedComponent<{}> = styled.div`
56-
background-image: url(${p => p.image});
56+
background-image: url('${p => p.image}');
5757
background-size: contain;
5858
background-position: center center;
5959
background-repeat: no-repeat;

apps/ledger-live-desktop/src/renderer/screens/learn/assets/NoConnection.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const NoConnectionIllustration = styled(Flex).attrs({
66
height: "200px",
77
width: "200px",
88
})`
9-
background-image: url(${noConnection});
9+
background-image: url('${noConnection}');
1010
background-size: contain;
1111
${p => p.theme.colors.type === "light" && "filter: invert(100%);"}
1212
`;

apps/ledger-live-desktop/src/renderer/screens/manager/Disconnected.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const illustrations = {
5656
};
5757

5858
const Illustration: ThemedComponent<{ modelId: string }> = styled.div`
59-
background: url(${p => illustrations[p.modelId][p.theme.colors.palette.type || "light"]})
59+
background: url('${p => illustrations[p.modelId][p.theme.colors.palette.type || "light"]}')
6060
no-repeat top right;
6161
width: ${p => illustrations[p.modelId].width}px;
6262
height: 50px;

apps/ledger-live-desktop/tools/main.js

+31-18
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,50 @@ const { buildMainEnv, buildRendererEnv, buildViteConfig, lldRoot } = require("./
1717
const startDev = async argv => {
1818
const electron = new Electron("./.webpack/main.bundle.js");
1919

20-
const devConfig = {
21-
minify: false,
22-
watch: {
23-
onRebuild(error, result) {
24-
if (error) {
25-
console.error("Watch build failed:", error);
20+
const OnRebuildPlugin = {
21+
name: "onRebuild",
22+
setup(build) {
23+
build.onEnd(result => {
24+
if (result.errors.length > 0) {
25+
console.log(`Build ended with ${result.errors.length} errors.`);
26+
console.log(result.errors.map(error => error.message).join("\n"));
2627
} else {
2728
electron.reload();
2829
}
29-
},
30+
});
3031
},
3132
};
3233

3334
const mainConfig = {
3435
...require("./config/main.esbuild"),
3536
define: buildMainEnv("development", argv),
36-
plugins: [...(require("./config/main.esbuild").plugins || []), NodeExternalsPlugin],
37-
...devConfig,
37+
plugins: [
38+
...(require("./config/main.esbuild").plugins || []),
39+
NodeExternalsPlugin,
40+
OnRebuildPlugin,
41+
],
42+
minify: false,
3843
};
3944
const preloaderConfig = {
4045
...require("./config/preloader.esbuild"),
4146
define: buildMainEnv("development", argv),
42-
...devConfig,
47+
plugins: [...(require("./config/preloader.esbuild").plugins || []), OnRebuildPlugin],
48+
minify: false,
4349
};
4450
const webviewPreloaderConfig = {
4551
...require("./config/webviewPreloader.esbuild"),
4652
define: buildMainEnv("development", argv),
47-
...devConfig,
53+
plugins: [...(require("./config/webviewPreloader.esbuild").plugins || []), OnRebuildPlugin],
54+
minify: false,
4855
};
4956
const swapConnectWebviewPreloaderConfig = {
5057
...require("./config/swapConnectWebviewPreloader.esbuild"),
5158
define: buildMainEnv("development", argv),
52-
...devConfig,
59+
plugins: [
60+
...(require("./config/swapConnectWebviewPreloader.esbuild").plugins || []),
61+
OnRebuildPlugin,
62+
],
63+
minify: false,
5364
};
5465

5566
try {
@@ -60,14 +71,16 @@ const startDev = async argv => {
6071

6172
const rendererServer = await createServer(buildViteConfig(argv));
6273

63-
await Promise.all([
64-
esbuild.build(mainConfig),
65-
esbuild.build(preloaderConfig),
66-
esbuild.build(webviewPreloaderConfig),
67-
esbuild.build(swapConnectWebviewPreloaderConfig),
68-
rendererServer.listen(),
74+
const contexts = await Promise.all([
75+
esbuild.context(mainConfig),
76+
esbuild.context(preloaderConfig),
77+
esbuild.context(webviewPreloaderConfig),
78+
esbuild.context(swapConnectWebviewPreloaderConfig),
6979
]);
7080

81+
await rendererServer.listen();
82+
await Promise.all(contexts.map(context => context.watch()));
83+
7184
rendererServer.printUrls();
7285
electron.start();
7386
};

apps/ledger-live-desktop/tools/utils/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (!GIT_REVISION) {
2222

2323
const parsed = prerelease(pkg.version);
2424
let PRERELEASE = false;
25-
let CHANNEL;
25+
let CHANNEL = null;
2626
if (parsed) {
2727
PRERELEASE = !!(parsed && parsed.length);
2828
CHANNEL = parsed[0];
@@ -45,7 +45,7 @@ const buildMainEnv = (mode, argv) => {
4545
__GIT_REVISION__: JSON.stringify(GIT_REVISION),
4646
__SENTRY_URL__: JSON.stringify(SENTRY_URL || null),
4747
// See: https://github.com/node-formidable/formidable/issues/337
48-
"global.GENTLY": false,
48+
"global.GENTLY": JSON.stringify(false),
4949
__PRERELEASE__: JSON.stringify(PRERELEASE),
5050
__CHANNEL__: JSON.stringify(CHANNEL),
5151
};

libs/ledger-live-common/package.json

-6
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,10 @@
4242
}
4343
},
4444
"exports": {
45-
"./lib/*/": "./lib/*/index.js",
4645
"./lib/*": "./lib/*.js",
4746
"./lib/*.js": "./lib/*.js",
48-
"./lib-es/*/": "./lib-es/*/index.js",
4947
"./lib-es/*": "./lib-es/*.js",
5048
"./lib-es/*.js": "./lib-es/*.js",
51-
"./*/": {
52-
"require": "./lib/*/index.js",
53-
"default": "./lib-es/*/index.js"
54-
},
5549
"./*": {
5650
"require": "./lib/*.js",
5751
"default": "./lib-es/*.js"

libs/ledgerjs/packages/cryptoassets/package.json

-6
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,10 @@
4545
}
4646
},
4747
"exports": {
48-
"./lib/*/": "./lib/*/index.js",
4948
"./lib/*": "./lib/*.js",
5049
"./lib/*.js": "./lib/*.js",
51-
"./lib-es/*/": "./lib-es/*/index.js",
5250
"./lib-es/*": "./lib-es/*.js",
5351
"./lib-es/*.js": "./lib-es/*.js",
54-
"./*/": {
55-
"require": "./lib/*/index.js",
56-
"default": "./lib-es/*/index.js"
57-
},
5852
"./*": {
5953
"require": "./lib/*.js",
6054
"default": "./lib-es/*.js"

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
"actions": "pnpm --filter @actions/*"
9494
},
9595
"devDependencies": {
96-
"@changesets/changelog-github": "^0.4.6",
97-
"@changesets/cli": "^2.24.3",
96+
"@changesets/changelog-github": "^0.4.8",
97+
"@changesets/cli": "^2.26.0",
9898
"@commitlint/cli": "^17.4.2",
9999
"@commitlint/config-conventional": "^17.4.2",
100100
"@commitlint/prompt-cli": "^17.4.2",
@@ -103,7 +103,7 @@
103103
"pnpm-utils": "workspace:*",
104104
"rimraf": "^4.1.2",
105105
"turbo": "^1.7.2",
106-
"zx": "^7.0.7"
106+
"zx": "^7.1.1"
107107
},
108108
"pnpm": {
109109
"overrides": {

0 commit comments

Comments
 (0)