Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump swc #8276

Merged
merged 8 commits into from Jul 20, 2022
Merged

Bump swc #8276

merged 8 commits into from Jul 20, 2022

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented Jul 3, 2022

Fixes #8277
Fixes #8281

  • Something is broken once again with the inserted var __dirname declarations...
    The problem here was that we generated var __dirname = require("path").resolve(__dirname, "../src");, which only worked by coincidence when swc renamed it to var __dirname1 = .... But after the upgrade, it wasn't renamed anymore. I've changed it to use new variables instead (and then also rename all id references to that):
// inserted by Parcel:
var $parcel$__dirname = require("path").resolve(__dirname, "../src");
var $parcel$__filename = require("path").resolve(__dirname, "../src", "index.js");
// source with renamed ids:
const fs = require("fs");
const path = require("path");
const firstDirnameTest = path.join($parcel$__dirname, "data");
const secondDirnameTest = path.join($parcel$__dirname, "other-data");
const firstFilenameTest = $parcel$__filename;
const secondFilenameTest = `${$parcel$__filename}?query-string=test`;
  • swc's resolver now takes into account module/script mode (strict/nonstrict). So
console.log(typeof bar, typeof baz);
if (true) {
  console.log(typeof bar, typeof baz);
  function bar() {}
  class Test {}
}
console.log(typeof bar, typeof baz);

class Foo {}
function baz() {}

console.log(typeof bar)

will be parsed as this in module mode (what we did so far):

console.log(typeof bar, typeof baz);
if (true) {
    console.log(typeof bar1, typeof baz);
    function bar1() {}
    class Test {
    }
}
console.log(typeof bar, typeof baz);
class Foo {
}
function baz() {}

using a script, it behaves as it did before bumping
Solution: parse as program (automatically detect script/module), and convert to module after resolving (so that the other passes can insert import statements)

@mischnic mischnic requested a review from devongovett July 5, 2022 10:10
@parcel-benchmark
Copy link

parcel-benchmark commented Jul 5, 2022

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.94s +120.00ms ⚠️
Cached 436.00ms +18.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

React HackerNews ✅

Timings

Description Time Difference
Cold 11.08s +242.00ms
Cached 592.00ms +50.00ms ⚠️

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.83m -2.85s
Cached 3.22s +85.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/index.85d4de0b.js 3.33mb +155.00b ⚠️ 36.45s +780.00ms
dist/index.fecc0faa.js 1.27mb +97.00b ⚠️ 1.38m -535.00ms
dist/pdfRenderer.aae3e078.js 1.11mb +63.00b ⚠️ 1.38m -500.00ms
dist/editorView.f874dc50.js 606.88kb -82.00b 🚀 1.38m -512.00ms
dist/refractor.aa9d6b22.js 599.28kb +435.00b ⚠️ 1.38m -511.00ms
dist/ConfigPanelFieldsLoader.06470302.js 287.98kb +11.00b ⚠️ 40.08s +495.00ms
dist/esm.c7dc1640.js 61.96kb +0.00b 1.38m +37.64s ⚠️
dist/ElementBrowser.3a733953.js 57.29kb +15.00b ⚠️ 41.44s +551.00ms
dist/DatePicker.63d5864f.js 26.86kb -12.00b 🚀 40.08s +495.00ms
dist/workerHasher.e50d242f.js 1.72kb +0.00b 1.38m +37.66s ⚠️
dist/16.1969624f.js 1.08kb +0.00b 45.84s +4.95s ⚠️
dist/16.069344b7.js 905.00b +0.00b 45.84s +4.95s ⚠️
dist/simpleHasher.46d6f2e5.js 742.00b +0.00b 1.38m +37.66s ⚠️
dist/index.html 240.00b +0.00b 45.27s +9.59s ⚠️

Cached Bundles

Bundle Size Difference Time Difference
dist/index.b31e1f9c.js 3.33mb +155.00b ⚠️ 35.32s +57.00ms
dist/index.a5d11a6e.js 1.27mb +97.00b ⚠️ 1.36m +614.00ms
dist/pdfRenderer.f837d787.js 1.11mb +63.00b ⚠️ 1.36m +614.00ms
dist/editorView.f874dc50.js 606.88kb -82.00b 🚀 1.36m +612.00ms
dist/refractor.aa9d6b22.js 599.28kb +435.00b ⚠️ 1.36m +612.00ms
dist/ConfigPanelFieldsLoader.06470302.js 287.98kb +11.00b ⚠️ 38.95s -15.00ms
dist/ElementBrowser.3a733953.js 57.29kb +15.00b ⚠️ 40.26s +4.00ms
dist/DatePicker.63d5864f.js 26.86kb -12.00b 🚀 38.95s -16.00ms

Three.js ✅

Timings

Description Time Difference
Cold 7.67s +92.00ms
Cached 365.00ms +25.00ms ⚠️

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@mischnic mischnic merged commit 62f64ca into v2 Jul 20, 2022
@mischnic mischnic deleted the bump-swc branch July 20, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants