Skip to content

Commit 7db14c8

Browse files
committed
fix(deps): update dependency.
1 parent 9dff6c6 commit 7db14c8

File tree

5 files changed

+39
-17
lines changed

5 files changed

+39
-17
lines changed

Diff for: core/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/kktjs/markdown-react-code-preview-loader"
1515
},
1616
"license": "MIT",
17-
"main": "./lib/index.js",
17+
"main": "lib/index.js",
1818
"module": "esm/index.js",
1919
"types": "lib/index.d.ts",
2020
"files": [
@@ -25,18 +25,18 @@
2525
"esm"
2626
],
2727
"scripts": {
28-
"build": "tsbb build",
29-
"watch": "tsbb watch"
28+
"build": "tsbb build src/**/*.ts --use-babel",
29+
"watch": "tsbb watch src/**/*.ts --use-babel"
3030
},
3131
"dependencies": {
3232
"@babel/plugin-syntax-unicode-sets-regex": "~7.18.6",
3333
"@babel/standalone": "^7.22.2",
34-
"babel-plugin-transform-remove-imports": "^1.7.0",
35-
"babel-plugin-transform-replace-export-default": "^1.0.3",
34+
"babel-plugin-transform-remove-imports": "^1.8.0",
35+
"babel-plugin-transform-replace-export-default": "^1.0.4",
3636
"remark": "~13.0.0"
3737
},
3838
"devDependencies": {
3939
"@types/babel__standalone": "^7.1.4",
40-
"webpack": "^5.72.0"
40+
"webpack": "^5.95.0"
4141
}
4242
}

Diff for: core/src/index.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
2-
import { PluginItem } from '@babel/core';
3-
import { Options as RIOptions } from 'babel-plugin-transform-remove-imports';
4-
import { getProcessor, getCodeBlock, getHeadings, HeadingItem, HeadingListType } from './utils';
5-
import { LoaderDefinitionFunction } from 'webpack';
2+
import { type LoaderDefinitionFunction } from 'webpack';
3+
import { type PluginItem } from '@babel/core';
4+
import { type Options as RIOptions } from 'babel-plugin-transform-remove-imports';
5+
import { getProcessor, getCodeBlock, getHeadings, type HeadingItem, type HeadingListType } from './utils';
6+
67
export * from './utils';
78

89
export type CodeBlockItem = {

Diff for: core/src/utils/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Parent, Node } from 'unist';
1+
import { type Node } from 'unist';
22
import webpack from 'webpack';
33
import remark from 'remark';
44
import { getTransformValue } from './transform';
5-
import { Options, FUNNAME_PREFIX, CodeBlockItem, CodeBlockData } from '../';
5+
import { type Options, FUNNAME_PREFIX, CodeBlockItem, CodeBlockData } from '../';
66

77
/**
88
* Creates an object containing the parameters of the current URL.
@@ -32,11 +32,12 @@ export interface MarkdownDataChild extends Node {
3232
children?: Array<MarkdownDataChild>;
3333
}
3434

35-
export interface MarkdownParseData extends Parent<MarkdownDataChild> {}
35+
export interface MarkdownParseData extends MarkdownDataChild {}
3636

3737
/** 转换 代码*/
3838
export const getProcessor = (source: string) => {
3939
try {
40+
// @ts-ignore
4041
const child = remark.parse(source) as MarkdownParseData;
4142
return child.children;
4243
} catch (err) {

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"⬆️⬆️⬆️⬆️⬆️ package ⬆️⬆️⬆️⬆️⬆️": "▲▲▲▲▲ package ▲▲▲▲▲",
1111
"test": "tsbb test",
1212
"coverage": "tsbb test --coverage --bail",
13-
"prepare": "husky install",
13+
"prepare": "husky",
1414
"version": "lerna version --exact --force-publish --no-push --no-git-tag-version",
1515
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
1616
"remove": "npm run clean && lerna exec \"rm -rf package-lock.json\" --scope markdown-react-code-preview-loader --scope website",
@@ -45,4 +45,4 @@
4545
"pretty-quick": "~4.0.0",
4646
"tsbb": "^4.4.0"
4747
}
48-
}
48+
}

Diff for: website/.kktrc.ts

+22-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import rawModules from '@kkt/raw-modules';
55
import scopePluginOptions from '@kkt/scope-plugin-options';
66
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
77
import pkg from './package.json';
8-
import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
8+
// import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
99

1010
export default (conf: WebpackConfiguration, env: 'development' | 'production', options: LoaderConfOptions) => {
1111
conf = lessModules(conf, env, options);
@@ -19,8 +19,28 @@ export default (conf: WebpackConfiguration, env: 'development' | 'production', o
1919
VERSION: JSON.stringify(pkg.version),
2020
}),
2121
);
22-
conf = mdCodeModulesLoader(conf);
22+
23+
if (Array.isArray(conf.module?.rules)) {
24+
conf.module?.rules.forEach((ruleItem) => {
25+
if (typeof ruleItem === 'object' && ruleItem !== null) {
26+
if (ruleItem.oneOf) {
27+
ruleItem.oneOf.unshift({
28+
test: /.md$/,
29+
use: [
30+
{
31+
loader: 'markdown-react-code-preview-loader',
32+
options: {},
33+
},
34+
],
35+
});
36+
}
37+
}
38+
});
39+
}
40+
2341
conf.module!.exprContextCritical = false;
42+
/** https://github.com/kktjs/kkt/issues/446 */
43+
conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }];
2444

2545
if (process.env.NODE_ENV === 'production') {
2646
conf.output = { ...conf.output, publicPath: './' };

0 commit comments

Comments
 (0)