Skip to content

Commit

Permalink
refactor: deps update
Browse files Browse the repository at this point in the history
  • Loading branch information
Genuifx committed Mar 17, 2024
1 parent 473827e commit ad70d29
Show file tree
Hide file tree
Showing 11 changed files with 2,952 additions and 586 deletions.
1,238 changes: 851 additions & 387 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/wxa-cli/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"@babel/preset-env",
{
"targets": {
"node": "8"
}
"node": "14"
},
"exclude": ["proposal-dynamic-import"]
}
]
],
Expand Down
22 changes: 11 additions & 11 deletions packages/wxa-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"dependencies": {
"@babel/generator": "^7.1.3",
"@babel/parser": "^7.1.3",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-decorators": "^7.2.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/runtime": "7.8.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.24.0",
"@babel/plugin-transform-runtime": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/runtime": "7.24.0",
"@babel/template": "~7.10.0",
"@babel/traverse": "~7.9.6",
"@babel/types": "~7.9.6",
Expand All @@ -55,18 +55,18 @@
"dom-serializer": "^0.1.1",
"find-cache-dir": "^1.0.0",
"find-root": "^1.1.0",
"globby": "^8.0.1",
"globby": "^14.0.1",
"htmlparser2": "^3.10.1",
"inquirer": "^6.2.0",
"inquirer": "^9.2.16",
"js-base64": "^2.4.0",
"json5": "^2.1.1",
"json5": "^2.2.3",
"mkdirp": "^0.5.1",
"mockjs": "^1.1.0",
"node-notifier": "^5.2.1",
"postcss": "^7.0.36",
"postcss-pxtorpx-pro": "^1.0.0",
"postcss": "^8.4.35",
"postcss-pxtorpx-pro": "^2.0.0",
"promise.prototype.finally": "^3.1.0",
"shelljs": "^0.8.3",
"shelljs": "^0.8.5",
"source-map": "^0.7.3",
"tapable": "^1.0.0",
"valid-url": "^1.0.9"
Expand Down
10 changes: 5 additions & 5 deletions packages/wxa-cli/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {readFile, applyPlugins, isFile, getHash, promiseSerial, writeFile} from
import path from 'path';
import fs from 'fs';
import chokidar from 'chokidar';
import globby from 'globby';
// import {globby} from 'globby';
import debugPKG from 'debug';

import Schedule from './schedule';
Expand Down Expand Up @@ -332,9 +332,9 @@ class Builder {
appConfigs: appConfigs,
});
wxaPerformance.markEnd('wxa_optimize_code-init');

applyPlugins(this.scheduler.wxaConfigs.plugins, optimizer);

await optimizer.run(indexedMap, appConfigs, fullModuleMap);
wxaPerformance.markEnd('wxa_optimize_code');

