Skip to content

Commit f27ee49

Browse files
committed
Fix escapes, update dependencies
1 parent eca18c4 commit f27ee49

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

compilers/css.mjs

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { getBrowsersList } from './tools.mjs';
33
import { pathToURL } from '../utils.mjs';
44
import postcss from 'postcss';
55
import postcssPresetEnv from 'postcss-preset-env';
6-
import querystring from 'querystring';
76
import url from 'url';
87
export const modulesCache = new Map;
98

@@ -12,12 +11,12 @@ const preprocess = async (ctx, content, sourceMap, { skipSM }) => {
1211
const prePlugins = [ root => {
1312
const replacePath3 = (math, p1, styleImport, p2) =>
1413
styleImport.startsWith('/') ?
15-
`${p1}${url.resolve(`${pathToURL(querystring.escape(ctx.app.src))}/`, styleImport.slice(1))}${p2}` :
16-
`${p1}.${url.resolve(`${querystring.escape(ctx.dirname)}/`, styleImport)}${p2}`;
14+
`${p1}${url.resolve(`${pathToURL(ctx.app.src)}/`, styleImport.slice(1))}${p2}` :
15+
`${p1}.${url.resolve(`${pathToURL(ctx.dirname)}/`, styleImport)}${p2}`;
1716
const replacePath1 = (match, styleImport) =>
1817
styleImport.startsWith('/') ?
19-
`${url.resolve(`${pathToURL(querystring.escape(ctx.app.src))}/`, styleImport.slice(1))}` :
20-
`.${url.resolve(`${querystring.escape(ctx.dirname)}/`, styleImport)}`;
18+
`${url.resolve(`${pathToURL(ctx.app.src)}/`, styleImport.slice(1))}` :
19+
`.${url.resolve(`${pathToURL(ctx.dirname)}/`, styleImport)}`;
2120
root.walkAtRules('import', rule => {
2221
rule.params = rule.params
2322
.replace(/(url\(['"]*)([^'")]+)(['"]*\))/g, replacePath3)

compilers/js.mjs

+5-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import hqTransformPaths from '@hqjs/babel-plugin-transform-paths';
5959
import hqTransformTypescript from '@hqjs/babel-plugin-transform-typescript';
6060
import hqTypeMetadata from '@hqjs/babel-plugin-add-type-metadata';
6161
import path from 'path';
62-
import querystring from 'querystring';
6362
import url from 'url';
6463

6564
const CSS_MODULES_REX = /import\s+[*a-zA-Z_,{}\s]+\s+from\s+['"]{1}([^'"]+\.(css|sass|scss|less))['"]{1}/gm;
@@ -81,7 +80,7 @@ const getPrePlugins = (ctx, skipHQTrans, skipPoly) => {
8180
[ babelTransformPrivateMethods, { loose: true }],
8281
[ hqTransformDefine, {
8382
// TODO: make it conditional
84-
'import.meta': { url: querystring.escape(ctx.dpath) },
83+
'import.meta': { url: pathToURL(ctx.dpath) },
8584
'process.env.NODE_ENV': ctx.app.production ? 'production' : 'development',
8685
'typeof window': 'object',
8786
}],
@@ -502,7 +501,7 @@ const compileCSSModules = async (ctx, content) => {
502501
...Array.from(content.matchAll(CSS_REQUIRE_MODULES_REX)),
503502
];
504503
const cssModules = styleImports.map(([ , filename ]) =>
505-
urlToPath(querystring.unescape(url.resolve(`${querystring.escape(ctx.dirname)}/`, filename))));
504+
urlToPath(url.resolve(`${pathToURL(ctx.dirname)}/`, filename)));
506505
const extensions = styleImports.map(([ ,, ext ]) => ext);
507506

508507
const styleBuilds = cssModules
@@ -515,8 +514,7 @@ const compileCSSModules = async (ctx, content) => {
515514
const { code, map } = await compileCSS({
516515
...ctx,
517516
dpath,
518-
originalPath: querystring.escape(dpath),
519-
path: querystring.escape(dpath),
517+
path: dpath,
520518
srcPath: fileSrcPath,
521519
stats: { ...ctx.stats, ext: `.${extensions[index]}` },
522520
}, styleContent, false, { skipSM: ctx.app.build, useModules: true });
@@ -539,7 +537,7 @@ const compileCSSModules = async (ctx, content) => {
539537
const stats = ctx.app.table.touch(fileSrcPath);
540538
const styleBuildPromise = saveContent(code, {
541539
dpath,
542-
path: querystring.escape(dpath),
540+
path: dpath,
543541
stats,
544542
store: ctx.store,
545543
});
@@ -549,7 +547,7 @@ const compileCSSModules = async (ctx, content) => {
549547
// TODO: add map byte length here
550548
const mapBuildPromise = saveContent(JSON.stringify(map), {
551549
dpath: `${dpath}.map`,
552-
path: `${querystring.escape(dpath)}.map`,
550+
path: `${dpath}.map`,
553551
stats: mapStats,
554552
store: ctx.store,
555553
});

package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
"npm": ">=6.10.3"
3636
},
3737
"dependencies": {
38-
"@babel/cli": "^7.12.1",
39-
"@babel/core": "^7.12.3",
38+
"@babel/cli": "^7.12.10",
39+
"@babel/core": "^7.12.10",
4040
"@babel/plugin-proposal-class-properties": "^7.12.1",
4141
"@babel/plugin-proposal-decorators": "^7.12.1",
4242
"@babel/plugin-proposal-export-default-from": "^7.12.1",
4343
"@babel/plugin-proposal-private-methods": "^7.12.1",
44-
"@babel/preset-env": "^7.12.1",
44+
"@babel/preset-env": "^7.12.11",
4545
"@babel/preset-flow": "^7.12.1",
46-
"@babel/preset-react": "^7.12.5",
46+
"@babel/preset-react": "^7.12.10",
4747
"@hqjs/babel-plugin-add-decorators-metadata": "~0.0.2",
4848
"@hqjs/babel-plugin-add-type-metadata": "~0.0.4",
4949
"@hqjs/babel-plugin-expose-global-to-window": "~0.0.2",
@@ -70,44 +70,44 @@
7070
"babel-plugin-minify-dead-code-elimination": "~0.5.1",
7171
"babel-plugin-transform-assets-import-to-string": "^1.2.0",
7272
"babel-preset-minify": "~0.5.1",
73-
"browserslist": "^4.14.6",
74-
"buffer": "^6.0.1",
73+
"browserslist": "^4.16.0",
74+
"buffer": "^6.0.3",
7575
"chokidar": "^3.4.3",
7676
"coffeescript": "^2.5.1",
7777
"compressible": "^2.0.18",
78-
"core-js": "^3.7.0",
78+
"core-js": "^3.8.1",
7979
"cssnano": "^4.1.10",
8080
"fast-glob": "^3.2.4",
8181
"fs-extra": "^9.0.1",
82-
"htmlnano": "~0.2.7",
82+
"htmlnano": "~0.2.8",
8383
"imagemin": "^7.0.1",
8484
"imagemin-gifsicle": "^7.0.0",
8585
"imagemin-mozjpeg": "^9.0.0",
8686
"imagemin-pngquant": "^9.0.1",
8787
"imagemin-svgo": "^8.0.0",
8888
"koa": "^2.13.0",
8989
"koa-compose": "^4.1.0",
90-
"less": "^3.12.2",
90+
"less": "^4.0.0",
9191
"mime-types": "^2.1.27",
9292
"node-fetch": "^2.6.1",
9393
"node-sass": "^5.0.0",
94-
"postcss": "^8.1.6",
94+
"postcss": "^8.2.1",
9595
"postcss-less": "^4.0.0",
96-
"postcss-modules": "^3.2.2",
96+
"postcss-modules": "^4.0.0",
9797
"postcss-preset-env": "^6.7.0",
9898
"postcss-sass": "^0.4.4",
9999
"postcss-scss": "^3.0.4",
100-
"posthtml": "~0.13.4",
100+
"posthtml": "~0.15.1",
101101
"process": "~0.11.10",
102102
"regenerator-runtime": "~0.13.7",
103-
"resolve": "^1.18.1",
104-
"rollup": "^2.33.1",
103+
"resolve": "^1.19.0",
104+
"rollup": "^2.35.1",
105105
"vue-template-compiler": "^2.6.12",
106106
"woothee": "^1.11.1",
107-
"ws": "^7.3.1"
107+
"ws": "^7.4.1"
108108
},
109109
"devDependencies": {
110-
"eslint": "^7.13.0",
110+
"eslint": "^7.16.0",
111111
"nodemon": "^2.0.6"
112112
},
113113
"publishConfig": {

0 commit comments

Comments
 (0)