mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
@@ -50,7 +50,7 @@ type Options struct {
|
||||
}
|
||||
|
||||
// DecodeOptions decodes options to and generates command flags
|
||||
func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
func DecodeOptions(m map[string]any) (opts Options, err error) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
@@ -58,8 +58,8 @@ func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (opts Options) toArgs() []interface{} {
|
||||
var args []interface{}
|
||||
func (opts Options) toArgs() []any {
|
||||
var args []any
|
||||
|
||||
// external is not a known constant on the babel command line
|
||||
// .sourceMaps must be a boolean, "inline", "both", or undefined
|
||||
@@ -147,11 +147,11 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
|
||||
|
||||
ctx.ReplaceOutPathExtension(".js")
|
||||
|
||||
var cmdArgs []interface{}
|
||||
var cmdArgs []any
|
||||
|
||||
if configFile != "" {
|
||||
logger.Infoln("babel: use config file", configFile)
|
||||
cmdArgs = []interface{}{"--config-file", configFile}
|
||||
cmdArgs = []any{"--config-file", configFile}
|
||||
}
|
||||
|
||||
if optArgs := t.options.toArgs(); len(optArgs) > 0 {
|
||||
|
@@ -31,7 +31,7 @@ func NewTestResourceSpec() (*resources.Spec, error) {
|
||||
cfg.Set("baseURL", "https://example.org")
|
||||
cfg.Set("publishDir", "public")
|
||||
|
||||
imagingCfg := map[string]interface{}{
|
||||
imagingCfg := map[string]any{
|
||||
"resampleFilter": "linear",
|
||||
"quality": 68,
|
||||
"anchor": "left",
|
||||
|
@@ -62,7 +62,7 @@ func TestTransform(t *testing.T) {
|
||||
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(transformed.RelPermalink(), qt.Equals, "/hugo.a5ad1c6961214a55de53c1ce6e60d27b6b761f54851fa65e33066460dfa6a0db.txt")
|
||||
c.Assert(transformed.Data(), qt.DeepEquals, map[string]interface{}{"Integrity": template.HTMLAttr("sha256-pa0caWEhSlXeU8HObmDSe2t2H1SFH6ZeMwZkYN+moNs=")})
|
||||
c.Assert(transformed.Data(), qt.DeepEquals, map[string]any{"Integrity": template.HTMLAttr("sha256-pa0caWEhSlXeU8HObmDSe2t2H1SFH6ZeMwZkYN+moNs=")})
|
||||
content, err := transformed.(resource.ContentProvider).Content()
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(content, qt.Equals, "Hugo Rocks!")
|
||||
|
@@ -54,7 +54,7 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) *Client {
|
||||
}
|
||||
|
||||
type buildTransformation struct {
|
||||
optsm map[string]interface{}
|
||||
optsm map[string]any
|
||||
c *Client
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ func (t *buildTransformation) Transform(ctx *resources.ResourceTransformationCtx
|
||||
}
|
||||
|
||||
// Process process esbuild transform
|
||||
func (c *Client) Process(res resources.ResourceTransformer, opts map[string]interface{}) (resource.Resource, error) {
|
||||
func (c *Client) Process(res resources.ResourceTransformer, opts map[string]any) (resource.Resource, error) {
|
||||
return res.Transform(
|
||||
&buildTransformation{c: c, optsm: opts},
|
||||
)
|
||||
|
@@ -71,14 +71,14 @@ type Options struct {
|
||||
Inject []string
|
||||
|
||||
// User defined symbols.
|
||||
Defines map[string]interface{}
|
||||
Defines map[string]any
|
||||
|
||||
// Maps a component import to another.
|
||||
Shims map[string]string
|
||||
|
||||
// User defined params. Will be marshaled to JSON and available as "@params", e.g.
|
||||
// import * as params from '@params';
|
||||
Params interface{}
|
||||
Params any
|
||||
|
||||
// What to use instead of React.createElement.
|
||||
JSXFactory string
|
||||
@@ -106,7 +106,7 @@ type Options struct {
|
||||
tsConfig string
|
||||
}
|
||||
|
||||
func decodeOptions(m map[string]interface{}) (Options, error) {
|
||||
func decodeOptions(m map[string]any) (Options, error) {
|
||||
var opts Options
|
||||
|
||||
if err := mapstructure.WeakDecode(m, &opts); err != nil {
|
||||
@@ -269,7 +269,7 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) {
|
||||
params := opts.Params
|
||||
if params == nil {
|
||||
// This way @params will always resolve to something.
|
||||
params = make(map[string]interface{})
|
||||
params = make(map[string]any)
|
||||
}
|
||||
|
||||
b, err := json.Marshal(params)
|
||||
|
@@ -33,7 +33,7 @@ import (
|
||||
func TestOptionKey(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
opts := map[string]interface{}{
|
||||
opts := map[string]any{
|
||||
"TargetPath": "foo",
|
||||
"Target": "es2018",
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ func New(rs *resources.Spec) *Client {
|
||||
return &Client{rs: rs}
|
||||
}
|
||||
|
||||
func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
func DecodeOptions(m map[string]any) (opts Options, err error) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
@@ -165,11 +165,11 @@ func (t *postcssTransformation) Transform(ctx *resources.ResourceTransformationC
|
||||
}
|
||||
}
|
||||
|
||||
var cmdArgs []interface{}
|
||||
var cmdArgs []any
|
||||
|
||||
if configFile != "" {
|
||||
logger.Infoln("postcss: use config file", configFile)
|
||||
cmdArgs = []interface{}{"--config", configFile}
|
||||
cmdArgs = []any{"--config", configFile}
|
||||
}
|
||||
|
||||
if optArgs := t.options.toArgs(); len(optArgs) > 0 {
|
||||
|
@@ -31,14 +31,14 @@ import (
|
||||
// Issue 6166
|
||||
func TestDecodeOptions(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
opts1, err := DecodeOptions(map[string]interface{}{
|
||||
opts1, err := DecodeOptions(map[string]any{
|
||||
"no-map": true,
|
||||
})
|
||||
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(opts1.NoMap, qt.Equals, true)
|
||||
|
||||
opts2, err := DecodeOptions(map[string]interface{}{
|
||||
opts2, err := DecodeOptions(map[string]any{
|
||||
"noMap": true,
|
||||
})
|
||||
|
||||
|
@@ -44,7 +44,7 @@ type executeAsTemplateTransform struct {
|
||||
rs *resources.Spec
|
||||
t tpl.TemplatesProvider
|
||||
targetPath string
|
||||
data interface{}
|
||||
data any
|
||||
}
|
||||
|
||||
func (t *executeAsTemplateTransform) Key() internal.ResourceTransformationKey {
|
||||
@@ -63,7 +63,7 @@ func (t *executeAsTemplateTransform) Transform(ctx *resources.ResourceTransforma
|
||||
return t.t.Tmpl().Execute(templ, ctx.To, t.data)
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteAsTemplate(res resources.ResourceTransformer, targetPath string, data interface{}) (resource.Resource, error) {
|
||||
func (c *Client) ExecuteAsTemplate(res resources.ResourceTransformer, targetPath string, data any) (resource.Resource, error) {
|
||||
return res.Transform(&executeAsTemplateTransform{
|
||||
rs: c.rs,
|
||||
targetPath: helpers.ToSlashTrimLeading(targetPath),
|
||||
|
@@ -69,7 +69,7 @@ type Client struct {
|
||||
transpiler *godartsass.Transpiler
|
||||
}
|
||||
|
||||
func (c *Client) ToCSS(res resources.ResourceTransformer, args map[string]interface{}) (resource.Resource, error) {
|
||||
func (c *Client) ToCSS(res resources.ResourceTransformer, args map[string]any) (resource.Resource, error) {
|
||||
if c.dartSassNotAvailable {
|
||||
return res.Transform(resources.NewFeatureNotAvailableTransformer(transformationName, args))
|
||||
}
|
||||
@@ -123,7 +123,7 @@ type Options struct {
|
||||
EnableSourceMap bool
|
||||
}
|
||||
|
||||
func decodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
func decodeOptions(m map[string]any) (opts Options, err error) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ func Supports() bool {
|
||||
}
|
||||
|
||||
type transform struct {
|
||||
optsm map[string]interface{}
|
||||
optsm map[string]any
|
||||
c *Client
|
||||
}
|
||||
|
||||
|
@@ -62,7 +62,7 @@ type Options struct {
|
||||
EnableSourceMap bool
|
||||
}
|
||||
|
||||
func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
func DecodeOptions(m map[string]any) (opts Options, err error) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build extended
|
||||
// +build extended
|
||||
|
||||
package scss
|
||||
|
@@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !extended
|
||||
// +build !extended
|
||||
|
||||
package scss
|
||||
|
@@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build extended
|
||||
// +build extended
|
||||
|
||||
package scss
|
||||
|
Reference in New Issue
Block a user