├── CHANGES.md ├── README.md ├── deploy.sh ├── deps.edn ├── dev-resources ├── deps.cljs ├── js-foreign-lib.js └── js-lib.js ├── epl-v10.html ├── repl.sh ├── resources └── bootstrap.js ├── src-build └── replique_build │ └── deploy.clj ├── src └── replique │ ├── classpath.clj │ ├── classpath_jdk9+.clj │ ├── cljs.clj │ ├── cljs_env │ ├── browser.cljs │ ├── completion.cljs │ ├── elisp_printer.clj │ ├── elisp_printer.cljs │ ├── javafx.cljs │ ├── repl.cljs │ └── watch.cljs │ ├── completion.clj │ ├── context.clj │ ├── elisp_printer.clj │ ├── environment.clj │ ├── files.clj │ ├── find_usage.clj │ ├── http.clj │ ├── http_server.clj │ ├── interactive.clj │ ├── log4j2.clj │ ├── logback.clj │ ├── main.clj │ ├── meta.clj │ ├── nashorn.clj │ ├── omniscient.clj │ ├── omniscient_runtime.cljc │ ├── repl.clj │ ├── repl_cljs.clj │ ├── repl_common.clj │ ├── repliquedoc.clj │ ├── server.clj │ ├── shadow_cljs.clj │ ├── source_meta.clj │ ├── spec_tooling.clj │ ├── tooling.clj │ ├── tooling_msg.clj │ ├── utils.clj │ ├── watch.clj │ └── watch_protocols.clj └── test └── replique └── compliment ├── ns_mappings_clj_test.clj ├── ns_mappings_cljc_test.cljc ├── ns_mappings_cljs_test.cljs └── ns_mappings_cljs_test2.cljs /CHANGES.md: -------------------------------------------------------------------------------- 1 | # Version 1.0.0 2 | 3 | - Add the possibility to refresh the clojurescript "deps.cljs" file 4 | - Fix potential races conditions when loading file concurrently from clojure/clojurescript 5 | - Support for Clojurescript 1.11.60 6 | - Update Clojurescript minimum version to 1.10.238 7 | 8 | # Version 0.0.17 9 | 10 | - Prevents the cljs REPL from hanging when connected to chrome 11 | - Add :global-goog-object&array to the cljs compiler options that can be customized 12 | - More robust "replique.interactive/set-cljs-compiler-opt" 13 | - Default the Clojurescript :language-in option to :ecmascript6 14 | - Add the possibility to reload log4j2 configurations 15 | - Add the replique.files/create-file function 16 | - Fix jump-to-definition for forms evaluated in the REPL without loading a file 17 | - Support for Clojurescript 1.10.891 18 | - The cljs REPL now binds the cljs.analyzer/*fn-invoke-direct* var 19 | - Fix the printing of keywords by the elisp printer (escape special chars) 20 | - Fix several bugs when requiring javascript modules 21 | - The usage of strings in the cljs (:require ...) syntax is now correctly handled 22 | 23 | # Version 0.0.16 24 | 25 | - Fix replique.watch refresh/browsing errors in some cases 26 | - Logback reloading now requires an explicit url 27 | - Fix private var usage warning with clojurescript 1.10.439 28 | - Add the replique.interactive/eval-js function 29 | - cljs repl params (dynamic bindings) were sometimes unexpectedly reset 30 | - Post hooks API changes + enable post eval hooks for Clojure 31 | 32 | # Version 0.0.15 33 | 34 | - Improve Clojurescript namespace/var watching 35 | - Replique now depends on clojure tools.deps instead of Leiningen 36 | 37 | # Version 0.0.14 38 | 39 | - Add the possibility to reload logback configurations 40 | - Support for Clojurescript 1.10.238 41 | 42 | # Version 0.0.13 43 | 44 | - Add the possibility to ensure that a cljs namespace and its dependencies are loaded in the cljs analysis env when starting a cljs REPL 45 | - Add a find-usage feature 46 | - A .repliquedoc file can be added to directories to exclude from the Replique search based features (find-usage, main js file refreshing, ...) 47 | - Tooling support to visualize watchable data 48 | - Support for Clojurescript 1.10.238 49 | - Autocompletion of system classes for jdk9+ 50 | - Fix auto completion in import contexts 51 | 52 | # Version 0.0.12 Corrupted release - see 0.0.13 53 | 54 | # Version 0.0.11 - Corrupted release - see 0.0.13 55 | 56 | # Version 0.0.10 57 | 58 | - Tooling messages exception are now returned as data instead of strings 59 | - The cljs REPL no longer tries to automatically reconnect when the connection is closed by the cljs server because of a new connection coming in 60 | - Clojurescript dependencies are now checked for recompilation when analyzed for the first time 61 | - Performance improvement for the replique/reload-all command when used in a cljs context 62 | - Metadata for namespaces: now returns all the files of a namespace when its definition is split in multiple files 63 | 64 | # Version 0.0.9 65 | 66 | - Autocompletion refactoring - fuzzy matching, autocompletion for files and javascript interop calls 67 | - Improve the REPL startup sequence, interactive commands can now be used while the REPL is starting 68 | - Fix Replique startup under jdk9 69 | - Fix the compilation order of Clojurescript files (and their dependencies) 70 | - Add metadata (line, column number, file name) to forms evaluated at the REPL from a clj/cljs buffer 71 | - Clojurescript constants can now be reloaded 72 | - Add support for reloading a clojurescript file an all its dependencies (like the :reload-all option of require in Clojure) 73 | 74 | # Version 0.0.8 75 | 76 | - Fix undefined var warning for cljs 1.9.854 + 77 | - Fix the cljs repl when using clojurescript version 1.9.655 or 1.9.660 78 | - Add the replique.interactive/load-url macro. clj/cljs/cljc files can now be loaded from files or from files in jar archives 79 | - Fix a "broken link" exception when reloading a web browser page connected to the browser REPL 80 | - The omniscient no longer always use the namespace of the session when resolving symbols 81 | - Replique now checks the clojurescript version number for compatibility 82 | - The browser REPL now supports query string parameters 83 | - Stringify all Clojure symbols in tooling messages 84 | - Starting a REPL did not work when some dependencies were excluded 85 | - Add the remove-var interactive macro 86 | - Update the minimum cljs version required to 1.9.473 87 | - Improve local bindings analysis 88 | - Fix the omniscient debugger when updating the var being debugged in an already started omniscient repl 89 | 90 | # Version 0.0.7 91 | 92 | - The omniscient debugger now captures the deftype and defrecord fields 93 | - Omniscient debugger support for defrecord 94 | - Cljs repls did not work when starting a browser repl and a nashorn repl simultaneously 95 | - Cljs error printing and stacktrace handling now follows clojure behavior more closely 96 | - Classpath reloading 97 | - Javascript errors happening during load-file are now printed by a global error handler 98 | - Update the compliment library (autocompletion) 99 | 100 | # Version 0.0.6 101 | 102 | - Add support for the :checked-arrays cljs compiler option 103 | - Remove the replique.interactive/remote-repl command 104 | - Add an omniscient debugger 105 | - Add the replique.interactive/repl command 106 | 107 | # Version 0.0.5 108 | 109 | - Add support for javafx css file reloading 110 | - Add support of Nashorn as a Clojurescript evaluation environment 111 | - Post evaluation hook API for clojurescript vars and namesapces 112 | 113 | # Version 0.0.4 114 | 115 | - Fix compilation of cljs files with newer version of clojurescript 116 | - Fix the :meta-cljs tooling message (regression introduced in 0.0.3) 117 | 118 | # Version 0.0.3 119 | 120 | - Clojurescript 1.9.456 compatibility 121 | - When the cursor is on a class and this class was compiled from a var, the meta command returns the metadata of the var 122 | - When the cursor is in a string representing a resource in the classpath, the meta command returns the absolute path of the resource 123 | - The javascript environment will now automatically try to reconnect to the clojurescript server after an unexpected disconnection 124 | - Autocompletion now handles the :renames and :rename-macros keys of clojurescript namespace declarations (available since clojurescript 1.9.183) 125 | - Providing a hostname is now necessary to start the REPL 126 | - Update the cljs-repl connection logic to make connecting to the cljs repl from any environment possible 127 | WARNING: main javascript files must be recreated when updating to the 0.0.3 version 128 | 129 | # Version 0.0.2 130 | 131 | ## Bug fixes 132 | 133 | - output-main-js-file now munge namespace names and creates parent directories 134 | - jump to definition always jumps to the cljs definition when editing cljc files 135 | - replique.interactive/load-file sometimes throws an exception 136 | 137 | ## Changes 138 | 139 | - The function used to print data into the tooling REPL can now be customized 140 | - load-css cannot load css as data-uri anymore -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Replique 2 | 3 | Replique is a development environment for Clojure and Clojurescript. 4 | 5 | Replique relies on the Clojure [command line tools](https://clojure.org/guides/deps_and_cli) for starting REPLs. 6 | The Clojure command line tools must be [installed](https://clojure.org/guides/getting_started#_clojure_installer_and_cli_tools) before using Replique. 7 | 8 | If you are interested in using Replique, you should check out its [emacs mode](https://github.com/EwenG/replique.el). 9 | 10 | ## Overview 11 | 12 | The following is an overview of Replique features, demonstrating the use of Replique with only the help of a terminal. 13 | 14 | Create an empty directory named "replique-demo". In the replique-demo directory, create a file named "deps.edn" with the following content. 15 | 16 | ```clojure 17 | {:deps {replique/replique {:git/url "https://github.com/EwenG/replique.git" 18 | :git/tag "1.0.0" 19 | :git/sha "039e8bc"} 20 | org.clojure/clojurescript {:mvn/version "1.11.60"}}} 21 | ``` 22 | 23 | The dependency on Clojurescript is not strictly needed but is added because we will later start a Clojurescript REPL. 24 | 25 | From the project directory, start a REPL server on port 9000: 26 | 27 | `clj -J-Dreplique.server.port=9000 -J-Dreplique.http-server.port=9001 -M -m replique.main` 28 | 29 | In an other terminal, connect to the REPL server: 30 | 31 | `telnet localhost 9000` 32 | 33 | You are now in a Clojure REPL. You will notice that the current REPL does not print a prompt. The reason is Replique is designed to be easy to integrate into a text editor or an IDE. By not printing the prompt we make the REPL output easier to parse for the machine. 34 | You can enter any Clojure expression to get it evaluated. 35 | 36 | `(+ 1 2)` 37 | => `3` 38 | 39 | Now let's start a more familiar Clojure REPL: 40 | 41 | `(replique.repl/repl)` 42 | 43 | A prompt is now printed. Again, you can enter any Clojure expression. 44 | 45 | Let's start a Clojurescipt REPL. Ensure that you added a Clojurescript dependency to your deps.edn file, as described earlier. 46 | 47 | `(replique.interactive/cljs-repl)` 48 | 49 | Wait a few seconds for the Clojurescript core libraries to be compiled. Javascript files get compiled to the `target/cljs` folder. As you can now see, the Clojurescript REPL is waiting for a browser to connect on port 9000 ... 50 | 51 | `Waiting for browser to connect on port 9001 ...` 52 | 53 | Open a browser tab at `localhost:9001` 54 | 55 | You are now able to evaluate Clojurescript expressions at the REPL: 56 | 57 | `(js/alert "Hello from Replique")` 58 | 59 | You can also load entire files. Create a file named `test.cljs` at the root of the current directory. Add the following content to the new file: 60 | 61 | ```clojure 62 | (ns test) 63 | (js/alert "This file has been compiled to disk and loaded in the browser") 64 | ``` 65 | 66 | Load the file in the browser: 67 | 68 | `(replique.interactive/load-file "test.cljs")` 69 | 70 | The file has been loaded in the browser AND compiled to disk. It can be linked in HTML markup to be automatically loaded after a browser refresh. 71 | 72 | Quit the Clojurescript REPL to come back to the Clojure REPL: 73 | 74 | `:cljs/quit` 75 | 76 | Replique can be used to enhance your REPL with tooling features. Tooling features are optional. The code supporting them has not been loaded into the Clojure process yet. To leverage tooling features, it is best to use an editor or IDE. 77 | 78 | Let's start a "tooling" REPL. 79 | 80 | `(replique.repl/shared-tooling-repl :edn)` 81 | 82 | Notice that no prompt is printed. By not pinting a prompt, we make the REPL output easier to parse by the machine. The first parameter, `:edn`, instructs the REPL to print the tooling messages using the [EDN](https://github.com/edn-format/edn) format. The tooling REPL currently supports two formats: EDN and [elisp](https://en.wikipedia.org/wiki/Emacs_Lisp). 83 | 84 | Enter the following in the tooling REPL: 85 | 86 | ```clojure 87 | (replique.tooling-msg/tooling-msg-handle {:type :completion 88 | :repl-env :replique/clj 89 | :context nil 90 | :ns 'replique.repl 91 | :prefix "tooli"}) 92 | ``` 93 | => 94 | 95 | ```clojure 96 | {:candidates ({:candidate "tooling-msg", :type :namespace, :match-index 5} 97 | {:candidate "tooling-repl", :type :function, :ns "replique.repl", :match-index 5} 98 | {:candidate "replique.tooling", :type :namespace, :match-index 14} 99 | {:candidate "shared-tooling-repl", :type :function, :ns "replique.repl", :match-index 12} 100 | {:candidate "replique.tooling-msg", :type :namespace, :match-index 14}), 101 | :type :completion, 102 | :repl-env :replique/clj, 103 | :context nil, 104 | :ns replique.repl, 105 | :prefix "tooli"} 106 | ``` 107 | 108 | We are done, kill the process to exit. 109 | 110 | --- 111 | 112 | ## License 113 | 114 | Copyright 2016 Ewen Grosjean. 115 | 116 | The use and distribution terms for this software are covered by the 117 | Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0) 118 | which can be found in the file [epl-v10.html](epl-v10.html) at the root of this distribution. 119 | 120 | By using this software in any fashion, you are agreeing to be bound by 121 | the terms of this license. 122 | 123 | You must not remove this notice, or any other, from this software. 124 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | clojure -M:build -m replique-build.deploy 4 | -------------------------------------------------------------------------------- /deps.edn: -------------------------------------------------------------------------------- 1 | {:paths ["src" "resources"] 2 | :deps {org.clojure/clojure {:mvn/version "1.8.0"}} 3 | :aliases {:dev {:extra-paths ["dev-resources"] 4 | :extra-deps {org.clojure/clojurescript {:mvn/version "1.11.60"} 5 | org.clojure/clojure {:mvn/version "1.11.1"}} 6 | :jvm-opts ["-XX:-OmitStackTraceInFastThrow"]} 7 | :build {:extra-deps {org.clojure/clojure {:mvn/version "1.11.1"} 8 | com.github.eweng/badigeon2 {:git/tag "1.1.0" :git/sha "1a0e369"}} 9 | :extra-paths ["src-build"]}}} 10 | 11 | -------------------------------------------------------------------------------- /dev-resources/deps.cljs: -------------------------------------------------------------------------------- 1 | {:libs ["js-lib.js"] 2 | :foreign-libs [{:file "js-foreign-lib.js" 3 | :provides ["replique.js-foreign-lib"]}]} 4 | -------------------------------------------------------------------------------- /dev-resources/js-foreign-lib.js: -------------------------------------------------------------------------------- 1 | replique.js_foreign_lib = {}; 2 | replique.js_foreign_lib.data = "data"; 3 | -------------------------------------------------------------------------------- /dev-resources/js-lib.js: -------------------------------------------------------------------------------- 1 | goog.provide('replique.js_lib'); 2 | 3 | replique.js_lib = {}; 4 | replique.js_lib.data = "data"; 5 | -------------------------------------------------------------------------------- /epl-v10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Eclipse Public License - Version 1.0 8 | 25 | 26 | 27 | 28 | 29 | 30 |

