#lang racket/base
(require racket/contract
racket/runtime-path
syntax/modresolve)
(provide/contract [query (module-path? . -> . string?)]
[has-javascript-implementation? (module-path? . -> . boolean?)]
[redirected? (path? . -> . boolean?)]
[follow-redirection (path? . -> . path?)])
(define-runtime-path record.rkt "record.rkt")
(define ns (make-base-empty-namespace))
(define (query a-module-path)
(let ([resolved-path (resolve-module-path a-module-path #f)])
(parameterize ([current-namespace ns])
(dynamic-require a-module-path (void)) ((dynamic-require-for-syntax record.rkt 'lookup-javascript-implementation) resolved-path))))
(define (has-javascript-implementation? a-module-path)
(let ([resolved-path (resolve-module-path a-module-path #f)])
(parameterize ([current-namespace ns])
(dynamic-require a-module-path (void)) ((dynamic-require-for-syntax record.rkt 'has-javascript-implementation?) resolved-path))))
(define (redirected? a-module-path)
(let ([resolved-path (resolve-module-path a-module-path #f)])
(parameterize ([current-namespace ns])
(dynamic-require a-module-path (void)) (path? ((dynamic-require-for-syntax record.rkt 'follow-redirection)
resolved-path)))))
(define (follow-redirection a-module-path)
(let ([resolved-path (resolve-module-path a-module-path #f)])
(parameterize ([current-namespace ns])
(dynamic-require a-module-path (void)) ((dynamic-require-for-syntax record.rkt 'follow-redirection)
resolved-path))))