@khanacademy/simple-markdown
Advanced tools
Comparing version 0.0.0-PR2262-20250221180350 to 0.0.0-PR2262-20250221190748
@@ -1,3 +0,43 @@ | ||
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core'; | ||
/** | ||
* Adds the given perseus library version information to the __perseus_debug__ | ||
* object and ensures that the object is attached to `globalThis` (`window` in | ||
* browser environments). | ||
* | ||
* This allows each library to provide runtime version information to assist in | ||
* debugging in production environments. | ||
*/ | ||
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => { | ||
// If the library version is the default value, then we don't want to | ||
// prefix it with a "v" to indicate that it is a version number. | ||
let prefix = "v"; | ||
if (libraryVersion === "__lib_version__") { | ||
prefix = ""; | ||
} | ||
const formattedVersion = `${prefix}${libraryVersion}`; | ||
if (typeof globalThis !== "undefined") { | ||
var _globalThis$__perseus; | ||
globalThis.__perseus_debug__ = (_globalThis$__perseus = globalThis.__perseus_debug__) != null ? _globalThis$__perseus : {}; | ||
const existingVersionEntry = globalThis.__perseus_debug__[libraryName]; | ||
if (existingVersionEntry) { | ||
// If we already have an entry and it doesn't match the registered | ||
// version, we morph the entry into an array and log a warning. | ||
if (existingVersionEntry !== formattedVersion) { | ||
// Existing entry might be an array already (oops, at least 2 | ||
// versions of the library already loaded!). | ||
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry]; | ||
allVersions.push(formattedVersion); | ||
globalThis.__perseus_debug__[libraryName] = allVersions; | ||
// eslint-disable-next-line no-console | ||
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`); | ||
} | ||
} else { | ||
globalThis.__perseus_debug__[libraryName] = formattedVersion; | ||
} | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.warn(`globalThis not found found (${formattedVersion})`); | ||
} | ||
}; | ||
// This file is processed by a Rollup plugin (replace) to inject the production | ||
@@ -4,0 +44,0 @@ const libName = "@khanacademy/simple-markdown"; |
@@ -5,8 +5,47 @@ 'use strict'; | ||
var perseusCore = require('@khanacademy/perseus-core'); | ||
/** | ||
* Adds the given perseus library version information to the __perseus_debug__ | ||
* object and ensures that the object is attached to `globalThis` (`window` in | ||
* browser environments). | ||
* | ||
* This allows each library to provide runtime version information to assist in | ||
* debugging in production environments. | ||
*/ | ||
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => { | ||
// If the library version is the default value, then we don't want to | ||
// prefix it with a "v" to indicate that it is a version number. | ||
let prefix = "v"; | ||
if (libraryVersion === "__lib_version__") { | ||
prefix = ""; | ||
} | ||
const formattedVersion = `${prefix}${libraryVersion}`; | ||
if (typeof globalThis !== "undefined") { | ||
globalThis.__perseus_debug__ = globalThis.__perseus_debug__ ?? {}; | ||
const existingVersionEntry = globalThis.__perseus_debug__[libraryName]; | ||
if (existingVersionEntry) { | ||
// If we already have an entry and it doesn't match the registered | ||
// version, we morph the entry into an array and log a warning. | ||
if (existingVersionEntry !== formattedVersion) { | ||
// Existing entry might be an array already (oops, at least 2 | ||
// versions of the library already loaded!). | ||
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry]; | ||
allVersions.push(formattedVersion); | ||
globalThis.__perseus_debug__[libraryName] = allVersions; | ||
// eslint-disable-next-line no-console | ||
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`); | ||
} | ||
} else { | ||
globalThis.__perseus_debug__[libraryName] = formattedVersion; | ||
} | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.warn(`globalThis not found found (${formattedVersion})`); | ||
} | ||
}; | ||
// This file is processed by a Rollup plugin (replace) to inject the production | ||
const libName = "@khanacademy/simple-markdown"; | ||
const libVersion = "0.13.20"; | ||
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion); | ||
addLibraryVersionToPerseusDebug(libName, libVersion); | ||
@@ -13,0 +52,0 @@ /* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */ |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR2262-20250221180350", | ||
"version": "0.0.0-PR2262-20250221190748", | ||
"publishConfig": { | ||
@@ -25,7 +25,5 @@ "access": "public" | ||
], | ||
"dependencies": { | ||
"@khanacademy/perseus-core": "0.0.0-PR2262-20250221180350" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"perseus-build-settings": "0.0.0-PR2262-20250221180350" | ||
"perseus-build-settings": "0.0.0-PR2262-20250221190748" | ||
}, | ||
@@ -32,0 +30,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
375244
2
11
3026
- Removed@khanacademy/perseus-core@0.0.0-PR2262-20250221180350
- Removed@khanacademy/perseus-core@0.0.0-PR2262-20250221180350(transitive)
- Removed@khanacademy/wonder-stuff-core@1.5.4(transitive)
- Removedunderscore@1.13.7(transitive)