@khanacademy/perseus-core
Advanced tools
Comparing version 0.0.0-PR745-20231003224747 to 0.0.0-PR745-20231004184637
# @khanacademy/perseus-core | ||
## 0.0.0-PR745-20231003224747 | ||
## 0.0.0-PR745-20231004184637 | ||
### Patch Changes | ||
- dc6c6973: Print package name and version when loaded in the page | ||
- 9473a2b8: Print package name and version when loaded in the page | ||
@@ -9,0 +9,0 @@ ## 1.1.0 |
@@ -18,10 +18,26 @@ import { addLibraryVersionToPerseusDebug as addLibraryVersionToPerseusDebug$1 } from '@khanacademy/perseus-core'; | ||
} | ||
const s = `${prefix}${libraryVersion}`; | ||
if (globalThis) { | ||
const formattedVersion = `${prefix}${libraryVersion}`; | ||
if (typeof globalThis !== "undefined") { | ||
var _globalThis$__perseus; | ||
globalThis.__perseus_debug__ = (_globalThis$__perseus = globalThis.__perseus_debug__) != null ? _globalThis$__perseus : {}; | ||
globalThis.__perseus_debug__[libraryName] = s; | ||
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 (${s})`); | ||
console.warn(`globalThis not found found (${formattedVersion})`); | ||
} | ||
@@ -28,0 +44,0 @@ }; |
export type { PerseusAnalyticsEvent, AnalyticsEventHandlerFn } from "./analytics"; | ||
export type { KEScore, KeypadContextRendererInterface, RendererInterface, } from "./types"; | ||
export { addLibraryVersionToPerseusDebug } from "./utils/add-library-version-To-perseus-debug"; | ||
export { addLibraryVersionToPerseusDebug } from "./utils/add-library-version-to-perseus-debug"; | ||
export { libVersion } from "./version"; |
@@ -22,10 +22,26 @@ 'use strict'; | ||
} | ||
const s = "".concat(prefix).concat(libraryVersion); | ||
if (globalThis) { | ||
const formattedVersion = "".concat(prefix).concat(libraryVersion); | ||
if (typeof globalThis !== "undefined") { | ||
var _globalThis$__perseus; | ||
globalThis.__perseus_debug__ = (_globalThis$__perseus = globalThis.__perseus_debug__) !== null && _globalThis$__perseus !== void 0 ? _globalThis$__perseus : {}; | ||
globalThis.__perseus_debug__[libraryName] = s; | ||
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 ".concat(libraryName, " loaded on this page: ").concat(allVersions.sort().join(", "))); | ||
} | ||
} else { | ||
globalThis.__perseus_debug__[libraryName] = formattedVersion; | ||
} | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.warn("globalThis not found found (".concat(s, ")")); | ||
console.warn("globalThis not found found (".concat(formattedVersion, ")")); | ||
} | ||
@@ -32,0 +48,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR745-20231003224747", | ||
"version": "0.0.0-PR745-20231004184637", | ||
"publishConfig": { | ||
@@ -9,0 +9,0 @@ "access": "public" |
@@ -9,4 +9,4 @@ export type {PerseusAnalyticsEvent, AnalyticsEventHandlerFn} from "./analytics"; | ||
// Careful, `version.ts` uses this function so it _must_ be imported above it | ||
export {addLibraryVersionToPerseusDebug} from "./utils/add-library-version-To-perseus-debug"; | ||
export {addLibraryVersionToPerseusDebug} from "./utils/add-library-version-to-perseus-debug"; | ||
export {libVersion} from "./version"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72926
22
402