@das-fed/cli 6.4.0-dev.9 → 6.4.0-dev.90

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.
Files changed (56) hide show
  1. package/package.json +1 -1
  2. package/src/commands/build/generate-nginx.js +1 -1
  3. package/src/commands/build/index.js +1 -1
  4. package/src/commands/build/nginx.main.conf +54 -54
  5. package/src/commands/build/nginx.micro.conf +56 -61
  6. package/src/commands/dev-helper/watchers/i18n/index.js +1 -1
  7. package/src/commands/extra/auth/index.js +1 -0
  8. package/src/commands/extra/i18n/index.js +2 -0
  9. package/src/commands/extra/i18n/vite.config.ts +1 -0
  10. package/src/commands/extra/index.js +1 -0
  11. package/src/commands/extra/theme/index.js +1 -0
  12. package/src/commands/init/index.js +1 -1
  13. package/src/commands/init/template/.pnpmfile.cjs +29 -0
  14. package/src/commands/init/template/.prettierignore +21 -21
  15. package/src/commands/init/template/.prettierrc +8 -8
  16. package/src/commands/init/template/package.json +7 -12
  17. package/src/commands/init/template/{index.html → packages/microapp/index.html} +13 -12
  18. package/src/commands/init/template/packages/microapp/package.json +25 -0
  19. package/src/commands/init/template/{config.js → packages/microapp/public/config.js} +3 -3
  20. package/src/commands/init/template/packages/microapp/src/das-web-app.ts +11 -0
  21. package/src/commands/init/template/packages/microapp/src/main.dev.ts +16 -0
  22. package/src/commands/init/template/packages/microapp/src/main.ts +10 -0
  23. package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/api/index.ts +6 -6
  24. package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/app.vue +157 -157
  25. package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/i18n/index.ts +16 -16
  26. package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/router.ts +12 -12
  27. package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/theme/index.ts +18 -18
  28. package/src/commands/init/template/{tsconfig.app.json → packages/microapp/tsconfig.json} +32 -28
  29. package/src/commands/init/template/{tsconfig.node.json → packages/microapp/tsconfig.node.json} +10 -13
  30. package/src/commands/init/template/packages/microapp/vite.config.ts +7 -0
  31. package/src/commands/init/template/pnpm-workspace.yaml +6 -0
  32. package/src/commands/init/template/scripts/build.js +34 -0
  33. package/src/utils/pure-resolve/index.js +1 -0
  34. package/src/vite-plugins/das-fe/index.js +1 -1
  35. package/src/vite-plugins/das-fe-web-app/index.js +1 -1
  36. package/src/commands/build/get-window-config.js +0 -1
  37. package/src/commands/helper/modules/gen-auth/gen/dist/config.js +0 -1
  38. package/src/commands/helper/modules/gen-auth/gen/dist/config.local.js +0 -1
  39. package/src/commands/helper/modules/gen-auth/gen/dist/index.js +0 -1
  40. package/src/commands/init/template/README.md +0 -19
  41. package/src/commands/init/template/public/config.js +0 -1
  42. package/src/commands/init/template/src/main.ts +0 -9
  43. package/src/commands/init/template/src/micro-app.ts +0 -8
  44. package/src/commands/init/template/src/views/demo/app.vue +0 -61
  45. package/src/commands/init/template/src/views/demo/i18n/index.ts +0 -14
  46. package/src/commands/init/template/src/views/demo/router.ts +0 -13
  47. package/src/commands/init/template/src/views/demo/theme/index.ts +0 -7
  48. package/src/commands/init/template/src/vite-env.d.ts +0 -1
  49. package/src/commands/init/template/tsconfig.json +0 -11
  50. package/src/commands/init/template/vite.config.ts +0 -14
  51. package/src/vite-plugins/das-fe-ui/index.js +0 -1
  52. package/src/vite-plugins/das-fe-utils/index.js +0 -1
  53. package/src/vite-plugins/das-fe-web/index.js +0 -1
  54. /package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/assets/das.png +0 -0
  55. /package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/assets/vite.svg +0 -0
  56. /package/src/commands/init/template/{src/views/hello → packages/microapp/src/views/demo}/assets/vue.svg +0 -0
