Project

Profile

Help

Feature #4655

open

Standard-ESM imports

Added by Michael Kay over 4 years ago. Updated about 3 years ago.

Status:
AwaitingInfo
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2020-07-24
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

Request received from Max Fechner by email:

Thank you for developing saxonJS!

It would be great if you could support standard-esm imports like

import saxonJS from 'http://www.saxonica.com/saxon.js'

this would work in *deno as well as nodejs as well as modern browsers!

thank you for considering this proposal!

best, Max Fechner

Actions #1

Updated by Debbie Lockett almost 4 years ago

  • Applies to JS Branch 2 added
Actions #2

Updated by Norm Tovey-Walsh over 3 years ago

  • Priority changed from Normal to Low

We rely on the Closure compiler to build the release artifacts. As far as I can tell in a couple of days of research, the Closure compiler doesn't offer any options for producing ESM modules and I couldn't find any workarounds that seemed practical. I'll plan to check back periodically, and naturally I'm open to suggestions, but short of support from the compiler, I'm not sure this is something we can do.

Actions #3

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from New to AwaitingInfo

Using "AwaitingInfo" to indicate that we need support from the Closure compiler (or something else) for this.

Actions #4

Updated by Daniel Naab over 3 years ago

Hello,

Not being familiar with Saxon-JS project structure, I don't know if this is a useful suggestion or not, but typically a project would be refactored to internally use ES modules; then a tool like Rollup could be used to create the distributable artifacts (Rollup, for instance, has a Google Closure plugin - https://github.com/ampproject/rollup-plugin-closure-compiler). Rollup can produce a single ESM with obsfucated code, in addition to something like the current IIFE bundle.

If internally Saxon-JS is difficult to convert to ES modules, Rollup also has plugins to use alternate modules types as input. For instance, using AMD modules - https://www.npmjs.com/package/rollup-plugin-amd

I have some familiarity with doing this, and could help clarify your options, if there is any interest. I am exploring a use case that would benefit from ESM usage, also.

Actions #5

Updated by Alf Eaton about 3 years ago

One option would be to use Skypack:

import saxonJS from 'https://cdn.skypack.dev/saxon-js';
Actions #6

Updated by Norm Tovey-Walsh about 3 years ago

Thank you for the suggestion. I'll take a look.

Please register to edit this issue

Also available in: Atom PDF Tracking page