Expand All @@ -345,7 +345,7 @@ class Builder {
indexedMap.forEach((mdl)=>{
generateTasks.push(generator.do(mdl));
});

await Promise.all(generateTasks);

wxaPerformance.markEnd('wxa_generate_code');
Expand Down Expand Up @@ -376,7 +376,7 @@ class Builder {
entry = this.hooks.entryOption.call(entry) || entry;
// debug('entry after hooks %O', entry);

entry = await globby(entry);
entry = await (await import('globby')).globby(entry);
entry = entry.map((item)=>item.replace(/\//g, path.sep));
debug('entry after globby %O', entry);

Expand Down
6 changes: 3 additions & 3 deletions packages/wxa-cli/src/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs';
import path from 'path';
import shell from 'shelljs';
import https from 'https';
import inquirer from 'inquirer';
// import inquirer from 'inquirer';

let remoteMap = new Map([
['github', 'https://github.com/wxajs'],
Expand Down Expand Up @@ -61,10 +61,10 @@ class Creator {
try {
// 先尝试从github、gitee远程拉取模版配置json,并询问项目名+模板类型
let configs = await this.getRemoteConfigs();
options = await inquirer.prompt(getQA(JSON.parse(configs), this.cmdOptions.projectName));
options = await ((await import("inquirer")).default).prompt(getQA(JSON.parse(configs), this.cmdOptions.projectName));
} catch (err) {
// getRemoteConfigs失败后,先询问项目名,clone git模版仓库,拿到模版再配置询问模版类型
options = await inquirer.prompt(getQAProjectName(this.cmdOptions.projectName));
options = await ((await import("inquirer")).default).prompt(getQAProjectName(this.cmdOptions.projectName));
}
options.projectName = options.projectName || this.cmdOptions.projectName;
this.create(options);
Expand Down
6 changes: 3 additions & 3 deletions packages/wxa-cli/src/optimizer/pxtorpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import postcss from 'postcss';
import pxtorpx from 'postcss-pxtorpx-pro';
import {isEmpty} from '../utils';

export default function transformPixelsToRpx(mdl, wxaConfigs) {
export default async function transformPixelsToRpx(mdl, wxaConfigs) {
let options = wxaConfigs.optimization.transformPxToRpx;
options = (typeof options === 'boolean' || isEmpty(options)) ? {} : options;

let css = postcss().use(pxtorpx(options)).process(mdl.code, {from: mdl.src}).css;
let result = await postcss([pxtorpx(options)]).process(mdl.code, {from: mdl.src});

mdl.code = css;
mdl.code = result.css;

return mdl;
}
9 changes: 6 additions & 3 deletions packages/wxa-cli/src/schedule.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import crypto from 'crypto';
import {unlinkSync, statSync} from 'fs';
import path from 'path';
import globby from 'globby';
// import {globbySync} from 'globby';
import debugPKG from 'debug';
import {SyncHook} from 'tapable';

Expand All @@ -21,6 +21,7 @@ import {isIgnoreFile} from './helpers/pathParser';

let debug = debugPKG('WXA:Schedule');

let globbySync;
class Schedule {
constructor(loader) {
this.current = process.cwd();
Expand Down Expand Up @@ -212,6 +213,8 @@ class Schedule {

// if module is app.json, then add Page entry points.
if (dep.meta && dep.meta.source === this.APP_CONFIG_PATH) {
if (!globbySync) globbySync = (await import('globby')).globbySync;

let oldPages = new Map(this.$pageArray.entries());
let newPages = this.addPageEntryPoint();
newPages = new Map(newPages.map((page)=>[page.src, page]));
Expand Down Expand Up @@ -508,7 +511,7 @@ class Schedule {

debug('page %s %s', wxaPage, page);
let dr = new DependencyResolver(this.wxaConfigs.resolve, this.meta);

if (/.+(png|jpg|jpeg|webp|eot|woff|woff2|ttf|file')$/.test(page)) {
let src = path.join(this.meta.context, page);
try {
Expand Down Expand Up @@ -548,7 +551,7 @@ class Schedule {
logger.error(e);
}
} else {
let sections = globby.sync(path.join(this.meta.context, page+'.*'));
let sections = globbySync(path.join(this.meta.context, page+'.*'));

sections.forEach((section)=>{
if (isFile(section)) {
Expand Down
3 changes: 2 additions & 1 deletion packages/wxa-compiler-babel/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"useBuiltIns": "usage",
"targets": {
"node": "8"
}
},
"corejs": "3.0"
}]]
}

3 changes: 2 additions & 1 deletion packages/wxa-compiler-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"memfs": "^2.14.2"
},
"dependencies": {
"@babel/core": "^7.1.0",
"@babel/core": "^7.24.0",
"core-js": "^3.36.0",
"debug": "^4.0.1",
"find-cache-dir": "^2.0.0",
"mkdirp": "^0.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/wxa-compiler-sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"debug": "^4.0.1"
},
"dependencies": {
"sass": "^1.43.4"
"sass": "^1.72.0"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit ad70d29

Please sign in to comment.