From 1f31c21cecacb57f087c0eb2ee99a836031fbeff Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 10 Feb 2013 17:39:18 -0800 Subject: [PATCH] Generate and server Closure sourcemaps. Change-Id: Ida17718eeffa1f5f1f3c849790d977921707d440 --- .gitignore | 1 + Makefile | 1 + pkg/server/ui.go | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 638a1290a..016808f80 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ build/root .DS_Store tmp server/camlistored/newui/all.js +server/camlistored/newui/all.js.map diff --git a/Makefile b/Makefile index c0812f434..e160ec4c3 100644 --- a/Makefile +++ b/Makefile @@ -36,4 +36,5 @@ $(NEWUIDIR)/all.js: $(NEWUIDIR)/blob_item.js $(NEWUIDIR)/blob_item_container.js --compiler_flags="--jscomp_warning=checkTypes" \ --compiler_flags="--debug" \ --compiler_flags="--formatting=PRETTY_PRINT" \ + --compiler_flags="--create_source_map=$(NEWUIDIR)/all.js.map" \ > $(NEWUIDIR)/all.js diff --git a/pkg/server/ui.go b/pkg/server/ui.go index 103ea0e56..8919ec735 100644 --- a/pkg/server/ui.go +++ b/pkg/server/ui.go @@ -47,7 +47,7 @@ var _ = log.Printf var ( staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif))$`) - static2FilePattern = regexp.MustCompile(`^new/*(/[a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif))*$`) + static2FilePattern = regexp.MustCompile(`^new/*(/[a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif|js\.map))*$`) identOrDotPattern = regexp.MustCompile(`^[a-zA-Z\_]+(\.[a-zA-Z\_]+)*$`) // Download URL suffix: @@ -445,6 +445,9 @@ func (ui *UIHandler) serveNewUI(rw http.ResponseWriter, req *http.Request) { ui.serveDepsJS(rw, req) return } + if file == "/all.js" { + rw.Header().Set("X-SourceMap", "all.js.map") + } // TODO(mpl): temporary hack to ease the work on the newui with // the closure compiler. if strings.HasSuffix(file, "index.html") && os.Getenv("CAMLI_USE_COMPILED_JS") == "1" {