<commit_before>// Copyright 2015 The Serulian Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package developer

import (
	"bytes"
	"fmt"
	"html/template"
	"io/ioutil"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"strings"

	"github.com/gorilla/mux"
	"github.com/serulian/compiler/builder"
	"github.com/serulian/compiler/compilercommon"
	"github.com/serulian/compiler/generator/es5"
	"github.com/serulian/compiler/graphs/scopegraph"
	"github.com/serulian/compiler/sourcemap"
)

// developerRuntimeTemplateStr defines the template for the ES code emitted to allow for
// UI when running the developer tool.
const developerRuntimeTemplateStr = `
	console.group('Compilation of project {{ .Name }}');
	console.info('Compilation has begun');
	document.write('<script src="http://localhost{{ .Addr }}/{{ .Name }}.develop.js"></script>');
`

// developTransaction represents a single transaction of loading source via the development
// server.
type developTransaction struct {
	vcsDevelopmentDirectories []string             // VCS development directory paths.
	rootSourceFilePath        string               // The root source file
	addr                      string               // The address of the running server.
	name                      string               // The name of the source being developed.<commit_msg>Make the injected script in develop mode as async<commit_after>// Copyright 2015 The Serulian Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package developer

import (
	"bytes"
	"fmt"
	"html/template"
	"io/ioutil"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"strings"

	"github.com/gorilla/mux"
	"github.com/serulian/compiler/builder"
	"github.com/serulian/compiler/compilercommon"
	"github.com/serulian/compiler/generator/es5"
	"github.com/serulian/compiler/graphs/scopegraph"
	"github.com/serulian/compiler/sourcemap"
)

// developerRuntimeTemplateStr defines the template for the ES code emitted to allow for
// UI when running the developer tool.
const developerRuntimeTemplateStr = `
	console.group('Compilation of project {{ .Name }}');
	console.info('Compilation has begun');
	document.write('<script src="http://localhost{{ .Addr }}/{{ .Name }}.develop.js" async></script>');
`

// developTransaction represents a single transaction of loading source via the development
// server.
type developTransaction struct {
	vcsDevelopmentDirectories []string             // VCS development directory paths.
	rootSourceFilePath        string               // The root source file
	addr                      string               // The address of the running server.
	name                      string               // The name of the source being developed.
{'fraction_non_alphanumeric': 0.10378681626928471, 'fraction_numerical': 0.0035063113604488078, 'mean_word_length': 3.110951008645533, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2192792', 'n_tokens_mistral': 805, 'n_tokens_neox': 779, 'n_words': 252}