]> source.dussan.org Git - jquery.git/commit
Build: Add `exports` to package.json, export slim & esm builds
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 10 Jul 2023 17:14:08 +0000 (19:14 +0200)
committerGitHub <noreply@github.com>
Mon, 10 Jul 2023 17:14:08 +0000 (19:14 +0200)
commit8be4c0e4f89d6c8f780e5937a0534921d8c7815e
tree55d87bcc040dfea54ec5c77ba86d942aa9526916
parent65b85031fb5688361c077bc04e641e4b502671e1
Build: Add `exports` to package.json, export slim & esm builds

Summary of the changes:
* define the `exports` field in `package.json`; `jQuery` & `$` are also
  exported as named exports in ESM builds now
* declare `"type": "module"` globally except for the `build` folder
* add the `--esm` option to `grunt custom`, generating jQuery as an ECMAScript
  module into the `dist-module` folder
* expand `node_smoke_tests` to test the slim & ESM builds and their various
  combinations; also, test both jQuery loaded via a path to the file as well
  as from module specifiers that should be parsed via the `exports` feature
* add details about ESM usage to the release package README
* run `compare_size` on all built minified files; don't run it anymore on
  unminified files where they don't provide lots of value
* remove the remove_map_comment task; SWC doesn't insert the
`//# sourceMappingURL=` pragma by default so there's nothing to strip

Fixes gh-4592
Closes gh-5255
58 files changed:
.eslintignore
.gitignore
.npmignore
Gruntfile.cjs [new file with mode: 0644]
Gruntfile.js [deleted file]
README.md
build/fixtures/README.md
build/package.json [new file with mode: 0644]
build/release.js
build/release/cdn.js
build/tasks/build.js
build/tasks/dist.js
build/tasks/node_smoke_tests.js
build/tasks/promises_aplus_tests.js
build/tasks/sourcemap.js [deleted file]
dist-module/.eslintrc.json [new file with mode: 0644]
dist-module/jquery.node-module-wrapper.js [new file with mode: 0644]
dist-module/jquery.node-module-wrapper.slim.js [new file with mode: 0644]
dist-module/package.json [new file with mode: 0644]
dist/.eslintrc.json
dist/package.json [new file with mode: 0644]
package.json
src/.eslintrc.json
src/wrapper-esm.js [new file with mode: 0644]
src/wrapper.js
test/data/mock.php
test/middleware-mockserver.cjs [new file with mode: 0644]
test/middleware-mockserver.js [deleted file]
test/node_smoke_tests/.eslintrc.json [deleted file]
test/node_smoke_tests/commonjs/.eslintrc.json [new file with mode: 0644]
test/node_smoke_tests/commonjs/document_missing.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/document_passed.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/iterable_with_native_symbol.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/lib/ensure_global_not_created.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/lib/ensure_iterability_es6.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/lib/ensure_jquery.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/lib/jquery-module-specifier.cjs [new file with mode: 0644]
test/node_smoke_tests/commonjs/window_present_originally.cjs [new file with mode: 0644]
test/node_smoke_tests/document_missing.js [deleted file]
test/node_smoke_tests/document_passed.js [deleted file]
test/node_smoke_tests/document_present_originally.js [deleted file]
test/node_smoke_tests/iterable_with_native_symbol.js [deleted file]
test/node_smoke_tests/lib/ensure_global_not_created.js [deleted file]
test/node_smoke_tests/lib/ensure_iterability_es6.js [deleted file]
test/node_smoke_tests/lib/ensure_jquery.js [deleted file]
test/node_smoke_tests/module/.eslintrc.json [new file with mode: 0644]
test/node_smoke_tests/module/document_missing.js [new file with mode: 0644]
test/node_smoke_tests/module/document_passed.js [new file with mode: 0644]
test/node_smoke_tests/module/iterable_with_native_symbol.js [new file with mode: 0644]
test/node_smoke_tests/module/lib/ensure_global_not_created.js [new file with mode: 0644]
test/node_smoke_tests/module/lib/ensure_iterability_es6.js [new file with mode: 0644]
test/node_smoke_tests/module/lib/ensure_jquery.js [new file with mode: 0644]
test/node_smoke_tests/module/lib/jquery-module-specifier.js [new file with mode: 0644]
test/node_smoke_tests/module/window_present_originally.js [new file with mode: 0644]
test/promises_aplus_adapters/deferred.cjs [new file with mode: 0644]
test/promises_aplus_adapters/deferred.js [deleted file]
test/promises_aplus_adapters/when.cjs [new file with mode: 0644]
test/promises_aplus_adapters/when.js [deleted file]