@khanacademy/perseus-linter 1.3.6 → 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/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import { PerseusError, Errors } from '@khanacademy/perseus-core';
|
|
3
|
+
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-utils';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
|
|
5
6
|
/* eslint-disable no-useless-escape */
|
|
@@ -1842,51 +1843,9 @@ class Stack {
|
|
|
1842
1843
|
}
|
|
1843
1844
|
}
|
|
1844
1845
|
|
|
1845
|
-
/**
|
|
1846
|
-
* Adds the given perseus library version information to the __perseus_debug__
|
|
1847
|
-
* object and ensures that the object is attached to `globalThis` (`window` in
|
|
1848
|
-
* browser environments).
|
|
1849
|
-
*
|
|
1850
|
-
* This allows each library to provide runtime version information to assist in
|
|
1851
|
-
* debugging in production environments.
|
|
1852
|
-
*/
|
|
1853
|
-
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
1854
|
-
// If the library version is the default value, then we don't want to
|
|
1855
|
-
// prefix it with a "v" to indicate that it is a version number.
|
|
1856
|
-
let prefix = "v";
|
|
1857
|
-
if (libraryVersion === "__lib_version__") {
|
|
1858
|
-
prefix = "";
|
|
1859
|
-
}
|
|
1860
|
-
const formattedVersion = `${prefix}${libraryVersion}`;
|
|
1861
|
-
if (typeof globalThis !== "undefined") {
|
|
1862
|
-
var _globalThis$__perseus;
|
|
1863
|
-
globalThis.__perseus_debug__ = (_globalThis$__perseus = globalThis.__perseus_debug__) != null ? _globalThis$__perseus : {};
|
|
1864
|
-
const existingVersionEntry = globalThis.__perseus_debug__[libraryName];
|
|
1865
|
-
if (existingVersionEntry) {
|
|
1866
|
-
// If we already have an entry and it doesn't match the registered
|
|
1867
|
-
// version, we morph the entry into an array and log a warning.
|
|
1868
|
-
if (existingVersionEntry !== formattedVersion) {
|
|
1869
|
-
// Existing entry might be an array already (oops, at least 2
|
|
1870
|
-
// versions of the library already loaded!).
|
|
1871
|
-
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry];
|
|
1872
|
-
allVersions.push(formattedVersion);
|
|
1873
|
-
globalThis.__perseus_debug__[libraryName] = allVersions;
|
|
1874
|
-
|
|
1875
|
-
// eslint-disable-next-line no-console
|
|
1876
|
-
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`);
|
|
1877
|
-
}
|
|
1878
|
-
} else {
|
|
1879
|
-
globalThis.__perseus_debug__[libraryName] = formattedVersion;
|
|
1880
|
-
}
|
|
1881
|
-
} else {
|
|
1882
|
-
// eslint-disable-next-line no-console
|
|
1883
|
-
console.warn(`globalThis not found found (${formattedVersion})`);
|
|
1884
|
-
}
|
|
1885
|
-
};
|
|
1886
|
-
|
|
1887
1846
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
1888
1847
|
const libName = "@khanacademy/perseus-linter";
|
|
1889
|
-
const libVersion = "1.3.
|
|
1848
|
+
const libVersion = "1.3.7";
|
|
1890
1849
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1891
1850
|
|
|
1892
1851
|
// Define the shape of the linter context object that is passed through the
|