Skip to content

Commit

Permalink
deps(sveltekit): Bump sorcery to 1.0.0 (#13660)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lms24 committed Sep 13, 2024
1 parent bcd2a17 commit 8711bdd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@sentry/vite-plugin": "2.22.3",
"magic-string": "0.30.7",
"magicast": "0.2.8",
"sorcery": "0.11.0"
"sorcery": "1.0.0"
},
"devDependencies": {
"@babel/types": "7.20.7",
Expand Down
5 changes: 3 additions & 2 deletions packages/sveltekit/src/vite/sourceMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { getSentryRelease } from '@sentry/node';
import { escapeStringForRegex, uuid4 } from '@sentry/utils';
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
import { sentryVitePlugin } from '@sentry/vite-plugin';
// @ts-expect-error -sorcery has no types :(
import * as sorcery from 'sorcery';
import type { Plugin } from 'vite';

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

// @ts-expect-error - we're using dynamic import here and TS complains about that. It works though.
const sorcery = await import('sorcery');

for (const file of jsFiles) {
try {
await (sorcery as Sorcery).load(file).then(async chain => {
Expand Down
15 changes: 12 additions & 3 deletions packages/sveltekit/test/vite/sourceMaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ vi.mock('@sentry/vite-plugin', async () => {
};
});

vi.mock('sorcery', async () => {
return {
load: vi.fn().mockResolvedValue({
apply: vi.fn().mockResolvedValue(undefined),
write: vi.fn().mockResolvedValue(undefined),
}),
};
});

beforeEach(() => {
vi.clearAllMocks();
});
Expand Down Expand Up @@ -79,7 +88,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: true } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();
expect(mockedSentryVitePlugin.writeBundle).toHaveBeenCalledTimes(1);
});

Expand All @@ -89,7 +98,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: false } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();
expect(mockedSentryVitePlugin.writeBundle).not.toHaveBeenCalled();
});
});
Expand All @@ -110,7 +119,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: true } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();

expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Failed to upload source maps'));
expect(consoleLogSpy).toHaveBeenCalled();
Expand Down
38 changes: 11 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13474,16 +13474,16 @@ bson@^1.1.4:
resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.6.tgz#fb819be9a60cd677e0853aee4ca712a785d6618a"
integrity sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==

buffer-crc32@^0.2.5, buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=

buffer-crc32@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-1.0.0.tgz#a10993b9055081d55304bd9feb4a072de179f405"
integrity sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==

buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
Expand Down Expand Up @@ -17028,11 +17028,6 @@ es6-object-assign@^1.1.0:
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=

es6-promise@^3.1.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"
integrity sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==

[email protected]:
version "0.15.18"
resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz#20a7ae1416c8eaade917fb2453c1259302c637a5"
Expand Down Expand Up @@ -29334,7 +29329,7 @@ rfdc@^1.4.1:
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca"
integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==

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:
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:
version "2.7.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
Expand Down Expand Up @@ -29662,16 +29657,6 @@ safe-stable-stringify@^2.4.1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

sander@^0.5.0:
version "0.5.1"
resolved "https://registry.yarnpkg.com/sander/-/sander-0.5.1.tgz#741e245e231f07cafb6fdf0f133adfa216a502ad"
integrity sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==
dependencies:
es6-promise "^3.1.2"
graceful-fs "^4.1.3"
mkdirp "^0.5.1"
rimraf "^2.5.2"

sane@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded"
Expand Down Expand Up @@ -30446,15 +30431,14 @@ solid-use@^0.8.0:
resolved "https://registry.yarnpkg.com/solid-use/-/solid-use-0.8.0.tgz#d46258c45edb0f4c621285e0ad1aa6b6a674d79b"
integrity sha512-YX+XmcKLvSx3bwMimMhFy40ZkDnShnUcEw6cW6fSscwKEgl1TG3GlgAvkBmQ3AeWjvQSd8+HGTr82ImsrjkkqA==

sorcery@0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-0.11.0.tgz#310c80ee993433854bb55bb9aa4003acd147fca8"
integrity sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==
sorcery@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-1.0.0.tgz#b5bb81fb9706c0c240f5f2d3214b4d2be649e07f"
integrity sha512-5ay9oJE+7sNmhzl3YNG18jEEEf4AOQCM/FAqR5wMmzqd1FtRorFbJXn3w3SKOhbiQaVgHM+Q1lszZspjri7bpA==
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.14"
buffer-crc32 "^0.2.5"
minimist "^1.2.0"
sander "^0.5.0"
tiny-glob "^0.2.9"

sort-keys@^2.0.0:
version "2.0.0"
Expand Down

0 comments on commit 8711bdd

Please sign in to comment.