Generate and server Closure sourcemaps.

Change-Id: Ida17718eeffa1f5f1f3c849790d977921707d440
This commit is contained in:
Brad Fitzpatrick 2013-02-10 17:39:18 -08:00
parent 1fe472a202
commit 1f31c21cec
3 changed files with 6 additions and 1 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ build/root
.DS_Store .DS_Store
tmp tmp
server/camlistored/newui/all.js server/camlistored/newui/all.js
server/camlistored/newui/all.js.map

View File

@ -36,4 +36,5 @@ $(NEWUIDIR)/all.js: $(NEWUIDIR)/blob_item.js $(NEWUIDIR)/blob_item_container.js
--compiler_flags="--jscomp_warning=checkTypes" \ --compiler_flags="--jscomp_warning=checkTypes" \
--compiler_flags="--debug" \ --compiler_flags="--debug" \
--compiler_flags="--formatting=PRETTY_PRINT" \ --compiler_flags="--formatting=PRETTY_PRINT" \
--compiler_flags="--create_source_map=$(NEWUIDIR)/all.js.map" \
> $(NEWUIDIR)/all.js > $(NEWUIDIR)/all.js

View File

@ -47,7 +47,7 @@ var _ = log.Printf
var ( var (
staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif))$`) 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\_]+)*$`) identOrDotPattern = regexp.MustCompile(`^[a-zA-Z\_]+(\.[a-zA-Z\_]+)*$`)
// Download URL suffix: // Download URL suffix:
@ -445,6 +445,9 @@ func (ui *UIHandler) serveNewUI(rw http.ResponseWriter, req *http.Request) {
ui.serveDepsJS(rw, req) ui.serveDepsJS(rw, req)
return 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 // TODO(mpl): temporary hack to ease the work on the newui with
// the closure compiler. // the closure compiler.
if strings.HasSuffix(file, "index.html") && os.Getenv("CAMLI_USE_COMPILED_JS") == "1" { if strings.HasSuffix(file, "index.html") && os.Getenv("CAMLI_USE_COMPILED_JS") == "1" {