js: Remove external source map option
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 4 Nov 2020 18:09:40 +0000 (19:09 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 4 Nov 2020 22:04:12 +0000 (23:04 +0100)
It was merged by accident and the implementation does not look correct.

Fixes #7932

resources/resource_transformers/js/build.go
resources/resource_transformers/js/options.go
resources/resource_transformers/js/options_test.go

index 3a7065e0d568eceb2f40371c857639d3d94cba28..5ff21cf02df6bbdbe79cd6672ca5bb2aaa2195c4 100644 (file)
@@ -78,8 +78,7 @@ func (t *buildTransformation) Transform(ctx *resources.ResourceTransformationCtx
        }
 
        opts.sourcefile = ctx.SourcePath
-       opts.workDir = t.c.rs.WorkingDir
-       opts.resolveDir = opts.workDir
+       opts.resolveDir = t.c.rs.WorkingDir
        opts.contents = string(src)
        opts.mediaType = ctx.InMediaType
 
index 654dbbab9882b1275b7ae0265b65552c77d11049..689efe0b4b74ae2fa1a3cc5db295063fd4b93c17 100644 (file)
@@ -93,7 +93,6 @@ type Options struct {
        contents   string
        sourcefile string
        resolveDir string
-       workDir    string
        tsConfig   string
 }
 
@@ -365,12 +364,6 @@ func toBuildOptions(opts Options) (buildOptions api.BuildOptions, err error) {
        switch opts.SourceMap {
        case "inline":
                sourceMap = api.SourceMapInline
-       case "external":
-               // When doing external sourcemaps we should specify
-               // out file and no out dir
-               sourceMap = api.SourceMapExternal
-               outFile = filepath.Join(opts.workDir, opts.TargetPath)
-               outDir = ""
        case "":
                sourceMap = api.SourceMapNone
        default:
index abc8091a9c3b115b948e30987fcc408ffc566d61..ef8c203ce8b7bcfe42671ad8ece374d5ebacf2af 100644 (file)
@@ -93,7 +93,7 @@ func TestToBuildOptions(t *testing.T) {
 
        opts, err = toBuildOptions(Options{
                Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
-               SourceMap: "external"})
+               SourceMap: "inline"})
        c.Assert(err, qt.IsNil)
        c.Assert(opts, qt.DeepEquals, api.BuildOptions{
                Bundle:            true,
@@ -102,7 +102,7 @@ func TestToBuildOptions(t *testing.T) {
                MinifyIdentifiers: true,
                MinifySyntax:      true,
                MinifyWhitespace:  true,
-               Sourcemap:         api.SourceMapExternal,
+               Sourcemap:         api.SourceMapInline,
                Stdin: &api.StdinOptions{
                        Loader: api.LoaderJS,
                },