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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.16.0
22.18.0
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Elastic's documentation build toolchain. Processes Markdown from multiple repos
| `src/tooling/docs-builder/` | CLI — entry point `Program.cs`, commands in `Commands/` |
| `src/tooling/essc/` | AOT CLI indexing elastic.co content (Contentstack, Labs) into Elasticsearch; ships as `ghcr.io/elastic/website-search-essc` |
| `src/services/search/Elastic.Documentation.Search.Contract/` | Shared search document/mapping/API contract used by docs search and essc |
| `src/Elastic.Documentation.Site/` | Frontend (TypeScript · React · Parcel) |
| `src/Elastic.Documentation.Site/` | Frontend (TypeScript · React · Vite) |
| `src/Elastic.Documentation.Configuration/` | YAML config schema and loading |
| `src/Elastic.Documentation.Navigation/` | Nav tree assembly and validation |
| `src/Elastic.Documentation.Links/` | Cross-repo link index and resolution |
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Native (recommended for active development)

- [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)
- [Node.js 22.13.1 (LTS)](https://nodejs.org/en/blog/release/v22.13.1)
- [Node.js 22.18.0 (LTS)](https://nodejs.org/en/blog/release/v22.18.0)

The Aspire toolchain is bundled as a local dotnet tool — no workload install required.

Expand Down Expand Up @@ -89,7 +89,7 @@ Two watch loops are available depending on what you're working on:

Monitors code, Razor template files, and frontend assets for a **single documentation set**.
Markdown files refresh via live reload without a recompile. Code or layout changes relaunch
the server automatically. Web assets are rebuilt by `parcel watch` in the background.
the server automatically. Web assets are rebuilt by `vite build --watch` in the background.

### Full assembled-site watch (assembler, navigation, multi-repo)

Expand Down
2 changes: 1 addition & 1 deletion build/dev/watch-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ serve() {
# build never triggers itself.
changed() {
[ -n "$(find src config docs \
\( -name node_modules -o -name bin -o -name obj -o -name _static -o -name .parcel-cache \) -prune -o \
\( -name node_modules -o -name bin -o -name obj -o -name _static \) -prune -o \
-type f -newer "$marker" \
\( -name '*.cs' -o -name '*.cshtml' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' \
-o -name '*.yml' -o -name '*.md' -o -name '*.csproj' -o -name '*.props' \) \
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Documentation.Site/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.parcel-cache/
node_modules/
_static/assets/
_static/asset-*
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Documentation.Site/Assets/codex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Codex build entry point.
*
* Built as a separate Parcel target ("codex-js") and loaded only for
* Built as a separate Vite entry ("codex") and loaded only for
* Codex builds via _Head.cshtml. Registers the <codex-search-bar>
* web component without bloating main.js with React / EUI dependencies.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Documentation.Site/Assets/hljs-languages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import esql from '@elastic/highlightjs-esql'
import { LanguageFn } from 'highlight.js'
import type { LanguageFn } from 'highlight.js'
import asciidoc from 'highlight.js/lib/languages/asciidoc'
import bash from 'highlight.js/lib/languages/bash'
import c from 'highlight.js/lib/languages/c'
Expand Down
6 changes: 3 additions & 3 deletions src/Elastic.Documentation.Site/Assets/hljs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ describe('highlightCodeBlocks', () => {
})

describe('toLanguageFn', () => {
// Parcel's dynamic import() resolves a language module to the LanguageFn directly,
// A bundler's dynamic import() can resolve a language module to the LanguageFn directly,
// while Babel/Jest wrap it as { default: fn }. Both must yield the function; a
// regression here silently breaks highlighting only in the Parcel production build.
it('returns the function when the module is the function itself (Parcel)', async () => {
// regression here silently breaks highlighting only in the production bundle.
it('returns the function when the module is the function itself (bundler)', async () => {
const { toLanguageFn } = await loadModule()
const fn = () => ({ contains: [] })

Expand Down
6 changes: 3 additions & 3 deletions src/Elastic.Documentation.Site/Assets/hljs.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { mergeHTMLPlugin } from './hljs-merge-html-plugin'
import { LanguageFn } from 'highlight.js'
import type { LanguageFn } from 'highlight.js'
import hljs from 'highlight.js/lib/core'

// highlight.js language modules and the esql plugin default-export the LanguageFn.
// Parcel's dynamic import() resolves to the module's exports directly (the function),
// whereas other bundlers/test runners (Babel/Jest) wrap it as a namespace with a
// A bundler's dynamic import() can resolve to the module's exports directly (the function),
// whereas test runners (Babel/Jest) wrap it as a namespace with a
// `default`. Normalize both so registerLanguage always receives the function.
export function toLanguageFn(mod: unknown): LanguageFn {
const m = mod as { default?: LanguageFn }
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Documentation.Site/Assets/isolated.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Isolated/Codex header entry point.
*
* Built as a separate Parcel target ("isolated-js") and loaded only for
* Built as a separate Vite entry ("isolated") and loaded only for
* Isolated and Codex builds via _Head.cshtml. Registers the
* <elastic-docs-header> web component without bloating main.js with
* React / EUI dependencies.
Expand Down
25 changes: 22 additions & 3 deletions src/Elastic.Documentation.Site/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
transform: {
'^.+\\.svg$': '<rootDir>/svgTransform.js',
'^.+\\.(ts|tsx)$': [
// .ts must not get preset-react: JSX parsing would break generic arrows like `<T>(x: T) => x`
'^.+\\.ts$': [
'babel-jest',
{
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
[
'@babel/preset-env',
{ targets: { node: 'current' }, modules: 'commonjs' },
],
'@babel/preset-typescript',
],
},
],
'^.+\\.tsx$': [
'babel-jest',
{
presets: [
[
'@babel/preset-env',
{ targets: { node: 'current' }, modules: 'commonjs' },
],
['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-typescript',
],
Expand All @@ -20,7 +36,10 @@ module.exports = {
'babel-jest',
{
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
[
'@babel/preset-env',
{ targets: { node: 'current' }, modules: 'commonjs' },
],
['@babel/preset-react', { runtime: 'automatic' }],
],
},
Expand Down
Loading
Loading