Skip to content

Commit

Permalink
fix(docz-core): hot loader and mdx plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Mar 11, 2019
1 parent d5e243d commit 0531d65
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
6 changes: 0 additions & 6 deletions core/docz-core/src/bundler/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ export const createConfig = (args: Args, env: Env) => async (hooks: Hooks) => {
.add(doczDependenciesDir)
.add(paths.root)

if (inYarnWorkspaces) {
config.module.noParse(content => {
return /docz\/core\/docz/.test(content)
})
}

/**
* loaders
*/
Expand Down
16 changes: 9 additions & 7 deletions core/docz-core/src/bundler/loaders.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as path from 'path'
import Config from 'webpack-chain'

import frontmatter from 'remark-frontmatter'
import remarkDocz from 'remark-docz'
import rehypeDocz from 'rehype-docz'
import slug from 'rehype-slug'

import * as paths from '../config/paths'
import { Config as Args } from '../config/argv'
import { BabelRC } from '../config/babel'
Expand Down Expand Up @@ -103,15 +108,12 @@ export const mdx = (config: Config, args: Args, babelrc: BabelRC) => {
.loader(require.resolve('@mdx-js/loader'))
.options({
mdPlugins: mdPlugins.concat([
[require('remark-frontmatter'), { type: 'yaml', marker: '-' }],
require('remark-docz'),
[frontmatter, { type: 'yaml', marker: '-' }],
remarkDocz,
]),
hastPlugins: hastPlugins.concat([
[
require('rehype-docz'),
{ root: paths.root, useCodeSandbox: args.codeSandbox },
],
require('rehype-slug'),
[rehypeDocz, { root: paths.root, useCodeSandbox: args.codeSandbox }],
slug,
]),
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/docz-core/templates/root.tpl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Link, Router, Routes, useDataServer } from 'docz'
import { hot } from 'react-hot-loader/root'
import { hot } from 'react-hot-loader'
import Theme from '<%- theme %>'

import { imports } from './imports'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"clean": "lerna clean",
"bs": "lerna bootstrap",
"packages": "run-s packages:*",
"packages:test": "lerna run --parallel test",
"packages:fix": "lerna run --parallel fix && echo",
"packages:lint": "lerna run --parallel tslint",
"packages:build": "lerna run build --ignore docz-example-*",
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2440,13 +2440,6 @@
"@types/connect" "*"
"@types/node" "*"

"@types/chokidar@^2.1.3":
version "2.1.3"
resolved "https://registry.npmjs.org/@types/chokidar/-/chokidar-2.1.3.tgz#123ab795dba6d89be04bf076e6aecaf8620db674"
integrity sha512-6qK3xoLLAhQVTucQGHTySwOVA1crHRXnJeLwqK6KIFkkKa2aoMFXh+WEi8PotxDtvN6MQJLyYN9ag9P6NLV81w==
dependencies:
chokidar "*"

"@types/clean-css@*":
version "4.2.0"
resolved "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.0.tgz#785749d3ba799ae2cd3efcb3ce622781efd00340"
Expand Down Expand Up @@ -4807,7 +4800,7 @@ cheerio@^0.22.0:
lodash.reject "^4.4.0"
lodash.some "^4.4.0"

chokidar@*, chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3, chokidar@^2.0.4, chokidar@^2.1.2:
chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3, chokidar@^2.0.4, chokidar@^2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/chokidar/-/chokidar-2.1.2.tgz#9c23ea40b01638439e0513864d362aeacc5ad058"
integrity sha512-IwXUx0FXc5ibYmPC2XeEj5mpXoV66sR+t3jqu2NS2GYwCktt3KF1/Qqjws/NkegajBA4RbZ5+DDwlOiJsxDHEg==
Expand Down

0 comments on commit 0531d65

Please sign in to comment.