Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only support webpack 5, expose some types #32

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { getOptions } = require('loader-utils');
const { compile } = require('./dist/index');

// FIXME: we shouldn't be doing this, but we need it
Expand All @@ -21,9 +20,7 @@ import React from 'react';
// - MDX compiler built in
const loader = async function (content) {
const callback = this.async();
// this.getOptions() is webpack5 only
const queryOptions = this.getOptions ? this.getOptions() : getOptions(this);
const options = Object.assign({}, queryOptions, {
const options = Object.assign({}, this.getOptions(), {
filepath: this.resourcePath,
});

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"prettier": "prettier",
"prepare": "husky install"
},
"dependencies": {
"loader-utils": "^2.0.4"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import {
wrapperJs,
stringifyMeta,
} from './sb-mdx-plugin';
import { CompileOptions, MdxCompileOptions } from './types';
import type { CompileOptions, MdxCompileOptions, JSXOptions } from './types';
import { transformJSXAsync, transformJSXSync } from './jsx';

export type { CompileOptions, MdxCompileOptions, JSXOptions };

export const SEPARATOR = '/* ========= */';

export { wrapperJs };
Expand Down
1 change: 0 additions & 1 deletion src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare module 'estree-to-babel';
declare module 'loader-utils';
9 changes: 0 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9117,15 +9117,6 @@ loader-utils@^2.0.0:
emojis-list "^3.0.0"
json5 "^2.1.2"

loader-utils@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"

locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
Expand Down