@@ -1,157 +1,157 @@
1
- <template>
2
- <div class="hello-container">
3
- <button type="button" @click="setLang('zh-CN')">中</button>
4
- <button type="button" style="margin-left: 10px" @click="setLang('en')">英</button>
5
- <div class="img-container">
6
- <a href="https://vitejs.dev" target="_blank">
7
- <img src="./assets/vite.svg" class="logo" alt="Vite logo" />
8
- </a>
9
- <a href="https://vuejs.org/" target="_blank">
10
- <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
11
- </a>
12
- </div>
13
- <router-link to="/"> {{ t('home-router') }} </router-link>
14
- <span>-</span>
15
- <router-link to="/demo"> {{ t('demo-router') }} </router-link>
16
-
17
- <div>
18
- <h1>{{ msg }}</h1>
19
-
20
- <div class="card">
21
- <p>
22
- {{ t('edit', 'views/hello/app.vue') }}
23
- </p>
24
- </div>
25
-
26
- <p v-html="t('click-out', `<a href='http://docs.chn-das.com' target='_blank'>达实文档中心</a>`)"></p>
27
- <p v-html="t('suggest', `<a href='https://github.com/vuejs/language-tools' target='_blank'>Volar</a>`)"></p>
28
- <router-link to="/demo">
29
- <p class="read-the-demo">{{ t('read-the-demo') }}</p>
30
- </router-link>
31
- </div>
32
- <button type="button" @click="setTheme('light')">{{ t('light') }}</button>
33
- <button type="button" style="margin-left: 10px" @click="setTheme('dark')">
34
- {{ t('dark') }}
35
- </button>
36
- <br />
37
- <br />
38
- <div class="img-container">
39
- <a href="https://aiot.chn-das.com/login" target="_blank">
40
- <img class="das-logo" src="./assets/das.png" />
41
- </a>
42
- </div>
43
- </div>
44
- </template>
45
-
46
- <script setup lang="ts">
47
- import { ref } from 'vue'
48
- import { t, setLang, setTheme } from '@das-fed/web'
49
-
50
- const msg = ref('vite + vue + das-fe')
51
- </script>
52
-
53
- <style>
54
-
55
-
56
- .hello-container {
57
- height: 100%;
58
- margin: 0 auto;
59
- padding: 2rem;
60
- text-align: center;
61
- background: var(--hello-bg);
62
- color: var(--hello-color);
63
- }
64
- .hello-container p {
65
- margin-bottom: 10px;
66
- }
67
- .hello-container h1 {
68
- font-weight: 600;
69
- margin-bottom: 20px;
70
- color: var(--btn-color);
71
- }
72
-
73
- .img-container {
74
- display: flex;
75
- justify-content: center;
76
- }
77
- body {
78
- background: var(--hello-bg);
79
- color: var(--hello-color);
80
- }
81
- button {
82
- background: var(--btn-bg);
83
- color: var(--btn-color);
84
- }
85
- .logo {
86
- height: 6em;
87
- padding: 1.5em;
88
- will-change: filter;
89
- transition: filter 300ms;
90
- }
91
- .logo:hover {
92
- filter: drop-shadow(0 0 2em #646cffaa);
93
- }
94
- .logo.vue:hover {
95
- filter: drop-shadow(0 0 2em #42b883aa);
96
- }
97
- .das-logo {
98
- height: 30px;
99
- will-change: filter;
100
- transition: filter 300ms;
101
- }
102
- .das-logo:hover {
103
- filter: drop-shadow(0 0 2em #646cffaa);
104
- }
105
-
106
- .read-the-demo {
107
- color: #888;
108
- /* font-size: 14px; */
109
- font-weight: 400;
110
- }
111
- :root {
112
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
113
- line-height: 1.5;
114
- font-weight: 400;
115
-
116
- color-scheme: light dark;
117
- color: rgba(255, 255, 255, 0.87);
118
- background-color: #242424;
119
-
120
- font-synthesis: none;
121
- text-rendering: optimizeLegibility;
122
- -webkit-font-smoothing: antialiased;
123
- -moz-osx-font-smoothing: grayscale;
124
- }
125
-
126
- a {
127
- font-weight: 500;
128
- color: #646cff;
129
- text-decoration: inherit;
130
- }
131
- a:hover {
132
- color: #535bf2;
133
- }
134
-
135
- h1 {
136
- font-size: 3.2em;
137
- line-height: 1.1;
138
- }
139
-
140
- button {
141
- border-radius: 8px;
142
- border: 1px solid transparent;
143
- padding: 0.6em 1.2em;
144
- font-size: 1em;
145
- font-weight: 500;
146
- font-family: inherit;
147
- cursor: pointer;
148
- transition: border-color 0.25s;
149
- }
150
- button:hover {
151
- border-color: #646cff;
152
- }
153
- button:focus,
154
- button:focus-visible {
155
- outline: 4px auto -webkit-focus-ring-color;
156
- }
157
- </style>
1
+ <template>
2
+ <div class="hello-container">
3
+ <button type="button" @click="setLang('zh-CN')">中</button>
4
+ <button type="button" style="margin-left: 10px" @click="setLang('en')">英</button>
5
+ <div class="img-container">
6
+ <a href="https://vitejs.dev" target="_blank">
7
+ <img src="./assets/vite.svg" class="logo" alt="Vite logo" />
8
+ </a>
9
+ <a href="https://vuejs.org/" target="_blank">
10
+ <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
11
+ </a>
12
+ </div>
13
+ <router-link to="/"> {{ t('home-router') }} </router-link>
14
+ <span>-</span>
15
+ <router-link to="/demo"> {{ t('demo-router') }} </router-link>
16
+
17
+ <div>
18
+ <h1>{{ msg }}</h1>
19
+
20
+ <div class="card">
21
+ <p>
22
+ {{ t('edit', 'views/hello/app.vue') }}
23
+ </p>
24
+ </div>
25
+
26
+ <p v-html="t('click-out', `<a href='http://docs.chn-das.com' target='_blank'>达实文档中心</a>`)"></p>
27
+ <p v-html="t('suggest', `<a href='https://github.com/vuejs/language-tools' target='_blank'>Volar</a>`)"></p>
28
+ <router-link to="/demo">
29
+ <p class="read-the-demo">{{ t('read-the-demo') }}</p>
30
+ </router-link>
31
+ </div>
32
+ <button type="button" @click="setTheme('light')">{{ t('light') }}</button>
33
+ <button type="button" style="margin-left: 10px" @click="setTheme('dark')">
34
+ {{ t('dark') }}
35
+ </button>
36
+ <br />
37
+ <br />
38
+ <div class="img-container">
39
+ <a href="https://aiot.chn-das.com/login" target="_blank">
40
+ <img class="das-logo" src="./assets/das.png" />
41
+ </a>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script setup lang="ts">
47
+ import { ref } from 'vue'
48
+ import { t, setLang, setTheme } from '@das-fed/web'
49
+
50
+ const msg = ref('vite + vue + das-fe')
51
+ </script>
52
+
53
+ <style>
54
+
55
+
56
+ .hello-container {
57
+ height: 100%;
58
+ margin: 0 auto;
59
+ padding: 2rem;
60
+ text-align: center;
61
+ background: var(--hello-bg);
62
+ color: var(--hello-color);
63
+ }
64
+ .hello-container p {
65
+ margin-bottom: 10px;
66
+ }
67
+ .hello-container h1 {
68
+ font-weight: 600;
69
+ margin-bottom: 20px;
70
+ color: var(--btn-color);
71
+ }
72
+
73
+ .img-container {
74
+ display: flex;
75
+ justify-content: center;
76
+ }
77
+ body {
78
+ background: var(--hello-bg);
79
+ color: var(--hello-color);
80
+ }
81
+ button {
82
+ background: var(--btn-bg);
83
+ color: var(--btn-color);
84
+ }
85
+ .logo {
86
+ height: 6em;
87
+ padding: 1.5em;
88
+ will-change: filter;
89
+ transition: filter 300ms;
90
+ }
91
+ .logo:hover {
92
+ filter: drop-shadow(0 0 2em #646cffaa);
93
+ }
94
+ .logo.vue:hover {
95
+ filter: drop-shadow(0 0 2em #42b883aa);
96
+ }
97
+ .das-logo {
98
+ height: 30px;
99
+ will-change: filter;
100
+ transition: filter 300ms;
101
+ }
102
+ .das-logo:hover {
103
+ filter: drop-shadow(0 0 2em #646cffaa);
104
+ }
105
+
106
+ .read-the-demo {
107
+ color: #888;
108
+ /* font-size: 14px; */
109
+ font-weight: 400;
110
+ }
111
+ :root {
112
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
113
+ line-height: 1.5;
114
+ font-weight: 400;
115
+
116
+ color-scheme: light dark;
117
+ color: rgba(255, 255, 255, 0.87);
118
+ background-color: #242424;
119
+
120
+ font-synthesis: none;
121
+ text-rendering: optimizeLegibility;
122
+ -webkit-font-smoothing: antialiased;
123
+ -moz-osx-font-smoothing: grayscale;
124
+ }
125
+
126
+ a {
127
+ font-weight: 500;
128
+ color: #646cff;
129
+ text-decoration: inherit;
130
+ }
131
+ a:hover {
132
+ color: #535bf2;
133
+ }
134
+
135
+ h1 {
136
+ font-size: 3.2em;
137
+ line-height: 1.1;
138
+ }
139
+
140
+ button {
141
+ border-radius: 8px;
142
+ border: 1px solid transparent;
143
+ padding: 0.6em 1.2em;
144
+ font-size: 1em;
145
+ font-weight: 500;
146
+ font-family: inherit;
147
+ cursor: pointer;
148
+ transition: border-color 0.25s;
149
+ }
150
+ button:hover {
151
+ border-color: #646cff;
152
+ }
153
+ button:focus,
154
+ button:focus-visible {
155
+ outline: 4px auto -webkit-focus-ring-color;
156
+ }
157
+ </style>
@@ -1,16 +1,16 @@
1
- export default {
2
- 'home-router': { 'zh-CN': '主页', en: 'home' },
3
- 'demo-router': { 'zh-CN': '示例', en: 'demo' },
4
- light: { 'zh-CN': '浅色', en: 'light' },
5
- dark: { 'zh-CN': '深色', en: 'dark' },
6
- edit: {
7
- 'zh-CN': '编辑 $0 来测试模块热重载',
8
- en: 'Edit $0 to test HMR',
9
- },
10
- 'click-out': {
11
- 'zh-CN': '进入 $0 , 快速创建 Vue + Vite + Das Front-End 的开发模板',
12
- en: 'Click out $0 , check the official Vue + Vite + Das Front-End starter',
13
- },
14
- suggest: { 'zh-CN': '安装 $0 在您的IDE中获得更好的开发体验', en: 'Install $0 in your IDE for a better DX' },
15
- 'read-the-demo': { 'zh-CN': '进入示例页面,查看组件库使用示例', en: 'to read demo' },
16
- }
1
+ export default {
2
+ 'home-router': { 'zh-CN': '主页', en: 'home' },
3
+ 'demo-router': { 'zh-CN': '示例', en: 'demo' },
4
+ light: { 'zh-CN': '浅色', en: 'light' },
5
+ dark: { 'zh-CN': '深色', en: 'dark' },
6
+ edit: {
7
+ 'zh-CN': '编辑 $0 来测试模块热重载',
8
+ en: 'Edit $0 to test HMR',
9
+ },
10
+ 'click-out': {
11
+ 'zh-CN': '进入 $0 , 快速创建 Vue + Vite + Das Front-End 的开发模板',
12
+ en: 'Click out $0 , check the official Vue + Vite + Das Front-End starter',
13
+ },
14
+ suggest: { 'zh-CN': '安装 $0 在您的IDE中获得更好的开发体验', en: 'Install $0 in your IDE for a better DX' },
15
+ 'read-the-demo': { 'zh-CN': '进入示例页面,查看组件库使用示例', en: 'to read demo' },
16
+ }
@@ -1,12 +1,12 @@
1
- import type { RouteRecordRaw } from 'vue-router'
2
- import { setI18nRule, setThemeRule } from '@das-fed/web'
3
- import i18n from './i18n'
4
- import theme from './theme'
5
-
6
- setI18nRule(i18n)
7
- setThemeRule(theme)
8
-
9
- export default {
10
- path: '/',
11
- component: () => import('./app.vue'),
12
- } as RouteRecordRaw
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import { setI18nRule, setThemeRule } from '@das-fed/web'
3
+ import i18n from './i18n'
4
+ import theme from './theme'
5
+
6
+ setI18nRule(i18n)
7
+ setThemeRule(theme)
8
+
9
+ export default {
10
+ path: '/',
11
+ component: () => import('./app.vue'),
12
+ } as RouteRecordRaw
@@ -1,18 +1,18 @@
1
- export default {
2
- '--hello-bg': {
3
- light: '#fff',
4
- dark: '#000',
5
- },
6
- '--hello-color': {
7
- light: '#000',
8
- dark: '#fff',
9
- },
10
- '--btn-bg': {
11
- light: '#f9f9f9',
12
- dark: '#1a1a1a',
13
- },
14
- '--btn-color': {
15
- light: '#213547',
16
- dark: '#f9f9f9',
17
- },
18
- }
1
+ export default {
2
+ '--hello-bg': {
3
+ light: '#fff',
4
+ dark: '#000',
5
+ },
6
+ '--hello-color': {
7
+ light: '#000',
8
+ dark: '#fff',
9
+ },
10
+ '--btn-bg': {
11
+ light: '#f9f9f9',
12
+ dark: '#1a1a1a',
13
+ },
14
+ '--btn-color': {
15
+ light: '#213547',
16
+ dark: '#f9f9f9',
17
+ },
18
+ }
@@ -1,28 +1,32 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
- "target": "ES2020",
6
- "useDefineForClassFields": true,
7
- "module": "ESNext",
8
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
9
- "skipLibCheck": true,
10
-
11
- /* Bundler mode */
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "moduleDetection": "force",
17
- "noEmit": true,
18
- "jsx": "preserve",
19
- "jsxImportSource": "vue", // vue 3.4+ 需要显示指定jsx导出为vue
20
-
21
- /* Linting */
22
- "strict": true,
23
- "noUnusedLocals": true,
24
- "noUnusedParameters": true,
25
- "noFallthroughCasesInSwitch": true
26
- },
27
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
28
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "preserve",
16
+ "jsxImportSource": "vue", // vue 3.4+ 需要显示指定jsx导出为vue
17
+
18
+ /* Linting */
19
+ "strict": true,
20
+ "noUnusedLocals": false,
21
+ "noUnusedParameters": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+
24
+ /* @ alias */
25
+ "baseUrl": "./",
26
+ "paths": {
27
+ "@/*": ["src/*"]
28
+ }
29
+ },
30
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
31
+ "references": [{ "path": "./tsconfig.node.json" }]
32
+ }
@@ -1,13 +1,10 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
- "skipLibCheck": true,
6
- "module": "ESNext",
7
- "moduleResolution": "bundler",
8
- "allowSyntheticDefaultImports": true,
9
- "strict": true,
10
- "noEmit": true
11
- },
12
- "include": ["vite.config.ts"]
13
- }
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import { dasFeWebVitePlugin } from '@das-fed/cli'
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [dasFeWebVitePlugin({ dasWebApp: { type: 'microApp' } })],
7
+ })
@@ -0,0 +1,6 @@
1
+ # pnpm-workspace.yaml
2
+ packages:
3
+ # all packages in direct subdirs of packages/
4
+ - 'packages/*'
5
+
6
+ - 'packages/*/packages/*'
@@ -0,0 +1,34 @@
1
+ import path from 'path'
2
+ import fs from 'fs'
3
+ import { execSync } from 'child_process'
4
+ import { fileURLToPath } from 'url'
5
+
6
+ const __filename = fileURLToPath(import.meta.url)
7
+ const __dirname = path.dirname(__filename)
8
+
9
+ const getFirstPackage = (dirPath) => {
10
+ const items = fs.readdirSync(dirPath)
11
+ for (const item of items) {
12
+ const fullPath = path.join(dirPath, item)
13
+ if (fs.statSync(fullPath).isDirectory()) return fullPath
14
+ }
15
+ return null
16
+ }
17
+
18
+ const copyDirectorySync = (src, dest) => {
19
+ if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true })
20
+ const items = fs.readdirSync(src)
21
+ items.forEach((item) => {
22
+ const srcPath = path.join(src, item)
23
+ const destPath = path.join(dest, item)
24
+ if (fs.statSync(srcPath).isDirectory()) {
25
+ copyDirectorySync(srcPath, destPath)
26
+ } else {
27
+ fs.copyFileSync(srcPath, destPath)
28
+ }
29
+ })
30
+ }
31
+
32
+ const cwd = getFirstPackage(path.resolve(__dirname, `../packages`))
33
+ execSync('pnpm run build', { cwd, stdio: 'inherit' })
34
+ copyDirectorySync(path.join(cwd, 'dist'), path.join(__dirname, '../dist'))
@@ -0,0 +1 @@
1
+ import{fileURLToPath}from"url";import{dirname,resolve,sep}from"path";import fs from"fs-extra";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);import{parse as lexerParse}from"es-module-lexer";import MagicString from"magic-string";function addDirectoryAtLevel(e,r,i){if(i<0||i>e.split(sep).length)throw new Error("层级无效");return e.split(sep).reduce((e,s,t)=>(t===i&&e.push(r),e.push(s),e),[]).join(sep)}let pureExtname=async(e,s)=>{var t,r=[".js",".mjs","/index.js","/index.mjs"],i=resolve(s,e);for(t of r)if(await fs.exists(i+t))return""+e+t;if(e.startsWith("@das-fed/")){var a,n=resolve(s,addDirectoryAtLevel(e,"dist",2));for(a of r)if(await fs.exists(n+a))return""+e+a}},pureResolve=async(e,s)=>{var t,{cwd:r,nodeModulesCwd:i,packages:a=["@das-fed/ui","@das-fed/web","@das-fed/utils","@das-fed/web-components","dayjs","element-plus","ant-design-vue"]}=s||{};for(t of e){var n=resolve(r,t),l=(await fs.readFile(n)).toString(),[o]=lexerParse(l);if(o){o=o.filter(e=>!!e.n).filter(e=>!(e.n.endsWith(".js")||e.n.endsWith(".mjs")));if(o.length){var d=new MagicString(l);for(let t of o){let s=null;var f=t.n.endsWith(".css"),m=t.n.startsWith("element-plus")&&t.n.endsWith("/style/css"),p=t.n.startsWith("ant-design-vue")&&t.n.endsWith("/style/css"),u=!f&&!p&&!m&&!a.includes(t.n)&&(a.find(e=>t.n.startsWith(e))||t.n.startsWith("."));if(f&&d.overwrite(t.ss,t.se,""),m&&d.overwrite(t.ss,t.se,""),p&&d.overwrite(t.ss,t.se,""),u)if(t.n.startsWith(".")){f=await pureExtname(t.n,resolve(n,"../"));f&&(s=f)}else{let e=t.n;e.startsWith("dayjs")&&(e=e.replace("dayjs","dayjs/esm"));m=await pureExtname(e,i);console.log(m),m&&(s=m)}null!==s&&(2===t.t&&(s=`"${s}"`),d.overwrite(t.s,t.e,s))}await fs.writeFile(n,d.toString())}}}};export{pureResolve};
@@ -1 +1 @@
1
- import{resolve,extname}from"path";import fs from"fs-extra";import MagicString from"magic-string";import{parseImportCode}from"../../utils/parse-import-code.js";let dasFeWeb=async e=>{let s;var r=process.cwd();let t=["@das-fed/web","@das-fed/utils","@das-fed/ui","@das-fed/ui","@das-fed/web-components"],n=resolve(r,"node_modules"),i={};return{name:"das-fe",enforce:"pre",config:(e,{})=>({resolve:{alias:{"@":resolve(process.cwd(),"src")}}}),configResolved(e){s=e},buildStart:async()=>{s.cwd=resolve(process.cwd())},transformIndexHtml:{order:"post",handler:()=>{var e=s.base||"./";let r="development"===s.mode?e+"config.local.js":e+"config.js";return[{tag:"script",attrs:{src:r}}]}},async transform(r,e){if(!(-1<e.indexOf("?"))&&!(-1<e.indexOf("node_modules"))&&[".vue",".ts",".js",".jsx",".tsx"].includes(extname(e))){let e=parseImportCode(r);if(e&&0!==(e=e.filter(r=>t.find(e=>r.name===e))).length){var s,a,d=new MagicString(r);for(let o of e){s=o.name,a=void 0;let t=await(i[s]||(a=resolve(n,s,"esm-map.json"),await fs.exists(a)?(a=await fs.readJson(a),i[s]=a,i[s]):void 0));if(t){let s="";o.members.map(e=>{var r=e.name,r=t[r];r&&(s+=`import { ${e.code} } from '${o.name}${r}';`)}),s&&d.overwrite(o.start,o.end,s)}}return d.toString()}}}}};export default e=>[dasFeWeb(e)];
1
+ import{resolve,extname}from"path";import fs from"fs-extra";import MagicString from"magic-string";import glob from"fast-glob";import{parseImportCode}from"../../utils/parse-import-code.js";let dasFeWeb=async e=>{let o;var s=process.cwd();let t=["@das-fed/web","@das-fed/utils","@das-fed/ui","@das-fed/ui","@das-fed/web-components"],i=resolve(s,"node_modules");s=["vue","vue-router","pinia","axios","@vueuse/core","element-plus","ant-design-vue","@element-plus/icons-vue","@ant-design/icons-vue","echarts","monaco-editor","@das-fed/web/packages/style","@das-fed/ui/packages/global/style",...e?.optimizeDepsInlclude||[]];let a=[],l=(await Promise.all(s.map(async e=>{var s;await fs.exists(resolve(i,e))&&(a.push(e),"element-plus"===e&&(a.push("element-plus/es"),s=await glob(["element-plus/es/components/*/style/css.mjs"],{cwd:i,onlyFiles:!0}),a.push(...s.map(e=>e.split(".")[0]))),"ant-design-vue"===e&&(a.push("ant-design-vue/es"),s=await glob(["ant-design-vue/es/*/style/css.js"],{cwd:i,onlyFiles:!0}),a.push(...s.map(e=>e.split(".")[0]))),"monaco-editor"===e)&&a.push("monaco-editor/esm/vs/language/json/json.worker","monaco-editor/esm/vs/language/css/css.worker","monaco-editor/esm/vs/language/html/html.worker","monaco-editor/esm/vs/language/typescript/ts.worker","monaco-editor/esm/vs/editor/editor.worker")})),{});return{name:"das-fe",enforce:"pre",config:(e,{})=>({optimizeDeps:{include:a},resolve:{alias:{"@":resolve(process.cwd(),"src")}}}),configResolved(e){o=e},buildStart:async()=>{o.cwd=resolve(process.cwd())},transformIndexHtml:{order:"post",handler:()=>{var e=o.base||"./";let s="development"===o.mode?e+"config.local.js":e+"config.js";return[{tag:"script",attrs:{src:s}}]}},async transform(s,e){if(!(-1<e.indexOf("?"))&&!(-1<e.indexOf("node_modules"))&&[".vue",".ts",".js",".jsx",".tsx"].includes(extname(e))){let e=parseImportCode(s);if(e&&0!==(e=e.filter(s=>t.find(e=>s.name===e))).length){var o,r,n=new MagicString(s);for(let a of e){o=a.name,r=void 0;let t=await(l[o]||(r=resolve(i,o,"esm-map.json"),await fs.exists(r)?(r=await fs.readJson(r),l[o]=r,l[o]):void 0));if(t){let o="";a.members.map(e=>{var s=e.name,s=t[s];s&&(o+=`import { ${e.code} } from '${a.name}${s}';`)}),o&&n.overwrite(a.start,a.end,o)}}return n.toString()}}}}};export default e=>[dasFeWeb(e)];
@@ -1 +1 @@
1
- import{resolve,extname}from"path";import dayjs from"dayjs";let pureOpt=e=>{process.cwd();let{base:p="./",apply:s="build",type:t="singleApp",external:a=["vue","vue-router",/^@das-fed\//],entry:r="src/das-web-app.ts",outputDir:i="dist",...l}=e||{};return{base:p,apply:s,type:t,external:a,entry:r,outputDir:i,isSingleApp:"singleApp"===t,isDasMainApp:"mainApp"===t,isDasMicroApp:"microApp"===t,...l}},dasFeWebApp=e=>{let s=process.cwd(),{base:t,apply:p,external:a,entry:r,isSingleApp:i}=pureOpt(e);return i?{}:{name:"das-fe-web-app",apply:p,config:(e,{})=>{let p=e?.build?.assetsDir??"assets";(p=p||"")&&!p.endsWith("/")&&(p+="/");e=dayjs().format("YYYY-MM-DD-HH-mm-ss-SSS");return{base:t,build:{lib:{entry:resolve(s,r),name:"index",fileName:"index",formats:["es"]},rollupOptions:{external:a,output:{chunkFileNames:`[name]-[hash]-${e}.js`}}}}}}};export default e=>[dasFeWebApp(e)];
1
+ import{resolve,extname}from"path";import dayjs from"dayjs";import fs from"fs-extra";import glob from"fast-glob";import{pureResolve}from"../../utils/pure-resolve/index.js";let pureOpt=e=>{process.cwd();let{base:s="./",apply:p="build",type:t="singleApp",external:a=["vue","vue-router","pinia","pinia-plugin-persistedstate",/^@das-fed\//,/^dayjs(\/.*)?$/,/^element-plus(\/.*)?$/,/^ant-design-vue(\/.*)?$/],entry:r="src/das-web-app.ts",outputDir:i="dist",...l}=e||{};return{base:s,apply:p,type:t,external:a,entry:r,outputDir:i,isSingleApp:"singleApp"===t,isDasMainApp:"mainApp"===t,isDasMicroApp:"microApp"===t,...l}},dasFeWebApp=e=>{let p=process.cwd(),{base:t,apply:s,external:a,entry:r,isSingleApp:i}=pureOpt(e);return i?{}:{name:"das-fe-web-app",apply:s,config:(e,{})=>{let s=e?.build?.assetsDir??"assets";(s=s||"")&&!s.endsWith("/")&&(s+="/");e=dayjs().format("YYYY-MM-DD-HH-mm-ss-SSS");return{base:t,build:{lib:{entry:resolve(p,r),name:"index",fileName:"index",formats:["es"]},rollupOptions:{external:a,output:{chunkFileNames:`[name]-[hash]-${e}.js`}}}}},closeBundle:async()=>{var e=resolve(p,"dist"),s=await glob("**/**/*.js",{cwd:e});await pureResolve(s,{cwd:e,nodeModulesCwd:resolve(p,"node_modules")})}}};export default e=>[dasFeWebApp(e)];
@@ -1 +0,0 @@
1
- import fs from"fs-extra";import prettier from"prettier";import strip from"strip-comments";import json5 from"json5";let getWindowConfig=async r=>{r=(await fs.readFile(r)).toString(),r=(await prettier.format(strip(r),{parser:"typescript"})).split(";").find(r=>r.match("window.config")).replace(/\s/g,"").replace("window.config=","");return json5.parse(r)};export{getWindowConfig};
@@ -1 +0,0 @@
1
- window.config={};
@@ -1 +0,0 @@
1
- window.config={};
@@ -1 +0,0 @@
1
- let m={path:"/demo",component:()=>"virtual:module",meta:{keepAlive:!0}},l=(e,p)=>{var t=(s,e)=>async e=>{let t="string"==typeof e?e:"",a=("object"==typeof e&&(t=e.value),{method:s,url:t,headers:{}});return"get"!==a.method&&(a.params={...a.params,timestamp:(new Date).getTime()}),(a=p?await p(a):a).baseURL&&a.urlPrefix&&(a.baseURL=a.baseURL+a.urlPrefix),a};return{get:t("get"),post:t("post"),put:t("put"),patch:t("patch"),delete:t("delete")}},f=(t,e)=>l(null,async e=>(e.urlPrefix=t,e)),a=f("/test"),h=a.get("/user"),r=a.post("/user"),i=a.put("/user"),c=a.delete("/user"),p=Object.freeze(Object.defineProperty({__proto__:null,addUser:r,deleteUser:c,editUser:i,getUser:h},Symbol.toStringTag,{value:"Module"})),_={name:"示例",code:"demo",path:m.path,apis:p,btns:{add:{name:"新增按钮",apis:[r]},edit:{name:"编辑按钮",apis:[i]},delete:{name:"删除按钮",apis:[c]}}},g={path:"/",component:()=>"virtual:module"},b={name:"公告列表",code:"notice",path:g.path,apis:p,btns:{add:{name:"新增按钮",apis:[r]},edit:{name:"编辑按钮",apis:[i]},delete:{name:"删除按钮",apis:[c]}}},v=Object.assign({"./demo/index.ts":_,"./hello/index.ts":b}),U={code:"cms",name:"内容运营",modules:v};export{U as default};
@@ -1,19 +0,0 @@
1
- # pnpm-workspace app for @das-fed
2
-
3
- ## install
4
-
5
- ```
6
- pnpm i
7
- ```
8
-
9
- ## dev
10
-
11
- ```
12
- pnpm run dev
13
- ```
14
-
15
- ## build
16
-
17
- ```
18
- pnpm run build
19
- ```
@@ -1 +0,0 @@
1
- window.config = {}
@@ -1,9 +0,0 @@
1
- import { createDasWebApp } from '@das-fed/web'
2
- import '@das-fed/web/packages/style'
3
-
4
- createDasWebApp({
5
- // @ts-ignore
6
- microAppName: __MICRO_APPNAME__,
7
- router: { glob: import.meta.glob('@/views/**/router.ts', { eager: true, import: 'default' }) },
8
- plugins: { glob: import.meta.glob('@/plugins/*/index.ts', { eager: true, import: 'default' }) },
9
- })
@@ -1,8 +0,0 @@
1
- import { createDasWebApp } from '@das-fed/web'
2
-
3
- createDasWebApp({
4
- // @ts-ignore
5
- microAppName: __MICRO_APPNAME__,
6
- router: { glob: import.meta.glob('@/views/**/router.ts', { eager: true, import: 'default' }) },
7
- plugins: { glob: import.meta.glob('@/plugins/*/index.ts', { eager: true, import: 'default' }) },
8
- })