Skip to content

Commit 8711bdd

Browse files
authored
deps(sveltekit): Bump sorcery to 1.0.0 (#13660)
Bump `sorcery` to version 1.0.0. the main changes made were to move the package to output ESM code. The SvelteKit build complained a bit about ESM initially but moving from a static to a dynamic import worked, so I'll take that.
1 parent bcd2a17 commit 8711bdd

File tree

4 files changed

+27
-33
lines changed

4 files changed

+27
-33
lines changed

packages/sveltekit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@sentry/vite-plugin": "2.22.3",
5050
"magic-string": "0.30.7",
5151
"magicast": "0.2.8",
52-
"sorcery": "0.11.0"
52+
"sorcery": "1.0.0"
5353
},
5454
"devDependencies": {
5555
"@babel/types": "7.20.7",

packages/sveltekit/src/vite/sourceMaps.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { getSentryRelease } from '@sentry/node';
55
import { escapeStringForRegex, uuid4 } from '@sentry/utils';
66
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
77
import { sentryVitePlugin } from '@sentry/vite-plugin';
8-
// @ts-expect-error -sorcery has no types :(
9-
import * as sorcery from 'sorcery';
108
import type { Plugin } from 'vite';
119

1210
import MagicString from 'magic-string';
@@ -187,6 +185,9 @@ export async function makeCustomSentryVitePlugins(options?: CustomSentryVitePlug
187185
// eslint-disable-next-line no-console
188186
debug && console.log('[Source Maps Plugin] Flattening source maps');
189187

188+
// @ts-expect-error - we're using dynamic import here and TS complains about that. It works though.
189+
const sorcery = await import('sorcery');
190+
190191
for (const file of jsFiles) {
191192
try {
192193
await (sorcery as Sorcery).load(file).then(async chain => {

packages/sveltekit/test/vite/sourceMaps.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ vi.mock('@sentry/vite-plugin', async () => {
1717
};
1818
});
1919

20+
vi.mock('sorcery', async () => {
21+
return {
22+
load: vi.fn().mockResolvedValue({
23+
apply: vi.fn().mockResolvedValue(undefined),
24+
write: vi.fn().mockResolvedValue(undefined),
25+
}),
26+
};
27+
});
28+
2029
beforeEach(() => {
2130
vi.clearAllMocks();
2231
});
@@ -79,7 +88,7 @@ describe('makeCustomSentryVitePlugin()', () => {
7988
// @ts-expect-error this function exists!
8089
plugin.configResolved({ build: { ssr: true } });
8190
// @ts-expect-error this function exists!
82-
plugin.closeBundle();
91+
await plugin.closeBundle();
8392
expect(mockedSentryVitePlugin.writeBundle).toHaveBeenCalledTimes(1);
8493
});
8594

@@ -89,7 +98,7 @@ describe('makeCustomSentryVitePlugin()', () => {
8998
// @ts-expect-error this function exists!
9099
plugin.configResolved({ build: { ssr: false } });
91100
// @ts-expect-error this function exists!
92-
plugin.closeBundle();
101+
await plugin.closeBundle();
93102
expect(mockedSentryVitePlugin.writeBundle).not.toHaveBeenCalled();
94103
});
95104
});
@@ -110,7 +119,7 @@ describe('makeCustomSentryVitePlugin()', () => {
110119
// @ts-expect-error this function exists!
111120
plugin.configResolved({ build: { ssr: true } });
112121
// @ts-expect-error this function exists!
113-
plugin.closeBundle();
122+
await plugin.closeBundle();
114123

115124
expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Failed to upload source maps'));
116125
expect(consoleLogSpy).toHaveBeenCalled();

yarn.lock

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13474,16 +13474,16 @@ bson@^1.1.4:
1347413474
resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.6.tgz#fb819be9a60cd677e0853aee4ca712a785d6618a"
1347513475
integrity sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==
1347613476

13477-
buffer-crc32@^0.2.5, buffer-crc32@~0.2.3:
13478-
version "0.2.13"
13479-
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
13480-
integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=
13481-
1348213477
buffer-crc32@^1.0.0:
1348313478
version "1.0.0"
1348413479
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-1.0.0.tgz#a10993b9055081d55304bd9feb4a072de179f405"
1348513480
integrity sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==
1348613481

13482+
buffer-crc32@~0.2.3:
13483+
version "0.2.13"
13484+
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
13485+
integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=
13486+
1348713487
1348813488
version "1.0.1"
1348913489
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
@@ -17028,11 +17028,6 @@ es6-object-assign@^1.1.0:
1702817028
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
1702917029
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
1703017030

17031-
es6-promise@^3.1.2:
17032-
version "3.3.1"
17033-
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"
17034-
integrity sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==
17035-
1703617031
1703717032
version "0.15.18"
1703817033
resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz#20a7ae1416c8eaade917fb2453c1259302c637a5"
@@ -29334,7 +29329,7 @@ rfdc@^1.4.1:
2933429329
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca"
2933529330
integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==
2933629331

29337-
rimraf@^2.2.8, rimraf@^2.3.4, rimraf@^2.4.3, rimraf@^2.5.2, rimraf@^2.5.3, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3:
29332+
rimraf@^2.2.8, rimraf@^2.3.4, rimraf@^2.4.3, rimraf@^2.5.3, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3:
2933829333
version "2.7.1"
2933929334
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
2934029335
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
@@ -29662,16 +29657,6 @@ safe-stable-stringify@^2.4.1:
2966229657
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
2966329658
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
2966429659

29665-
sander@^0.5.0:
29666-
version "0.5.1"
29667-
resolved "https://registry.yarnpkg.com/sander/-/sander-0.5.1.tgz#741e245e231f07cafb6fdf0f133adfa216a502ad"
29668-
integrity sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==
29669-
dependencies:
29670-
es6-promise "^3.1.2"
29671-
graceful-fs "^4.1.3"
29672-
mkdirp "^0.5.1"
29673-
rimraf "^2.5.2"
29674-
2967529660
sane@^4.0.0:
2967629661
version "4.1.0"
2967729662
resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded"
@@ -30446,15 +30431,14 @@ solid-use@^0.8.0:
3044630431
resolved "https://registry.yarnpkg.com/solid-use/-/solid-use-0.8.0.tgz#d46258c45edb0f4c621285e0ad1aa6b6a674d79b"
3044730432
integrity sha512-YX+XmcKLvSx3bwMimMhFy40ZkDnShnUcEw6cW6fSscwKEgl1TG3GlgAvkBmQ3AeWjvQSd8+HGTr82ImsrjkkqA==
3044830433

30449-
sorcery@0.11.0:
30450-
version "0.11.0"
30451-
resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-0.11.0.tgz#310c80ee993433854bb55bb9aa4003acd147fca8"
30452-
integrity sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==
30434+
sorcery@1.0.0:
30435+
version "1.0.0"
30436+
resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-1.0.0.tgz#b5bb81fb9706c0c240f5f2d3214b4d2be649e07f"
30437+
integrity sha512-5ay9oJE+7sNmhzl3YNG18jEEEf4AOQCM/FAqR5wMmzqd1FtRorFbJXn3w3SKOhbiQaVgHM+Q1lszZspjri7bpA==
3045330438
dependencies:
3045430439
"@jridgewell/sourcemap-codec" "^1.4.14"
30455-
buffer-crc32 "^0.2.5"
3045630440
minimist "^1.2.0"
30457-
sander "^0.5.0"
30441+
tiny-glob "^0.2.9"
3045830442

3045930443
sort-keys@^2.0.0:
3046030444
version "2.0.0"

0 commit comments

Comments
 (0)