@soederpop/luca 0.0.36 → 0.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soederpop/luca",
3
- "version": "0.0.36",
3
+ "version": "0.1.0",
4
4
  "website": "https://luca.soederpop.com",
5
5
  "description": "lightweight universal conversational architecture AKA Le Ultimate Component Architecture AKA Last Universal Common Ancestor, part AI part Human",
6
6
  "author": "jon soeder aka the people's champ <jon@soederpop.com>",
@@ -109,7 +109,6 @@
109
109
  "detect-port": "^1.5.1",
110
110
  "dotenv": "^17.2.4",
111
111
  "endent": "^2.1.0",
112
- "esbuild-wasm": "0.17.18",
113
112
  "excalidraw-to-svg": "^3.1.0",
114
113
  "express": "^4.18.2",
115
114
  "figlet": "^1.6.0",
@@ -1,5 +1,5 @@
1
1
  // Auto-generated bootstrap content
2
- // Generated at: 2026-03-28T00:36:31.608Z
2
+ // Generated at: 2026-03-28T05:59:18.171Z
3
3
  // Source: docs/bootstrap/*.md, docs/bootstrap/templates/*, docs/examples/*.md, docs/tutorials/*.md
4
4
  //
5
5
  // Do not edit manually. Run: luca build-bootstrap
@@ -1,4 +1,4 @@
1
1
  // Generated at compile time — do not edit manually
2
2
  export const BUILD_SHA = 'acd8dd0'
3
3
  export const BUILD_BRANCH = 'main'
