chore: bump version of dependencies (#6472)

* chore: bump version of dependencies

* fix: update transform rule

* fix: test case

* chore: update core-js
This commit is contained in:
ClarkXia 2023-08-21 16:26:00 +08:00 committed by GitHub
parent dd8106056c
commit 1dbcfa51a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 376 additions and 519 deletions

View File

@ -0,0 +1,5 @@
---
'@ice/bundles': patch
---
fix: bump @swc/core, webpack, swc plugins, core-js version

View File

@ -24,6 +24,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -23,6 +23,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -20,6 +20,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -21,6 +21,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -24,6 +24,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -28,6 +28,6 @@
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -24,6 +24,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -26,6 +26,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -19,6 +19,6 @@
"fs-extra": "^10.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -19,6 +19,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -19,6 +19,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
}
}

View File

@ -15,13 +15,13 @@
"main": "./esm/index.js",
"type": "module",
"dependencies": {
"@swc/core": "1.3.19",
"@ice/swc-plugin-remove-export": "0.1.2",
"@ice/swc-plugin-keep-export": "0.1.4-2",
"@ice/swc-plugin-node-transform": "0.1.0-8",
"@swc/core": "1.3.77",
"@ice/swc-plugin-remove-export": "0.2.0",
"@ice/swc-plugin-keep-export": "0.2.0",
"@ice/swc-plugin-node-transform": "0.2.0",
"ansi-html-community": "^0.0.8",
"html-entities": "^2.3.2",
"core-js": "3.29.1",
"core-js": "3.32.0",
"caniuse-lite": "^1.0.30001431",
"chokidar": "3.5.3",
"esbuild": "^0.17.16",
@ -65,7 +65,7 @@
"terser-webpack-plugin": "5.3.5",
"typescript": "^4.6.4",
"trusted-cert": "1.1.3",
"webpack": "5.86.0",
"webpack": "5.88.2",
"webpack-bundle-analyzer": "4.5.0",
"webpack-dev-server": "4.15.0",
"unplugin": "0.9.5",

View File

@ -84,7 +84,7 @@
"react-router": "6.14.2",
"sass": "^1.50.0",
"unplugin": "^0.9.0",
"webpack": "^5.86.0",
"webpack": "^5.88.0",
"webpack-dev-server": "^4.7.4"
},
"peerDependencies": {

View File

@ -1,10 +1,6 @@
import { defineConfig } from '@ice/pkg';
export default defineConfig({
bundle: {
filename: 'jsx-runtime',
formats: ['umd'],
},
transform: {
formats: ['esm'],
},

View File

@ -37,7 +37,7 @@
"style-unit": "^3.0.4"
},
"devDependencies": {
"@ice/pkg": "1.1.2-0",
"@ice/pkg": "^1.5.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"react": "^18.0.0",

View File

@ -21,7 +21,7 @@
"@ice/bundles": "^0.1.10"
},
"devDependencies": {
"webpack": "^5.86.0"
"webpack": "^5.88.0"
},
"publishConfig": {
"access": "public"

View File

@ -32,7 +32,7 @@
},
"devDependencies": {
"@ice/app": "^3.2.10",
"webpack": "^5.86.0",
"webpack": "^5.88.0",
"@ice/runtime": "^1.2.5"
},
"repository": {

View File

@ -46,7 +46,7 @@
"url-join": "^5.0.0"
},
"devDependencies": {
"@ice/pkg": "^1.0.0",
"@ice/pkg": "^1.5.0",
"@ice/app": "workspace:^",
"@ice/runtime": "workspace:^",
"@remix-run/router": "^1.6.1",

View File

@ -49,7 +49,7 @@
"devDependencies": {
"@ice/app": "^3.2.6",
"@ice/runtime": "^1.2.4",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
},
"repository": {
"type": "http",

View File

@ -79,7 +79,7 @@ const getMiniappTask = ({
// FIXME: enable cache will cause error, disable it temporarily
enableCache: false,
plugins,
loaders: module.rules,
loaders: module?.rules,
optimization: {
sideEffects: true,
usedExports: true,

View File

@ -44,4 +44,7 @@ export interface MiniappWebpackOptions {
nativeConfig: Record<string, any>;
}
export type MiniappWebpackConfig = Pick<webpack.Configuration, 'plugins' | 'module'>;
export interface MiniappWebpackConfig {
plugins: Config['plugins'];
module: webpack.Configuration['module'];
}

View File

@ -28,7 +28,7 @@
"@ice/app": "^3.2.9",
"build-scripts": "^2.1.1-0",
"esbuild": "^0.17.16",
"webpack": "^5.86.0",
"webpack": "^5.88.0",
"webpack-dev-server": "^4.9.2"
},
"repository": {

View File

@ -32,7 +32,7 @@
"devDependencies": {
"@ice/app": "^3.2.8",
"@types/lodash-es": "^4.17.7",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
},
"repository": {
"type": "http",
@ -45,4 +45,4 @@
"publishConfig": {
"access": "public"
}
}
}

View File

@ -54,7 +54,7 @@
"@ice/appear": "^0.2.0"
},
"devDependencies": {
"@ice/pkg": "1.1.2-0",
"@ice/pkg": "^1.5.0",
"@types/rax": "^1.0.8",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",

View File

@ -26,7 +26,7 @@
"devDependencies": {
"esbuild": "^0.17.16",
"postcss": "^8.4.18",
"webpack": "^5.86.0",
"webpack": "^5.88.0",
"webpack-dev-server": "^4.7.4"
},
"scripts": {

View File

@ -1,7 +1,6 @@
import type { BuildOptions } from 'esbuild';
import unplugin from '@ice/bundles/compiled/unplugin/index.js';
import type { UnpluginOptions } from '@ice/bundles/compiled/unplugin/index.js';
import type { Configuration } from 'webpack';
import type { Config } from './types.js';
import compilationPlugin from './unPlugins/compilation.js';
import redirectImportPlugin from './unPlugins/redirectImport.js';
@ -32,7 +31,7 @@ function transformInclude(id: string) {
return !!id.match(/\.(js|jsx|ts|tsx|mjs|mts|css|less|scss)$/);
}
function getCompilerPlugins(rootDir: string, config: Config, compiler: 'webpack', transformOptions: TransformOptions): Configuration['plugins'];
function getCompilerPlugins(rootDir: string, config: Config, compiler: 'webpack', transformOptions: TransformOptions): Config['plugins'];
function getCompilerPlugins(rootDir: string, config: Config, compiler: 'esbuild', transformOptions: TransformOptions): BuildOptions['plugins'];
function getCompilerPlugins(rootDir: string, config: Config, compiler: Compiler, transformOptions: TransformOptions) {
const {
@ -91,7 +90,7 @@ function getCompilerPlugins(rootDir: string, config: Config, compiler: Compiler,
// Plugins will be transformed as webpack loader, the execute order of webpack loader is reversed.
? compilerPlugins
.reverse()
.map((plugin) => createUnplugin(() => getPluginTransform(plugin, transformOptions)).webpack())
.map((plugin) => createUnplugin(() => getPluginTransform(plugin, transformOptions)).webpack()) as Config['plugins']
: compilerPlugins.map(plugin => getPluginTransform(plugin, transformOptions));
}

View File

@ -96,7 +96,7 @@ export interface Config {
publicPath?: string;
loaders?: (RuleSetRule | '...')[];
loaders?: (undefined | null | false | '' | 0 | RuleSetRule | '...')[];
plugins?: (
| ((this: Compiler, compiler: Compiler) => void)

View File

@ -226,7 +226,7 @@ function getJsxTransformOptions({
loose: false,
...(polyfill ? {
mode: polyfill,
coreJs: '3.29',
coreJs: '3.32',
} : {}),
};
const supportBrowsers = getSupportedBrowsers(rootDir, mode === 'development');

View File

@ -40,10 +40,11 @@ const transformImport = async (source: string, coreJsPath: string) => {
if (!isESM) {
// Replace @swc/helpers with cjs path.
const importStr = source.substring(targetImport.ss, targetImport.se);
const matchImport = importStr.match(/import\s+([\w*\s{},]*)\s+from\s+['"](.*)['"]/);
// Import rule: import { _ as _type_of } from "@swc/helpers/_/_type_of";
const matchImport = importStr.match(/import\s+{\s+([\w*\s{},]*)\s+}\s+from\s+['"](.*)['"]/);
if (matchImport) {
const [,identifier] = matchImport;
const replaceModule = `var ${identifier} = require('${targetImport.n.replace(/@swc\/helpers\/src\/(.*).mjs$/,
const replaceModule = `var ${identifier.split('as')[1].trim()} = require('${targetImport.n.replace(/@swc\/helpers\/_\/(.*)$/,
(_, matched) => `@swc/helpers/cjs/${matched}.cjs`)}')._`;
str().overwrite(targetImport.ss, targetImport.se, replaceModule);
}

View File

@ -1 +1 @@
import _object_spread from '@swc/helpers/src/_object_spread.mjs';import 'react';
import { _ as _object_spread } from '@swc/helpers/_/_object_spread';import 'react';

View File

@ -1 +1 @@
import _object_spread from '@swc/helpers/src/_object_spread.mjs';module.exports = {};
import { _ as _object_spread } from '@swc/helpers/_/_object_spread';module.exports = {};

View File

@ -40,7 +40,7 @@ describe('transform core js path', () => {
it('@swc/helpers esm', async () => {
const orignalCode = fs.readFileSync(path.join(__dirname, './fixtures/transformImport/swc-esm.js'), 'utf-8');
expect(await transformImport(orignalCode, coreJsPath))
.toBe('import _object_spread from \'@swc/helpers/src/_object_spread.mjs\';import \'react\';');
.toBe('import { _ as _object_spread } from \'@swc/helpers/_/_object_spread\';import \'react\';');
});
it('@swc/helpers cjs', async () => {
const orignalCode = fs.readFileSync(path.join(__dirname, './fixtures/transformImport/swc.js'), 'utf-8');

View File

@ -16,7 +16,7 @@
},
"devDependencies": {
"@ice/webpack-config": "^1.0.0",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
},
"scripts": {
"watch": "tsc -w",

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
"glob": "^7.2.3",
"gray-matter": "^4.0.3",
"typescript": "^4.9.5",
"webpack": "^5.86.0"
"webpack": "^5.88.0"
},
"browserslist": {
"production": [