pdf.js/test
Jonas Jenwald 927e50f5d4 [api-major] Output JavaScript modules in the builds (issue 10317)
At this point in time all browsers, and also Node.js, support standard `import`/`export` statements and we can now finally consider outputting modern JavaScript modules in the builds.[1]

In order for this to work we can *only* use proper `import`/`export` statements throughout the main code-base, and (as expected) our Node.js support made this much more complicated since both the official builds and the GitHub Actions-based tests must keep working.[2]
One remaining issue is that the `pdf.scripting.js` file cannot be built as a JavaScript module, since doing so breaks PDF scripting.

Note that my initial goal was to try and split these changes into a couple of commits, however that unfortunately didn't really work since it turned out to be difficult for smaller patches to work correctly and pass (all) tests that way.[3]
This is a classic case of every change requiring a couple of other changes, with each of those changes requiring further changes in turn and the size/scope quickly increasing as a result.

One possible "issue" with these changes is that we'll now only output JavaScript modules in the builds, which could perhaps be a problem with older tools. However it unfortunately seems far too complicated/time-consuming for us to attempt to support both the old and modern module formats, hence the alternative would be to do "nothing" here and just keep our "old" builds.[4]

---
[1] The final blocker was module support in workers in Firefox, which was implemented in Firefox 114; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility

[2] It's probably possible to further improve/simplify especially the Node.js-specific code, but it does appear to work as-is.

[3] Having partially "broken" patches, that fail tests, as part of the commit history is *really not* a good idea in general.

[4] Outputting JavaScript modules was first requested almost five years ago, see issue 10317, and nowadays there *should* be much better support for JavaScript modules in various tools.
2023-10-07 09:31:08 +02:00
..
chromium Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
font [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
images [Editor] Support svg images in the stamp annotation 2023-07-07 15:59:13 +02:00
integration [Editor] Add the possibility to create a new editor in using the keyboard (bug 1853424) 2023-10-05 22:49:15 +02:00
pdfs Update the noHTML flag to take into account the hasOwnCanvas one (fixes #17069) 2023-10-04 18:06:21 +02:00
resources Enable the declaration-block-no-redundant-longhand-properties Stylelint rule 2023-03-25 10:08:27 +01:00
stats Use more for...of loops in the code-base 2022-07-17 16:18:54 +02:00
ttx Update ttx from version 2.5 to version 3.19.0 2022-07-10 21:18:36 +02:00
types Add support for modern ECMAScript class features 2021-10-22 22:01:17 +02:00
unit [api-major] Output JavaScript modules in the builds (issue 10317) 2023-10-07 09:31:08 +02:00
.eslintrc Enable ESLint rules that no longer need to be disabled on a directory/file-basis 2021-01-22 17:47:03 +01:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
add_test.mjs [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
annotation_layer_builder_overrides.css Enable some Stylelint color-related rules to slightly reduce file sizes 2023-10-05 17:51:21 +02:00
downloadutils.mjs [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
driver.js [api-major] Output JavaScript modules in the builds (issue 10317) 2023-10-07 09:31:08 +02:00
integration-boot.mjs [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
test_manifest.json Update the noHTML flag to take into account the hasOwnCanvas one (fixes #17069) 2023-10-04 18:06:21 +02:00
test_slave.html [api-major] Output JavaScript modules in the builds (issue 10317) 2023-10-07 09:31:08 +02:00
test.mjs [Editor] Add an integration test for the new alt-text flow 2023-09-24 13:39:18 +02:00
testutils.mjs [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
text_layer_test.css Enable some Stylelint color-related rules to slightly reduce file sizes 2023-10-05 17:51:21 +02:00
webserver.mjs [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
xfa_layer_builder_overrides.css Enable some Stylelint color-related rules to slightly reduce file sizes 2023-10-05 17:51:21 +02:00