4
- export const BUILD_DATE = '2026-03-28T00:36:32Z'
4
+ export const BUILD_DATE = '2026-03-28T05:59:19Z'
@@ -38,7 +38,7 @@ async function evalBeforeRepl(evalArg: string, container: any, featureContext: R
38
38
  if (target.type === 'markdown') {
39
39
  await container.docs.load()
40
40
  const doc = await container.docs.parseMarkdownAtPath(target.value)
41
- const esbuild = container.feature('esbuild')
41
+ const transpiler = container.feature('transpiler')
42
42
  const shared = vm.createContext({
43
43
  console, fetch, URL, URLSearchParams,
44
44
  setTimeout, clearTimeout, setInterval, clearInterval,
@@ -59,7 +59,7 @@ async function evalBeforeRepl(evalArg: string, container: any, featureContext: R
59
59
  const needsTransform = lang === 'tsx' || lang === 'jsx'
60
60
  let code = value
61
61
  if (needsTransform) {
62
- const { code: transformed } = esbuild.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
62
+ const { code: transformed } = transpiler.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
63
63
  code = transformed
64
64
  }
65
65
 
@@ -722,8 +722,8 @@ async function executePromptFile(resolvedPath: string, container: any, inputs?:
722
722
  capturedLines.length = 0
723
723
  let code = value
724
724
  if (lang === 'tsx' || lang === 'jsx') {
725
- const esbuild = container.feature('esbuild')
726
- const { code: transformed } = esbuild.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
725
+ const transpiler = container.feature('transpiler')
726
+ const { code: transformed } = transpiler.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
727
727
  code = transformed
728
728
  }
729
729
 
@@ -16,37 +16,6 @@ export const argsSchema = CommandOptionsSchema.extend({
16
16
  dontInjectContext: z.boolean().default(false).describe('Skip auto-injecting container context into scripts (run with plain bun instead)'),
17
17
  })
18
18
 
19
- /**
20
- * Convert esbuild ESM output imports/exports to CJS require/module.exports
21
- * so the code can run in a vm context that provides `require`.
22
- */
23
- function esmToCjs(code: string): string {
24
- return code
25
- // import { a, b } from 'x' → const { a, b } = require('x')
26
- .replace(/^import\s+\{([^}]+)\}\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
27
- 'const {$1} = require($2);')
28
- // import x from 'y' → const x = require('y').default ?? require('y')
29
- .replace(/^import\s+(\w+)\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
30
- 'const $1 = require($2).default ?? require($2);')
31
- // import * as x from 'y' → const x = require('y')
32
- .replace(/^import\s+\*\s+as\s+(\w+)\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
33
- 'const $1 = require($2);')
34
- // import 'y' → require('y')
35
- .replace(/^import\s+(['"][^'"]+['"])\s*;?$/gm,
36
- 'require($1);')
37
- // export default → module.exports.default =
38
- .replace(/^export\s+default\s+/gm, 'module.exports.default = ')
39
- // export { ... } → strip (vars already in scope)
40
- .replace(/^export\s+\{[^}]*\}\s*;?$/gm, '')
41
- // export const/let/var → const/let/var
42
- .replace(/^export\s+(const|let|var)\s+/gm, '$1 ')
43
- }
44
-
45
- function hasTLA(code: string): boolean {
46
- // Quick check: contains await outside of async function bodies
47
- // This is a heuristic — wrapTopLevelAwait does the real work
48
- return /\bawait\b/.test(code) && !/^\s*\(?\s*async\b/.test(code)
49
- }
50
19
 
51
20
  function resolveScript(ref: string, context: ContainerContext): string | null {
52
21
  const container = context.container as any
@@ -108,7 +77,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
108
77
 
109
78
  const doc = await container.docs.parseMarkdownAtPath(scriptPath)
110
79
 
111
- const esbuild = container.feature('esbuild')
80
+ const transpiler = container.feature('transpiler')
112
81
  const ink = container.feature('ink', { enable: true })
113
82
  await ink.loadModules()
114
83
 
@@ -128,7 +97,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
128
97
 
129
98
  for (const source of blockSources) {
130
99
  const keysBefore = new Set(Object.keys(shared))
131
- const { code: transformed } = esbuild.transformSync(source, { loader: 'tsx', format: 'cjs' })
100
+ const { code: transformed } = transpiler.transformSync(source, { loader: 'tsx', format: 'cjs' })
132
101
 
133
102
  await vm.run(transformed, shared)
134
103
 
@@ -190,7 +159,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
190
159
  let code = value
191
160
 
192
161
  if (needsTransform) {
193
- const { code: transformed } = esbuild.transformSync(value, {
162
+ const { code: transformed } = transpiler.transformSync(value, {
194
163
  loader: lang as 'tsx' | 'jsx',
195
164
  format: 'cjs',
196
165
  })
@@ -229,19 +198,10 @@ async function runScript(scriptPath: string, context: ContainerContext, options:
229
198
  }
230
199
 
231
200
  const vm = container.feature('vm')
232
- const esbuild = container.feature('esbuild')
201
+ const transpiler = container.feature('transpiler')
233
202
  const raw = container.fs.readFile(scriptPath)
234
203
 
235
- let code: string
236
- if (hasTLA(raw)) {
237
- // TLA is incompatible with CJS format, so transform as ESM (preserves await)
238
- // then convert import/export statements to require/module.exports for the vm
239
- const { code: esm } = esbuild.transformSync(raw, { format: 'esm' })
240
- code = esmToCjs(esm)
241
- } else {
242
- const { code: cjs } = esbuild.transformSync(raw, { format: 'cjs' })
243
- code = cjs
244
- }
204
+ const { code } = transpiler.transformSync(raw, { format: 'cjs' })
245
205
 
246
206
  const ctx = {
247
207
  require: vm.createRequireFor(scriptPath),
@@ -1,7 +1,7 @@
1
1
  import { setBuildTimeData, setContainerBuildTimeData } from './index.js';
2
2
 
3
3
  // Auto-generated introspection registry data
4
- // Generated at: 2026-03-28T00:36:29.946Z
4
+ // Generated at: 2026-03-28T05:59:16.407Z
5
5
 
6
6
  setBuildTimeData('features.googleDocs', {
7
7
  "id": "features.googleDocs",
@@ -953,77 +953,6 @@ setBuildTimeData('features.git', {
953
953
  }
954
954
  });
955
955
 
956
- setBuildTimeData('features.esbuild', {
957
- "id": "features.esbuild",
958
- "description": "A Feature for compiling typescript / esm modules, etc to JavaScript that the container can run at runtime. Uses esbuild for fast, reliable TypeScript/ESM transformation with full format support (esm, cjs, iife).",
959
- "shortcut": "features.esbuild",
960
- "className": "ESBuild",
961
- "methods": {
962
- "transformSync": {
963
- "description": "/** Transform code synchronously",
964
- "parameters": {
965
- "code": {
966
- "type": "string",
967
- "description": "The code to transform"
968
- },
969
- "options": {
970
- "type": "esbuild.TransformOptions",
971
- "description": "The options to pass to esbuild"
972
- }
973
- },
974
- "required": [
975
- "code"
976
- ],
977
- "returns": "esbuild.TransformResult"
978
- },
979
- "transform": {
980
- "description": "Transform code asynchronously",
981
- "parameters": {
982
- "code": {
983
- "type": "string",
984
- "description": "The code to transform"
985
- },
986
- "options": {
987
- "type": "esbuild.TransformOptions",
988
- "description": "The options to pass to esbuild"
989
- }
990
- },
991
- "required": [
992
- "code"
993
- ],
994
- "returns": "Promise<esbuild.TransformResult>"
995
- },
996
- "bundle": {
997
- "description": "Bundle one or more entry points, resolving imports and requires into a single output. Supports Node platform by default so require() and Node builtins are handled. Returns in-memory output files unless write is enabled in options.",
998
- "parameters": {
999
- "entryPoints": {
1000
- "type": "string[]",
1001
- "description": "File paths to bundle from"
1002
- },
1003
- "options": {
1004
- "type": "esbuild.BuildOptions",
1005
- "description": "esbuild BuildOptions overrides"
1006
- }
1007
- },
1008
- "required": [
1009
- "entryPoints"
1010
- ],
1011
- "returns": "Promise<esbuild.BuildResult>"
1012
- }
1013
- },
1014
- "getters": {},
1015
- "events": {},
1016
- "state": {},
1017
- "options": {},
1018
- "envVars": [],
1019
- "examples": [
1020
- {
1021
- "language": "ts",
1022
- "code": "const esbuild = container.feature('esbuild')\nconst result = esbuild.transformSync('const x: number = 1')\nconsole.log(result.code) // 'const x = 1;\\n'"
1023
- }
1024
- ]
1025
- });
1026
-
1027
956
  setBuildTimeData('features.dns', {
1028
957
  "id": "features.dns",
1029
958
  "description": "The Dns feature provides structured DNS lookups by wrapping the `dig` CLI. All query methods parse dig output into typed JSON objects, making it easy to explore and audit a domain's DNS configuration programmatically.",
@@ -4994,6 +4923,127 @@ setBuildTimeData('features.docker', {
4994
4923
  }
4995
4924
  });
4996
4925
 
4926
+ setBuildTimeData('features.transpiler', {
4927
+ "id": "features.transpiler",
4928
+ "description": "Transpile TypeScript, TSX, and JSX to JavaScript at runtime using Bun's built-in transpiler. Compile code strings on the fly without touching the filesystem or spawning external processes.",
4929
+ "shortcut": "features.transpiler",
4930
+ "className": "Transpiler",
4931
+ "methods": {
4932
+ "transformSync": {
4933
+ "description": "Transform code synchronously",
4934
+ "parameters": {
4935
+ "code": {
4936
+ "type": "string",
4937
+ "description": "The code to transform"
4938
+ },
4939
+ "options": {
4940
+ "type": "TransformOptions",
4941
+ "description": "Transform options (loader, format, minify)",
4942
+ "properties": {
4943
+ "loader": {
4944
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
4945
+ "description": ""
4946
+ },
4947
+ "format": {
4948
+ "type": "'esm' | 'cjs'",
4949
+ "description": ""
4950
+ },
4951
+ "minify": {
4952
+ "type": "boolean",
4953
+ "description": ""
4954
+ }
4955
+ }
4956
+ }
4957
+ },
4958
+ "required": [
4959
+ "code"
4960
+ ],
4961
+ "returns": "TransformResult"
4962
+ },
4963
+ "transform": {
4964
+ "description": "Transform code asynchronously",
4965
+ "parameters": {
4966
+ "code": {
4967
+ "type": "string",
4968
+ "description": "The code to transform"
4969
+ },
4970
+ "options": {
4971
+ "type": "TransformOptions",
4972
+ "description": "Transform options (loader, format, minify)",
4973
+ "properties": {
4974
+ "loader": {
4975
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
4976
+ "description": ""
4977
+ },
4978
+ "format": {
4979
+ "type": "'esm' | 'cjs'",
4980
+ "description": ""
4981
+ },
4982
+ "minify": {
4983
+ "type": "boolean",
4984
+ "description": ""
4985
+ }
4986
+ }
4987
+ }
4988
+ },
4989
+ "required": [
4990
+ "code"
4991
+ ],
4992
+ "returns": "Promise<TransformResult>"
4993
+ }
4994
+ },
4995
+ "getters": {},
4996
+ "events": {},
4997
+ "state": {},
4998
+ "options": {},
4999
+ "envVars": [],
5000
+ "examples": [
5001
+ {
5002
+ "language": "ts",
5003
+ "code": "const transpiler = container.feature('transpiler')\nconst result = transpiler.transformSync('const x: number = 1')\nconsole.log(result.code) // 'const x = 1;\\n'"
5004
+ }
5005
+ ],
5006
+ "types": {
5007
+ "TransformOptions": {
5008
+ "description": "",
5009
+ "properties": {
5010
+ "loader": {
5011
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
5012
+ "description": "",
5013
+ "optional": true
5014
+ },
5015
+ "format": {
5016
+ "type": "'esm' | 'cjs'",
5017
+ "description": "",
5018
+ "optional": true
5019
+ },
5020
+ "minify": {
5021
+ "type": "boolean",
5022
+ "description": "",
5023
+ "optional": true
5024
+ }
5025
+ }
5026
+ },
5027
+ "TransformResult": {
5028
+ "description": "",
5029
+ "properties": {
5030
+ "code": {
5031
+ "type": "string",
5032
+ "description": ""
5033
+ },
5034
+ "map": {
5035
+ "type": "string",
5036
+ "description": ""
5037
+ },
5038
+ "warnings": {
5039
+ "type": "any[]",
5040
+ "description": ""
5041
+ }
5042
+ }
5043
+ }
5044
+ }
5045
+ });
5046
+
4997
5047
  setBuildTimeData('features.yaml', {
4998
5048
  "id": "features.yaml",
4999
5049
  "description": "The YAML feature provides utilities for parsing and stringifying YAML data. This feature wraps the js-yaml library to provide convenient methods for converting between YAML strings and JavaScript objects. It's automatically attached to Node containers for easy access.",
@@ -18540,7 +18590,7 @@ setContainerBuildTimeData('Container', {
18540
18590
 
18541
18591
  setContainerBuildTimeData('NodeContainer', {
18542
18592
  "className": "NodeContainer",
18543
- "description": "Server-side container for Node.js and Bun environments. Extends the base Container with file system access, process management, git integration, and other server-side capabilities. Auto-enables core features on construction: fs, proc, git, grep, os, networking, ui, vm, esbuild, helpers. Also attaches Client, Server, Command, Endpoint, and Selector helper types, providing `container.client()`, `container.server()`, `container.command()`, etc. factory methods.",
18593
+ "description": "Server-side container for Node.js and Bun environments. Extends the base Container with file system access, process management, git integration, and other server-side capabilities. Auto-enables core features on construction: fs, proc, git, grep, os, networking, ui, vm, transpiler, helpers. Also attaches Client, Server, Command, Endpoint, and Selector helper types, providing `container.client()`, `container.server()`, `container.command()`, etc. factory methods.",
18544
18594
  "methods": {},
18545
18595
  "getters": {
18546
18596
  "cwd": {
@@ -19566,76 +19616,6 @@ export const introspectionData = [
19566
19616
  }
19567
19617
  }
19568
19618
  },
19569
- {
19570
- "id": "features.esbuild",
19571
- "description": "A Feature for compiling typescript / esm modules, etc to JavaScript that the container can run at runtime. Uses esbuild for fast, reliable TypeScript/ESM transformation with full format support (esm, cjs, iife).",
19572
- "shortcut": "features.esbuild",
19573
- "className": "ESBuild",
19574
- "methods": {
19575
- "transformSync": {
19576
- "description": "/** Transform code synchronously",
19577
- "parameters": {
19578
- "code": {
19579
- "type": "string",
19580
- "description": "The code to transform"
19581
- },
19582
- "options": {
19583
- "type": "esbuild.TransformOptions",
19584
- "description": "The options to pass to esbuild"
19585
- }
19586
- },
19587
- "required": [
19588
- "code"
19589
- ],
19590
- "returns": "esbuild.TransformResult"
19591
- },
19592
- "transform": {
19593
- "description": "Transform code asynchronously",
19594
- "parameters": {
19595
- "code": {
19596
- "type": "string",
19597
- "description": "The code to transform"
19598
- },
19599
- "options": {
19600
- "type": "esbuild.TransformOptions",
19601
- "description": "The options to pass to esbuild"
19602
- }
19603
- },
19604
- "required": [
19605
- "code"
19606
- ],
19607
- "returns": "Promise<esbuild.TransformResult>"
19608
- },
19609
- "bundle": {
19610
- "description": "Bundle one or more entry points, resolving imports and requires into a single output. Supports Node platform by default so require() and Node builtins are handled. Returns in-memory output files unless write is enabled in options.",
19611
- "parameters": {
19612
- "entryPoints": {
19613
- "type": "string[]",
19614
- "description": "File paths to bundle from"
19615
- },
19616
- "options": {
19617
- "type": "esbuild.BuildOptions",
19618
- "description": "esbuild BuildOptions overrides"
19619
- }
19620
- },
19621
- "required": [
19622
- "entryPoints"
19623
- ],
19624
- "returns": "Promise<esbuild.BuildResult>"
19625
- }
19626
- },
19627
- "getters": {},
19628
- "events": {},
19629
- "state": {},
19630
- "options": {},
19631
- "envVars": [],
19632
- "examples": [
19633
- {
19634
- "language": "ts",
19635
- "code": "const esbuild = container.feature('esbuild')\nconst result = esbuild.transformSync('const x: number = 1')\nconsole.log(result.code) // 'const x = 1;\\n'"
19636
- }
19637
- ]
19638
- },
19639
19619
  {
19640
19620
  "id": "features.dns",
19641
19621
  "description": "The Dns feature provides structured DNS lookups by wrapping the `dig` CLI. All query methods parse dig output into typed JSON objects, making it easy to explore and audit a domain's DNS configuration programmatically.",
@@ -23590,6 +23570,126 @@ export const introspectionData = [
23590
23570
  }
23591
23571
  }
23592
23572
  },
23573
+ {
23574
+ "id": "features.transpiler",
23575
+ "description": "Transpile TypeScript, TSX, and JSX to JavaScript at runtime using Bun's built-in transpiler. Compile code strings on the fly without touching the filesystem or spawning external processes.",
23576
+ "shortcut": "features.transpiler",
23577
+ "className": "Transpiler",
23578
+ "methods": {
23579
+ "transformSync": {
23580
+ "description": "Transform code synchronously",
23581
+ "parameters": {
23582
+ "code": {
23583
+ "type": "string",
23584
+ "description": "The code to transform"
23585
+ },
23586
+ "options": {
23587
+ "type": "TransformOptions",
23588
+ "description": "Transform options (loader, format, minify)",
23589
+ "properties": {
23590
+ "loader": {
23591
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
23592
+ "description": ""
23593
+ },
23594
+ "format": {
23595
+ "type": "'esm' | 'cjs'",
23596
+ "description": ""
23597
+ },
23598
+ "minify": {
23599
+ "type": "boolean",
23600
+ "description": ""
23601
+ }
23602
+ }
23603
+ }
23604
+ },
23605
+ "required": [
23606
+ "code"
23607
+ ],
23608
+ "returns": "TransformResult"
23609
+ },
23610
+ "transform": {
23611
+ "description": "Transform code asynchronously",
23612
+ "parameters": {
23613
+ "code": {
23614
+ "type": "string",
23615
+ "description": "The code to transform"
23616
+ },
23617
+ "options": {
23618
+ "type": "TransformOptions",
23619
+ "description": "Transform options (loader, format, minify)",
23620
+ "properties": {
23621
+ "loader": {
23622
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
23623
+ "description": ""
23624
+ },
23625
+ "format": {
23626
+ "type": "'esm' | 'cjs'",
23627
+ "description": ""
23628
+ },
23629
+ "minify": {
23630
+ "type": "boolean",
23631
+ "description": ""
23632
+ }
23633
+ }
23634
+ }
23635
+ },
23636
+ "required": [
23637
+ "code"
23638
+ ],
23639
+ "returns": "Promise<TransformResult>"
23640
+ }
23641
+ },
23642
+ "getters": {},
23643
+ "events": {},
23644
+ "state": {},
23645
+ "options": {},
23646
+ "envVars": [],
23647
+ "examples": [
23648
+ {
23649
+ "language": "ts",
23650
+ "code": "const transpiler = container.feature('transpiler')\nconst result = transpiler.transformSync('const x: number = 1')\nconsole.log(result.code) // 'const x = 1;\\n'"
23651
+ }
23652
+ ],
23653
+ "types": {
23654
+ "TransformOptions": {
23655
+ "description": "",
23656
+ "properties": {
23657
+ "loader": {
23658
+ "type": "'ts' | 'tsx' | 'jsx' | 'js'",
23659
+ "description": "",
23660
+ "optional": true
23661
+ },
23662
+ "format": {
23663
+ "type": "'esm' | 'cjs'",
23664
+ "description": "",
23665
+ "optional": true
23666
+ },
23667
+ "minify": {
23668
+ "type": "boolean",
23669
+ "description": "",
23670
+ "optional": true
23671
+ }
23672
+ }
23673
+ },
23674
+ "TransformResult": {
23675
+ "description": "",
23676
+ "properties": {
23677
+ "code": {
23678
+ "type": "string",
23679
+ "description": ""
23680
+ },
23681
+ "map": {
23682
+ "type": "string",
23683
+ "description": ""
23684
+ },
23685
+ "warnings": {
23686
+ "type": "any[]",
23687
+ "description": ""
23688
+ }
23689
+ }
23690
+ }
23691
+ }
23692
+ },
23593
23693
  {
23594
23694
  "id": "features.yaml",
23595
23695
  "description": "The YAML feature provides utilities for parsing and stringifying YAML data. This feature wraps the js-yaml library to provide convenient methods for converting between YAML strings and JavaScript objects. It's automatically attached to Node containers for easy access.",
@@ -37093,7 +37193,7 @@ export const containerIntrospectionData = [
37093
37193
  },
37094
37194
  {
37095
37195
  "className": "NodeContainer",
37096
- "description": "Server-side container for Node.js and Bun environments. Extends the base Container with file system access, process management, git integration, and other server-side capabilities. Auto-enables core features on construction: fs, proc, git, grep, os, networking, ui, vm, esbuild, helpers. Also attaches Client, Server, Command, Endpoint, and Selector helper types, providing `container.client()`, `container.server()`, `container.command()`, etc. factory methods.",
37196
+ "description": "Server-side container for Node.js and Bun environments. Extends the base Container with file system access, process management, git integration, and other server-side capabilities. Auto-enables core features on construction: fs, proc, git, grep, os, networking, ui, vm, transpiler, helpers. Also attaches Client, Server, Command, Endpoint, and Selector helper types, providing `container.client()`, `container.server()`, `container.command()`, etc. factory methods.",
37097
37197
  "methods": {},
37098
37198
  "getters": {
37099
37199
  "cwd": {