@windwalker-io/core 4.1.12 → 4.2.0
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/bin/release.js +2 -2
- package/core/index.d.ts +1 -0
- package/core/index.html +13 -0
- package/core/lib/main.ts +9 -0
- package/core/package.json +26 -0
- package/core/public/vite.svg +1 -0
- package/core/src/main.ts +23 -0
- package/core/src/style.css +95 -0
- package/core/src/typescript.svg +1 -0
- package/core/src/vite-env.d.ts +1 -0
- package/package.json +67 -56
- package/{postcss.config.cjs → postcss.config.js} +1 -1
- package/src/app/app.ts +50 -0
- package/src/app/index.ts +3 -0
- package/src/app/macros/defineJsModules.ts +5 -0
- package/src/app/macros/index.ts +1 -0
- package/src/asset-bundler.mjs +114 -0
- package/src/debugger/Store.vue +1 -1
- package/src/debugger/debugger.js +3 -5
- package/src/index.mjs +2 -0
- package/src/next/fusion/index.ts +2 -0
- package/src/next/fusion/plugins/assets.ts +29 -0
- package/src/next/fusion/plugins/index.ts +3 -0
- package/src/next/fusion/plugins/systemjs.ts +66 -0
- package/src/next/fusion/processors/cloneAssets.ts +81 -0
- package/src/next/fusion/processors/cssModulize.ts +105 -0
- package/src/next/fusion/processors/index.ts +4 -0
- package/src/next/fusion/processors/installVendors.ts +178 -0
- package/src/next/fusion/processors/jsModulize.ts +296 -0
- package/src/next/index.ts +2 -0
- package/src/next/utilities/asset-sync.ts +47 -0
- package/src/next/utilities/crypto.ts +11 -0
- package/src/next/utilities/fs.ts +61 -0
- package/src/next/utilities/index.ts +5 -0
- package/src/next/utilities/modules.ts +17 -0
- package/tailwind/console.tailwind.config.cjs +1 -1
- package/tailwind.config.js +10 -0
- package/vite.config.debugger.ts +94 -0
- package/vite.config.next.ts +75 -0
- package/.gulp.json +0 -7
- package/dist/debugger/100-a64696bac484f689dc7f.js +0 -2
- package/dist/debugger/100.js.map +0 -1
- package/dist/debugger/153-2f3366cb4e48e0749485.js +0 -2
- package/dist/debugger/153.js.map +0 -1
- package/dist/debugger/282-6f9f84a149fc7e52beb5.js +0 -2
- package/dist/debugger/282.js.map +0 -1
- package/dist/debugger/358-bdcf2ec8126fe2a9a049.js +0 -2
- package/dist/debugger/358.js.map +0 -1
- package/dist/debugger/416-ac63d360de6c26cab89a.js +0 -2
- package/dist/debugger/416.js.map +0 -1
- package/dist/debugger/489-e2b77a72f97d9e96f9c0.js +0 -2
- package/dist/debugger/489.js.map +0 -1
- package/dist/debugger/694-f1f22e67d91a57498639.js +0 -2
- package/dist/debugger/694.js.map +0 -1
- package/dist/debugger/941-c22b0704c67ca5058678.js +0 -2
- package/dist/debugger/941.js.map +0 -1
- package/dist/debugger/debugger.js +0 -3
- package/dist/debugger/debugger.js.LICENSE.txt +0 -13
- package/dist/debugger/main.js.map +0 -1
- package/dist/debugger/windwalker-logo-h-w.svg +0 -1
- package/dist/debugger-console.css +0 -2
- package/dist/debugger-console.css.map +0 -1
- package/dist/debugger-console.js +0 -2
- package/dist/debugger-console.js.map +0 -1
- package/dist/images/windwalker-logo-h-w.svg +0 -1
- package/fusionfile.mjs +0 -96
- package/src/debugger/webpack.config.js +0 -9
- package/tailwind.config.cjs +0 -30
package/bin/release.js
CHANGED
|
@@ -20,8 +20,8 @@ if (cliInput['help'] || cliInput['h']) {
|
|
|
20
20
|
process.exit(0);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
console.log(`>>> yarn build`);
|
|
24
|
+
exec(`yarn build`, { stdio: 'inherit' });
|
|
25
25
|
|
|
26
26
|
console.log(`>>> npm version ${args.join(' ')}`);
|
|
27
27
|
const buffer = exec(`npm version ${args.join(' ')} --no-workspaces-update`);
|
package/core/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function setupCounter(element: HTMLButtonElement): void
|
package/core/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/core/lib/main.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function setupCounter(element: HTMLButtonElement) {
|
|
2
|
+
let counter = 0
|
|
3
|
+
const setCounter = (count: number) => {
|
|
4
|
+
counter = count
|
|
5
|
+
element.innerHTML = `count is ${counter}`
|
|
6
|
+
}
|
|
7
|
+
element.addEventListener('click', () => setCounter(++counter))
|
|
8
|
+
setCounter(0)
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"index.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/counter.umd.cjs",
|
|
11
|
+
"module": "./dist/counter.js",
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"import": "./dist/counter.js",
|
|
16
|
+
"require": "./dist/counter.umd.cjs"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "tsc && vite build"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "~5.9.2",
|
|
24
|
+
"vite": "^7.1.5"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/core/src/main.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './style.css'
|
|
2
|
+
import typescriptLogo from './typescript.svg'
|
|
3
|
+
import { setupCounter } from '../lib/main'
|
|
4
|
+
|
|
5
|
+
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
|
|
6
|
+
<div>
|
|
7
|
+
<a href="https://vite.dev" target="_blank">
|
|
8
|
+
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.typescriptlang.org/" target="_blank">
|
|
11
|
+
<img src="${typescriptLogo}" class="logo vanilla" alt="TypeScript logo" />
|
|
12
|
+
</a>
|
|
13
|
+
<h1>Vite + TypeScript</h1>
|
|
14
|
+
<div class="card">
|
|
15
|
+
<button id="counter" type="button"></button>
|
|
16
|
+
</div>
|
|
17
|
+
<p class="read-the-docs">
|
|
18
|
+
Click on the Vite and TypeScript logos to learn more
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
setupCounter(document.querySelector<HTMLButtonElement>('#counter')!)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #646cff;
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: #535bf2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
place-items: center;
|
|
29
|
+
min-width: 320px;
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 3.2em;
|
|
35
|
+
line-height: 1.1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#app {
|
|
39
|
+
max-width: 1280px;
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
padding: 2rem;
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.logo {
|
|
46
|
+
height: 6em;
|
|
47
|
+
padding: 1.5em;
|
|
48
|
+
will-change: filter;
|
|
49
|
+
}
|
|
50
|
+
.logo:hover {
|
|
51
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
52
|
+
}
|
|
53
|
+
.logo.vanilla:hover {
|
|
54
|
+
filter: drop-shadow(0 0 2em #3178c6aa);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.card {
|
|
58
|
+
padding: 2em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.read-the-docs {
|
|
62
|
+
color: #888;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
button {
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
border: 1px solid transparent;
|
|
68
|
+
padding: 0.6em 1.2em;
|
|
69
|
+
font-size: 1em;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
font-family: inherit;
|
|
72
|
+
background-color: #1a1a1a;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
transition: border-color 0.25s;
|
|
75
|
+
}
|
|
76
|
+
button:hover {
|
|
77
|
+
border-color: #646cff;
|
|
78
|
+
}
|
|
79
|
+
button:focus,
|
|
80
|
+
button:focus-visible {
|
|
81
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (prefers-color-scheme: light) {
|
|
85
|
+
:root {
|
|
86
|
+
color: #213547;
|
|
87
|
+
background-color: #ffffff;
|
|
88
|
+
}
|
|
89
|
+
a:hover {
|
|
90
|
+
color: #747bff;
|
|
91
|
+
}
|
|
92
|
+
button {
|
|
93
|
+
background-color: #f9f9f9;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#007ACC" d="M0 128v128h256V0H0z"></path><path fill="#FFF" d="m56.612 128.85l-.081 10.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121 10.443Zm149.955-10.742c6.501 1.625 11.459 4.51 16.01 9.224c2.357 2.52 5.851 7.111 6.136 8.208c.08.325-11.053 7.802-17.798 11.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759 3.535-12.718 10.321c0 1.992.284 3.17 1.097 4.795c1.707 3.536 4.876 5.649 14.832 9.956c18.326 7.883 26.168 13.084 31.045 20.48c5.445 8.249 6.664 21.415 2.966 31.208c-4.063 10.646-14.14 17.879-28.323 20.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163 1.178-.813 2.356-1.504c1.138-.65 5.446-3.129 9.509-5.485l7.355-4.267l1.544 2.276c2.154 3.29 6.867 7.801 9.712 9.305c8.167 4.307 19.383 3.698 24.909-1.26c2.357-2.153 3.332-4.388 3.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76 12.353-21.659 26.25-24.3c4.51-.853 14.994-.528 19.424.569Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,60 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"name": "@windwalker-io/core",
|
|
3
|
+
"version": "4.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Windwalker Core JS package",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "yarn build:next && yarn build:debugger",
|
|
8
|
+
"dev": "yarn dev:debugger",
|
|
9
|
+
"build:next": "vite build --config vite.config.next.ts",
|
|
10
|
+
"dev:next": "yarn build:next --watch",
|
|
11
|
+
"build:debugger": "vite build --config vite.config.debugger.ts",
|
|
12
|
+
"dev:debugger": "vite --config vite.config.debugger.ts"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./src/index.js",
|
|
16
|
+
"./next": {
|
|
17
|
+
"types": "./dist/next.d.ts",
|
|
18
|
+
"require": "./dist/next.js",
|
|
19
|
+
"import": "./dist/next.js"
|
|
12
20
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@asika32764/vue-animate": "^3.0.2",
|
|
19
|
-
"@fortawesome/fontawesome-svg-core": "^6.2.0",
|
|
20
|
-
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
|
21
|
-
"@fortawesome/vue-fontawesome": "^3.0.1",
|
|
22
|
-
"@tailwindcss/custom-forms": "^0.2.1",
|
|
23
|
-
"@tailwindcss/ui": "^0.7.2",
|
|
24
|
-
"@types/gulp-rename": "^2",
|
|
25
|
-
"@vue/reactivity": "^3.3.7",
|
|
26
|
-
"@vue/tsconfig": "^0.4.0",
|
|
27
|
-
"@windwalker-io/fusion": "^1.0",
|
|
28
|
-
"autoprefixer": "^10.2.6",
|
|
29
|
-
"axios": "^1.0",
|
|
30
|
-
"bootstrap": "^5.0",
|
|
31
|
-
"dayjs": "^1.11.5",
|
|
32
|
-
"file-loader": "^6.2.0",
|
|
33
|
-
"gulp": "^4.0.2",
|
|
34
|
-
"gulp-postcss": "~9.0.0",
|
|
35
|
-
"postcss-import": "^14.0.2",
|
|
36
|
-
"postcss-loader": "^4.0.0",
|
|
37
|
-
"postcss-nested": "^5.0.5",
|
|
38
|
-
"regenerator-runtime": "^0.13.7",
|
|
39
|
-
"sql-formatter": "^10.6.0",
|
|
40
|
-
"tailwindcss": "^2.1.4",
|
|
41
|
-
"ts-loader": "^9.4.4",
|
|
42
|
-
"typescript": "^5.1.6",
|
|
43
|
-
"vue": "^3.0.11",
|
|
44
|
-
"vue-loader": "^16.0",
|
|
45
|
-
"vue-router": "^4.2.4",
|
|
46
|
-
"vue-style-loader": "^4.1.3",
|
|
47
|
-
"vue-tsc": "^1.8.8",
|
|
48
|
-
"vuedraggable": "^3.0||^4.0.3",
|
|
49
|
-
"webpack": "^5.0",
|
|
50
|
-
"webpack-bundle-analyzer": "^4.6.1"
|
|
51
|
-
},
|
|
52
|
-
"windwalker": {
|
|
53
|
-
"vendors": [
|
|
54
|
-
"@windwalker-io/core"
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"gulp-rename": "^2.0.0"
|
|
21
|
+
"./app": {
|
|
22
|
+
"require": "./src/app/index.ts",
|
|
23
|
+
"import": "./src/app/index.ts"
|
|
59
24
|
}
|
|
25
|
+
},
|
|
26
|
+
"repository": "https://github.com/ventoviro/windwalker-core",
|
|
27
|
+
"author": "Simon Asika",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@windwalker-io/fusion-next": "*",
|
|
31
|
+
"fast-glob": "^3.3.3",
|
|
32
|
+
"is-glob": "^4.0.3",
|
|
33
|
+
"micromatch": "^4.0.8",
|
|
34
|
+
"node-html-parser": "^7.0.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@asika32764/vue-animate": "^3.0.2",
|
|
38
|
+
"@fortawesome/fontawesome-svg-core": "^6.2.0",
|
|
39
|
+
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
|
40
|
+
"@fortawesome/vue-fontawesome": "^3.0.1",
|
|
41
|
+
"@types/gulp-rename": "^2",
|
|
42
|
+
"@types/is-glob": "^4",
|
|
43
|
+
"@types/micromatch": "^4.0.9",
|
|
44
|
+
"@types/systemjs": "^6",
|
|
45
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
46
|
+
"@vue/reactivity": "^3.3.7",
|
|
47
|
+
"@vue/tsconfig": "^0.4.0",
|
|
48
|
+
"axios": "^1.0",
|
|
49
|
+
"bootstrap": "^5.0",
|
|
50
|
+
"dayjs": "^1.11.5",
|
|
51
|
+
"file-loader": "^6.2.0",
|
|
52
|
+
"gulp-rename": "^2.0.0",
|
|
53
|
+
"rimraf": "^6.0.1",
|
|
54
|
+
"sql-formatter": "^10.6.0",
|
|
55
|
+
"systemjs": "^6.15.1",
|
|
56
|
+
"tailwindcss": "^3.0",
|
|
57
|
+
"typescript": "^5.1.6",
|
|
58
|
+
"unplugin-dts": "^1.0.0-beta.6",
|
|
59
|
+
"vite": "^7.1.6",
|
|
60
|
+
"vite-plugin-dts": "^4.5.4",
|
|
61
|
+
"vite-plugin-public-path": "^1.1.0",
|
|
62
|
+
"vue": "^3.0.11",
|
|
63
|
+
"vue-router": "^4.2.4",
|
|
64
|
+
"vuedraggable": "^3.0||^4.0.3"
|
|
65
|
+
},
|
|
66
|
+
"windwalker": {
|
|
67
|
+
"vendors": [
|
|
68
|
+
"@windwalker-io/core"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
60
71
|
}
|
package/src/app/app.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
type Route = string | RouteLoader;
|
|
2
|
+
type RouteLoader = () => Promise<any>;
|
|
3
|
+
|
|
4
|
+
export class App {
|
|
5
|
+
routes: Record<string, RouteLoader> = {};
|
|
6
|
+
|
|
7
|
+
constructor(routes: Record<string, Route> = {}) {
|
|
8
|
+
this.registerRoutes(routes);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
registerRoutes(routes: Record<string, Route>) {
|
|
12
|
+
for (const route in routes) {
|
|
13
|
+
this.addRoute(route, routes[route]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
addRoute(route: string, target: Route) {
|
|
20
|
+
if (typeof target === 'string') {
|
|
21
|
+
target = () => import(/* @vite-ignore */`${target as string}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.routes[route] = target;
|
|
25
|
+
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeRoute(route: string) {
|
|
30
|
+
delete this.routes[route];
|
|
31
|
+
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async import<T = any>(route: string): Promise<T> {
|
|
36
|
+
const target = this.routes[route];
|
|
37
|
+
|
|
38
|
+
if (!target) {
|
|
39
|
+
throw new Error(`Unable to import file: ${route}, file not found.`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return target();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
reset() {
|
|
46
|
+
this.routes = {};
|
|
47
|
+
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/app/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineJsModules';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { webpackBundle } from '@windwalker-io/fusion';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { globSync } from 'glob';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { findModules } from './asset-sync.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {string} mainFile
|
|
10
|
+
* @param {string|string[]} source
|
|
11
|
+
* @param {string} dest
|
|
12
|
+
* @param {any} options
|
|
13
|
+
* @returns {Promise<any>}
|
|
14
|
+
*/
|
|
15
|
+
export async function bundleJS(
|
|
16
|
+
mainFile = `./resources/assets/src/app.ts`,
|
|
17
|
+
source = 'src/Module/**/*.ts',
|
|
18
|
+
dest = 'www/assets/js/app/app.js',
|
|
19
|
+
options = {}
|
|
20
|
+
) {
|
|
21
|
+
const workingDir = process.cwd();
|
|
22
|
+
|
|
23
|
+
if (typeof source === 'string') {
|
|
24
|
+
source = [source];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const files = findFilesFromGlobArray([
|
|
28
|
+
...findModules('**/assets/*.ts'),
|
|
29
|
+
...source,
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
let listJS = "{\n";
|
|
33
|
+
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
if (file.fullpath.endsWith('.d.ts')) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let key = file.relativePath.replace(/assets$/, '').toLowerCase();
|
|
40
|
+
key = key.substring(0, key.lastIndexOf('.'));
|
|
41
|
+
listJS += `'${key}': () => import('${file.fullpath}'),\n`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
listJS += "}";
|
|
45
|
+
|
|
46
|
+
let ts = `
|
|
47
|
+
import loader from '@windwalker-io/core/src/loader/core-loader.ts';
|
|
48
|
+
|
|
49
|
+
loader.register(${listJS});
|
|
50
|
+
|
|
51
|
+
export default loader;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
// const base64 = Buffer.from(ts).toString('base64');
|
|
55
|
+
// const dataUri = `data:text/javascript;base64,${base64}`;
|
|
56
|
+
const tmpDir = workingDir + '/tmp/fusion';
|
|
57
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
58
|
+
|
|
59
|
+
const tmpFile = tmpDir + '/app.js';
|
|
60
|
+
fs.writeFileSync(tmpFile, ts);
|
|
61
|
+
|
|
62
|
+
const r = await webpackBundle(
|
|
63
|
+
tmpFile,
|
|
64
|
+
dest,
|
|
65
|
+
(config) => {
|
|
66
|
+
config.devtool = false;
|
|
67
|
+
// config.entry = dataUri;
|
|
68
|
+
// config.output.uniqueName = 'app';
|
|
69
|
+
config.output.libraryTarget = 'module';
|
|
70
|
+
config.experiments.outputModule = true;
|
|
71
|
+
config.resolve.modules.push(path.resolve('./'));
|
|
72
|
+
config.context = path.resolve('./');
|
|
73
|
+
config.resolve.alias = {
|
|
74
|
+
'@main': path.resolve(mainFile),
|
|
75
|
+
'@app': path.resolve(mainFile),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// fs.unlinkSync(tmpFile);
|
|
81
|
+
|
|
82
|
+
return r;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function findFilesFromGlobArray(sources) {
|
|
86
|
+
let files = [];
|
|
87
|
+
|
|
88
|
+
for (const source of sources) {
|
|
89
|
+
files = [
|
|
90
|
+
...files,
|
|
91
|
+
...findFiles(source)
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return files;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @param {string} src
|
|
100
|
+
*/
|
|
101
|
+
function findFiles(src) {
|
|
102
|
+
const i = src.lastIndexOf('**');
|
|
103
|
+
|
|
104
|
+
const path = src.substring(0, i);
|
|
105
|
+
|
|
106
|
+
return globSync(src).map((file) => {
|
|
107
|
+
file = file.replace(/\\/g, '/');
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
fullpath: file,
|
|
111
|
+
relativePath: file.substring(path.length)
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
package/src/debugger/Store.vue
CHANGED
package/src/debugger/debugger.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import('@asika32764/vue-animate/dist/vue-animate.min.css');
|
|
2
|
+
import('../../scss/debugger.scss');
|
|
1
3
|
|
|
2
|
-
import '
|
|
3
|
-
|
|
4
|
-
import App from '@/App.vue';
|
|
5
|
-
import '@asika32764/vue-animate/dist/vue-animate.min.css';
|
|
4
|
+
import App from './App.vue';
|
|
6
5
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
7
6
|
import { createApp } from 'vue';
|
|
8
|
-
import '../../scss/debugger.scss';
|
|
9
7
|
import './font-awesome.js';
|
|
10
8
|
import 'bootstrap/dist/js/bootstrap.js';
|
|
11
9
|
import router from './routes.js';
|
package/src/index.mjs
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FusionPlugin } from '@windwalker-io/fusion-next';
|
|
2
|
+
import { getAvailableForReposition, handleCloneAssets, handleReposition } from '../processors/cloneAssets';
|
|
3
|
+
|
|
4
|
+
export interface WindwalkerAssetsOptions {
|
|
5
|
+
clone?: Record<string, string>;
|
|
6
|
+
reposition?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function globalAssets(options: WindwalkerAssetsOptions): FusionPlugin {
|
|
10
|
+
return {
|
|
11
|
+
name: 'core:global-assets',
|
|
12
|
+
buildConfig(builder) {
|
|
13
|
+
const clone = options.clone || {};
|
|
14
|
+
let reposition = options.reposition || {};
|
|
15
|
+
|
|
16
|
+
reposition = { ...reposition, ...getAvailableForReposition(clone) };
|
|
17
|
+
|
|
18
|
+
// Handle reposition
|
|
19
|
+
handleReposition(builder, reposition);
|
|
20
|
+
|
|
21
|
+
const clonePatterns = Object.keys(clone);
|
|
22
|
+
|
|
23
|
+
// Handle clone
|
|
24
|
+
if (clonePatterns.length > 0) {
|
|
25
|
+
handleCloneAssets(builder, clonePatterns);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import type { OutputAsset, OutputChunk } from 'rollup';
|
|
4
|
+
import type { PluginOption } from 'vite';
|
|
5
|
+
|
|
6
|
+
export function injectSystemJS(systemPath?: string, filter?: (file: OutputAsset | OutputChunk) => any): PluginOption {
|
|
7
|
+
systemPath ??= resolve('node_modules/systemjs/dist/system.min.js');
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
name: 'core:inject-systemjs',
|
|
11
|
+
async generateBundle(options, bundle) {
|
|
12
|
+
if (options.format !== 'system') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const systemjsCode = fs.readFileSync(
|
|
17
|
+
resolve(systemPath),
|
|
18
|
+
'utf-8'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
for (const file of Object.values(bundle)) {
|
|
22
|
+
if (filter && !filter(file)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (file.type === 'chunk' && file.isEntry && file.fileName.endsWith('.js')) {
|
|
27
|
+
file.code = systemjsCode + '\n' + file.code;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function systemCSSFix(): PluginOption {
|
|
35
|
+
return {
|
|
36
|
+
name: 'core:systemjs-css-fix',
|
|
37
|
+
async generateBundle(options, bundle) {
|
|
38
|
+
if (options.format !== 'system') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
43
|
+
if (fileName.endsWith('.css') && 'code' in chunk) {
|
|
44
|
+
const regex = /__vite_style__\.textContent\s*=\s*"([\s\S]*?)";/;
|
|
45
|
+
let match = chunk.code.match(regex);
|
|
46
|
+
|
|
47
|
+
// For minified
|
|
48
|
+
if (!match) {
|
|
49
|
+
const regex = /\.textContent\s*=\s*`([\s\S]*?)`/;
|
|
50
|
+
match = chunk.code.match(regex);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (match && match[1]) {
|
|
54
|
+
chunk.code = match[1]
|
|
55
|
+
.replace(/\\"/g, '"')
|
|
56
|
+
.replace(/\\n/g, '\n')
|
|
57
|
+
.replace(/\\t/g, '\t')
|
|
58
|
+
.replace(/\\\\/g, '\\')
|
|
59
|
+
.replace(/\/\*\$vite\$:\d+\*\/$/, '')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|