@khanacademy/perseus-linter 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var perseusCore = require('@khanacademy/perseus-core');
|
|
6
|
+
var perseusUtils = require('@khanacademy/perseus-utils');
|
|
6
7
|
var PropTypes = require('prop-types');
|
|
7
8
|
|
|
8
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -1847,51 +1848,10 @@ class Stack {
|
|
|
1847
1848
|
}
|
|
1848
1849
|
}
|
|
1849
1850
|
|
|
1850
|
-
/**
|
|
1851
|
-
* Adds the given perseus library version information to the __perseus_debug__
|
|
1852
|
-
* object and ensures that the object is attached to `globalThis` (`window` in
|
|
1853
|
-
* browser environments).
|
|
1854
|
-
*
|
|
1855
|
-
* This allows each library to provide runtime version information to assist in
|
|
1856
|
-
* debugging in production environments.
|
|
1857
|
-
*/
|
|
1858
|
-
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
1859
|
-
// If the library version is the default value, then we don't want to
|
|
1860
|
-
// prefix it with a "v" to indicate that it is a version number.
|
|
1861
|
-
let prefix = "v";
|
|
1862
|
-
if (libraryVersion === "__lib_version__") {
|
|
1863
|
-
prefix = "";
|
|
1864
|
-
}
|
|
1865
|
-
const formattedVersion = `${prefix}${libraryVersion}`;
|
|
1866
|
-
if (typeof globalThis !== "undefined") {
|
|
1867
|
-
globalThis.__perseus_debug__ = globalThis.__perseus_debug__ ?? {};
|
|
1868
|
-
const existingVersionEntry = globalThis.__perseus_debug__[libraryName];
|
|
1869
|
-
if (existingVersionEntry) {
|
|
1870
|
-
// If we already have an entry and it doesn't match the registered
|
|
1871
|
-
// version, we morph the entry into an array and log a warning.
|
|
1872
|
-
if (existingVersionEntry !== formattedVersion) {
|
|
1873
|
-
// Existing entry might be an array already (oops, at least 2
|
|
1874
|
-
// versions of the library already loaded!).
|
|
1875
|
-
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry];
|
|
1876
|
-
allVersions.push(formattedVersion);
|
|
1877
|
-
globalThis.__perseus_debug__[libraryName] = allVersions;
|
|
1878
|
-
|
|
1879
|
-
// eslint-disable-next-line no-console
|
|
1880
|
-
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`);
|
|
1881
|
-
}
|
|
1882
|
-
} else {
|
|
1883
|
-
globalThis.__perseus_debug__[libraryName] = formattedVersion;
|
|
1884
|
-
}
|
|
1885
|
-
} else {
|
|
1886
|
-
// eslint-disable-next-line no-console
|
|
1887
|
-
console.warn(`globalThis not found found (${formattedVersion})`);
|
|
1888
|
-
}
|
|
1889
|
-
};
|
|
1890
|
-
|
|
1891
1851
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
1892
1852
|
const libName = "@khanacademy/perseus-linter";
|
|
1893
|
-
const libVersion = "1.3.
|
|
1894
|
-
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1853
|
+
const libVersion = "1.3.7";
|
|
1854
|
+
perseusUtils.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1895
1855
|
|
|
1896
1856
|
// Define the shape of the linter context object that is passed through the
|
|
1897
1857
|
const linterContextProps = PropTypes__default["default"].shape({
|