@moneko/core 3.1.0-beta.4 → 3.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/polyfills.d.ts +2 -0
- package/lib/polyfills.js +4 -0
- package/lib/swcrc.js +3 -3
- package/package.json +2 -1
package/lib/polyfills.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import r from"browserslist";import o from"core-js-compat";import t from"./paths.js";export default function(){// 从项目的根目录自动寻找 browserslistrc 配置
|
|
2
|
+
let{list:e}=o({targets:r(void 0,{path:t.programPath,env:process.env.NODE_ENV}),// 必须指定 core-js 的 前两位 具体版本,如 `3.20`,否则 polyfill 会不全
|
|
3
|
+
version:"3.32"});// ['es.error.cause', 'es.aggregate-error', 'es.aggregate-error.cause', ...]
|
|
4
|
+
return e}
|
package/lib/swcrc.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import{isReact as t,isSolid as
|
|
2
|
-
externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:t&&
|
|
3
|
-
env:{mode:"entry",coreJs:"3.32.2"}});return o.swcrc&&(
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isReact as t,isSolid as n,jsxImportSource as c}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((p=!1)=>{let a={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0,topLevelAwait:!0,importMeta:!0},loose:!0,// target: 'es2022',
|
|
2
|
+
externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:t&&p,development:p,importSource:c},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],n&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0},i=Object.assign(a,!p&&{// swc polyfill,会复用 babel 链路,但效率比 babel 低
|
|
3
|
+
env:{include:s(),mode:"entry",coreJs:"3.32.2"}});return o.swcrc&&(i=e(i,"function"==typeof o.swcrc?o.swcrc(p):o.swcrc)),i});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.1.0-beta.
|
|
3
|
+
"version": "3.1.0-beta.5",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@teamsupercell/typings-for-css-modules-loader": "2.5.2",
|
|
21
21
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
22
22
|
"core-js": "3.32.2",
|
|
23
|
+
"core-js-compat": "3.32.2",
|
|
23
24
|
"cross-env": "7.0.3",
|
|
24
25
|
"css-loader": "6.8.1",
|
|
25
26
|
"css-minimizer-webpack-plugin": "5.0.1",
|