@mdx-js/loader
Advanced tools
Comparing version 2.1.3 to 2.1.4
import type {ProcessorOptions} from '@mdx-js/mdx/lib/core.js' | ||
import type {LoaderContext} from 'webpack' | ||
type LoaderContext = import('webpack').LoaderContext<unknown> | ||
/** | ||
@@ -10,3 +9,3 @@ * A Webpack loader to compile MDX to JavaScript. | ||
* | ||
* @this {LoaderContext} | ||
* @this {LoaderContext<unknown>} | ||
* @param {string} value | ||
@@ -16,3 +15,3 @@ * The original module source code. | ||
*/ | ||
declare function mdxLoader(this: LoaderContext, value: string): void | ||
declare function mdxLoader(this: LoaderContext<unknown>, value: string): void | ||
@@ -19,0 +18,0 @@ export default mdxLoader |
@@ -13,2 +13,3 @@ /** | ||
export type VFile = import('vfile').VFile; | ||
export type VFileMessage = import('vfile-message').VFileMessage; | ||
export type CompileOptions = import('@mdx-js/mdx').CompileOptions; | ||
@@ -15,0 +16,0 @@ export type Defaults = Pick<CompileOptions, 'SourceMapGenerator'>; |
/** | ||
* @typedef {import('vfile').VFileCompatible} VFileCompatible | ||
* @typedef {import('vfile').VFile} VFile | ||
* @typedef {import('vfile-message').VFileMessage} VFileMessage | ||
* @typedef {import('@mdx-js/mdx').CompileOptions} CompileOptions | ||
@@ -13,2 +14,3 @@ * @typedef {Pick<CompileOptions, 'SourceMapGenerator'>} Defaults | ||
import {createHash} from 'node:crypto' | ||
import path from 'node:path' | ||
import {SourceMapGenerator} from 'source-map' | ||
@@ -66,6 +68,12 @@ import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js' | ||
process({value, path: this.resourcePath}).then((file) => { | ||
callback(null, file.value, file.map) | ||
return file | ||
}, callback) | ||
process({value, path: this.resourcePath}).then( | ||
(file) => { | ||
callback(null, file.value, file.map) | ||
}, | ||
(/** @type VFileMessage */ error) => { | ||
const fpath = path.relative(this.context, this.resourcePath) | ||
error.message = `${fpath}:${error.name}: ${error.message}` | ||
callback(error) | ||
} | ||
) | ||
} | ||
@@ -72,0 +80,0 @@ |
{ | ||
"name": "@mdx-js/loader", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Webpack loader for MDX", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
12825
134