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
5 changes: 3 additions & 2 deletions .cursor/rules/ts-rules.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
description: Complete Effect-TS Documentation
alwaysApply: false
---

---

description: "Expert guidelines for TypeScript and Node.js development, including tech stack (Lodash, Zod), shortcuts for pair programming and prompt improvement, core principles, coding standards (naming, functions, types), code review checklist, documentation standards (Google Style Guide, TypeDoc), and Git commit rules."
Expand All @@ -25,7 +26,7 @@ The application we are working on uses the following tech stack:

- TypeScript
- Node.js
- tsup v2+ for bundling/rollup
- esbuild for bundling/rollup
- turbo for managing package target dependencies

## NPM Targets
Expand Down Expand Up @@ -139,7 +140,7 @@ The application we are working on uses the following tech stack:
## Module Loading and Bundling

- Web extensions do not support ES module imports, `require()` for external modules, or `importScripts()`. The ONLY exception is `require('vscode')`, which works via a special shim.
- All web extension code MUST be bundled into a single file before deployment. Configure build tools (webpack, esbuild, tsup) to produce a single-file output.
- All web extension code MUST be bundled into a single file before deployment. Use esbuild (preferred) or webpack to produce a single-file output.
- Never attempt to dynamically load additional extension files or node modules at runtime in web extensions.

## Node.js APIs and Globals
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ test-workspace
/test-artifacts
.turbo

# tsup generated files
tsup.config.*.mjs
tsup.config.js
tsup.config.d.ts
tsup.config.js.map
tsup.config.d.ts.map
/packages/apex-parser-ast/test/generator/test-files
/packages/apex-parser-ast/src/generated

Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ packages/

#### Build & Bundling

- **`tsup.config.ts`**: TypeScript bundling configuration
- **`esbuild.config.js`**: Alternative bundling configuration
- **`esbuild.config.ts`**: TypeScript bundling configuration
- **`scripts/build-and-package.js`**: Packaging script for extensions
- **`scripts/merge-coverage.js`**: Test coverage aggregation

Expand All @@ -97,7 +96,7 @@ packages/

1. **Turbo**: Monorepo build system with intelligent caching and parallel execution
2. **TypeScript**: Primary language with strict type checking
3. **tsup**: Fast TypeScript bundler built on esbuild
3. **esbuild**: Fast TypeScript bundler used across the monorepo
4. **Jest**: Testing framework with coverage reporting
5. **ESLint + Prettier**: Code quality and formatting

Expand Down Expand Up @@ -161,7 +160,7 @@ Each package supports these build targets:

- **`precompile`**: Generate resources, copy files, prepare for compilation
- **`compile`**: TypeScript compilation to JavaScript + declaration files
- **`bundle`**: Create optimized bundles using tsup
- **`bundle`**: Create optimized bundles using esbuild
- **`package`**: Create distributable packages (extensions only)
- **`test`**: Run unit tests
- **`test:coverage`**: Run tests with coverage reporting
Expand Down
59 changes: 21 additions & 38 deletions build-config/README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,34 @@
# Build Configuration

This directory contains shared build configuration for the Apex Language Server monorepo.
Shared esbuild presets now live in the publishable package `@salesforce/esbuild-presets` under `packages/esbuild-presets/`.

## Files
## Usage (inside this repo)

### `tsup.shared.ts`

Shared configuration base for all packages using tsup bundling:

- **`COMMON_EXTERNAL`**: Dependencies that should always be external (vscode, language server packages, etc.)
- **`INTERNAL_PACKAGES`**: Internal Salesforce packages that are typically external
- **`nodeBaseConfig`**: Base configuration for Node.js builds
- **`browserBaseConfig`**: Base configuration for browser/web builds
- **`BROWSER_ALIASES`**: Standard polyfill aliases for browser builds

## Usage

Import shared configuration in your package's `tsup.config.ts`:
Import from the workspace package:

```typescript
import { defineConfig } from 'tsup';
import { nodeBaseConfig, browserBaseConfig, BROWSER_ALIASES } from '../../build-config/tsup.shared';

export default defineConfig([
{
name: 'my-package',
...nodeBaseConfig,
entry: ['src/index.ts'],
// package-specific overrides
}
]);
import {
nodeBaseConfig,
browserBaseConfig,
configureWebWorkerPolyfills,
runBuilds,
} from '@salesforce/esbuild-presets';
```

## Benefits
## Usage (published)

- **Consistency**: All packages use the same base configuration
- **Maintainability**: Update external dependencies in one place
- **Clarity**: Named builds show clearly in logs (e.g., `[DESKTOP]`, `[WEB]`)
- **Reduced Duplication**: No more copying external arrays between configs
- **Easier Debugging**: Named builds make it clear which target is building
Install and import in another project:

## Named Builds
```bash
npm install @salesforce/esbuild-presets esbuild
```

All builds now have descriptive names that appear in the build output:
```typescript
import { nodeBaseConfig, runBuilds } from '@salesforce/esbuild-presets';
```

- Extension: `[DESKTOP]`, `[WEB]`
- Apex-LS: `[NODE]`, `[BROWSER]`, `[WORKER]`
- Libraries: `[SHARED]`, `[PARSER-AST]`, `[CUSTOM-SERVICES]`, etc.
## What’s included

This makes it much easier to understand build logs and debug issues.
- `nodeBaseConfig` / `browserBaseConfig`
- `NODE_POLYFILLS` and `configureWebWorkerPolyfills`
- `runBuilds` helper for one-off or watch mode builds with hooks/logging
135 changes: 0 additions & 135 deletions build-config/tsup.shared.ts

This file was deleted.

4 changes: 2 additions & 2 deletions eslint-rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The rule detects when package.json scripts directly call tools that correspond t

- `"compile": "tsc --build"` → Should be `"compile": "turbo run compile"`
- `"test": "jest"` → Should be `"test": "turbo run test"`
- `"bundle": "tsup"` → Should be `"bundle": "turbo run bundle"`
- `"bundle": "esbuild ..."` → Should be `"bundle": "turbo run bundle"`
- `"lint": "eslint src/**/*.ts"` → Should be `"lint": "turbo run lint"`

### Configuration
Expand Down Expand Up @@ -48,7 +48,7 @@ The rule accepts the following options:
"compile": "tsc --build",
"test": "jest",
"test:coverage": "jest --coverage",
"bundle": "tsup",
"bundle": "esbuild",
"lint": "eslint src/**/*.ts",
"lint:fix": "eslint src/**/*.ts --fix",
"clean": "rimraf dist",
Expand Down
Loading
Loading