@@ -59,7 +59,6 @@ import hqTransformPaths from '@hqjs/babel-plugin-transform-paths';
59
59
import hqTransformTypescript from '@hqjs/babel-plugin-transform-typescript' ;
60
60
import hqTypeMetadata from '@hqjs/babel-plugin-add-type-metadata' ;
61
61
import path from 'path' ;
62
- import querystring from 'querystring' ;
63
62
import url from 'url' ;
64
63
65
64
const CSS_MODULES_REX = / i m p o r t \s + [ * a - z A - Z _ , { } \s ] + \s + f r o m \s + [ ' " ] { 1 } ( [ ^ ' " ] + \. ( c s s | s a s s | s c s s | l e s s ) ) [ ' " ] { 1 } / gm;
@@ -81,7 +80,7 @@ const getPrePlugins = (ctx, skipHQTrans, skipPoly) => {
81
80
[ babelTransformPrivateMethods , { loose : true } ] ,
82
81
[ hqTransformDefine , {
83
82
// TODO: make it conditional
84
- 'import.meta' : { url : querystring . escape ( ctx . dpath ) } ,
83
+ 'import.meta' : { url : pathToURL ( ctx . dpath ) } ,
85
84
'process.env.NODE_ENV' : ctx . app . production ? 'production' : 'development' ,
86
85
'typeof window' : 'object' ,
87
86
} ] ,
@@ -502,7 +501,7 @@ const compileCSSModules = async (ctx, content) => {
502
501
...Array . from ( content . matchAll ( CSS_REQUIRE_MODULES_REX ) ) ,
503
502
] ;
504
503
const cssModules = styleImports . map ( ( [ , filename ] ) =>
505
- urlToPath ( querystring . unescape ( url . resolve ( `${ querystring . escape ( ctx . dirname ) } /` , filename ) ) ) ) ;
504
+ urlToPath ( url . resolve ( `${ pathToURL ( ctx . dirname ) } /` , filename ) ) ) ;
506
505
const extensions = styleImports . map ( ( [ , , ext ] ) => ext ) ;
507
506
508
507
const styleBuilds = cssModules
@@ -515,8 +514,7 @@ const compileCSSModules = async (ctx, content) => {
515
514
const { code, map } = await compileCSS ( {
516
515
...ctx ,
517
516
dpath,
518
- originalPath : querystring . escape ( dpath ) ,
519
- path : querystring . escape ( dpath ) ,
517
+ path : dpath ,
520
518
srcPath : fileSrcPath ,
521
519
stats : { ...ctx . stats , ext : `.${ extensions [ index ] } ` } ,
522
520
} , styleContent , false , { skipSM : ctx . app . build , useModules : true } ) ;
@@ -539,7 +537,7 @@ const compileCSSModules = async (ctx, content) => {
539
537
const stats = ctx . app . table . touch ( fileSrcPath ) ;
540
538
const styleBuildPromise = saveContent ( code , {
541
539
dpath,
542
- path : querystring . escape ( dpath ) ,
540
+ path : dpath ,
543
541
stats,
544
542
store : ctx . store ,
545
543
} ) ;
@@ -549,7 +547,7 @@ const compileCSSModules = async (ctx, content) => {
549
547
// TODO: add map byte length here
550
548
const mapBuildPromise = saveContent ( JSON . stringify ( map ) , {
551
549
dpath : `${ dpath } .map` ,
552
- path : `${ querystring . escape ( dpath ) } .map` ,
550
+ path : `${ dpath } .map` ,
553
551
stats : mapStats ,
554
552
store : ctx . store ,
555
553
} ) ;
0 commit comments