@khanacademy/simple-markdown
Advanced tools
Comparing version 0.0.0-PR2209-20250213234803 to 0.0.0-PR2209-20250224200429
@@ -1,6 +0,46 @@ | ||
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 | ||
const libName = "@khanacademy/simple-markdown"; | ||
const libVersion = "0.13.18"; | ||
const libVersion = "0.13.20"; | ||
addLibraryVersionToPerseusDebug(libName, libVersion); | ||
@@ -15,2 +55,3 @@ | ||
// we can: | ||
// End TypeScript Definitions | ||
@@ -17,0 +58,0 @@ |
@@ -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.18"; | ||
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion); | ||
const libVersion = "0.13.20"; | ||
addLibraryVersionToPerseusDebug(libName, libVersion); | ||
@@ -20,2 +59,3 @@ /* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */ | ||
// we can: | ||
// End TypeScript Definitions | ||
@@ -22,0 +62,0 @@ |
{ | ||
"name": "@khanacademy/simple-markdown", | ||
"description": "Javascript markdown parsing, made simple", | ||
"author": "Khan Academy", | ||
"license": "MIT", | ||
"version": "0.0.0-PR2209-20250213234803", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Khan/perseus.git", | ||
"directory": "packages/simple-markdown" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Khan/perseus/issues" | ||
}, | ||
"module": "dist/es/index.js", | ||
"main": "dist/index.js", | ||
"source": "src/index.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "../../utils/package-pre-publish-check.sh", | ||
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'" | ||
}, | ||
"dependencies": { | ||
"@khanacademy/perseus-core": "0.0.0-PR2209-20250213234803" | ||
}, | ||
"devDependencies": { | ||
"perseus-build-settings": "^0.4.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"keywords": [ | ||
"markdown" | ||
] | ||
"name": "@khanacademy/simple-markdown", | ||
"description": "Javascript markdown parsing, made simple", | ||
"author": "Khan Academy", | ||
"license": "MIT", | ||
"version": "0.0.0-PR2209-20250224200429", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Khan/perseus.git", | ||
"directory": "packages/simple-markdown" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Khan/perseus/issues" | ||
}, | ||
"module": "dist/es/index.js", | ||
"main": "dist/index.js", | ||
"source": "src/index.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"perseus-build-settings": "0.0.0-PR2209-20250224200429" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"keywords": [ | ||
"markdown" | ||
], | ||
"scripts": {} | ||
} |
@@ -38,4 +38,4 @@ # @khanacademy/simple-markdown | ||
If you want to run these examples in | ||
node, you should run `yarn` in the simple-markdown | ||
folder or `yarn add simple-markdown` in your project's | ||
node, you should run `pnpm install` in the simple-markdown | ||
folder or `pnpm add simple-markdown` in your project's | ||
folder. Then you can acquire the `SimpleMarkdown` variable | ||
@@ -42,0 +42,0 @@ with: |
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-PR2209-20250213234803
- Removed@khanacademy/perseus-core@0.0.0-PR2209-20250213234803(transitive)