Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit c0e7109

Browse files
committed
Revert "fix(gatsby-theme-docz): fix faulty webpack resolution"
This reverts commit 3c2d6eb.
1 parent 3c2d6eb commit c0e7109

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

core/gatsby-theme-docz/lib/onCreateWebpackConfig.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
const fs = require('fs-extra')
2+
const path = require('path')
13
const { Plugin, parseConfig } = require('docz-core')
24

5+
const nodeModules = path.resolve(__dirname, 'node_modules')
6+
const parentNodeModules = path.resolve(__dirname, '../../../node_modules')
7+
38
module.exports = async (params, opts) => {
49
const { stage, actions, getConfig } = params
10+
const hasParentNodeModules = fs.pathExistsSync(parentNodeModules)
511
const args = await parseConfig(opts)
612
const run = Plugin.runPluginsMethod(args.plugins)
713
const config = getConfig()
@@ -14,5 +20,13 @@ module.exports = async (params, opts) => {
1420
})
1521
}
1622

23+
if (hasParentNodeModules) {
24+
actions.setWebpackConfig({
25+
resolve: {
26+
modules: [nodeModules, parentNodeModules],
27+
},
28+
})
29+
}
30+
1731
run('onCreateWebpackConfig', params, stage === 'develop', args, config)
1832
}

examples/material-ui/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"private": true,
44
"version": "2.0.0-rc.41",
55
"license": "MIT",
6+
"files": [
7+
"src/",
8+
"doczrc.js",
9+
"package.json"
10+
],
611
"scripts": {
712
"dev": "docz dev",
813
"build": "docz build",
@@ -12,7 +17,11 @@
1217
"dependencies": {
1318
"@material-ui/core": "^4.4.0",
1419
"docz": "next",
20+
"postinstall-postinstall": "^2.0.0",
1521
"react": "^16.8.6",
1622
"react-dom": "^16.8.6"
23+
},
24+
"devDependencies": {
25+
"patch-package": "^6.1.2"
1726
}
1827
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
diff --git a/node_modules/compass-vertical-rhythm/dist/index.js b/node_modules/compass-vertical-rhythm/dist/index.js
2+
index 559b838..963af7e 100644
3+
--- a/node_modules/compass-vertical-rhythm/dist/index.js
4+
+++ b/node_modules/compass-vertical-rhythm/dist/index.js
5+
@@ -1,2 +1,2 @@
6+
-var e=require("convert-css-length"),n=require("parse-unit"),t=function(e){return n(e)[1]},i=function(e){return n(e)[0]},r={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},a=function(n,t){var r,a=e(t.baseFontSize),o=i(a(n,"px")),s=i(t.baseLineHeightInPx),u=i(a(t.minLinePadding,"px"));return(r=t.roundToNearestHalfLine?Math.ceil(2*o/s)/2:Math.ceil(o/s))*s-o<2*u&&(r+=t.roundToNearestHalfLine?.5:1),r},o=function(n){var r=e(n.baseFontSize);return function(e,a,o){null==e&&(e=1),null==a&&(a=n.baseFontSize),null==o&&(o=0);var s=e*i(n.baseLineHeightInPx)-o+"px",u=r(s,n.rhythmUnit,a);return"px"===t(u)&&(u=Math.floor(i(u))+t(u)),parseFloat(i(u).toFixed(5))+t(u)}};module.exports=function(n){var s=JSON.parse(JSON.stringify(r)),u=Object.assign({},s,n),h=e(u.baseFontSize);if(t(u.baseLineHeight)){i(h(u.baseFontSize,"px"));u.baseLineHeightInPx=h(u.baseLineHeight,"px")}else u.baseLineHeightInPx=i(u.baseFontSize)*u.baseLineHeight+"px";return{rhythm:o(u),establishBaseline:function(){return function(n){e(n.baseFontSize);return{fontSize:i(n.baseFontSize)/16*100+"%",lineHeight:n.baseLineHeight.toString()}}(u)},linesForFontSize:function(e){return a(e,u)},adjustFontSizeTo:function(n,r,s){return null==r&&(r="auto"),function(n,r,s,u){null==s&&(s=u.baseFontSize),"%"===t(n)&&(n=i(u.baseFontSize)*(i(n)/100)+"px");var h=e(u.baseFontSize);n=h(n,"px",s=h(s,"px"));var l=o(u);return"auto"===r&&(r=a(n,u)),{fontSize:h(n,u.rhythmUnit,s),lineHeight:l(r,s)}}(n,r,s,u)}}};
7+
+var e=require("convert-css-length").default,n=require("parse-unit"),t=function(e){return n(e)[1]},i=function(e){return n(e)[0]},r={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},a=function(n,t){var r,a=e(t.baseFontSize),o=i(a(n,"px")),s=i(t.baseLineHeightInPx),u=i(a(t.minLinePadding,"px"));return(r=t.roundToNearestHalfLine?Math.ceil(2*o/s)/2:Math.ceil(o/s))*s-o<2*u&&(r+=t.roundToNearestHalfLine?.5:1),r},o=function(n){var r=e(n.baseFontSize);return function(e,a,o){null==e&&(e=1),null==a&&(a=n.baseFontSize),null==o&&(o=0);var s=e*i(n.baseLineHeightInPx)-o+"px",u=r(s,n.rhythmUnit,a);return"px"===t(u)&&(u=Math.floor(i(u))+t(u)),parseFloat(i(u).toFixed(5))+t(u)}};module.exports=function(n){var s=JSON.parse(JSON.stringify(r)),u=Object.assign({},s,n),h=e(u.baseFontSize);if(t(u.baseLineHeight)){i(h(u.baseFontSize,"px"));u.baseLineHeightInPx=h(u.baseLineHeight,"px")}else u.baseLineHeightInPx=i(u.baseFontSize)*u.baseLineHeight+"px";return{rhythm:o(u),establishBaseline:function(){return function(n){e(n.baseFontSize);return{fontSize:i(n.baseFontSize)/16*100+"%",lineHeight:n.baseLineHeight.toString()}}(u)},linesForFontSize:function(e){return a(e,u)},adjustFontSizeTo:function(n,r,s){return null==r&&(r="auto"),function(n,r,s,u){null==s&&(s=u.baseFontSize),"%"===t(n)&&(n=i(u.baseFontSize)*(i(n)/100)+"px");var h=e(u.baseFontSize);n=h(n,"px",s=h(s,"px"));var l=o(u);return"auto"===r&&(r=a(n,u)),{fontSize:h(n,u.rhythmUnit,s),lineHeight:l(r,s)}}(n,r,s,u)}}};
8+
//# sourceMappingURL=index.js.map

0 commit comments

Comments
 (0)