feat: Add IIFE bundle for script-tag installs#1
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-introduces the IIFE distribution path that v1.1 had removed. Host apps that
don't use npm or a bundler (PHP, Python, Java, ASP.NET, Ruby, classic HTML) can
now load the connector via a single
<script>tag served from jsDelivr.The runtime API is unchanged.
LearnosityWProofreader.init({...})from a<script>tag is identical to the ESM call site.What changed
package.json: version bumped to 1.2.0; addedesbuild ^0.23.0as a devdependency; added a
buildscript that producesdist/wproofreader-learnosity.min.jsvia esbuild (IIFE, minified, ~5 KB); added a
prepackhook so the bundle isregenerated automatically at publish time; added
dist/tofiles..gitignore: addeddist/. The bundle is a build artefact, not committedsource. It ships in the npm tarball, not in the repo.
.github/workflows/ci.yml: added a build step after the existing teststep, plus a soft bundle-size check that emits a GitHub Actions warning when
the bundle exceeds 10 KB. Does not fail the build.
README.md: split the "Install" section into "Via npm (Node host apps)"and "Via
<script>tag (non-Node host apps)" subsections. The secondsubsection documents the pinned jsDelivr URL for v1.2.0 and notes the bundle
is about 5 KB minified with no runtime dependencies.
CHANGELOG.md: added v1.2.0 entry under Features.How to verify
npm install npm run build ls -lh dist/wproofreader-learnosity.min.js # ~5 KB