clojurific 0.12.7 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/vite-plugin-cljs/index.js +12 -12
package/README.md
CHANGED
|
@@ -28,10 +28,10 @@ Dependencies and source paths come from the project's `deps.edn`:
|
|
|
28
28
|
|
|
29
29
|
```js
|
|
30
30
|
// vite.config.mjs
|
|
31
|
-
import
|
|
31
|
+
import cljf from 'clojurific/vite';
|
|
32
32
|
|
|
33
33
|
export default {
|
|
34
|
-
plugins: [
|
|
34
|
+
plugins: [cljf({ outputDir: 'target/cljs' })],
|
|
35
35
|
};
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -57,7 +57,7 @@ npx cljf repl
|
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`cljf repl` is a ClojureScript REPL evaluating in the pages the dev server
|
|
60
|
-
runs, through its nREPL server: `
|
|
60
|
+
runs, through its nREPL server: `cljf({ outputDir: 'target/cljs',
|
|
61
61
|
compilerOptions: { repl: { 'nrepl-port': 0 } } })` with `nrepl/nrepl` in
|
|
62
62
|
`deps.edn`.
|
|
63
63
|
|
|
@@ -87,7 +87,7 @@ npx cljf setup-java
|
|
|
87
87
|
| `CLJF_MAVEN_REPO` | a Maven Central mirror to download the dependency resolver from; other dependencies use `:mvn/repos` |
|
|
88
88
|
| `CLJF_CACHE_DIR` | where `setup-java` installs Java |
|
|
89
89
|
|
|
90
|
-
See [
|
|
90
|
+
See [README.md](https://github.com/WhimsicalCode/clojurific/blob/main/README.md) for
|
|
91
91
|
compiler options, the Vite plugin's options, the REPL and how the launcher
|
|
92
92
|
works.
|
|
93
93
|
|
package/package.json
CHANGED
|
@@ -256,7 +256,7 @@ export default module.exports;
|
|
|
256
256
|
* defaults to false: only from this machine. A proxy in front of the dev
|
|
257
257
|
* server must set X-Real-IP to the client's address.
|
|
258
258
|
*/
|
|
259
|
-
export default function
|
|
259
|
+
export default function cljf(options) {
|
|
260
260
|
const manifestName = options.manifest ?? 'manifest.json';
|
|
261
261
|
let config, proc, server, minify, root, cwd, outputDir, compiler;
|
|
262
262
|
// the namespaces of the pages' scripts, compiled as main namespaces
|
|
@@ -328,8 +328,8 @@ export default function cljs(options) {
|
|
|
328
328
|
} else if (event.type === 'compiled' || event.type === 'error') {
|
|
329
329
|
compiled();
|
|
330
330
|
const logger = config?.logger ?? console;
|
|
331
|
-
if (event.type === 'error') logger.error(`[
|
|
332
|
-
else logger.info(`[
|
|
331
|
+
if (event.type === 'error') logger.error(`[cljf] ${event.message}`);
|
|
332
|
+
else logger.info(`[cljf] compiled ${event.namespaces} namespace(s) in ${event.ms}ms`);
|
|
333
333
|
if (first && event.type === 'compiled') {
|
|
334
334
|
first = false;
|
|
335
335
|
resolve();
|
|
@@ -402,7 +402,7 @@ export default function cljs(options) {
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
return {
|
|
405
|
-
name: '
|
|
405
|
+
name: 'cljf',
|
|
406
406
|
// before Vite's resolver, which would take cljs-npm-as: specifiers
|
|
407
407
|
enforce: 'pre',
|
|
408
408
|
|
|
@@ -623,7 +623,7 @@ export default function cljs(options) {
|
|
|
623
623
|
this.warn('nothing was pruned: package.json has "type": "commonjs", so the bundler treats the project\'s ' +
|
|
624
624
|
'.js files as CommonJS and wraps the ClojureScript they import in initializers. Use "type": "module".');
|
|
625
625
|
}
|
|
626
|
-
config.logger.info(`[
|
|
626
|
+
config.logger.info(`[cljf] removed ${pruned.removed} unused statements (${pruneMs}ms), ` +
|
|
627
627
|
`renamed ${Object.keys(renames).length} properties, ` +
|
|
628
628
|
`minified (${Date.now() - start - pruneMs}ms)`);
|
|
629
629
|
}
|
|
@@ -686,7 +686,7 @@ export default function cljs(options) {
|
|
|
686
686
|
// since: a reloaded page runs the output with warnings
|
|
687
687
|
let problem = null;
|
|
688
688
|
const showProblem = err => {
|
|
689
|
-
problem = { type: 'error', err: { stack: '', plugin: '
|
|
689
|
+
problem = { type: 'error', err: { stack: '', plugin: 'cljf', ...err } };
|
|
690
690
|
server.ws.send(problem);
|
|
691
691
|
};
|
|
692
692
|
server.ws.on('connection', socket => problem && socket.send(JSON.stringify(problem)));
|
|
@@ -702,14 +702,14 @@ export default function cljs(options) {
|
|
|
702
702
|
for (const name of ssrEntries) {
|
|
703
703
|
const file = info?.entries?.[name];
|
|
704
704
|
if (!file) {
|
|
705
|
-
config.logger.error(`[
|
|
705
|
+
config.logger.error(`[cljf] ssrEntries: no :js-entries ${name}`, { timestamp: true });
|
|
706
706
|
continue;
|
|
707
707
|
}
|
|
708
708
|
try {
|
|
709
709
|
await runner.import(path.join(outputDir, file));
|
|
710
710
|
ssrEntries = ssrEntries.filter(n => n !== name);
|
|
711
711
|
} catch (e) {
|
|
712
|
-
config.logger.error(`[
|
|
712
|
+
config.logger.error(`[cljf] running ${name} (${file}): ${e.stack ?? e}`, { timestamp: true });
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
};
|
|
@@ -738,7 +738,7 @@ export default function cljs(options) {
|
|
|
738
738
|
send({
|
|
739
739
|
op: 'console-result',
|
|
740
740
|
rid: data.rid,
|
|
741
|
-
result: { error: 'cljs_eval only runs in pages on the dev server\'s machine, see the
|
|
741
|
+
result: { error: 'cljs_eval only runs in pages on the dev server\'s machine, see the cljf plugin\'s replRemoteConsole' },
|
|
742
742
|
});
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
@@ -829,7 +829,7 @@ export default function cljs(options) {
|
|
|
829
829
|
const outstanding = [...warnings.values()].flat();
|
|
830
830
|
if (event.type === 'compiled' && outstanding.length) {
|
|
831
831
|
const [first] = outstanding;
|
|
832
|
-
config.logger.warn(`[
|
|
832
|
+
config.logger.warn(`[cljf] compiled ${event.namespaces} namespace(s) in ${event.ms}ms, ` +
|
|
833
833
|
`hot reload paused by ${outstanding.length} warning(s)`, { timestamp: true });
|
|
834
834
|
showProblem({
|
|
835
835
|
message: outstanding
|
|
@@ -840,7 +840,7 @@ export default function cljs(options) {
|
|
|
840
840
|
});
|
|
841
841
|
ready();
|
|
842
842
|
} else if (event.type === 'compiled') {
|
|
843
|
-
config.logger.info(`[
|
|
843
|
+
config.logger.info(`[cljf] compiled ${event.namespaces} namespace(s) in ${event.ms}ms`, { timestamp: true });
|
|
844
844
|
problem = null;
|
|
845
845
|
// the namespaces held back that this compile didn't update
|
|
846
846
|
const client = server.environments.client;
|
|
@@ -850,7 +850,7 @@ export default function cljs(options) {
|
|
|
850
850
|
runSsrEntries();
|
|
851
851
|
ready();
|
|
852
852
|
} else if (event.type === 'error') {
|
|
853
|
-
config.logger.error(`[
|
|
853
|
+
config.logger.error(`[cljf] ${event.message}`, { timestamp: true });
|
|
854
854
|
showProblem({
|
|
855
855
|
message: event.message,
|
|
856
856
|
id: event.file,
|