Eclipse Public License - v 1.0

31 | 32 |

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 33 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR 34 | DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS 35 | AGREEMENT.

36 | 37 |

1. DEFINITIONS

38 | 39 |

"Contribution" means:

40 | 41 |

a) in the case of the initial Contributor, the initial 42 | code and documentation distributed under this Agreement, and

43 |

b) in the case of each subsequent Contributor:

44 |

i) changes to the Program, and

45 |

ii) additions to the Program;

46 |

where such changes and/or additions to the Program 47 | originate from and are distributed by that particular Contributor. A 48 | Contribution 'originates' from a Contributor if it was added to the 49 | Program by such Contributor itself or anyone acting on such 50 | Contributor's behalf. Contributions do not include additions to the 51 | Program which: (i) are separate modules of software distributed in 52 | conjunction with the Program under their own license agreement, and (ii) 53 | are not derivative works of the Program.

54 | 55 |

"Contributor" means any person or entity that distributes 56 | the Program.

57 | 58 |

"Licensed Patents" mean patent claims licensable by a 59 | Contributor which are necessarily infringed by the use or sale of its 60 | Contribution alone or when combined with the Program.

61 | 62 |

"Program" means the Contributions distributed in accordance 63 | with this Agreement.

64 | 65 |

"Recipient" means anyone who receives the Program under 66 | this Agreement, including all Contributors.

67 | 68 |

2. GRANT OF RIGHTS

69 | 70 |

a) Subject to the terms of this Agreement, each 71 | Contributor hereby grants Recipient a non-exclusive, worldwide, 72 | royalty-free copyright license to reproduce, prepare derivative works 73 | of, publicly display, publicly perform, distribute and sublicense the 74 | Contribution of such Contributor, if any, and such derivative works, in 75 | source code and object code form.

76 | 77 |

b) Subject to the terms of this Agreement, each 78 | Contributor hereby grants Recipient a non-exclusive, worldwide, 79 | royalty-free patent license under Licensed Patents to make, use, sell, 80 | offer to sell, import and otherwise transfer the Contribution of such 81 | Contributor, if any, in source code and object code form. This patent 82 | license shall apply to the combination of the Contribution and the 83 | Program if, at the time the Contribution is added by the Contributor, 84 | such addition of the Contribution causes such combination to be covered 85 | by the Licensed Patents. The patent license shall not apply to any other 86 | combinations which include the Contribution. No hardware per se is 87 | licensed hereunder.

88 | 89 |

c) Recipient understands that although each Contributor 90 | grants the licenses to its Contributions set forth herein, no assurances 91 | are provided by any Contributor that the Program does not infringe the 92 | patent or other intellectual property rights of any other entity. Each 93 | Contributor disclaims any liability to Recipient for claims brought by 94 | any other entity based on infringement of intellectual property rights 95 | or otherwise. As a condition to exercising the rights and licenses 96 | granted hereunder, each Recipient hereby assumes sole responsibility to 97 | secure any other intellectual property rights needed, if any. For 98 | example, if a third party patent license is required to allow Recipient 99 | to distribute the Program, it is Recipient's responsibility to acquire 100 | that license before distributing the Program.

101 | 102 |

d) Each Contributor represents that to its knowledge it 103 | has sufficient copyright rights in its Contribution, if any, to grant 104 | the copyright license set forth in this Agreement.

105 | 106 |

3. REQUIREMENTS

107 | 108 |

A Contributor may choose to distribute the Program in object code 109 | form under its own license agreement, provided that:

110 | 111 |

a) it complies with the terms and conditions of this 112 | Agreement; and

113 | 114 |

b) its license agreement:

115 | 116 |

i) effectively disclaims on behalf of all Contributors 117 | all warranties and conditions, express and implied, including warranties 118 | or conditions of title and non-infringement, and implied warranties or 119 | conditions of merchantability and fitness for a particular purpose;

120 | 121 |

ii) effectively excludes on behalf of all Contributors 122 | all liability for damages, including direct, indirect, special, 123 | incidental and consequential damages, such as lost profits;

124 | 125 |

iii) states that any provisions which differ from this 126 | Agreement are offered by that Contributor alone and not by any other 127 | party; and

128 | 129 |

iv) states that source code for the Program is available 130 | from such Contributor, and informs licensees how to obtain it in a 131 | reasonable manner on or through a medium customarily used for software 132 | exchange.

133 | 134 |

When the Program is made available in source code form:

135 | 136 |

a) it must be made available under this Agreement; and

137 | 138 |

b) a copy of this Agreement must be included with each 139 | copy of the Program.

140 | 141 |

Contributors may not remove or alter any copyright notices contained 142 | within the Program.

143 | 144 |

Each Contributor must identify itself as the originator of its 145 | Contribution, if any, in a manner that reasonably allows subsequent 146 | Recipients to identify the originator of the Contribution.

147 | 148 |

4. COMMERCIAL DISTRIBUTION

149 | 150 |

Commercial distributors of software may accept certain 151 | responsibilities with respect to end users, business partners and the 152 | like. While this license is intended to facilitate the commercial use of 153 | the Program, the Contributor who includes the Program in a commercial 154 | product offering should do so in a manner which does not create 155 | potential liability for other Contributors. Therefore, if a Contributor 156 | includes the Program in a commercial product offering, such Contributor 157 | ("Commercial Contributor") hereby agrees to defend and 158 | indemnify every other Contributor ("Indemnified Contributor") 159 | against any losses, damages and costs (collectively "Losses") 160 | arising from claims, lawsuits and other legal actions brought by a third 161 | party against the Indemnified Contributor to the extent caused by the 162 | acts or omissions of such Commercial Contributor in connection with its 163 | distribution of the Program in a commercial product offering. The 164 | obligations in this section do not apply to any claims or Losses 165 | relating to any actual or alleged intellectual property infringement. In 166 | order to qualify, an Indemnified Contributor must: a) promptly notify 167 | the Commercial Contributor in writing of such claim, and b) allow the 168 | Commercial Contributor to control, and cooperate with the Commercial 169 | Contributor in, the defense and any related settlement negotiations. The 170 | Indemnified Contributor may participate in any such claim at its own 171 | expense.

172 | 173 |

For example, a Contributor might include the Program in a commercial 174 | product offering, Product X. That Contributor is then a Commercial 175 | Contributor. If that Commercial Contributor then makes performance 176 | claims, or offers warranties related to Product X, those performance 177 | claims and warranties are such Commercial Contributor's responsibility 178 | alone. Under this section, the Commercial Contributor would have to 179 | defend claims against the other Contributors related to those 180 | performance claims and warranties, and if a court requires any other 181 | Contributor to pay any damages as a result, the Commercial Contributor 182 | must pay those damages.

183 | 184 |

5. NO WARRANTY

185 | 186 |

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 187 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 188 | OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 189 | ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 190 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 191 | responsible for determining the appropriateness of using and 192 | distributing the Program and assumes all risks associated with its 193 | exercise of rights under this Agreement , including but not limited to 194 | the risks and costs of program errors, compliance with applicable laws, 195 | damage to or loss of data, programs or equipment, and unavailability or 196 | interruption of operations.

197 | 198 |

6. DISCLAIMER OF LIABILITY

199 | 200 |

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT 201 | NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 202 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 203 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 204 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 205 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 206 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 207 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

208 | 209 |

7. GENERAL

210 | 211 |

If any provision of this Agreement is invalid or unenforceable under 212 | applicable law, it shall not affect the validity or enforceability of 213 | the remainder of the terms of this Agreement, and without further action 214 | by the parties hereto, such provision shall be reformed to the minimum 215 | extent necessary to make such provision valid and enforceable.

216 | 217 |

If Recipient institutes patent litigation against any entity 218 | (including a cross-claim or counterclaim in a lawsuit) alleging that the 219 | Program itself (excluding combinations of the Program with other 220 | software or hardware) infringes such Recipient's patent(s), then such 221 | Recipient's rights granted under Section 2(b) shall terminate as of the 222 | date such litigation is filed.

223 | 224 |

All Recipient's rights under this Agreement shall terminate if it 225 | fails to comply with any of the material terms or conditions of this 226 | Agreement and does not cure such failure in a reasonable period of time 227 | after becoming aware of such noncompliance. If all Recipient's rights 228 | under this Agreement terminate, Recipient agrees to cease use and 229 | distribution of the Program as soon as reasonably practicable. However, 230 | Recipient's obligations under this Agreement and any licenses granted by 231 | Recipient relating to the Program shall continue and survive.

232 | 233 |

Everyone is permitted to copy and distribute copies of this 234 | Agreement, but in order to avoid inconsistency the Agreement is 235 | copyrighted and may only be modified in the following manner. The 236 | Agreement Steward reserves the right to publish new versions (including 237 | revisions) of this Agreement from time to time. No one other than the 238 | Agreement Steward has the right to modify this Agreement. The Eclipse 239 | Foundation is the initial Agreement Steward. The Eclipse Foundation may 240 | assign the responsibility to serve as the Agreement Steward to a 241 | suitable separate entity. Each new version of the Agreement will be 242 | given a distinguishing version number. The Program (including 243 | Contributions) may always be distributed subject to the version of the 244 | Agreement under which it was received. In addition, after a new version 245 | of the Agreement is published, Contributor may elect to distribute the 246 | Program (including its Contributions) under the new version. Except as 247 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives no 248 | rights or licenses to the intellectual property of any Contributor under 249 | this Agreement, whether expressly, by implication, estoppel or 250 | otherwise. All rights in the Program not expressly granted under this 251 | Agreement are reserved.

252 | 253 |

This Agreement is governed by the laws of the State of New York and 254 | the intellectual property laws of the United States of America. No party 255 | to this Agreement will bring a legal action under this Agreement more 256 | than one year after the cause of action arose. Each party waives its 257 | rights to a jury trial in any resulting litigation.

258 | 259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /repl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | clojure -M:dev:build 4 | -------------------------------------------------------------------------------- /resources/bootstrap.js: -------------------------------------------------------------------------------- 1 | // Reusable browser REPL bootstrapping. Patches the essential functions 2 | // in goog.base to support re-loading of namespaces after page load. 3 | 4 | // Monkey-patch goog.provide if running under optimizations :none 5 | 6 | // Notice how this file only has a dependency on goog.base. This make 7 | // it possible to connect to the cljs REPL from any environment, even environments without a 8 | // clojurescript or google-closure dependency 9 | 10 | (function() { 11 | goog.require__ = goog.require; 12 | goog.isProvided__ = goog.isProvided_; 13 | 14 | // Patch goog.isProvided_ to enable script reloading 15 | goog.isProvided_ = function(name) { 16 | if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && 17 | goog.isDocumentLoading_()) { 18 | return goog.isProvided__(name); 19 | } else { 20 | return false; 21 | } 22 | }; 23 | 24 | // Patch goog.Dependency.prototype.load to add a crossorigin parameter to scripts 25 | goog.Dependency.prototype.load__ = goog.Dependency.prototype.load; 26 | goog.Dependency.prototype.load = function(controller) { 27 | if (goog.global.CLOSURE_IMPORT_SCRIPT) { 28 | if (goog.global.CLOSURE_IMPORT_SCRIPT(this.path)) { 29 | controller.loaded(); 30 | } else { 31 | controller.pause(); 32 | } 33 | return; 34 | } 35 | 36 | if (!goog.inHtmlDocument_()) { 37 | goog.logToConsole_( 38 | 'Cannot use default debug loader outside of HTML documents.'); 39 | if (this.relativePath == 'deps.js') { 40 | // Some old code is relying on base.js auto loading deps.js failing with 41 | // no error before later setting CLOSURE_IMPORT_SCRIPT. 42 | // CLOSURE_IMPORT_SCRIPT should be set *before* base.js is loaded, or 43 | // CLOSURE_NO_DEPS set to true. 44 | goog.logToConsole_( 45 | 'Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, ' + 46 | 'or setting CLOSURE_NO_DEPS to true.'); 47 | controller.loaded(); 48 | } else { 49 | controller.pause(); 50 | } 51 | return; 52 | } 53 | 54 | /** @type {!HTMLDocument} */ 55 | var doc = goog.global.document; 56 | 57 | // If the user tries to require a new symbol after document load, 58 | // something has gone terribly wrong. Doing a document.write would 59 | // wipe out the page. This does not apply to the CSP-compliant method 60 | // of writing script tags. 61 | if (doc.readyState == 'complete' && 62 | !goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) { 63 | // Certain test frameworks load base.js multiple times, which tries 64 | // to write deps.js each time. If that happens, just fail silently. 65 | // These frameworks wipe the page between each load of base.js, so this 66 | // is OK. 67 | var isDeps = /\bdeps.js$/.test(this.path); 68 | if (isDeps) { 69 | controller.loaded(); 70 | return; 71 | } else { 72 | throw Error('Cannot write "' + this.path + '" after document load'); 73 | } 74 | } 75 | 76 | var nonce = goog.getScriptNonce_(); 77 | if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && 78 | goog.isDocumentLoading_()) { 79 | var key; 80 | var callback = function(script) { 81 | if (script.readyState && script.readyState != 'complete') { 82 | script.onload = callback; 83 | return; 84 | } 85 | goog.Dependency.unregisterCallback_(key); 86 | controller.loaded(); 87 | }; 88 | key = goog.Dependency.registerCallback_(callback); 89 | 90 | var defer = goog.Dependency.defer_ ? ' defer' : ''; 91 | var nonceAttr = nonce ? ' nonce="' + nonce + '"' : ''; 92 | var script = '');\n" 73 | "document.write('');\n" 74 | (when (:main opts) 75 | (str "document.write('');")) 76 | "})();\n")))))))) 77 | 78 | ;; Patch output-unoptimzed to always output cljs-deps into cljs_deps.js 79 | ;; If output-to is defined and main is not defined, a main file is written 80 | ;; which does not goog.require any namespace 81 | #_(alter-var-root 82 | #'cljsc/output-unoptimized 83 | (constantly 84 | (fn output-unoptimized 85 | [opts & sources] 86 | (let [disk-sources (remove #(= (:group %) :goog) 87 | (map #(cljsc/source-on-disk opts %) sources)) 88 | goog-deps (io/file (util/output-directory opts) 89 | "goog" "deps.js") 90 | main (:main opts)] 91 | (util/mkdirs goog-deps) 92 | (spit goog-deps (slurp (io/resource "goog/deps.js"))) 93 | (cljsc/output-deps-file 94 | (assoc opts :output-to 95 | (str (util/output-directory opts) 96 | File/separator "cljs_deps.js")) 97 | disk-sources) 98 | (cljsc/output-main-file opts))))) 99 | 100 | (defmacro with-version [[min-major min-minor min-qualifier] 101 | [max-major max-minor max-qualifier] & body] 102 | (let [{cljs-major :major 103 | cljs-minor :minor 104 | cljs-qualifier :qualifier} cljs.util/*clojurescript-version*] 105 | (when 106 | (and 107 | (or (> cljs-major min-major) (> cljs-minor min-minor) 108 | (and (= cljs-major min-major) (= cljs-minor min-minor) 109 | (>= cljs-qualifier min-qualifier))) 110 | (or (nil? max-major) (nil? max-minor) (nil? max-qualifier) 111 | (< cljs-major max-major) (< cljs-minor max-minor) 112 | (and (= cljs-major max-major) (= cljs-minor max-minor) 113 | (<= cljs-qualifier max-qualifier)))) 114 | `(do ~@body)))) 115 | 116 | ;; Support for :reload-all 117 | (def ^:dynamic *reload-all* false) 118 | 119 | (def compilation-error (if-let [compilation-error-var (resolve 'cljs.util/compilation-error)] 120 | @compilation-error-var 121 | (fn compilation-error [cause] 122 | (ex-info nil {:clojure.error/phase :compilation} cause)))) 123 | 124 | ;; Alternative to cljs.closure/src-file->goog-require in order to support goog.require 125 | ;; with :reload-all 126 | (defn ^String src-file->goog-require 127 | ([src] (src-file->goog-require src {:wrap true})) 128 | ([src {:keys [wrap all-provides macros-ns] :as options}] 129 | (let [goog-ns 130 | (case (util/ext src) 131 | ("cljs" "cljc") (let [ns-str (str (comp/munge (:ns (ana/parse-ns src))))] 132 | (cond-> ns-str 133 | (and macros-ns (not (.endsWith ns-str "$macros"))) 134 | (str "$macros"))) 135 | "js" (cond-> (:provides (cljsc/parse-js-ns src)) 136 | (not all-provides) first) 137 | (throw 138 | (compilation-error 139 | (IllegalArgumentException. 140 | (str "Can't create goog.require expression for " src)))))] 141 | (if (and (not all-provides) wrap) 142 | (cond 143 | (:reload-all options) (str "goog.require(\"" goog-ns "\", \"reload-all\");") 144 | (:reload options) (str "goog.require(\"" goog-ns "\", true);") 145 | :else (str "goog.require(\"" goog-ns "\");")) 146 | (if (vector? goog-ns) 147 | goog-ns 148 | (str goog-ns)))))) 149 | 150 | ;; Patch parse 'def to allow :const redefinition 151 | ;; Remove constants from the environment before parsing 'def expressions 152 | 153 | (defonce parse-def-o (get (methods cljs.analyzer/parse) 'def)) 154 | 155 | (defn maybe-dissoc-const [env form] 156 | (if-let [sym (second form)] 157 | (let [maybe-const-var (get-in env [:ns :defs sym])] 158 | (if (:const maybe-const-var) 159 | (do 160 | (swap! cljs.env/*compiler* update-in 161 | [:cljs.analyzer/namespaces (-> env :ns :name) :defs] dissoc sym) 162 | (update-in env [:ns :defs] dissoc sym)) 163 | env)) 164 | env)) 165 | 166 | (defmethod cljs.analyzer/parse 'def 167 | [op env form _1 _2] 168 | (parse-def-o op (maybe-dissoc-const env form) form _1 _2)) 169 | 170 | 171 | ;; patch parse 'ns to allow :reload-all 172 | ;; parse 'ns* is not patched since (require ... :reload-all) doesn't really work 173 | 174 | (defonce parse-ns-o (get (methods cljs.analyzer/parse) 'ns)) 175 | 176 | (defmethod cljs.analyzer/parse 'ns 177 | [_1 env [_2 name & args :as form] _3 opts] 178 | (let [ns-infos (parse-ns-o _1 env form _3 opts)] 179 | (if *reload-all* 180 | (-> ns-infos 181 | (assoc-in [:reload :user-macros] :reload) 182 | (assoc-in [:reload :require-macros] :reload)) 183 | ns-infos))) 184 | 185 | ;; patch cljs.compiler/requires-compilation? to only check for modified file when using :reload-all 186 | ;; or when the namespace of the file is not in the compiler environment yet 187 | 188 | (with-version 189 | [1 10 238] 190 | [nil nil nil] 191 | (defn requires-compilation? 192 | ([src dest] 193 | (requires-compilation? src dest 194 | (when env/*compiler* 195 | (:options @env/*compiler*)))) 196 | ([^File src ^File dest opts] 197 | (let [{:keys [ns requires]} (ana/parse-ns src)] 198 | (env/ensure 199 | (or (not (.exists dest)) 200 | (and *reload-all* (util/changed? src dest)) 201 | (and (nil? (get-in @env/*compiler* [::ana/namespaces ns])) (util/changed? src dest)) 202 | (let [version' (util/compiled-by-version dest) 203 | version (util/clojurescript-version)] 204 | (and version (not= version version'))) 205 | (and opts 206 | (not (and (io/resource "cljs/core.aot.js") (= 'cljs.core ns))) 207 | (not= (ana/build-affecting-options opts) 208 | (ana/build-affecting-options (util/build-options dest)))) 209 | (and opts (:source-map opts) 210 | (if (= (:optimizations opts) :none) 211 | (not (.exists (io/file (str (.getPath dest) ".map")))) 212 | (not (get-in @env/*compiler* [::compiled-cljs (.getAbsolutePath dest)])))) 213 | (when-let [recompiled' (and comp/*recompiled* @cljs.compiler/*recompiled*)] 214 | (some requires recompiled')))))))) 215 | 216 | (with-version 217 | [0 0 0] 218 | [1 9 946] 219 | (defn requires-compilation? 220 | ([src dest] 221 | (requires-compilation? src dest 222 | (when env/*compiler* 223 | (:options @env/*compiler*)))) 224 | ([^File src ^File dest opts] 225 | (let [{:keys [ns requires]} (ana/parse-ns src)] 226 | (if (and (= 'cljs.loader ns) (not (contains? opts :cache-key))) 227 | false 228 | (env/ensure 229 | (or (not (.exists dest)) 230 | (and *reload-all* (util/changed? src dest)) 231 | (and (nil? (get-in @env/*compiler* [::ana/namespaces ns])) (util/changed? src dest)) 232 | (let [version' (util/compiled-by-version dest) 233 | version (util/clojurescript-version)] 234 | (and version (not= version version'))) 235 | (and opts 236 | (not (and (io/resource "cljs/core.aot.js") (= 'cljs.core ns))) 237 | (not= (#'comp/build-affecting-options opts) 238 | (#'comp/build-affecting-options (util/build-options dest)))) 239 | (and opts (:source-map opts) 240 | (if (= (:optimizations opts) :none) 241 | (not (.exists (io/file (str (.getPath dest) ".map")))) 242 | (not (get-in @env/*compiler* [::compiled-cljs (.getAbsolutePath dest)])))) 243 | (when-let [recompiled' (and comp/*recompiled* @cljs.compiler/*recompiled*)] 244 | (some requires recompiled'))))))))) 245 | 246 | ;; goog.require seems to call goog.loadModule 247 | ;; cljs.closure/add-goog-load wraps the module into a goog.loadModule call 248 | ;; The double goog.loadModule calls seems to break the loading mechanism 249 | ;; patch cljs.closure/transpile to avoid wrapping the module into a goog.loadModule call 250 | 251 | (defonce transpile-var (resolve 'cljs.closure/transpile)) 252 | (defonce transpile-o (when transpile-var @transpile-var)) 253 | 254 | (defn transpile 255 | [opts res js] 256 | (transpile-o opts res (assoc js :module "none"))) 257 | 258 | (when transpile-o 259 | (alter-var-root transpile-var (constantly transpile))) 260 | 261 | ;; Fix cljs.closure/closure-transpile to munge "!" characters in file names 262 | ;; Otherwise the closure transpiler emits var names with "!", which is invalid js 263 | 264 | (defonce closure-transpile-var (resolve 'cljs.closure/closure-transpile)) 265 | (defonce closure-transpile-o (when closure-transpile-var @closure-transpile-var)) 266 | 267 | (defn closure-transpile 268 | ([rsc opts] 269 | (closure-transpile-o rsc opts)) 270 | ([path source opts] 271 | (let [path (clojure.string/replace (str path) "!" "_BANG_")] 272 | (closure-transpile-o path source opts)))) 273 | 274 | (when closure-transpile-o 275 | (alter-var-root closure-transpile-var (constantly closure-transpile))) 276 | 277 | ;; Force the inclusion of es6 polyfill 278 | ;; es6/util/inherits, es6/util/makeiterator 279 | ;; seem to not be included even though they are needed when compiling from es6 to es5 280 | (defonce closure-set-options-var (resolve 'cljs.closure/set-options)) 281 | (defonce closure-set-options-o (when closure-set-options-var @closure-set-options-var)) 282 | 283 | (defn closure-set-options 284 | ([opts compiler-options] 285 | (let [compiler-options (closure-set-options-o opts compiler-options)] 286 | (.setForceLibraryInjection compiler-options ["es6/util/inherits" "es6/util/makeiterator"]) 287 | compiler-options))) 288 | 289 | (when closure-set-options-o 290 | (alter-var-root closure-set-options-var (constantly closure-set-options))) 291 | 292 | -------------------------------------------------------------------------------- /src/replique/cljs_env/browser.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.cljs-env.browser 2 | (:require [cljs.reader :as reader] 3 | [goog.cssom] 4 | [goog.date :as date] 5 | [goog.Uri] 6 | [replique.omniscient-runtime] 7 | [replique.cljs-env.completion] 8 | [replique.cljs-env.watch] 9 | [replique.omniscient-runtime] 10 | [goog.object :as o]) 11 | (:require-macros [replique.interactive])) 12 | 13 | (defn remove-query-string [uri] 14 | (-> (goog.Uri.parse uri) 15 | (.setQuery "") 16 | str)) 17 | 18 | ;; Also filter stylsheets without href and stylsheets whith a data scheme 19 | (defn css-current-domain? [css] 20 | (let [current-domain js/window.location.hostname 21 | current-port (str js/window.location.port) 22 | href (.-href css)] 23 | (and href 24 | (= (.getDomain (goog.Uri/parse href)) current-domain) 25 | (= (str (.getPort (goog.Uri/parse href))) current-port)))) 26 | 27 | (defn list-css-urls [] 28 | (let [css-list (->> (goog.cssom.getAllCssStyleSheets) 29 | ;; Filter out css files imported with the 30 | ;; @import directive 31 | (filter #(.-ownerNode %)) 32 | (filter css-current-domain?) 33 | (map #(.-href %)) 34 | (map remove-query-string) 35 | distinct)] 36 | (pr-str css-list))) 37 | 38 | (comment 39 | (require '[goog.dom]) 40 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "mystyle.css") 41 | (goog.dom/createDom "link") 42 | (.appendChild (.-head js/document))) 43 | 44 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "ee/test.css") 45 | (goog.dom/createDom "link") 46 | (.appendChild (.-head js/document))) 47 | 48 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "mystyle2.css?ff=ee") 49 | (goog.dom/createDom "link") 50 | (.appendChild (.-head js/document))) 51 | 52 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "http://localhost:50526/mystyle4.css?ff=ee") 53 | (goog.dom/createDom "link") 54 | (.appendChild (.-head js/document))) 55 | 56 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "mystyle5.css?ff=ee") 57 | (goog.dom/createDom "link") 58 | (.appendChild (.-head js/document))) 59 | 60 | (->> (js-obj "rel" "stylesheet" "type" "text/css" "href" "data:text/css;base64,Ym9keSB7CiAgICBib3JkZXI6IDFweCBzb2xpZCByZWQ7Cn0K") 61 | (goog.dom/createDom "link") 62 | (.appendChild (.-head js/document))) 63 | ) 64 | 65 | (defn match-urls? [css url] 66 | (= (remove-query-string (.-href css)) url)) 67 | 68 | (defn stylesheet-with-url [url] 69 | (->> (goog.cssom.getAllCssStyleSheets) 70 | ;; Filter out css files imported with the 71 | ;; @import directive 72 | (filter #(.-ownerNode %)) 73 | (filter #(match-urls? % url)) 74 | first)) 75 | 76 | (defn reload-css-node [css-node] 77 | (let [href (.-href css-node)] 78 | (goog.dom.setProperties css-node (js-obj "href" href)))) 79 | 80 | (defn reload-css [url] 81 | (let [the-stylesheet (stylesheet-with-url url)] 82 | (reload-css-node (.-ownerNode the-stylesheet)))) 83 | 84 | ;; other parameters may not be supported by all browsers 85 | (defn global-error-handler [msg url line col error] 86 | (when error 87 | ;; this is not set synchronously, but this should work ok in 88 | ;; most cases anyway 89 | (set! *e error)) 90 | (println msg)) 91 | 92 | ;; handle errors during a load-file 93 | (o/set js/window "onerror" global-error-handler) 94 | -------------------------------------------------------------------------------- /src/replique/cljs_env/completion.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.cljs-env.completion 2 | (:require [replique.cljs-env.elisp-printer :as elisp] 3 | [clojure.string :as string :refer [split]] 4 | [goog.object :as o] 5 | [goog.string :as gstring]) 6 | (:import [goog.events EventType])) 7 | 8 | (def ^:const max-candidates-number 200) 9 | 10 | ;; Split on underscors or upper case letters 11 | (defn tokenize-prefix [prefix] 12 | (->> (string/split prefix #"_|(?=[A-Z])") 13 | (filter #(not= "" %)) 14 | distinct)) 15 | 16 | (defn is-upper-case [c] 17 | (and c 18 | (> (.-length c) 0) 19 | (= (.toUpperCase c) c))) 20 | 21 | (defn matches? [candidate prefix-tokens] 22 | (loop [prefix-tokens (seq prefix-tokens) 23 | match-index 0] 24 | (if-let [token (first prefix-tokens)] 25 | (let [maybe-match-index 26 | (if (is-upper-case (.charAt token 0)) 27 | (.lastIndexOf candidate token) 28 | (let [maybe-match-index (.lastIndexOf candidate (str "_" token))] 29 | (if (> maybe-match-index -1) 30 | (inc maybe-match-index) 31 | (if (string/starts-with? candidate token) 0 -1))))] 32 | (when (> maybe-match-index -1) 33 | (let [maybe-match-index (+ (count token) maybe-match-index)] 34 | (if (> maybe-match-index match-index) 35 | (recur (rest prefix-tokens) maybe-match-index) 36 | (recur (rest prefix-tokens) match-index))))) 37 | match-index))) 38 | 39 | (def by-length-comparator 40 | (fn [s1 s2] 41 | (let [res (compare (count s1) (count s2))] 42 | (if (zero? res) 43 | (compare s1 s2) 44 | res)))) 45 | 46 | (defn elisp-pr-str [x] 47 | (binding [*print-level* nil 48 | *print-length* nil] 49 | (elisp/pr-str x))) 50 | 51 | (defn js-scoped-candidates [original-scope-name munged-scope-name munged-prefix include-methods?] 52 | (->> (when-let [scope (if (= 0 (count munged-scope-name)) 53 | ;; js/window is not defined for all js runtimes 54 | (try js/window (catch js/Error e nil)) 55 | (try (js/eval munged-scope-name) (catch js/Error e nil)))] 56 | ;; getAllPropertyNames may not be available on old google closure versions 57 | ;; ~ before clojurescript 1.9.562 58 | (for [k (o/getAllPropertyNames scope true true) 59 | :when (and (or include-methods? (not (fn? (elisp/custom-unchecked-get scope k)))) 60 | (not (gstring/isNumeric k))) 61 | :let [match-index (matches? k (tokenize-prefix munged-prefix))] 62 | :when match-index] 63 | {:candidate (str original-scope-name (demunge k)) 64 | :match-index (+ (count original-scope-name) match-index)})) 65 | (sort-by :candidate by-length-comparator) 66 | (take max-candidates-number) 67 | elisp-pr-str)) 68 | 69 | (defn js-fields-candidates [munged-prefix munged-param methods?] 70 | (->> (when-let [scope (try (js/eval munged-param) (catch js/Error e nil))] 71 | ;; getAllPropertyNames may not be available on old google closure versions 72 | ;; ~ before clojurescript 1.9.562 73 | (for [k (o/getAllPropertyNames scope true true) 74 | :when (and (if methods? 75 | (fn? (elisp/custom-unchecked-get scope k)) 76 | (not (fn? (elisp/custom-unchecked-get scope k)))) 77 | (not (gstring/isNumeric k))) 78 | :let [match-index (matches? k (tokenize-prefix munged-prefix))] 79 | :when match-index] 80 | {:candidate (str (if methods? "." ".-") (demunge k)) 81 | :match-index (+ (if methods? 1 2) match-index)})) 82 | (sort-by :candidate by-length-comparator) 83 | (take max-candidates-number) 84 | elisp-pr-str)) 85 | 86 | (comment 87 | (matches? "forEach" (tokenize-prefix "for")) 88 | ) 89 | 90 | -------------------------------------------------------------------------------- /src/replique/cljs_env/elisp_printer.clj: -------------------------------------------------------------------------------- 1 | (ns replique.cljs-env.elisp-printer) 2 | 3 | (defmacro print-with-meta [o w & body] 4 | `(let [m# (meta ~o)] 5 | (if (and (pos? (count m#)) *print-meta*) 6 | (do 7 | (-write ~w "[\"~#with-meta\" [") 8 | ~@body 9 | (-write ~w " ") 10 | (-pr-writer m# ~w) 11 | (-write ~w "]]")) 12 | (do ~@body)))) 13 | 14 | ;; backport of cljs.core/unchecked-get 15 | (defmacro custom-unchecked-get [obj key] 16 | (list 'js* "(~{}[~{}])" obj key)) 17 | -------------------------------------------------------------------------------- /src/replique/cljs_env/javafx.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.cljs-env.javafx 2 | (:require [replique.omniscient-runtime] 3 | [replique.cljs-env.completion] 4 | [replique.cljs-env.watch] 5 | [replique.omniscient-runtime])) 6 | 7 | (defn list-css-urls [] 8 | (when-let [scene (.getScene js/muancefx.core.stage)] 9 | (pr-str (array-seq (.getStylesheets scene))))) 10 | 11 | (defn reload-css [url] 12 | (when-let [scene (.getScene js/muancefx.core.stage)] 13 | (.clear (.getStylesheets scene)) 14 | (.add (.getStylesheets scene) url))) 15 | -------------------------------------------------------------------------------- /src/replique/cljs_env/repl.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.cljs-env.repl 2 | "Xhr based repl. Uses CORS to bypass the same origin policy. 3 | Adapted from https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/browser/repl.cljs. 4 | Other changes: 5 | Replace :order by a :session id in messages sent to the server. 6 | Remove the use of goog.event because it is not compatible with reloading (reload-all)." 7 | (:require 8 | [goog.array :as garray] 9 | [goog.object :as o] 10 | [goog.userAgent.product :as product] 11 | [goog.net.EventType]) 12 | (:import [goog.net XhrIo CorsXmlHttpFactory])) 13 | 14 | (defonce connection (atom nil)) 15 | 16 | (defn xhr-connection 17 | "Returns an XhrIo connection" 18 | [] 19 | (XhrIo. (CorsXmlHttpFactory.))) 20 | 21 | (defonce print-queue (array)) 22 | (defonce flushing-print-queue? (atom false)) 23 | 24 | (defn send-result [conn url data] 25 | (.setTimeoutInterval conn 0) 26 | (.send conn url "POST" data nil)) 27 | 28 | (defn send-print 29 | "Send data to be printed in the REPL." 30 | [url data callback] 31 | (let [conn (xhr-connection)] 32 | (.listen conn goog.net.EventType/COMPLETE callback false) 33 | (.setTimeoutInterval conn 0) 34 | (.send conn url "POST" data nil))) 35 | 36 | (defn wrap-message 37 | ([t data] 38 | (binding [*print-length* nil 39 | *print-level* nil] 40 | (pr-str {:type t :content data}))) 41 | ([t data session] 42 | (binding [*print-length* nil 43 | *print-level* nil] 44 | (pr-str {:type t :content data :session session})))) 45 | 46 | (defn flush-print-queue! [] 47 | (if-let [x (.shift print-queue)] 48 | (send-print (:url @connection) x flush-print-queue!) 49 | (reset! flushing-print-queue? false))) 50 | 51 | (defn repl-print [data] 52 | (if (string? data) 53 | (.push print-queue (wrap-message :print data (:session @connection))) 54 | (.push print-queue (wrap-message :print (pr-str data) (:session @connection)))) 55 | (when-not @flushing-print-queue? 56 | (reset! flushing-print-queue? true) 57 | (flush-print-queue!))) 58 | 59 | (defn send-print-tooling [s] 60 | (.push print-queue (wrap-message :print-tooling s (:session @connection))) 61 | (when-not @flushing-print-queue? 62 | (reset! flushing-print-queue? true) 63 | (flush-print-queue!))) 64 | 65 | (defn get-ua-product [] 66 | (cond 67 | product/SAFARI :safari 68 | product/CHROME :chrome 69 | product/FIREFOX :firefox 70 | product/IE :ie)) 71 | 72 | (defn evaluate-javascript 73 | "Process a single block of JavaScript received from the server" 74 | [block] 75 | (let [repl-params {"cljs.core/*assert*" *assert* 76 | "cljs.core/*print-length*" *print-length* 77 | "cljs.core/*print-meta*" *print-meta* 78 | "cljs.core/*print-level*" *print-level* 79 | "cljs.core/*flush-on-newline*" *flush-on-newline* 80 | "cljs.core/*print-readably*" *print-readably* 81 | "cljs.core/*print-dup*" *print-dup*} 82 | result 83 | (try 84 | (let [eval-result (js* "eval(~{block})")] 85 | (if (instance? js/Error eval-result) 86 | {:status :success 87 | :ua-product (get-ua-product) 88 | :value (str eval-result) 89 | :stacktrace 90 | (if (.hasOwnProperty eval-result "stack") 91 | (.-stack eval-result) 92 | "No stacktrace available.") 93 | :params repl-params} 94 | {:status :success 95 | :value (str eval-result) 96 | :params repl-params})) 97 | (catch :default e 98 | {:status :exception 99 | :ua-product (get-ua-product) 100 | :value (str e) 101 | :stacktrace 102 | (if (.hasOwnProperty e "stack") 103 | (.-stack e) 104 | "No stacktrace available.") 105 | :params repl-params}))] 106 | (binding [*print-level* nil 107 | *print-length* nil] 108 | (pr-str result)))) 109 | 110 | (declare connect) 111 | (declare eval-connection) 112 | 113 | (defn process-pending-eval [] 114 | (let [{:keys [pending-eval]} @connection] 115 | (when pending-eval 116 | (swap! connection dissoc :pending-eval) 117 | (let [result (evaluate-javascript pending-eval) 118 | {:keys [url session]} @connection] 119 | (send-result 120 | (eval-connection url) url (wrap-message :result result session)))))) 121 | 122 | (o/set js/goog "replique_after_load_hook__" process-pending-eval) 123 | 124 | (defn eval-connection [url] 125 | (let [conn (xhr-connection)] 126 | (.listen conn goog.net.EventType/SUCCESS 127 | (fn [e] 128 | (let [js (.getResponseText (.-currentTarget e))] 129 | (swap! connection assoc :pending-eval js) 130 | ;; Wait for all file to be loaded 131 | ;; This seems necessary on some browsers even if the async attribute of '); 165 | document.write(''); 166 | document.write(''); 167 | document.write(''); 168 | document.write(''); 169 | %s 170 | document.write('');})();" 171 | http-port http-host 172 | (if main-ns (str "var mainNs = '" (namespace-munge main-ns) "';") "") 173 | (if main-ns 174 | "document.write('');" 175 | ""))))) 176 | 177 | (defmethod tooling-msg/tooling-msg-handle [:replique/cljs :output-main-js-files] 178 | [{:keys [output-to main-ns] :as msg}] 179 | (tooling-msg/with-tooling-response msg 180 | (output-main-js-file output-to main-ns) 181 | msg)) 182 | 183 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :eval] [{:keys [form] :as msg}] 184 | (tooling-msg/with-tooling-response msg 185 | (binding [*out* utils/process-out 186 | *err* utils/process-err] 187 | {:result (pr-str (eval (read-string {:read-cond :allow} form)))}))) 188 | 189 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :update-classpath] 190 | [msg] 191 | (tooling-msg/with-tooling-response msg 192 | (let [res (classpath/update-classpath (:classpath msg))] 193 | (reset! completion/classpath-data (completion/compute-classpath-data)) 194 | res))) 195 | 196 | (defn ns-files [comp-env the-ns] 197 | (distinct 198 | (for [[s v] (env/ns-interns comp-env the-ns) 199 | :let [f (:file (env/meta comp-env v))] 200 | ;; exclude vars defined at the repl 201 | :when (and f (or (.endsWith ^String f (env/file-extension comp-env)) 202 | (.endsWith ^String f ".cljc")))] 203 | f))) 204 | 205 | (defn var-with-meta [comp-env [v-name v]] 206 | (let [metas (env/meta comp-env v) 207 | filtered-metas (select-keys metas [:line :column]) 208 | f (r-meta/resource-str (:file metas)) 209 | f (when (and f (or (.endsWith ^String f (env/file-extension comp-env)) 210 | (.endsWith ^String f ".cljc"))) f) 211 | filtered-metas (if f 212 | (assoc filtered-metas :file f) 213 | filtered-metas)] 214 | [v-name filtered-metas])) 215 | 216 | (defn list-vars-with-meta [comp-env the-ns] 217 | (let [indexes (range) 218 | vars-with-meta (map (partial var-with-meta comp-env) 219 | (env/ns-interns comp-env the-ns)) 220 | file-sort-fn #(-> % second :file) 221 | line-sort-fn #(-> % second :line) 222 | column-sort-fn #(-> % second :column)] 223 | (sort-by (juxt file-sort-fn line-sort-fn column-sort-fn) 224 | vars-with-meta))) 225 | 226 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :list-vars] 227 | [{:keys [ns] :as msg}] 228 | (tooling-msg/with-tooling-response msg 229 | (let [ns (symbol ns) 230 | the-ns (find-ns ns)] 231 | (when the-ns 232 | {:vars (list-vars-with-meta nil the-ns)})))) 233 | 234 | (defmethod tooling-msg/tooling-msg-handle [:replique/cljs :list-vars] 235 | [{:keys [ns] :as msg}] 236 | (tooling-msg/with-tooling-response msg 237 | (let [comp-env (->CljsCompilerEnv @@cljs-compiler-env) 238 | ns (symbol ns) 239 | the-ns (env/find-ns comp-env ns)] 240 | (when the-ns 241 | {:vars (list-vars-with-meta comp-env the-ns)})))) 242 | 243 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :context] 244 | [{:keys [ns repl-env] :as msg}] 245 | (tooling-msg/with-tooling-response msg 246 | (when ns 247 | (context/context-forms 248 | nil repl-env ns 249 | context/context-forms-clj)))) 250 | 251 | (defmethod tooling-msg/tooling-msg-handle [:replique/browser :context] 252 | [{:keys [ns repl-env] :as msg}] 253 | (tooling-msg/with-tooling-response msg 254 | (when ns 255 | (context/context-forms 256 | (->CljsCompilerEnv @@cljs-compiler-env) repl-env ns 257 | context/context-forms-cljs)))) 258 | 259 | (defmethod tooling-msg/tooling-msg-handle [:replique/nashorn :context] 260 | [{:keys [ns repl-env] :as msg}] 261 | (tooling-msg/with-tooling-response msg 262 | (when ns 263 | (context/context-forms 264 | (->CljsCompilerEnv @@cljs-compiler-env) repl-env ns 265 | context/context-forms-cljs)))) 266 | 267 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :captured-env-locals] 268 | [{:keys [ns repl-env captured-env] :as msg}] 269 | (tooling-msg/with-tooling-response msg 270 | (when ns 271 | {:captured-env-locals (omniscient/captured-env-locals nil ns captured-env)}))) 272 | 273 | (defmethod tooling-msg/tooling-msg-handle [:replique/browser :captured-env-locals] 274 | [{:keys [ns repl-env captured-env] :as msg}] 275 | (tooling-msg/with-tooling-response msg 276 | (when ns 277 | {:captured-env-locals (omniscient/captured-env-locals-cljs 278 | (->CljsCompilerEnv @@cljs-compiler-env) 279 | @@cljs-repl-env 280 | ns captured-env)}))) 281 | 282 | (comment 283 | (tooling-msg/tooling-msg-handle {:repl-env :replique/clj 284 | :type :context 285 | :ns 'replique.tooling}) 286 | 287 | (tooling-msg/tooling-msg-handle {:repl-env :replique/cljs 288 | :type :context 289 | :ns 'cljs.user}) 290 | ) 291 | 292 | 293 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :source-meta] 294 | [msg] 295 | (tooling-msg/with-tooling-response msg 296 | (reset! replique.source-meta/source-meta (select-keys msg [:url :line :column])) 297 | {})) 298 | 299 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :symbols-in-namespaces] 300 | [{:keys [context ns] :as msg}] 301 | (tooling-msg/with-tooling-response msg 302 | (let [prefix (:symbol msg)] 303 | (assoc (find-usage/symbols-in-namespaces 304 | nil ns context prefix) 305 | :default-ns "user")))) 306 | 307 | (defmethod tooling-msg/tooling-msg-handle [:replique/cljs :symbols-in-namespaces] 308 | [{:keys [context ns is-string?] :as msg}] 309 | (tooling-msg/with-tooling-response msg 310 | (let [prefix (:symbol msg) 311 | comp-env (->CljsCompilerEnv @@cljs-compiler-env)] 312 | (assoc (find-usage/symbols-in-namespaces 313 | comp-env ns context prefix) 314 | :default-ns "cljs.user")))) 315 | 316 | ;; Exclude system modules / boot classpath since we are only looking for clj/sc sources 317 | (defmethod tooling-msg/tooling-msg-handle [:replique/clj :classpath-for-sources] 318 | [msg] 319 | (tooling-msg/with-tooling-response msg 320 | {:paths (->> (classpath/paths false) 321 | (into '() (map str)) 322 | reverse)})) 323 | -------------------------------------------------------------------------------- /src/replique/tooling_msg.clj: -------------------------------------------------------------------------------- 1 | (ns replique.tooling-msg 2 | (:refer-clojure :exclude [in-ns]) 3 | (:require [replique.utils :as utils] 4 | [clojure.stacktrace :refer [print-stack-trace]]) 5 | (:import [java.util.concurrent.locks ReentrantLock])) 6 | 7 | (defonce process-id nil) 8 | (defonce tooling-out nil) 9 | (defonce tooling-out-lock (ReentrantLock.)) 10 | (defonce tooling-err nil) 11 | (defonce tooling-prn prn) 12 | 13 | (defmacro with-tooling-response [msg & resp] 14 | `(try (dissoc (merge ~msg (~'do ~@resp)) :context) 15 | (catch Exception t# (assoc ~msg :error t#)))) 16 | 17 | (defn tooling-msg-handle-dispatch-fn [{:keys [repl-env type]}] [repl-env type]) 18 | (defmulti tooling-msg-handle tooling-msg-handle-dispatch-fn) 19 | 20 | (defmethod tooling-msg-handle :default 21 | [{:keys [process-id repl-env type] :as msg}] 22 | (assoc msg :error (format "Invalid tooling message type: %s for repl-env: %s" type repl-env))) 23 | 24 | (defn uncaught-exception [thread ex] 25 | (if (or (nil? tooling-err) (nil? tooling-out-lock)) 26 | (throw ex) 27 | (binding [*out* tooling-err 28 | *print-length* nil 29 | *print-level* nil 30 | *print-meta* nil] 31 | (utils/with-lock tooling-out-lock 32 | (tooling-prn {:type :error 33 | :process-id process-id 34 | :repl-type (utils/repl-type utils/*repl-env*) 35 | :repl-env utils/*repl-env* 36 | :thread (.getName ^Thread thread) 37 | :ns (ns-name *ns*) 38 | :value ex}))))) 39 | 40 | (defn tooling-available? [] 41 | (boolean (and tooling-out tooling-err tooling-out-lock))) 42 | 43 | (defmulti set-print-format identity) 44 | 45 | (defmethod set-print-format :default [print-format] 46 | ;; Do nothing 47 | ) 48 | 49 | (defmethod set-print-format :elisp [print-format] 50 | (require '[replique.elisp-printer]) 51 | (alter-var-root #'tooling-prn (constantly @(resolve 'replique.elisp-printer/prn)))) 52 | 53 | -------------------------------------------------------------------------------- /src/replique/utils.clj: -------------------------------------------------------------------------------- 1 | (ns replique.utils 2 | (:refer-clojure :exclude [delay]) 3 | (:require [clojure.core.server :as server]) 4 | (:import [java.util.concurrent.locks ReentrantLock] 5 | [java.net URL] 6 | [java.net ServerSocket] 7 | [java.nio.file Paths Path])) 8 | 9 | (defonce version "1.1.0-SNAPSHOT") 10 | 11 | (defonce host "localhost") 12 | (defonce port 0) 13 | (defonce http-host "localhost") 14 | (defonce http-port 0) 15 | (defonce cljs-compile-path "target/cljs") 16 | 17 | (defonce process-out nil) 18 | (defonce process-err nil) 19 | (defonce repl-server nil) 20 | (defonce http-server nil) 21 | 22 | (defonce root-dynamic-classloader nil) 23 | 24 | (defn server-port [server] 25 | (.getLocalPort ^ServerSocket server)) 26 | 27 | (defn server-host [server] 28 | (.getHostName (.getInetAddress ^ServerSocket server))) 29 | 30 | (defn- is-1-10-0+? [clojure-version] 31 | (let [{:keys [major minor incremental]} clojure-version] 32 | (or (> major 1) 33 | (and (= 1 major) (> minor 10)) 34 | (and (= 1 major) (= minor 10) (>= incremental 0))))) 35 | 36 | (defmacro with-1-10-0+ [& body] 37 | (when (is-1-10-0+? *clojure-version*) 38 | `(do ~@body))) 39 | 40 | (defn cljs-env? 41 | "Take the &env from a macro, and tell whether we are expanding into cljs." 42 | [env] 43 | (contains? env :ns)) 44 | 45 | (def ^:dynamic *repl-env* :replique/clj) 46 | (def ^:dynamic *main-ns* nil) 47 | 48 | (defmulti repl-type identity) 49 | (defmulti repl-ns identity) 50 | (defmulti repl-params identity) 51 | 52 | ;; Same as Delay but don't realize the Delay on exception. 53 | ;; This would not be possible with clojure Delay because it makes its function ^:once because 54 | ;; of local clearings. Replique Delay is not expected to be used in situations where local 55 | ;; clearing is needed 56 | 57 | (deftype Dynaload [^:unsynchronized-mutable f ^:unsynchronized-mutable val 58 | ^:unsynchronized-mutable exception] 59 | clojure.lang.IDeref 60 | (deref [this] 61 | (locking this 62 | (when f 63 | (let [res (try {:val (f)} 64 | (catch Exception e 65 | {:exception e}))] 66 | (when (:val res) 67 | (set! val (:val res)) 68 | (set! f nil) 69 | (set! exception nil)) 70 | (when (:exception res) 71 | (set! exception (:exception res))))) 72 | (when exception 73 | (throw (clojure.lang.Util/sneakyThrow exception))) 74 | val)) 75 | clojure.lang.IPending 76 | (isRealized [this] (nil? f))) 77 | 78 | (defmacro delay [& body] 79 | (list 'new 'replique.utils.Dynaload `(~'fn [] ~@body) nil nil)) 80 | 81 | (defn dynaload [s] 82 | (Dynaload. (fn [] 83 | (let [ns (namespace s)] 84 | (assert ns) 85 | (require (symbol ns)) 86 | (let [v (resolve s)] 87 | (if v 88 | @v 89 | (throw (RuntimeException. (str "Var " s " is not on the classpath"))))))) 90 | nil nil)) 91 | 92 | (defmacro with-lock 93 | [lock-expr & body] 94 | `(let [lockee# ~(with-meta lock-expr {:tag 'java.util.concurrent.locks.ReentrantLock})] 95 | (.lock lockee#) 96 | (try 97 | ~@body 98 | (finally 99 | (.unlock lockee#))))) 100 | 101 | (defmacro maybe-locking [x & body] 102 | (if (resolve 'clojure.core/locking) 103 | `(clojure.core/locking ~x ~@body) 104 | `(do ~@body))) 105 | 106 | (defn ^Path make-path 107 | "Returns a java.nio.file.Path constructed from the provided String(s)." 108 | [path & paths] 109 | (Paths/get (str path) (into-array String (map str paths)))) 110 | 111 | (defn jar-url->path [url] 112 | (let [url-str (str url) 113 | path (when (.contains url-str "!/") 114 | (last (.split url-str "!/")))] 115 | path)) 116 | 117 | (defn file-url->path [url] 118 | (.getFile ^URL url)) 119 | 120 | (defmulti url->path (fn [url] (.getProtocol ^URL url))) 121 | 122 | (defmethod url->path "file" [url] 123 | (file-url->path url)) 124 | 125 | (defmethod url->path "jar" [url] 126 | (jar-url->path url)) 127 | 128 | ;; post eval hooks 129 | (defonce clj-env-hooks (atom nil)) 130 | (defonce cljs-env-hooks (atom nil)) 131 | -------------------------------------------------------------------------------- /src/replique/watch_protocols.clj: -------------------------------------------------------------------------------- 1 | (ns replique.watch-protocols 2 | (:import [clojure.lang IDeref IObj IMeta])) 3 | 4 | (defprotocol IWatchHandler 5 | (add-watch-handler [this buffer-id])) 6 | 7 | (defprotocol IRecordable 8 | (start-recording [this buffer-id record-size]) 9 | (stop-recording [this buffer-id]) 10 | (record-position [this]) 11 | (most-recent-value [this]) 12 | (value-at-index [this index])) 13 | 14 | (defprotocol IRecordSize 15 | (record-size [this])) 16 | 17 | (defprotocol IGetRef 18 | (get-ref [this])) 19 | 20 | (declare ->WatchedRef) 21 | 22 | (deftype WatchedRef [ref values index meta] 23 | IDeref 24 | (deref [this] (get values index)) 25 | IObj 26 | (withMeta [this meta] (->WatchedRef ref values index meta)) 27 | IMeta 28 | (meta [this] meta)) 29 | 30 | (declare ->RecordedWatchedRef) 31 | 32 | (deftype RecordedWatchedRef [ref values index record-size meta] 33 | IDeref 34 | (deref [this] (get values index)) 35 | IObj 36 | (withMeta [this meta] (->RecordedWatchedRef ref values index record-size meta)) 37 | IMeta 38 | (meta [this] meta)) 39 | 40 | (extend-type nil 41 | IGetRef 42 | (get-ref [this] nil)) 43 | -------------------------------------------------------------------------------- /test/replique/compliment/ns_mappings_clj_test.clj: -------------------------------------------------------------------------------- 1 | (ns replique.compliment.ns-mappings-clj-test 2 | (:require [replique.repl :refer [tooling-repl]]) 3 | (:import [java.io File])) 4 | 5 | (defn my-fn [fff] 6 | (let [e nil] 7 | (e)) 8 | (prn "e") 9 | nil) 10 | 11 | (defmacro my-macro []) 12 | 13 | (defmacro mmmm []) 14 | 15 | ::fffffff 16 | -------------------------------------------------------------------------------- /test/replique/compliment/ns_mappings_cljc_test.cljc: -------------------------------------------------------------------------------- 1 | (ns replique.compliment.ns-mappings-cljc-test 2 | #?(:cljs (:import [goog.events EventType])) 3 | #?(:cljs (:require-macros [replique.compliment.ns-mappings-clj-test 4 | :as cljs-ns-m :refer [my-macro]]))) 5 | 6 | (defn my-fn "rr" [e f & {:keys [e r]}]) 7 | (def gg nil) 8 | ::eeeeee 9 | 10 | :replique.compliment.ns-mappings-clj-test/fffff 11 | 12 | ::ee 13 | ::eee 14 | #?(:cljs (prn "e")) 15 | -------------------------------------------------------------------------------- /test/replique/compliment/ns_mappings_cljs_test.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.compliment.ns-mappings-cljs-test 2 | (:require [clojure.string :as st :refer [split] :rename {split str-split}] 3 | [replique.compliment.ns-mappings-cljs-test2 :refer [ff2]] 4 | [replique.js-lib] 5 | [replique.js-foreign-lib]) 6 | (:import [goog.events EventType]) 7 | (:require-macros [replique.compliment.ns-mappings-clj-test 8 | :as cljs-ns-m :refer [my-macro mmmm] :rename {my-macro my-macro-2}])) 9 | 10 | (defn my-fn "rr" [e f & {:keys [e r]}]) 11 | (def gg nil) 12 | ::eeeeee 13 | 14 | :replique.compliment.ns-mappings-clj-test/fffff 15 | 16 | ::ee 17 | ::eee 18 | 19 | -------------------------------------------------------------------------------- /test/replique/compliment/ns_mappings_cljs_test2.cljs: -------------------------------------------------------------------------------- 1 | (ns replique.compliment.ns-mappings-cljs-test2 2 | (:require [goog.object])) 3 | 4 | (def ff2 "ff2") 5 | 6 | (goog.object/get #js {:e "e"} "e") 7 | 8 | (comment 9 | (goog.object/get #js {:e "e"} :e) 10 | ) 11 | --------------------------------------------------------------------------------