File tree Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Original file line number Diff line number Diff line change 6464 "next" : " ^9.0.2" ,
6565 "notistack" : " ^0.8.6" ,
6666 "postcss" : " ^7.0.0" ,
67- "raw-loader" : " ^1.0 .0" ,
67+ "raw-loader" : " ^3.1 .0" ,
6868 "react-autosuggest" : " ^9.4.3" ,
6969 "react-docgen" : " ^5.0.0-beta.1" ,
7070 "react-dom" : " ^16.8.5" ,
Original file line number Diff line number Diff line change @@ -127,25 +127,25 @@ function MarkdownDocs(props) {
127127 const match = filename . match ( / - ( [ a - z ] { 2 } ) \. m d $ / ) ;
128128
129129 if ( match && LANGUAGES_IN_PROGRESS . indexOf ( match [ 1 ] ) !== - 1 ) {
130- markdowns [ match [ 1 ] ] = req ( filename ) ;
130+ markdowns [ match [ 1 ] ] = req ( filename ) . default ;
131131 } else {
132- markdowns . en = req ( filename ) ;
132+ markdowns . en = req ( filename ) . default ;
133133 }
134134 } else if ( filename . indexOf ( '.tsx' ) !== - 1 ) {
135135 const demoName = `${ reqPrefix } /${ filename . replace ( / \. \/ / g, '' ) . replace ( / \. t s x / g, '.js' ) } ` ;
136136
137137 demos [ demoName ] = {
138138 ...demos [ demoName ] ,
139139 tsx : req ( filename ) . default ,
140- rawTS : reqSource ( filename ) ,
140+ rawTS : reqSource ( filename ) . default ,
141141 } ;
142142 } else {
143143 const demoName = `${ reqPrefix } /${ filename . replace ( / \. \/ / g, '' ) } ` ;
144144
145145 demos [ demoName ] = {
146146 ...demos [ demoName ] ,
147147 js : req ( filename ) . default ,
148- raw : reqSource ( filename ) ,
148+ raw : reqSource ( filename ) . default ,
149149 } ;
150150 }
151151 } ) ;
Original file line number Diff line number Diff line change 11export default function mapTranslations ( req , ext ) {
22 const translations = { } ;
3+ function load ( filename ) {
4+ // .md is required by raw-loader which uses ES6 modules
5+ // .json is required with default require semantics which use commonJS
6+ const esModuleRequire = ext === 'md' ;
7+ if ( esModuleRequire ) {
8+ return req ( filename ) . default ;
9+ }
10+ return req ( filename ) ;
11+ }
312 req . keys ( ) . forEach ( filename => {
413 const match = filename . match ( new RegExp ( `-([a-z]{2}).${ ext } $` ) ) ;
514
615 if ( match ) {
7- translations [ match [ 1 ] ] = req ( filename ) ;
16+ translations [ match [ 1 ] ] = load ( filename ) ;
817 } else {
9- translations . en = req ( filename ) ;
18+ translations . en = load ( filename ) ;
1019 }
1120 } ) ;
1221 return translations ;
Original file line number Diff line number Diff line change 1129611296 iconv-lite "0.4.24"
1129711297 unpipe "1.0.0"
1129811298
11299- raw-loader@^1.0 .0:
11300- version "1.0 .0"
11301- resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-1.0.0. tgz#3f9889e73dadbda9a424bce79809b4133ad46405 "
11302- integrity sha512-Uqy5AqELpytJTRxYT4fhltcKPj0TyaEpzJDcGz7DFJi+pQOOi3GjR/DOdxTkTsF+NzhnldIoG6TORaBlInUuqA ==
11299+ raw-loader@^3.1 .0:
11300+ version "3.1 .0"
11301+ resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-3. 1.0.tgz#5e9d399a5a222cc0de18f42c3bc5e49677532b3f "
11302+ integrity sha512-lzUVMuJ06HF4rYveaz9Tv0WRlUMxJ0Y1hgSkkgg+50iEdaI0TthyEDe08KIHb0XsF6rn8WYTqPCaGTZg3sX+qA ==
1130311303 dependencies:
1130411304 loader-utils "^1.1.0"
11305- schema-utils "^1 .0.0 "
11305+ schema-utils "^2 .0.1 "
1130611306
1130711307rc@^1.0.1, rc@^1.1.6, rc@^1.2.7:
1130811308 version "1.2.8"
@@ -12388,6 +12388,14 @@ schema-utils@^1.0.0:
1238812388 ajv-errors "^1.0.0"
1238912389 ajv-keywords "^3.1.0"
1239012390
12391+ schema-utils@^2.0.1:
12392+ version "2.0.1"
12393+ resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.0.1.tgz#1eec2e059556af841b7f3a83b61af13d7a3f9196"
12394+ integrity sha512-HJFKJ4JixDpRur06QHwi8uu2kZbng318ahWEKgBjc0ZklcE4FDvmm2wghb448q0IRaABxIESt8vqPFvwgMB80A==
12395+ dependencies:
12396+ ajv "^6.1.0"
12397+ ajv-keywords "^3.1.0"
12398+
1239112399section-iterator@^2.0.0:
1239212400 version "2.0.0"
1239312401 resolved "https://registry.yarnpkg.com/section-iterator/-/section-iterator-2.0.0.tgz#bf444d7afeeb94ad43c39ad2fb26151627ccba2a"
You can’t perform that action at this time.
0 commit comments