New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kokojs/babel-preset-h5

Package Overview
Dependencies
Maintainers
3
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kokojs/babel-preset-h5 - npm Package Compare versions

Comparing version 3.22.1 to 3.23.0

4

package.json
{
"name": "@kokojs/babel-preset-h5",
"version": "3.22.1",
"version": "3.23.0",
"license": "MIT",

@@ -33,3 +33,3 @@ "description": "Babel preset for h5 projects.",

},
"gitHead": "871fe2db89a5f14712f99530a81d49de1605e4c6"
"gitHead": "835515674ef6b75b0bc0fe0599b9c22c4f6c9f9d"
}

@@ -130,2 +130,11 @@ # Babel 预设配置 - H5

### enableDevTranspile
- Type: `boolean`
- Default: `false`
是否在 dev 模式下将代码编译至 ES5,注意开启后会降低 dev 的编译速度。
默认情况下,我们会在 build 时将代码编译至 ES5,而在 dev 阶段仅会对代码进行最小程度的编译(仅保证最新浏览器能运行)。
## 内置插件列表

@@ -132,0 +141,0 @@

@@ -5,2 +5,6 @@ function isEnvTest() {

function isEnvDev() {
return process.env.NODE_ENV === 'development';
}
function isDef(val) {

@@ -60,3 +64,3 @@ return val !== undefined && val !== null;

function getImportPlugins(useESModules, excludeStyleLibs) {
const componentLibrarys = [
const componentLibraries = [
'vant',

@@ -73,6 +77,6 @@ '@youzan/vis-ui',

if (tryResolve('@youzan/wsc-membercenter/es/index')) {
componentLibrarys.push('@youzan/wsc-membercenter');
componentLibraries.push('@youzan/wsc-membercenter');
}
return componentLibrarys.map((name) => [
return componentLibraries.map((name) => [
require('babel-plugin-import'),

@@ -97,2 +101,3 @@ {

const completeTranspile = !isEnvDev() || options.enableDevTranspile;
const useESModules = isUseESModules(options);

@@ -109,3 +114,23 @@ const useBuiltIns = getPresetEnvUseBuiltInsOption(options);

require('./babel-preset-vue-ts'),
[
require('@babel/preset-typescript'),
];
// vant-cli 中已经包含了 jsx preset
// 重复引入会导致报错
if (!process.env.VANT_CLI_VERSION) {
presets.push([
require('@vue/babel-preset-jsx'),
{
functional: false,
},
]);
}
const plugins = [
...getImportPlugins(useESModules, excludeStyleLibs),
[require('@babel/plugin-proposal-decorators'), { legacy: true }],
];
if (completeTranspile) {
presets.push([
require('@babel/preset-env'),

@@ -128,21 +153,5 @@ {

},
],
require('@babel/preset-typescript'),
];
// vant-cli 中已经包含了 jsx preset
// 重复引入会导致报错
if (!process.env.VANT_CLI_VERSION) {
presets.push([
require('@vue/babel-preset-jsx'),
{
functional: false,
},
]);
}
const plugins = [
...getImportPlugins(useESModules, excludeStyleLibs),
[require('@babel/plugin-proposal-decorators'), { legacy: true }],
[
plugins.push([
require('@babel/plugin-transform-runtime'),

@@ -159,9 +168,14 @@ {

},
],
];
if (useBuiltIns) {
// Add array.iterator polyfill for webpack dynamic import
// see: https://github.com/babel/babel/issues/9872
plugins.push(require('babel-plugin-dynamic-import-polyfill'));
]);
if (useBuiltIns) {
// Add array.iterator polyfill for webpack dynamic import
// see: https://github.com/babel/babel/issues/9872
plugins.push(require('babel-plugin-dynamic-import-polyfill'));
}
} else {
plugins.push(
[require('@babel/plugin-proposal-class-properties'), { loose }],
[require('@babel/plugin-proposal-optional-chaining'), { loose }],
[require('@babel/plugin-proposal-nullish-coalescing-operator'), { loose }]
);
}

@@ -168,0 +182,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc