diff --git a/.github/workflows/browser.yml b/.github/workflows/browser.yml
index 28697d7..c8066a7 100644
--- a/.github/workflows/browser.yml
+++ b/.github/workflows/browser.yml
@@ -64,7 +64,7 @@ jobs:
persist-credentials: false
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24.x"
cache: "npm"
@@ -83,7 +83,7 @@ jobs:
- name: Upload test results
if: failure()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: browser-test-results-${{ matrix.browser }}
path: test-results/browser
diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml
index 5f79f43..cf69361 100644
--- a/.github/workflows/conformance.yml
+++ b/.github/workflows/conformance.yml
@@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 24
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
cache: "npm"
@@ -73,7 +73,7 @@ jobs:
- name: Upload report
if: always()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: conformance-report
path: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 34f157b..271f172 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
@@ -51,7 +51,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "26.x"
cache: "npm"
@@ -76,7 +76,7 @@ jobs:
fi
- name: Upload build artifacts
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist/
@@ -106,7 +106,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "26.x"
registry-url: "https://registry.npmjs.org"
@@ -191,7 +191,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "26.x"
cache: "npm"
@@ -213,7 +213,7 @@ jobs:
run: node scripts/binaries/smoke.mjs "$BINARY"
- name: Upload the binary
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: binary-${{ matrix.target }}
path: dist-bin/${{ matrix.binary }}
@@ -235,12 +235,12 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "26.x"
- name: Download the binaries
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: binary-*
path: dist-bin
diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml
index 22e7279..5bb1c68 100644
--- a/.github/workflows/site.yml
+++ b/.github/workflows/site.yml
@@ -43,8 +43,8 @@ env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
# Pinned ssg release and the SHA-256 of its linux-amd64 archive, taken from
# the release's checksums.sha256. Update both together.
- SSG_VERSION: "1.8.64"
- SSG_SHA256: "dfc0a414b53d31984462533a95097ed1eb5815a4b024384cb418ff4acfa2f689"
+ SSG_VERSION: "1.9.7"
+ SSG_SHA256: "1999ac5c976f4dab9512044dbd12a2c6b30dd73f521b42c18008fe119d4e5e33"
# Wrangler release used for the deployment; keep in sync with the Makefile.
WRANGLER_VERSION: "4.144.0"
@@ -69,7 +69,7 @@ jobs:
persist-credentials: false
- name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
cache: "npm"
@@ -118,7 +118,7 @@ jobs:
run: ./node_modules/.bin/playwright test -c tests/browser/playwright.config.mjs --project=chromium tests/browser/check.spec.mjs
- name: Upload site
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: site
path: site/public
@@ -140,7 +140,7 @@ jobs:
persist-credentials: false
- name: Download site
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: site
path: site/public
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ade6e60..0e5e8b8 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -46,7 +46,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
@@ -91,7 +91,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 24.x
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
cache: "npm"
@@ -114,7 +114,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 24.x
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
cache: "npm"
@@ -153,7 +153,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 26.x
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 26.x
cache: "npm"
@@ -175,7 +175,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 26.x
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 26.x
cache: "npm"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dea2363..0d25cd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]
+## [1.3.5] - 2026-11-13
+
+### Fixed
+
+- **The browser bundle did not load in Safari 15.4 to 16.3** ([#35](https://github.com/spagu/XSLT-Processor/issues/35)): `SyntaxError: Invalid regular expression: invalid group specifier name`. The check for unpaired surrogates of EXSLT `str:encode-uri()`/`str:decode-uri()` used a regex lookbehind, which Safari only parses from 16.4, and a syntax error stops the whole script. It is now a loop over the code units. The build targets the browsers of docs/BROWSER-SUPPORT.md (Chrome/Edge 93, Firefox 92, Safari 15.4) instead of plain ES2022, and `src/browserSupport.test.js` fails on any lookbehind, `v` flag or built-in newer than Safari 15.4 in the sources.
+- **@tradik/xslt3 1.0.1 loads in Safari 15.4 to 16.3 as well** (issue #35): title-case number words (`format-integer($n, 'Ww')`) used a regex lookbehind, now a captured word start; the `m` flag's `^` still needs a lookbehind, which is now built at run time after a check of the engine, so Safari before 16.4 gets FORX0002 naming the cause for that one pattern instead of a bundle that does not load. The browser-support test scans `packages/xslt3/src` too.
+
+### Added
+
+- **`fetchOptions` for cross-origin requests** ([#34](https://github.com/spagu/XSLT-Processor/issues/34)): a `RequestInit` for the requests the processor makes itself with `fetch` (the asynchronous API's `xsl:import`, `xsl:include` and `document()` without a loader), e.g. `new XSLTProcessor({ fetchOptions: { credentials: "include" } })` for a server on another origin that needs cookies, the same opt-in as `crossorigin="use-credentials"`. `importStylesheetAsync()` and `transformAsync()` take `fetchOptions` for one call too; the call's `signal` still cancels the request, and a loader of yours is not affected. Documented in docs/LOADERS.md.
+
+### Changed
+
+- **Dependencies and CI**: development dependencies at their latest releases (jsdom 31.0.1, @playwright/test 1.65.0, ESLint 10.14.0, Prettier 3.10.1, linkedom 0.18.15) with minimatch held at 11.0.8 through `overrides` (GHSA-g3hv-75wg-m249 in ESLint's own dependency; `npm audit` is clean); actions/setup-node 7.1.0, actions/upload-artifact 7.0.2, actions/download-artifact 8.0.2; the website is built with ssg 1.9.7, which fixes the fingerprinting of CDN file names we reported (spagu/ssg#316), so the changelog page names the CDN bundle correctly again.
### Security
diff --git a/README.md b/README.md
index 2dd11ad..96a1bd5 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ The documentation is also published as a website with an interactive playground:
| Guide | Contents |
|-------|----------|
| [API Reference](docs/API.md) | `XSLTProcessor` methods, parameters, `xsl:output` serialization, module exports, `XsltEngine` options, TypeScript |
-| [Loaders](docs/LOADERS.md) | `xsl:import`, `xsl:include` and the `document()` function |
+| [Loaders](docs/LOADERS.md) | `xsl:import`, `xsl:include` and the `document()` function; `fetchOptions` for cross-origin requests with credentials |
| [Complete Example](docs/EXAMPLES.md) | A product list transformed into an HTML table (browser and CLI) |
| [Command Line Tool](docs/CLI.md) | `xslt` options, base directory, includes, input encodings |
| [Conformance](docs/CONFORMANCE.md) | W3C compliance tables, supported elements and functions, known deviations, test coverage |
diff --git a/docs/API.md b/docs/API.md
index 6e88cb6..937cfba 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -36,6 +36,7 @@ non-W3C options:
| `enableDynamicEvaluate` | Allow EXSLT `dyn:evaluate()` (trusted input only) |
| `clock` | `() => Date` used by EXSLT date functions and `current-dateTime()` |
| `legacyNameTests` | Deprecated: unprefixed name tests also match namespaced nodes, as before 1.2.0 |
+| `fetchOptions` | `RequestInit` for the requests the processor makes itself with `fetch` (the asynchronous API's `xsl:import`, `xsl:include` and `document()` when no loader is given), e.g. `{ credentials: "include" }` for a cross-origin server that needs cookies, `{ mode: "cors", headers: {…} }`. A call's `fetchOptions` takes its place for that call; a loader of yours makes its own requests and ignores it. See [Loaders](LOADERS.md#cross-origin-requests-and-credentials) |
| `legacyContentTypeMeta` | html output gets libxslt 1.1.45's ``, as up to 1.3.3, instead of Chrome's `` (the default since 1.3.4). `serializeResult()` takes the same choice as `contentTypeMeta: "http-equiv"` |
| `legacyXhtmlFragments` | Deprecated: `transformToFragment` turns xml output into XHTML elements of an HTML owner document, as in 1.2.0 to 1.3.0; Chrome and Firefox keep them in no namespace, the default since 1.3.1 |
@@ -236,8 +237,8 @@ large results incrementally. The synchronous W3C methods are unchanged.
| Method | Description |
|--------|-------------|
-| `importStylesheetAsync(style, stylesheetUri?, { loader?, documentLoader?, signal? })` | Loads the `xsl:import`/`xsl:include` tree (in parallel, each URI once) and the literal `document('...')` URIs with `fetch` or a custom loader, then compiles synchronously. `style` may be a Node, a string, bytes, a `ReadableStream` or an async iterable |
-| `transformAsync(source, { signal?, stylesheet?, stylesheetUri?, fetchStylesheet?, fetchDocument? })` | Returns a `Promise` with the serialized result; failures reject. Sources may be nodes, strings, bytes, `ReadableStream`s or async iterables, decoded by byte order mark, then the XML declaration's encoding, then UTF-8 |
+| `importStylesheetAsync(style, stylesheetUri?, { loader?, documentLoader?, signal?, fetchOptions? })` | Loads the `xsl:import`/`xsl:include` tree (in parallel, each URI once) and the literal `document('...')` URIs with `fetch` or a custom loader, then compiles synchronously. `style` may be a Node, a string, bytes, a `ReadableStream` or an async iterable |
+| `transformAsync(source, { signal?, stylesheet?, stylesheetUri?, fetchStylesheet?, fetchDocument?, fetchOptions? })` | Returns a `Promise` with the serialized result; failures reject. Sources may be nodes, strings, bytes, `ReadableStream`s or async iterables, decoded by byte order mark, then the XML declaration's encoding, then UTF-8 |
| `transformToStream(source, { signal?, chunkSize? })` | Returns a `ReadableStream` serialized on demand in chunks of about 16 KiB, with backpressure and cancellation |
```js
diff --git a/docs/BROWSER-SUPPORT.md b/docs/BROWSER-SUPPORT.md
index f360ac5..fdc4209 100644
--- a/docs/BROWSER-SUPPORT.md
+++ b/docs/BROWSER-SUPPORT.md
@@ -1,7 +1,16 @@
# Browser Compatibility
-The bundles are built for ES2022 without transpiling and use `Object.hasOwn()`
-and `Array.prototype.at()`, which set the minimum browser versions below.
+The bundles are built for the browsers below (esbuild targets `chrome93`,
+`edge93`, `firefox92`, `safari15.4`), so newer syntax is lowered for them.
+What esbuild cannot lower is kept out of the sources of the library and of
+`@tradik/xslt3` by a test (`src/browserSupport.test.js`): regular expression lookbehind, the `v` flag,
+and built-ins newer than Safari 15.4 such as `isWellFormed()`, `toSorted()` or
+`Object.groupBy()`. A lookbehind made the 1.3.4 bundle a `SyntaxError` in
+Safari 15.4 to 16.3 (issue #35). The one exception is the `m` flag of
+`@tradik/xslt3`'s regular expressions, which builds a lookbehind at run time
+only after checking that the engine has it, and otherwise raises FORX0002
+naming Safari before 16.4. `Object.hasOwn()` and
+`Array.prototype.at()` set the minimum versions.
## Polyfill Support
diff --git a/docs/LOADERS.md b/docs/LOADERS.md
index d7ec14a..38f8a8b 100644
--- a/docs/LOADERS.md
+++ b/docs/LOADERS.md
@@ -12,6 +12,7 @@ an XML string. See the [API Reference](API.md) for the rest of the API.
- [Advanced: the engine accessor](#advanced-the-engine-accessor)
- [Using the document() function](#using-the-document-function)
- [Import vs Include Behavior](#import-vs-include-behavior)
+- [Cross-origin requests and credentials](#cross-origin-requests-and-credentials)
## Using xsl:import and xsl:include
@@ -169,3 +170,37 @@ const result = processor.transformToDocument(xmlDoc);
```
+
+## Cross-origin requests and credentials
+
+Without a loader, the asynchronous API (`importStylesheetAsync`,
+`transformAsync`) loads `xsl:import`, `xsl:include` and literal `document()`
+URIs with the global `fetch`. Its defaults are `fetch`'s own: CORS for another
+origin, cookies only for the same origin. A server on another origin that
+needs cookies or HTTP authentication gets them with `fetchOptions`, any
+[`RequestInit`](https://developer.mozilla.org/docs/Web/API/RequestInit):
+
+```js
+// Every request of this processor sends credentials
+const processor = new XSLTProcessor({
+ fetchOptions: { credentials: "include" },
+});
+await processor.importStylesheetAsync(
+ (await fetch(url, { credentials: "include" })).body,
+ url,
+);
+
+// Or for one call: takes the place of the processor's fetchOptions
+await processor.importStylesheetAsync(stylesheet, url, {
+ fetchOptions: { credentials: "include", headers: { "X-Client": "app" } },
+});
+```
+
+This is the same opt-in as `crossorigin="use-credentials"` on a `