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

js: Support JSX and JSXImportSourceOptions #12119

Merged

Conversation

baltpeter
Copy link
Contributor

@baltpeter baltpeter commented Feb 22, 2024

As discussed in #12118, these two options make it easier to have React and non-React libraries automatically imported when using JSX.

When running mage -v check, I get an error in TestImageOperationsGolden. However, I get the same problem on master, so I'm assuming it isn't related to my changes.

Test error
panic: test timed out after 1m0s
running tests:
	TestImageOperationsGolden (34s)

goroutine 11105 [running]:
testing.(*M).startAlarm.func1()
	/usr/lib/go-1.21/src/testing/testing.go:2259 +0x1fc
created by time.goFunc
	/usr/lib/go-1.21/src/time/sleep.go:176 +0x45

goroutine 1 [chan receive]:
testing.tRunner.func1()
	/usr/lib/go-1.21/src/testing/testing.go:1561 +0x8cc
testing.tRunner(0xc0000e4b60, 0xc000629b08)
	/usr/lib/go-1.21/src/testing/testing.go:1601 +0x26c
testing.runTests(0xc0004f5400?, {0x62298a0, 0x15, 0x15}, {0x1c?, 0x4bfc59?, 0x6420180?})
	/usr/lib/go-1.21/src/testing/testing.go:2052 +0x897
testing.(*M).Run(0xc0004f5400)
	/usr/lib/go-1.21/src/testing/testing.go:1925 +0xb58
main.main()
	_testmain.go:93 +0x2be

goroutine 2240 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 2239
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3741 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3357
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3779 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3355
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 1078 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 900
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3778 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 2238
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3459 [runnable]:
image/draw.drawPaletted({0x55e6e48?, 0xc0012303c0?}, {{0xc00113e400?, 0xc0013e6178?}, {0x0?, 0x0?}}, {0x55e40c8?, 0xc00113e400?}, {0x0, 0x0}, ...)
	/usr/lib/go-1.21/src/image/draw/draw.go:1019 +0x12a5
image/draw.floydSteinberg.Draw({}, {0x55e6e48, 0xc0012303c0}, {{0x0, 0x0}, {0x190, 0xc8}}, {0x55e40c8, 0xc00113e400}, {0x0, ...})
	/usr/lib/go-1.21/src/image/draw/draw.go:77 +0x106
github.com/gohugoio/hugo/resources.(*imageResource).doWithImageConfig.func1()
	/home/benni/coding/rnd-stuff/hugo/resources/image.go:408 +0xf02
github.com/gohugoio/hugo/resources.(*ImageCache).getOrCreate.func1.2({{0xc001e23ec1?, 0xc0002faae0?}}, {0x7fbd75124f60?, 0xc00160a4c0})
	/home/benni/coding/rnd-stuff/hugo/resources/image_cache.go:73 +0x115
github.com/gohugoio/hugo/cache/filecache.(*Cache).ReadOrCreate(0xc000a5c910, {0xc001e23ec0, 0x5a}, 0xc0013e6d88, 0xc0013e6d08)
	/home/benni/coding/rnd-stuff/hugo/cache/filecache/filecache.go:180 +0x473
github.com/gohugoio/hugo/resources.(*ImageCache).getOrCreate.func1({0xc0008498c8?, 0x5607220?})
	/home/benni/coding/rnd-stuff/hugo/resources/image_cache.go:93 +0x25a
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x5600f80, {0xc001e23f20, 0x5a}, 0xc0013e70d0)
	/home/benni/go/pkg/mod/github.com/bep/lazycache@v0.4.0/lazycache.go:125 +0x302
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).GetOrCreate(...)
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:376
github.com/gohugoio/hugo/resources.(*ImageCache).getOrCreate(0xc0003c5320, 0xc000160a80, {0x2, {0x2b4130d, 0x6}, {0xc000f20018, 0x14}, 0x4b, 0x0, 0x0, ...}, ...)
	/home/benni/coding/rnd-stuff/hugo/resources/image_cache.go:44 +0x294
github.com/gohugoio/hugo/resources.(*imageResource).doWithImageConfig(0xc000160a80, {0x2, {0x2b4130d, 0x6}, {0xc000f20018, 0x14}, 0x4b, 0x0, 0x0, {0x0, ...}, ...}, ...)
	/home/benni/coding/rnd-stuff/hugo/resources/image.go:366 +0x128
github.com/gohugoio/hugo/resources.(*imageResource).Filter(0xc000160a80, {0xc00063e870, 0x1, 0xc00063e870?})
	/home/benni/coding/rnd-stuff/hugo/resources/image.go:281 +0x805
github.com/gohugoio/hugo/resources.(*resourceAdapter).Filter(0xc0003c2780?, {0xc00063e870, 0x1, 0x1})
	/home/benni/coding/rnd-stuff/hugo/resources/transform.go:255 +0x51
github.com/gohugoio/hugo/resources_test.TestImageOperationsGolden(0xc0009f71e0)
	/home/benni/coding/rnd-stuff/hugo/resources/image_test.go:708 +0x29d7
testing.tRunner(0xc0009f71e0, 0x2e0c720)
	/usr/lib/go-1.21/src/testing/testing.go:1595 +0x239
created by testing.(*T).Run in goroutine 1
	/usr/lib/go-1.21/src/testing/testing.go:1648 +0x82b

goroutine 3604 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3356
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 5621 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3357
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 2141 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 2140
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 1267 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 1266
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3398 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 2237
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 5488 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3357
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3742 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3458
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145

goroutine 3334 [select]:
github.com/gohugoio/hugo/cache/dynacache.(*Cache).start.func1()
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:295 +0xb0
created by github.com/gohugoio/hugo/cache/dynacache.(*Cache).start in goroutine 3459
	/home/benni/coding/rnd-stuff/hugo/cache/dynacache/dynacache.go:293 +0x145
FAIL	github.com/gohugoio/hugo/resources	60.171s

Fixes #12118

@CLAassistant
Copy link

CLAassistant commented Feb 22, 2024

CLA assistant check
All committers have signed the CLA.

@bep
Copy link
Member

bep commented Feb 23, 2024

TestImageOperationsGolden

I'm not sure what's the problem there, but I will add them to the "run on CI only" list, as they also take some time to run.

Thanks for this. I will merge this now, as I'm curious to test out preact myself. This means that it will likely end up in a patch release, but we can adjust the "new-in" badges later.

@bep bep merged commit 554aa58 into gohugoio:master Feb 23, 2024
8 checks passed
bep added a commit that referenced this pull request Feb 23, 2024
@baltpeter baltpeter deleted the feat/esbuild-jsx-jsximportsource-12118 branch February 26, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ESBuild options JSXImportSource and JSX
3 participants