js-impl now records just the paths in the implementation; compile time is when we suck the content into the file
This commit is contained in:
parent
69fe79c57a
commit
58fc1b400a
|
@ -15,6 +15,8 @@
|
||||||
racket/promise
|
racket/promise
|
||||||
racket/set
|
racket/set
|
||||||
racket/path
|
racket/path
|
||||||
|
racket/string
|
||||||
|
racket/port
|
||||||
(prefix-in query: "../lang/js/query.rkt")
|
(prefix-in query: "../lang/js/query.rkt")
|
||||||
(prefix-in resource-query: "../resource/query.rkt")
|
(prefix-in resource-query: "../resource/query.rkt")
|
||||||
(planet dyoo/closure-compile:1:1)
|
(planet dyoo/closure-compile:1:1)
|
||||||
|
@ -138,8 +140,13 @@
|
||||||
[(MainModuleSource? src)
|
[(MainModuleSource? src)
|
||||||
(get-javascript-implementation (MainModuleSource-source src))]
|
(get-javascript-implementation (MainModuleSource-source src))]
|
||||||
[(ModuleSource? src)
|
[(ModuleSource? src)
|
||||||
(let ([name (rewrite-path (ModuleSource-path src))]
|
(let* ([name (rewrite-path (ModuleSource-path src))]
|
||||||
[text (query:query `(file ,(path->string (ModuleSource-path src))))]
|
[paths (query:query `(file ,(path->string (ModuleSource-path src))))]
|
||||||
|
[text (string-join
|
||||||
|
(map (lambda (p)
|
||||||
|
(call-with-input-file p port->string))
|
||||||
|
paths)
|
||||||
|
"\n")]
|
||||||
[module-requires (query:lookup-module-requires (ModuleSource-path src))]
|
[module-requires (query:lookup-module-requires (ModuleSource-path src))]
|
||||||
[bytecode (parse-bytecode (ModuleSource-path src))])
|
[bytecode (parse-bytecode (ModuleSource-path src))])
|
||||||
(when (not (empty? module-requires))
|
(when (not (empty? module-requires))
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
(resolve-module-path a-module-path #f)))
|
(resolve-module-path a-module-path #f)))
|
||||||
|
|
||||||
|
|
||||||
(define-for-syntax (read-implementation a-module-path)
|
(define-for-syntax (resolve-implementation-path a-module-path)
|
||||||
(let ([a-path (my-resolve-path a-module-path)])
|
(let ([a-path (my-resolve-path a-module-path)])
|
||||||
(file->string a-path)))
|
(path->string a-path)))
|
||||||
|
|
||||||
|
|
||||||
(define-syntax (declare-implementation stx)
|
(define-syntax (declare-implementation stx)
|
||||||
|
@ -26,10 +26,8 @@
|
||||||
([resolved-racket-module-name
|
([resolved-racket-module-name
|
||||||
(my-resolve-path (syntax-e #'racket-module-name))]
|
(my-resolve-path (syntax-e #'racket-module-name))]
|
||||||
[impl
|
[impl
|
||||||
(string-join
|
(map (compose resolve-implementation-path syntax-e)
|
||||||
(map (compose read-implementation syntax-e)
|
(syntax->list #'(javascript-module-name ...)))]
|
||||||
(syntax->list #'(javascript-module-name ...)))
|
|
||||||
"\n")]
|
|
||||||
[(internal-name ...) (generate-temporaries #'(provided-name ...))])
|
[(internal-name ...) (generate-temporaries #'(provided-name ...))])
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(begin
|
(begin
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
syntax/modresolve)
|
syntax/modresolve)
|
||||||
|
|
||||||
|
|
||||||
(provide/contract [query (module-path? . -> . string?)]
|
(provide/contract [query (module-path? . -> . (listof string?))]
|
||||||
[has-javascript-implementation? (module-path? . -> . boolean?)]
|
[has-javascript-implementation? (module-path? . -> . boolean?)]
|
||||||
|
|
||||||
[redirected? (path? . -> . boolean?)]
|
[redirected? (path? . -> . boolean?)]
|
||||||
|
|
|
@ -465,6 +465,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var parseStringAsHtml = function(str) {
|
||||||
|
var dom = $("<html/>").append($(str));
|
||||||
|
return dom;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// coerseToView: (U resource View) -> View
|
// coerseToView: (U resource View) -> View
|
||||||
// Coerse a value into a view.
|
// Coerse a value into a view.
|
||||||
|
@ -474,7 +479,7 @@
|
||||||
return onSuccess(x);
|
return onSuccess(x);
|
||||||
} else if (isResource(x)) {
|
} else if (isResource(x)) {
|
||||||
try {
|
try {
|
||||||
dom = $("<html/>").append($(resourceContent(x).toString()))
|
dom = parseStringAsHtml(resourceContent(x).toString())
|
||||||
.css("margin", "0px")
|
.css("margin", "0px")
|
||||||
.css("padding", "0px")
|
.css("padding", "0px")
|
||||||
.css("border", "0px");
|
.css("border", "0px");
|
||||||
|
@ -502,7 +507,7 @@
|
||||||
return onSuccess(x);
|
return onSuccess(x);
|
||||||
} else if (isResource(x)) {
|
} else if (isResource(x)) {
|
||||||
try {
|
try {
|
||||||
dom = $("<html/>").append($(resourceContent(x).toString()))
|
dom = parseStringAsHtml(resourceContent(x).toString())
|
||||||
.css("margin", "0px")
|
.css("margin", "0px")
|
||||||
.css("padding", "0px")
|
.css("padding", "0px")
|
||||||
.css("border", "0px");
|
.css("border", "0px");
|
||||||
|
@ -534,7 +539,7 @@
|
||||||
return onSuccess(x);
|
return onSuccess(x);
|
||||||
} else if (isResource(x)) {
|
} else if (isResource(x)) {
|
||||||
try {
|
try {
|
||||||
dom = $(resourceContent(x).toString())
|
dom = parseStringAsHtml(resourceContent(x).toString())
|
||||||
.css("margin", "0px")
|
.css("margin", "0px")
|
||||||
.css("padding", "0px")
|
.css("padding", "0px")
|
||||||
.css("border", "0px");
|
.css("border", "0px");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user