update src/core/index.js to export all global APIs, deprecate old globals… #1195
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.
...in favor of a single global
DOCSIFY
, and add tests for this@anikethsaha This updates #1192 to fix the issues I found there.
The build now works, and the change is backwards compatible: it leaves the old globals in place but additionally creates a new single global variable
DOCSIFY
that we should recommend in favor of the other multiple globals which we should deprecate in the docs.I don't think this needs to be in a major version bump as people can still use the old globals, unaffected (as per the new tests in this PR). Then in the next major we can remove the old global. Plus we can add an
.esm.js
bundle and recommend for people to use that instead of the global version so that they don't pollute the global space.This new
DOCSIFY
global has theDocsify
constructor exposed, so we can start heading in a direction where we prefer people to donew DOCSIFY.Docsify(options)
instead ofwindow.$docsify = options
. In a following PR, I can add the new behavior but keep the old$docsify
options working for backwards compatibility without having to save it for a major bump.