feat: init

This commit is contained in:
Morten Olsen
2022-12-06 09:12:53 +01:00
commit 3f5e941446
115 changed files with 13148 additions and 0 deletions

5
packages/markdown-loader/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/node_modules/
/*.logs
/.yarn/
/dist/

View File

@@ -0,0 +1,11 @@
{
"name": "@morten-olsen/markdown-loader",
"main": "./dist/index.js",
"devDependencies": {
"remark": "^13"
},
"dependencies": {
"front-matter": "^4.0.2",
"fs-extra": "^11.1.0"
}
}

View File

@@ -0,0 +1,3 @@
import { webpackLoader } from './loader';
export default webpackLoader;

View File

@@ -0,0 +1,27 @@
import * as webpack from 'webpack';
import fm from 'front-matter';
function webpackLoader(
this: webpack.LoaderContext<{}>,
contents: string = ''
) {
const callback = this.async();
const run = async () => {
const { attributes, body } = fm(contents);
return {
attributes,
body,
};
};
run()
.then((content) => {
callback(null, `module.exports=${JSON.stringify(content)}`);
})
.catch((error) => {
callback(error);
});
}
export { webpackLoader };

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": [
"./src"
]
}