@moneko/core 3.0.0-beta.10 → 3.0.0-beta.11

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/build/swcrc.js CHANGED
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common.js";import r from"./envFlags.js";let t={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}};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((s=!1)=>{let n={module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:s,development:s},constModules:{globals:{"env-flags":r}},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;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||{})]]}},sourceMaps:!0,parseMap:!0},a=Object.assign(n,!s&&t);return o.swcrc&&(a=e(a,"function"==typeof o.swcrc?o.swcrc(s):o.swcrc)),a});
1
+ import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common.js";import r from"./envFlags.js";import{hasReact as t}from"./process-env.js";let s={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}};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((n=!1)=>{let a={module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:n,development:n,importSource:t?"react":"solid-js/h"},constModules:{globals:{"env-flags":r}},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;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||{})]]}},sourceMaps:!0,parseMap:!0},c=Object.assign(a,!n&&s);return o.swcrc&&(c=e(c,"function"==typeof o.swcrc?o.swcrc(n):o.swcrc)),c});
@@ -1 +1 @@
1
- import{Router as t}from"@solidjs/router";import{render as n}from"solid-js/web";import o from"@/index";function e(t){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(t))}var r=APPENTRY?require(APPENTRY):null,u=document.getElementById("root");r&&e(r.bootstrap)&&(null==r.bootstrap||r.bootstrap());var c=function(){return React.createElement(t,null,React.createElement(o,null))};window.rootInstance={unmount:function(){return null},render:function(){window.rootInstance.unmount=n(c,u)}},window.rootInstance.render(c),r&&e(r.mount)&&(null==r.mount||r.mount());
1
+ import{Router as o}from"@solidjs/router";import{render as n}from"solid-js/web";import t from"@/index";function r(o){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(o))}var e=APPENTRY?await import(APPENTRY):null,u=document.getElementById("root");e&&r(e.bootstrap)&&(null==e.bootstrap||e.bootstrap()),window.rootInstance={unmount:function(){return null},render:function(o){window.rootInstance.unmount=n(o,u)}},window.rootInstance.render(function(){return h(o,null,h(t,null))}),e&&r(e.mount)&&(null==e.mount||e.mount());
@@ -1 +1 @@
1
- function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}import{pathToRegexp as n}from"path-to-regexp";export function lazyImport(e){return new Promise(function(r){return import("@/pages/"+e.replace(/:/g,"$").replace(/^\//,"")).then(r).catch(function(){return Promise.resolve({default:null})})})}export var myPkgs=[];export var myDemoKv={};export var mdxComponents={};if("library"===APPTYPE){var t,o,i=require.context("@pkg/",!0,/README\.mdx?$/),a={};try{a=require("@/components/components").default}catch(e){}Object.assign(mdxComponents,r({},a)),null==(t=i.keys())||t.forEach(function(e){var n=e.substring(2).split("/").slice(0,-1).join("/"),t=i(e),o=t.basic,a=t.default;myPkgs.push(r({key:n,path:n,element:a},o,{props:{components:mdxComponents,path:n}}))});var l=require.context("@pkg/",!0,/\/examples\/(.+)\.mdx$/);null==(o=l.keys())||o.forEach(function(r){var n=r.substring(2).split("/"),t=n[0];Array.isArray(myDemoKv[t])||(myDemoKv[t]=[]);for(var o,i,a=l(r),u=a.matchAll(/```([^\r\n]+)?\r?\n([\s\S]*?)\r?\n```/g),c="",p="",s=null,h=function(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);if("Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(r,n)}}(r))){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(u);!(i=h()).done;){var d=i.value;p=d[1]||"tsx",c=d[2],s=a.replace(d[0],"")}myDemoKv[t].push({language:p,code:c,description:s,title:null==(o=n.pop())?void 0:o.replace(/\.mdx$/,""),noInline:/render\([^\\)]*\);?(?=\s*$)/.test(c)})})}var u=[];try{u=require("@/router").default}catch(e){console.info("自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]",e)}function c(e,r){return["*"===r&&"*"!==e?void 0:r,e].filter(Boolean).join("/")}var p=function(e){for(var r=[],n=0;n<e.length;n++)for(var t=e[n].split("/").slice(0,-1),o=r,i=0;i<t.length;i++){var a=t[i];if(""!==a){"."===a&&(a="*");var l=o;if(Array.isArray(o)){for(var u=0;u<o.length;u++)if(o[u].path===a){o=o[u].children;break}}if(l===o){var c=i===t.length-1?e[n]:t.slice(0,i+1).join("/")+"/",p={key:c=c.substring(2,c.lastIndexOf("/")),path:a,i18n:"route-"+c,children:[],alive:!1,element:lazyImport(c),hideMenu:c.includes(":"),props:{path:c}};Array.isArray(o)&&o.push(p),o=p.children}}}return r}(require.context("@/pages/",!0,/\.(t|j)sx$/,"lazy").keys().map(function(e){return e.replace(/\$/g,":")}));function s(e,n,t){return void 0===e&&(e=[]),e.map(function(e){var o=r({},e);return void 0===o.key&&(o.key=c(e.path,t)),void 0===o.i18n&&(o.i18n="route-"+o.key),void 0===o.alive&&(o.alive=!1),"*"===o.path&&void 0===o.hideMenu&&(o.hideMenu=!0),Array.isArray(o.children)&&(o.children=o.children.length?s(o.children,n,o.key):void 0),o.element||(o.element=lazyImport(o.key),o.props={path:o.key}),!!o.onlyLogin!==n||o.root?o:null}).filter(Boolean)}for(var h=[].concat(u),d=0,y=p.length;d<y;d++)!function e(n,t,o){var i,a=n.find(function(e){return e.path===t.path});a?(a.key=c(a.path,o),void 0===a.i18n&&(a.i18n="route-"+a.key),void 0===a.alive&&(a.alive=!1),void 0===a.element&&t.element&&(a.element=t.element,a.props=t.props),void 0===a.hideMenu&&(a.hideMenu="*"===a.path||a.key.includes(":")),Object.assign(a,r({},t,a)),t.children&&(!a.children&&Array.isArray(t.children)&&(a.children=t.children),null==(i=t.children)||i.forEach(function(r){e(null==a?void 0:a.children,r,null==a?void 0:a.key)}))):n.push(t)}(h,p[d]);export var onlyLoginRouter=s(h,!1);export var router=s(h,!0);export function matchUtil(e){var r={key:""};return!function t(o){for(var i=0,a=o.length;i<a;i++){if(o[i].path&&"*"!==o[i].path&&o[i].key)try{if(n(o[i].key).exec(e.substring(1))){r=o[i];return}}catch(e){}Array.isArray(o[i].children)&&t(o[i].children)}}(router),r}
1
+ function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}import{pathToRegexp as n}from"path-to-regexp";export function lazyImport(e){return new Promise(function(r){return import("@/pages/"+e.replace(/:/g,"$").replace(/^\//,"")).then(r).catch(function(){return Promise.resolve({default:null})})})}export var myPkgs=[];export var myDemoKv={};export var mdxComponents={};if("library"===APPTYPE){var t,o,i=require.context("@pkg/",!0,/README\.mdx?$/),a={};try{a=await import("@/components/components")}catch(e){}Object.assign(mdxComponents,r({},a)),null==(t=i.keys())||t.forEach(function(e){var n=e.substring(2).split("/").slice(0,-1).join("/"),t=i(e),o=t.basic,a=t.default;myPkgs.push(r({key:n,path:n,element:a},o,{props:{components:mdxComponents,path:n}}))});var l=require.context("@pkg/",!0,/\/examples\/(.+)\.mdx$/);null==(o=l.keys())||o.forEach(function(r){var n=r.substring(2).split("/"),t=n[0];Array.isArray(myDemoKv[t])||(myDemoKv[t]=[]);for(var o,i,a=l(r),u=a.matchAll(/```([^\r\n]+)?\r?\n([\s\S]*?)\r?\n```/g),c="",p="",s=null,h=function(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);if("Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(r,n)}}(r))){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(u);!(i=h()).done;){var d=i.value;p=d[1]||"tsx",c=d[2],s=a.replace(d[0],"")}myDemoKv[t].push({language:p,code:c,description:s,title:null==(o=n.pop())?void 0:o.replace(/\.mdx$/,""),noInline:/render\([^\\)]*\);?(?=\s*$)/.test(c)})})}var u=[];try{u=require("@/router").default}catch(e){console.info("自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]",e)}function c(e,r){return["*"===r&&"*"!==e?void 0:r,e].filter(Boolean).join("/")}var p=function(e){for(var r=[],n=0;n<e.length;n++)for(var t=e[n].split("/").slice(0,-1),o=r,i=0;i<t.length;i++){var a=t[i];if(""!==a){"."===a&&(a="*");var l=o;if(Array.isArray(o)){for(var u=0;u<o.length;u++)if(o[u].path===a){o=o[u].children;break}}if(l===o){var c=i===t.length-1?e[n]:t.slice(0,i+1).join("/")+"/",p={key:c=c.substring(2,c.lastIndexOf("/")),path:a,i18n:"route-"+c,children:[],alive:!1,element:lazyImport(c),hideMenu:c.includes(":"),props:{path:c}};Array.isArray(o)&&o.push(p),o=p.children}}}return r}(require.context("@/pages/",!0,/\.(t|j)sx$/,"lazy").keys().map(function(e){return e.replace(/\$/g,":")}));function s(e,n,t){return void 0===e&&(e=[]),e.map(function(e){var o=r({},e);return void 0===o.key&&(o.key=c(e.path,t)),void 0===o.i18n&&(o.i18n="route-"+o.key),void 0===o.alive&&(o.alive=!1),"*"===o.path&&void 0===o.hideMenu&&(o.hideMenu=!0),Array.isArray(o.children)&&(o.children=o.children.length?s(o.children,n,o.key):void 0),o.element||(o.element=lazyImport(o.key),o.props={path:o.key}),!!o.onlyLogin!==n||o.root?o:null}).filter(Boolean)}for(var h=[].concat(u),d=0,y=p.length;d<y;d++)!function e(n,t,o){var i,a=n.find(function(e){return e.path===t.path});a?(a.key=c(a.path,o),void 0===a.i18n&&(a.i18n="route-"+a.key),void 0===a.alive&&(a.alive=!1),void 0===a.element&&t.element&&(a.element=t.element,a.props=t.props),void 0===a.hideMenu&&(a.hideMenu="*"===a.path||a.key.includes(":")),Object.assign(a,r({},t,a)),t.children&&(!a.children&&Array.isArray(t.children)&&(a.children=t.children),null==(i=t.children)||i.forEach(function(r){e(null==a?void 0:a.children,r,null==a?void 0:a.key)}))):n.push(t)}(h,p[d]);export var onlyLoginRouter=s(h,!1);export var router=s(h,!0);export function matchUtil(e){var r={key:""};return!function t(o){for(var i=0,a=o.length;i<a;i++){if(o[i].path&&"*"!==o[i].path&&o[i].key)try{if(n(o[i].key).exec(e.substring(1))){r=o[i];return}}catch(e){}Array.isArray(o[i].children)&&t(o[i].children)}}(router),r}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.10",
3
+ "version": "3.0.0-beta.11",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "npm run build-conf && npm run build-src && npm run build:types",
9
9
  "build-conf": "swc config -d build -C module.type=nodenext -C jsc.target=esnext -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
10
- "build-src": "swc src -d lib -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
10
+ "build-src": "swc src -d lib -C jsc.transform.react.pragma=h -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
11
11
  "build:types": "tsc && tsc --project cli.json",
12
12
  "postbuild": "node ./copy.js ./prefix ./lib",
13
13
  "prebuild": "rm -rf ./build && rm -rf ./lib"