Aller au contenu principal
Jahia Store
FR

Javascript Modules Engine

supported
Télécharger 1.2.0

Informations

Identifiant du module
javascript-modules-engine
Identifiant de groupe
org.jahia.modules
Statut
supported
Catégorie
Platform
Auteur
JSG
Site web du développeur
http://www.jahia.com
Nécessite Jahia
8.2.1.0
Mis à jour
2026-07-09
Source
scm:git:git@github.com:Jahia/javascript-modules.git/javascript-modules-engine
Étiquettes
  • react
  • frontend
  • headless

This is the engine allowing JavaScript modules to run on a Jahia server.

Note: This module was previously called NPM modules engine. Javascript Modules 0.3.0 is a continuation of work done in NPM Modules Engine v0.5.0 which is now deprecated.

Versions

Improvements

  • Generate OSGi capabilities from declared nodetypes in cnd and xml import files

Misc

  • Removed warning about JDK not supporting runtime compilation
Nécessite Jahia 8.2.1.0Mis à jour 2026-01-20

New Features

  • useGQLQuery now accepts an optionally typed GraphQL document for its query parameter. (#548)

    This enables compatibility with GraphQL libraries such as gql.tada and GraphQL Codegen.

  • Enabled buildNodeUrl support for Java decorators by using the underlying node.getUrl() Java implementation. (#549)

    Example: buildNodeUrl(imageNode, { args: { width: 640 } }) will execute imageNode.getUrl(['width:640']).

  • Enabled jahia-deploy support for custom context in the JAHIA_HOST env var. (#551)

  • Improved the type declaration of <Render> to prevent runtime errors. (#571)

    We have not changed the implementation of <Render>, only its type declaration. If you encounter red squiggles on <Render>, your code will behave exactly the same as before, but it might mean you use mutually exclusive parameters, and one of them is ignored, or that you are missing a required parameter that gets a temporary value at runtime.

Other Changes

  • GraalVM runtime libraries (the Java code that runs JavaScript code) are now embedded in the JavaScript Modules Engine instead of Jahia core. (#601#609#610)

    This does not change anything if you are using JavaScript Modules, but makes the core slightly lighter for Java-only Jahia stacks.

    This change is coordinated with the upcoming release of Jahia 8.2.3.0: future versions of Jahia will require the JavaScript Modules Engine in version 1.1.0 or greater for JavaScript Modules to work.

  • All embedded libraries were upgraded to their latest version:

    Library Version in JSM 1.0.1 Version in JSM 1.1.0
    react 19.2.0 19.2.3
    react-dom 19.2.0 19.2.3
    i18next 25.6.0 25.7.3
    react-i18next 16.1.0 16.5.0

    To make analyzing embedded library version easier for you, we now resort to exact dependency versions: javascript-modules-engine/package.json

  • All of our npm packages are now published with a provenance certificate, certifying that packages were built and published from a trusted environment.

    We are making efforts to minimize the possibility

Nécessite Jahia 8.2.1.0Mis à jour 2025-12-30

This release only contains bug fixes.

Bug Fixes

  • The name in package.json can now be overriden by jahia.name to allow a wider range of characters. (#525)
  • Enabled support for yarn create @jahia/module. (#527)
  • Bumped React from 19.2.1 to 19.2.2. (#523)
  • Expose react-dom as a shared library. (#522)
  • Type JCR-SQL2 query results as JCRNodeWrapper. (#538)
  • Allow both react-i18next 15 and 16. (#541)

Full Changelog: 1_0_0...1_0_1

Nécessite Jahia 8.2.1.0Mis à jour 2025-10-20

JavaScript Modules are now considered stable! This also means that no breaking changes are coming in the foreseeable future.

Breaking Changes

  • Deprecated RenderInBrowser and HydrateInBrowser were removed. (#497)

    Please read the 0.9 release notes for migration details.

Bug Fixes

  • Running JSM engine on bare metal Windows is now expected to work properly. (#504, #511)

Other Changes

  • The npm create @jahia/module@latest command creates a slightly smaller Hello World. (#501)

  • The JSM engine now ships with React 19.2.0. (#513)

Full Changelog: 0_9_2...1_0_0

Nécessite Jahia 8.2.1.0Mis à jour 2025-10-03

Bug Fixes

  • Ensure all builds (client and server) succeed before running the yarn watch:callback command (#492)

  • Add a health check to postgres in the docker-compose.yml of the create module (#494)

Full Changelog: 0_9_1...0_9_2

Nécessite Jahia 8.2.1.0Mis à jour 2025-09-16

Bug Fixes

  • Ensure hydration paths are resolved correctly on Windows (#484)

Full Changelog: 0_9_0...0_9_1

Nécessite Jahia 8.2.1.0Mis à jour 2025-09-16

This is the last release before the v1!

Breaking Changes

  • <Island /> is the new client-side component, replacing <HydrateInBrowser /> and <RenderInBrowser />. (#447)

    To migrate, replace <HydrateInBrowser child={Comp} ... /> with <Island component={Comp} ... /> and <RenderInBrowser child={Comp} ... /> with <Island clientOnly component={Comp} ... />.

    The documentation for this new component is already available on the Academy!

    This change aligns with Island Architecture, and hides the implementation details: the fact that islands are hydrated is true in React 19, but might change in the future if React changes paradigm.

    Note: HydrateInBrowser are RenderInBrowser deprecated, and will be removed in the next major version. This 0.9 version acts as a migration window before the v1.

  • Server-side dist bundle now uses standard ESM imports instead of a custom library sharing mechanism. (#463)

    This does not change anything for your code but requires re-building your JavaScript Modules with the latest version of the Vite plugin.

Removed deprecated APIs:

  • Removed defineJahiaComponent and registerJahiaComponents, use jahiaComponent instead. (#421)

  • Removed areaView, allowedTypes and areaType from <(Absolute)Area /> components. Use view, allowedNodeTypes and nodeType instead. (#421)

  • Updated <AddContentButtons /> to only accept nodeTypes as an array of strings. (#421)

Bug Fixes

  • GraphQL query results are now properly encoded. (#422)

Dependency Bumps

The following embedded dependencies were bumped:

Dependency Version
react 19.1.1
i18next 25.4.2
react-i18next 15.7.3

Full Changelog: 0_8_0...0_9_0

Nécessite Jahia 8.2.1.0Mis à jour 2025-09-04

This release adds support for Vite-powered asset bundling.

Breaking Changes

  • The Vite plugin no longer inlines all resources! This is an important change for both performance and security. (#275)

    What it means in practice is that instead of two output folders (client and server), there are now three output folders:

    • server: contains a single JS file to run on the server
    • client: contains all JS files used for hydration
    • assets: contains a single CSS file (style.css), with resources referenced in CSS and JS files (fonts, images...)

    Assets will be deduplicated between client and server builds.

    The configuration structure of the plugin changed to reflect this new folder. Here is the new default configuration:

    jahia({
      inputDir: "src",
      outputDir: "dist",
      assetsDir: "assets", // Computed as dist/assets
      client: {
        inputGlob: "**/*.client.{jsx,tsx}", // Computed as src/**/*.client.{jsx,tsx}
        outputDir: "client", // Computed as dist/client
      },
      server: {
        inputGlob: "**/*.server.{jsx.tsx}", // Computed as src/**/*.server.{jsx,tsx}
        outputFile: "server/index.js", // Computed as dist/server/index.js
      },
    })
     
  • If you follow our conventions regarding file names (see the globs above), you can safely remove all pre-0.8 configuration settings.

    You will need to update your CSS import: <AddResources type="css" resources={buildModuleFileUrl("dist/assets/style.css")} /> (assets instead of server)

    You may now restrict web-accessible resources in your package.json: "static-resources": "/dist/client,/dist/assets"

  • The jahia-deploy CLI has been rewritten to improve the development experience: CND breaking change validation is now skipped during development, allowing easier prototyping. The new CLI always uses the provisioning API. (#378)

  • Hydration markers now use custom elements instead of <div>s to prevent invalid HTML. All custom elements are prefixed by jsm- to avoid collisions. The new elements used are jsm-hydrate, jsm-render and jsm-children. (#386)

New Features

  • The npm create @jahia/module@latest CLI has been revamped to offer different templates to start your integration with. (#407)

    You can now choose between 3 different bases:

    • A minimal Hello World template set (this was the only available base previously)
    • An empty template set
    • An empty module

    Newly created modules now ship with a docker-compose.yml file to ease the creation process of a local Jahia instance. (#364)

  • RenderChild and RenderChildren now accept a nodeTypes prop, used in page builder to restrict the node types that can be added as children. (#379)

  • Vite 7 is now officially supported! (#387)

  • buildModuleFileUrl keeps base64 URLs untouched instead of crashing. This features pairs well with Vite's assets handling. (#394)

Embedded JS Packages

No breaking changes here, we bumped JSM dependencies to the following versions:

  • react: 19.1.0
  • i18next: 25.3.2
  • react-i18next: 15.6.0

Full Changelog: 0_7_2...0_8_0

Nécessite Jahia 8.2.1.0Mis à jour 2025-07-28

No changes from 0.7.1

Nécessite Jahia 8.2.1.0Mis à jour 2025-06-05

This is a small developer experience release:

  • New JavaScript Modules are created with a docker-compose.yml file to start Jahia more easily. (#320)

    Use npm init @jahia/module to create a new module with the improved local setup, or copy the file from GitHub.

  • Performance: insert <link rel="modulepreload"> to improve client-side JS load performance. (#349)

Full Changelog: 0_7_0...0_7_1

Nécessite Jahia 8.2.1.0Mis à jour 2025-06-04

This release adds support for JS<->Java interactions through OSGi services.

New Features

  • JS code can interact with Java code through OSGi services. Usage looks roughly like this:

    import { jahiaComponent, server } from "@jahia/javascript-modules-library";
    
    jahiaComponent(
      {
        nodeType: "javascriptExample:testOSGi",
        name: "default",
        componentType: "view",
      },
      () => <p>{server.osgi.getService("org.example.services.SimpleService").sayHello("World")}</p>,
    );
     
  • The documentation will be updated shortly with more details on how to use this feature. In the meantime, you can check #294 for more examples. If you have feedback on this feature, please reach out to us: calendar.app.google/LigWTiUSDeHmVCwa7

  • JS client files are now minified. This should save up to 1 MB of client-side JavaScript for cold page loads! #269

  • process.env.NODE_ENV is now replaced during the build. This change makes JavaScript Modules more compatible with the rest of the Node.js ecosystem. #263

  • Sourcemaps are generated by default in development mode. #272

Breaking Changes

  • buildNavMenu has been removed. #282

Dependency Updates (#299)

All runtime dependencies have been updated to the latest versions. This includes:

  • i18next: 23.10.1 → 25.0.2 (🚨 Check i18next.com/misc/migration-guide for breaking changes affecting you)
  • react: 19.0.0 → 19.1.0
  • react-i18next: 15.4.0 → 15.5.1
  • styled-jsx: 5.1.6 → 5.1.7

Other Changes

  • All packages of this monorepo are now published to maven/npmjs.com on every commit. You can check the versions tab to install pre-release versions. Be careful, pre-releases do not go through our QA step. #254 and #281
  • You should no longer experience issues with jExperience and page-level personalization. #295
  • GraalVM is now correctly detected. #293

Full Changelog: 0_6_1...0_7_0

Nécessite Jahia 8.2.1.0Mis à jour 2025-05-14

JavaScript Modules are not compatible with Jahia 8.2.0.x.

This releases enforces that by raising the minimum Jahia version to 8.2.1.0.

This release contains a lot of breaking changes since the last published version of JavaScript Modules Engine:

(Note: 0.4 does not have exposed breaking changes)

Nécessite Jahia 8.2.1.0Mis à jour 2025-04-07
0.5.3brouillonTélécharger
  • feat: Integrate @jahia/create-module into the monorepo to follow the same versioning. The template now uses Vite (instead of Webpack).
  • fix(vite-plugin): skip client build if it has no entry files

All changes: https://github.com/Jahia/javascript-modules/compare/0_5_1...0_5_3

Nécessite Jahia 8.2.0.0Mis à jour 2025-03-03
0.5.1brouillonTélécharger

Welcome Vite! ⚡️

This release is a fairly large release with a major architectural rewrite on our end. This means a lot of breaking changes on your end too (sorry about that) but that's for the best: we replaced Webpack with Vite.

We heard your feedback about Webpack and decided to solve it by removing it altogether. If you're not familiar with Vite (and Webpack btw), it's a bundler: it takes source code in various languages (JS, TS, CSS, SCSS...) and produces a coherent output that the runtime can understand (e.g. JS+CSS for the browser).

All your configuration needs should be handled by a newcomer in this repository: @jahia/vite-plugin. It's a Vite plugin that takes care of everything for you:

import { defineConfig } from 'vite'
import jahia from '@jahia/vite-plugin'

export default defineConfig({
  plugins: [
    // ✨ And voilà!
    jahia()
  ]
})

There's no migration guide to migrate from Webpack to Vite—there's too much to cover—so instead we offer you a migration session with our Developer Advocate, @GauBen: → Book an appointment

Changelog

  • Build your JavaScript Modules with Vite and enjoy all its features out of the box: TypeScript transpilation, CSS Modules, raw imports, CSS preprocessors...
  • @jahia/javascript-modules-library is now written in TypeScript, with slightly stricter types, helping you find bugs before even running your code. As far as you're concerned, it's only a typing library, its runtime is handled by the JavaScript Modules Engine.
  • React 19! We bumped the supported React version and enabled support for the modern JSX transform.
  • The client directory (src/client) no longer needs to be flat, you can nest and organize your components the way you like.
  • Hydration now supports a larger range of objects: your props can be Map, Set, Date objects and more.
  • <AddContentButtons /> now takes a list of node types: <AddContentButtons nodeTypes={['ns:text', 'ns:richText']} />
  • Registering your components is now simpler, we added a jahiaComponent function that takes care of both the declaration (formerly defineJahiaComponent) and the registration (formerly registerJahiaComponents):
    jahiaComponent(
      {
        nodeType: "ns:foobar",
        displayName: "My fancy content type",
        componentType: "view",
      },
      ({ foo, bar }, { currentNode }) => {
        // ^^^ props  ^^^ server context
        return (
          <p>
            {foo} {bar}
            <a href={currentNode.getUrl()}>Read more</a>
          </p>
        );
      },
    );
  • Our Vite plugin supports glob entrypoints, allowing you to get rid of all the export * from ... statements
  • Under the hood, as we completely removed Webpack for both frontend and backend code, we no longer use Webpack Module Federation. Instead, we leverage a standard JS feature: <script type="importmap">. If you want to support old web browsers (see unsupported browsers), you'll have to add es-module-shims to your Jahia instance.

All changes: 0_4_0...0_5_1

Nécessite Jahia 8.2.0.0Mis à jour 2025-03-03
  • Rename from "NPM Modules" => "JavaScript Modules"
  • Introduce dependency to javascript-modules-engine in all JS modules
  • New helpers to build URLs
  • Easier way to generate URLs for resources in static folder
  • Simplification of folder structure 
  • Production build config for npm-module-engines and JS modules
  • Update version or Yarn (no pnp)
  • Remove dependencies of libraries that are provided by Jahia at runtime: react, i18next, react-i18next, prop-types
  • Merge npm-modules-engine and js-server-core in one open source Github repo: https://github.com/Jahia/javascript-modules 
Nécessite Jahia 8.2.0.0Mis à jour 2025-02-03