summaryrefslogtreecommitdiffstats
path: root/resources/resource_transformers/js
AgeCommit message (Collapse)Author
2023-07-13js: Pass tsconfig.json to esBuildJoe Mooring
Note that esBuild only inspects/honors certain fields. See https://esbuild.github.io/content-types/#tsconfig-json. Fixes #11232
2023-06-19all: Fix typos in function names and commentsOleksandr Redko
2023-05-16Create a struct with all of Hugo's config optionsBjørn Erik Pedersen
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
2023-03-02Correct typos in Go commentsOleksandr Redko
2023-03-01Replace deprecated ioutil with io and osOleksandr Redko
https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
2023-01-16deps: Upgrade github.com/evanw/esbuild v0.15.18 => v0.17.0Bjørn Erik Pedersen
Also add a test to make sure legal comments are preserved in JS bundles. Closes #10536
2022-12-13resources/js: Fix some import discrepancies between Hugo and ESBuildBjørn Erik Pedersen
This fixes the cases where ```js import 'imp2/index.js'; import 'imp3/foo.js'; ``` And these files lives in `assets` as: ``` imp2/index.ts imp3/foo.ts ``` Fixes #10527
2022-06-12js: Resolve index.esm.jsBjørn Erik Pedersen
Same logic as for `index.{js,ts...}` files applies; if both `index.esm.js` and `index.js` exists (unlikely), you need to use the name with extension when importing, else the `index.js` will win. Fixes #8631
2022-05-15Improve SASS errorsBjørn Erik Pedersen
Fixes #9897
2022-05-15postcss: Fix import error handlingBjørn Erik Pedersen
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import. You can work around this by either: * Use url imports or imports with media queries. * Set `skipInlineImportsNotFound=true` in the options Also get the argument order in the different NewFileError* funcs in line. Fixes #9895
2022-05-14errors: Misc improvementsBjørn Erik Pedersen
* Redo the server error template * Always add the content file context if relevant * Remove some now superflous error string matching * Move the server error template to _server/error.html * Add file context (with position) to codeblock render blocks * Improve JS build errors Fixes #9892 Fixes #9891 Fixes #9893
2022-05-13js: Bump test dependencyBjørn Erik Pedersen
To work around a cache issue.
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-03-17all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-02-09js: Port integration tests to its own packageBjørn Erik Pedersen
2021-09-01js: Fix import order for ./foo when both ./foo.js and ./foo/index.js existsBjørn Erik Pedersen
This is in line with how both Node and ESBuild's native import resolver does it. The ambiguous situations above were discovered trying to build AlpineJS v3. Note that the above was never an issue if you used `./foo.js` and similar to import the component. Fixes #8945
2021-07-15hugofs: Make FileMeta a structBjørn Erik Pedersen
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct. This is easier to reason about, and it's more effective: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4) ``` See #8749
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-03-14deps: Update to esbuild v0.9.0Bjørn Erik Pedersen
2021-02-16js: Fix potential path issue on WindowsBjørn Erik Pedersen
2021-02-01deps: Update to esbuild v0.8.39Bjørn Erik Pedersen
Fixes #8189
2021-01-22js: Add Inject config optionBjørn Erik Pedersen
Fixes #8164
2021-01-22js: Add Shims optionBjørn Erik Pedersen
This commit adds a new `shims` option to `js.Build` that allows swapping out a component with another. Fixes #8165
2021-01-21Fix nilpointer in js.Build error handlingBjørn Erik Pedersen
Fixes #8162
2021-01-18pipes: Add external source map support to js.Build and BabelAndreas Richter
Fixes #8132
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-11-25deps: Update to github.com/evanw/esbuild 0.8.11 to 0.8.14Bjørn Erik Pedersen
Closes #7986
2020-11-13js: Let ESBuild handle all imports from node_modulesBjørn Erik Pedersen
This commit fixes some issues where modules in /assets share the same name as in node_modules. This was not intended, and with this commit the node_modules-components should be isolated. If you want to redefine something inside node_modules, use the `defines` option. Fixes #7948
2020-11-04js: Remove external source map optionBjørn Erik Pedersen
It was merged by accident and the implementation does not look correct. Fixes #7932
2020-11-04js: Misc fixesBjørn Erik Pedersen
* Fix resolve of package.json deps in submodules * Fix directory logic for writing assets/jsconfig.json Fixes #7924 Fixes #7923
2020-11-03js: Add avoidTDZ optionBjørn Erik Pedersen
Fixes #7865
2020-11-03Make js.Build fully support modulesBjørn Erik Pedersen
Fixes #7816 Fixes #7777 Fixes #7916
2020-11-03js.Build: Generate tsconfig filesAndreas Richter
Updates #7777 Added support to allow SourceMap files to be external to the build. In addition added more information when the js compilation has an error. Correctly append sourceMappingURL to output file. Fix merge conflict.
2020-09-01js.Build: Add SourceMap flag with inline optionAndreas Richter
Added a flag to allow turning on sourcemap in ESBuild. The current support can only support inline or true as value for sourcemap. This is because the way ESBuild is invoked it doesn't have a separate output path to write the mapfile external to the asset pipeline. Add disable for "" and "0". Add test script and make sure mage check passes. Fixes #7607
2020-07-22resources/js: Add option for setting bundle formatBjørn Erik Pedersen
Fixes #7503
2020-07-22resources/js: Simplify options handlingBjørn Erik Pedersen
Mostly to minify cache hash breakage. Updates #7499
2020-07-20resources/js: Add es5 build targetBjørn Erik Pedersen
2020-07-17Add .Defines to js.Build optionsBjørn Erik Pedersen
This is needed to import `react` as a library, e.g.: ``` {{ $jsx := resources.Get "index.jsx" }} {{ $options := dict "defines" (dict "process.env.NODE_ENV" "\"development\"") }} {{ $js := $jsx | js.Build $options }} ``` Fixes #7489
2020-07-13Add proper Media Type handling in js.BuildBjørn Erik Pedersen
See #732
2020-07-13Add js.Build asset bundlingRemko Tronçon
Fixes #7321