conjure-js 0.0.12 → 0.0.13
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/dist-cli/conjure-js.mjs +9360 -5298
- package/dist-vite-plugin/index.mjs +9463 -5185
- package/package.json +3 -1
- package/src/bin/cli.ts +2 -2
- package/src/bin/nrepl-symbol.ts +150 -0
- package/src/bin/nrepl.ts +289 -167
- package/src/bin/version.ts +1 -1
- package/src/clojure/core.clj +757 -29
- package/src/clojure/core.clj.d.ts +75 -131
- package/src/clojure/generated/builtin-namespace-registry.ts +4 -0
- package/src/clojure/generated/clojure-core-source.ts +758 -29
- package/src/clojure/generated/clojure-set-source.ts +136 -0
- package/src/clojure/generated/clojure-walk-source.ts +72 -0
- package/src/clojure/set.clj +132 -0
- package/src/clojure/set.clj.d.ts +20 -0
- package/src/clojure/string.clj.d.ts +14 -0
- package/src/clojure/walk.clj +68 -0
- package/src/clojure/walk.clj.d.ts +7 -0
- package/src/core/assertions.ts +114 -6
- package/src/core/bootstrap.ts +337 -0
- package/src/core/conversions.ts +48 -31
- package/src/core/core-module.ts +303 -0
- package/src/core/env.ts +20 -6
- package/src/core/evaluator/apply.ts +40 -25
- package/src/core/evaluator/arity.ts +8 -8
- package/src/core/evaluator/async-evaluator.ts +565 -0
- package/src/core/evaluator/collections.ts +28 -5
- package/src/core/evaluator/destructure.ts +180 -69
- package/src/core/evaluator/dispatch.ts +12 -14
- package/src/core/evaluator/evaluate.ts +22 -20
- package/src/core/evaluator/expand.ts +45 -15
- package/src/core/evaluator/form-parsers.ts +178 -0
- package/src/core/evaluator/index.ts +7 -9
- package/src/core/evaluator/js-interop.ts +189 -0
- package/src/core/evaluator/quasiquote.ts +14 -8
- package/src/core/evaluator/recur-check.ts +6 -6
- package/src/core/evaluator/special-forms.ts +234 -191
- package/src/core/factories.ts +182 -3
- package/src/core/index.ts +54 -4
- package/src/core/module.ts +136 -0
- package/src/core/ns-forms.ts +107 -0
- package/src/core/printer.ts +371 -11
- package/src/core/reader.ts +84 -33
- package/src/core/registry.ts +209 -0
- package/src/core/runtime.ts +376 -0
- package/src/core/session.ts +253 -487
- package/src/core/stdlib/arithmetic.ts +528 -194
- package/src/core/stdlib/async-fns.ts +132 -0
- package/src/core/stdlib/atoms.ts +291 -56
- package/src/core/stdlib/errors.ts +54 -50
- package/src/core/stdlib/hof.ts +82 -166
- package/src/core/stdlib/js-namespace.ts +344 -0
- package/src/core/stdlib/lazy.ts +34 -0
- package/src/core/stdlib/maps-sets.ts +322 -0
- package/src/core/stdlib/meta.ts +61 -30
- package/src/core/stdlib/predicates.ts +325 -187
- package/src/core/stdlib/regex.ts +126 -98
- package/src/core/stdlib/seq.ts +564 -0
- package/src/core/stdlib/strings.ts +164 -135
- package/src/core/stdlib/transducers.ts +95 -100
- package/src/core/stdlib/utils.ts +292 -130
- package/src/core/stdlib/vars.ts +27 -27
- package/src/core/stdlib/vectors.ts +122 -0
- package/src/core/tokenizer.ts +2 -2
- package/src/core/transformations.ts +117 -9
- package/src/core/types.ts +98 -2
- package/src/host/node-host-module.ts +74 -0
- package/src/{vite-plugin-clj/nrepl-relay.ts → nrepl/relay.ts} +72 -11
- package/src/vite-plugin-clj/codegen.ts +87 -95
- package/src/vite-plugin-clj/index.ts +178 -23
- package/src/vite-plugin-clj/namespace-utils.ts +39 -0
- package/src/vite-plugin-clj/static-analysis.ts +211 -0
- package/src/clojure/demo.clj +0 -72
- package/src/clojure/demo.clj.d.ts +0 -0
- package/src/core/core-env.ts +0 -61
- package/src/core/stdlib/collections.ts +0 -739
- package/src/host/node.ts +0 -55
package/src/host/node.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
import {
|
|
4
|
-
define,
|
|
5
|
-
cljNativeFunction,
|
|
6
|
-
cljNil,
|
|
7
|
-
cljString,
|
|
8
|
-
valueToString,
|
|
9
|
-
type Session,
|
|
10
|
-
type CljValue,
|
|
11
|
-
} from '../core'
|
|
12
|
-
import { inferSourceRoot } from '../bin/nrepl-utils'
|
|
13
|
-
|
|
14
|
-
export function injectNodeHostFunctions(session: Session): void {
|
|
15
|
-
const coreEnv = session.registry.get('clojure.core')!
|
|
16
|
-
|
|
17
|
-
define(
|
|
18
|
-
'slurp',
|
|
19
|
-
cljNativeFunction('slurp', (pathVal: CljValue) => {
|
|
20
|
-
const filePath = resolve(valueToString(pathVal))
|
|
21
|
-
if (!existsSync(filePath)) {
|
|
22
|
-
throw new Error(`slurp: file not found: ${filePath}`)
|
|
23
|
-
}
|
|
24
|
-
return cljString(readFileSync(filePath, 'utf8'))
|
|
25
|
-
}),
|
|
26
|
-
coreEnv
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
define(
|
|
30
|
-
'spit',
|
|
31
|
-
cljNativeFunction('spit', (pathVal: CljValue, content: CljValue) => {
|
|
32
|
-
const filePath = resolve(valueToString(pathVal))
|
|
33
|
-
writeFileSync(filePath, valueToString(content), 'utf8')
|
|
34
|
-
return cljNil()
|
|
35
|
-
}),
|
|
36
|
-
coreEnv
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
define(
|
|
40
|
-
'load',
|
|
41
|
-
cljNativeFunction('load', (pathVal: CljValue) => {
|
|
42
|
-
const filePath = resolve(valueToString(pathVal))
|
|
43
|
-
if (!existsSync(filePath)) {
|
|
44
|
-
throw new Error(`load: file not found: ${filePath}`)
|
|
45
|
-
}
|
|
46
|
-
const source = readFileSync(filePath, 'utf8')
|
|
47
|
-
const inferred = inferSourceRoot(filePath, source)
|
|
48
|
-
if (inferred) session.addSourceRoot(inferred)
|
|
49
|
-
const loadedNs = session.loadFile(source)
|
|
50
|
-
session.setNs(loadedNs)
|
|
51
|
-
return cljNil()
|
|
52
|
-
}),
|
|
53
|
-
coreEnv
|
|
54
|
-
)
|
|
55
|
-
}
|