New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mdx-js/loader

Package Overview
Dependencies
Maintainers
4
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mdx-js/loader - npm Package Compare versions

Comparing version

to
2.3.0

index.d.cts

1

index.d.ts

@@ -0,1 +1,2 @@

// Some TS versions use this file, some `index.d.cts`.
import type {ProcessorOptions} from '@mdx-js/mdx/lib/core.js'

@@ -2,0 +3,0 @@ import type {LoaderContext} from 'webpack'

16

lib/index.d.ts

@@ -8,13 +8,19 @@ /**

* @param {string} value
* @param {(error: Error|null|undefined, content?: string|Buffer, map?: Object) => void} callback
* @param {LoaderContext['callback']} callback
*/
export function loader(this: LoaderContext, value: string, callback: (error: Error | null | undefined, content?: string | Buffer, map?: Object) => void): void;
export function loader(this: LoaderContext, value: string, callback: LoaderContext['callback']): void;
export type CompileOptions = import('@mdx-js/mdx').CompileOptions;
export type VFileCompatible = import('vfile').VFileCompatible;
export type VFile = import('vfile').VFile;
export type VFileMessage = import('vfile-message').VFileMessage;
export type CompileOptions = import('@mdx-js/mdx').CompileOptions;
export type LoaderContext = import('webpack').LoaderContext<unknown>;
export type WebpackCompiler = import('webpack').Compiler;
export type Defaults = Pick<CompileOptions, 'SourceMapGenerator'>;
/**
* Configuration.
*/
export type Options = Omit<CompileOptions, 'SourceMapGenerator'>;
export type LoaderContext = import('webpack').LoaderContext<unknown>;
export type WebpackCompiler = import('webpack').Compiler;
/**
* Process.
*/
export type Process = (vfileCompatible: VFileCompatible) => Promise<VFile>;
/**
* @typedef {import('@mdx-js/mdx').CompileOptions} CompileOptions
* @typedef {import('vfile').VFileCompatible} VFileCompatible
* @typedef {import('vfile').VFile} VFile
* @typedef {import('vfile-message').VFileMessage} VFileMessage
* @typedef {import('@mdx-js/mdx').CompileOptions} CompileOptions
* @typedef {Pick<CompileOptions, 'SourceMapGenerator'>} Defaults
* @typedef {Omit<CompileOptions, 'SourceMapGenerator'>} Options
* @typedef {import('webpack').LoaderContext<unknown>} LoaderContext
* @typedef {import('webpack').Compiler} WebpackCompiler
* @typedef {(vfileCompatible: VFileCompatible) => Promise<VFile>} Process
*/
/**
* @typedef {Pick<CompileOptions, 'SourceMapGenerator'>} Defaults
* @typedef {Omit<CompileOptions, 'SourceMapGenerator'>} Options
* Configuration.
*
* @callback Process
* Process.
* @param {VFileCompatible} vfileCompatible
* Input.
* @returns {Promise<VFile>}
* File.
*/
import {createHash} from 'node:crypto'

@@ -33,3 +43,3 @@ import path from 'node:path'

* @param {string} value
* @param {(error: Error|null|undefined, content?: string|Buffer, map?: Object) => void} callback
* @param {LoaderContext['callback']} callback
*/

@@ -39,3 +49,6 @@ export function loader(value, callback) {

const defaults = this.sourceMap ? {SourceMapGenerator} : {}
const options = /** @type {CompileOptions} */ (this.getOptions())
const options = {
development: this.mode === 'development',
.../** @type {CompileOptions} */ (this.getOptions())
}
const config = {...defaults, ...options}

@@ -71,2 +84,4 @@ const hash = getOptionsHash(options)

(file) => {
// @ts-expect-error: `webpack` is not compiled with `exactOptionalPropertyTypes`,
// so it does not allow `file.map` to be `undefined` here.
callback(null, file.value, file.map)

@@ -73,0 +88,0 @@ },

{
"name": "@mdx-js/loader",
"version": "2.2.1",
"version": "2.3.0",
"description": "Webpack loader for MDX",

@@ -42,4 +42,5 @@ "license": "MIT",

"lib/",
"index.d.ts",
"index.cjs"
"index.cjs",
"index.d.cts",
"index.d.ts"
],

@@ -69,3 +70,3 @@ "dependencies": {

"prepack": "npm run build",
"build": "rimraf \"lib/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage",
"build": "tsc --build --clean && tsc --build && type-coverage",
"test-api": "uvu test \"\\.js$\"",

@@ -72,0 +73,0 @@ "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",

Sorry, the diff of this file is not supported yet