Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/functions-compiler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Functions Compiler

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
functions-compiler:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/functions-compiler

steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Wix gateway proxy (mandatory)
uses: ./.github/actions/wix-gateway-proxy

- name: Setup Bun
id: setup-bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: latest

- name: Cache Bun dependencies
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ steps.setup-bun.outputs.bun-version }}-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-${{ steps.setup-bun.outputs.bun-version }}-

- name: Install dependencies
run: bun install --frozen-lockfile
working-directory: .

- name: Run typecheck
run: bun run typecheck

# The suite compiles real npm packages and executes the output in workerd
# (miniflare), so it needs the registry and a few minutes.
- name: Run tests
run: bun run test

# Proves the published tarball carries every runtime asset: the shims and
# the .ts modules the esbuild plugins read as text.
- name: Build the publishable package
run: bun run build

- name: Verify packaged assets
run: bun run scripts/verify-package.ts
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
registry=https://registry.npmjs.org/

# JSR packages (consumed via npm-compat) resolve from JSR's own registry.
# Used by @base44/functions-compiler for @deno/loader, the same way apper's
# bundler service resolves it.
@jsr:registry=https://npm.jsr.io
37 changes: 33 additions & 4 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,31 @@
"organizeImports": {
"level": "on",
"options": {
"groups": [":NODE:", ":PACKAGE:", ":ALIAS:", ":PATH:"]
"groups": [
":NODE:",
":PACKAGE:",
":ALIAS:",
":PATH:"
]
}
}
}
}
},
"files": {
"includes": ["**", "!**/dist", "!**/node_modules", "!**/tests/fixtures", "!**/*.d.ts"]
"includes": [
"**",
"!**/dist",
"!**/node_modules",
"!**/tests/fixtures",
"!**/*.d.ts",
"!packages/functions-compiler/src/shim/**",
"!packages/functions-compiler/src/private-data-sources/**",
"!packages/functions-compiler/src/runtime/**",
"!packages/functions-compiler/src/runtime-context.ts",
"!packages/functions-compiler/src/static-egress.ts",
"!packages/functions-compiler/src/static-egress-marker.ts"
]
},
"formatter": {
"enabled": true,
Expand Down Expand Up @@ -46,12 +63,24 @@
"useNodejsImportProtocol": "error",
"noNonNullAssertion": "off",
"useArrayLiterals": "error",
"useConsistentArrayType": { "level": "error", "options": { "syntax": "shorthand" } }
"useConsistentArrayType": {
"level": "error",
"options": {
"syntax": "shorthand"
}
}
},
"suspicious": {
"noExplicitAny": "warn",
"noVar": "error",
"noConsole": { "level": "off", "options": { "allow": ["log"] } },
"noConsole": {
"level": "off",
"options": {
"allow": [
"log"
]
}
},
"noIrregularWhitespace": "error"
},
"nursery": {}
Expand Down
47 changes: 42 additions & 5 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The codebase has two layers with a clear separation of concerns:
- **`packages/cli/bin/`** - Entry points: `run.js` (production, Node.js) and `dev.ts` (development, Bun runs TypeScript directly).
- **`packages/cli/templates/`** - Project scaffolding templates for `base44 create`.
- **`packages/cli/tests/`** - CLI integration tests (`cli/`), core unit tests (`core/`), and test fixtures (`fixtures/`).
- **`packages/functions-compiler/`** - `@base44/functions-compiler`: the production compiler that turns backend-function sources into a single Cloudflare Workers module. Extracted from apper's `base44-userapp-bundler` so the CLI and that HTTP service run one engine. Owns its own `bun run test` / `typecheck` / `build`; see its README before editing — several files under `src/` are compile-time **assets** read as text, not modules.

```
packages/cli/src/
Expand Down
49 changes: 43 additions & 6 deletions knip.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"include": ["classMembers"],
"include": [
"classMembers"
],
"workspaces": {
"packages/cli": {
"entry": ["src/cli/index.ts", "bin/binary-entry.ts", "tests/**/testkit/index.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"],
"ignore": ["tests/fixtures/**"],
"ignoreDependencies": ["@types/deno"]
"entry": [
"src/cli/index.ts",
"bin/binary-entry.ts",
"tests/**/testkit/index.ts"
],
"project": [
"src/**/*.ts",
"tests/**/*.ts"
],
"ignore": [
"tests/fixtures/**"
],
"ignoreDependencies": [
"@types/deno"
]
},
"packages/functions-compiler": {
"entry": [
"src/index.ts",
"scripts/*.ts",
"test/**/*.test.ts"
],
"project": [
"src/**/*.ts",
"test/**/*.ts",
"scripts/**/*.ts"
],
"ignore": [
"src/shim/**",
"src/runtime/**",
"src/runtime-context.ts",
"src/static-egress.ts",
"src/private-data-sources/**"
],
"ignoreDependencies": [
"@deno/shim-deno"
]
},
"packages/logger": {
"project": ["src/**/*.ts"]
"project": [
"src/**/*.ts"
]
}
}
}
3 changes: 3 additions & 0 deletions packages/functions-compiler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated shims (`bun run build:shim`) and the published build output.
dist/
lib/
Loading
Loading