@moneko/core 3.0.0-beta.11 → 3.0.0-beta.13
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.
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Router } from '@solidjs/router';
|
|
2
|
+
import { render } from 'solid-js/web';
|
|
3
|
+
import type { JSX } from 'solid-js';
|
|
4
|
+
import App from '@/index';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
|
|
7
|
+
function isFunction(target: any): target is VoidFunction & ((...v: any[]) => any) {
|
|
8
|
+
return [
|
|
9
|
+
'[object Function]',
|
|
10
|
+
'[object AsyncFunction]',
|
|
11
|
+
'[object GeneratorFunction]',
|
|
12
|
+
'[object Proxy]',
|
|
13
|
+
].includes(Object.prototype.toString.call(target));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const appEntry: AppEntryMethods | null = APPENTRY ? await import(APPENTRY) : null;
|
|
17
|
+
const container = document.getElementById('root') as HTMLElement;
|
|
18
|
+
|
|
19
|
+
if (appEntry && isFunction(appEntry.bootstrap)) {
|
|
20
|
+
appEntry.bootstrap?.();
|
|
21
|
+
}
|
|
22
|
+
const Main = () => (
|
|
23
|
+
<Router>
|
|
24
|
+
<App />
|
|
25
|
+
</Router>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
window.rootInstance = {
|
|
29
|
+
unmount: () => null,
|
|
30
|
+
render(ele: () => JSX.Element) {
|
|
31
|
+
window.rootInstance.unmount = render(ele, container);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
window.rootInstance.render(Main);
|
|
36
|
+
|
|
37
|
+
if (appEntry && isFunction(appEntry.mount)) {
|
|
38
|
+
appEntry.mount?.();
|
|
39
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../refresh-rem.js";import"../../normalize.css";var r=await import("./bootstrap.
|
|
1
|
+
import"../../refresh-rem.js";import"../../normalize.css";var r=await import("./bootstrap.tsx");export default r;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.13",
|
|
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
|
-
"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
|
|
10
|
-
"build-src": "swc src -d lib
|
|
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 -D",
|
|
10
|
+
"build-src": "swc src -d lib --extensions=.ts --ignore=src/packages/library/*.tsx -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true -D",
|
|
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"
|
|
@@ -1 +0,0 @@
|
|
|
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());
|