Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

demo-md-loader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

demo-md-loader - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

38

index.js
'use strict';
const path = require('path');
const fs = require('fs');
const frontMatter = require('front-matter');
const camelize = require('camelize');
var path = require('path');
var fs = require('fs');
var frontMatter = require('front-matter');
var camelize = require('camelize');
function build(markdown) {
return new Promise((resolve, reject) => {
let doImports = '';
const codeFiles = markdown.codeFiles;
const mods = [];
const linkPromise = [];
var doImports = '';
var codeFiles = markdown.codeFiles;
var mods = [];
var linkPromise = [];
if (codeFiles.length === 0) {

@@ -18,3 +18,3 @@ resolve(`export default ${raw(markdown.body)}`);

codeFiles.forEach((c, i) => {
const codeFilePath = path.resolve(this.context, c);
var codeFilePath = path.resolve(this.context, c);
doImports += `import mod_${i} from '${codeFilePath}';\n`;

@@ -39,9 +39,9 @@ mods.push(`mod_${i}`);

export const attributes = ${JSON.stringify(camelize(markdown.attributes))};
export const modules = [${mods}];
export const codes = [${[...arg]}];
export var attributes = ${JSON.stringify(camelize(markdown.attributes))};
export var modules = [${mods}];
export var codes = [${[...arg]}];
export default {
attributes,
modules,
codes,
attributes: attributes,
modules: modules,
codes: codes,
};

@@ -59,5 +59,5 @@ `

function parseCode(markdown) {
const body = markdown.body;
const codes = body.match(/```jsx(\r|\n)+\s*import\s+((\'.+\')|(\".+\"));?\s*(\r|\n)+```(\r|\n)*/g) || [];
const codeFiles = codes.map(c =>
var body = markdown.body;
var codes = body.match(/```jsx(\r|\n)+\s*import\s+((\'.+\')|(\".+\"));?\s*(\r|\n)+```(\r|\n)*/g) || [];
var codeFiles = codes.map(c =>
c.replace(/(```jsx(\r|\n)+\s*import\s+(\'|\"))|((\'|\");?\s*(\r|\n)+)|(```(\r|\n)*)/g, '')

@@ -83,3 +83,3 @@ );

module.exports = function (source) {
const callback = this.async();
var callback = this.async();

@@ -86,0 +86,0 @@ parse.call(this, source).then(m => {

{
"name": "demo-md-loader",
"version": "1.0.2",
"version": "1.0.3",
"description": "Webpack loader that parses markdown files and converts them to a useful javascript object.",

@@ -5,0 +5,0 @@ "main": "index.js",

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

# demo-markdown-loader
# demo-md-loader
Webpack loader that parses markdown files and converts them to a useful javascript object.
```
$ yarn add demo-md-loader
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc