@xtalpi/agentic-lab-skills 0.0.10 → 0.0.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/README.md +1 -1
- package/package.json +14 -14
- package/skills/lab-flow-designer/SKILL.md +612 -612
- package/skills/lab-flow-designer/embedded-template/SKILL.md +103 -103
- package/skills/lab-flow-designer/embedded-template/pools//345/205/245/345/217/243/346/261/240.md +21 -21
- package/skills/lab-flow-designer/embedded-template/pools//345/207/272/345/217/243/346/261/240.md +21 -21
- package/skills/lab-flow-designer/embedded-template/scripts//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.js +142 -142
- package/skills/lab-flow-designer/embedded-template/valves//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.md +114 -114
- package/skills/lab-flow-designer/references/agentic-lab-processer.md +122 -122
- package/skills/lab-flow-designer/references/agentic-lab-sdk.md +534 -361
- package/skills/lab-flow-designer/references/rhea-api/README.md +7 -7
- package/skills/lab-flow-designer/references/rhea-api/execute_process_batch.md +58 -58
- package/skills/lab-flow-designer/references/skill-package-layout.md +268 -268
- package/skills/lab-flow-designer/references//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/346/240/207/345/207/206.md +216 -216
- package/skills/lab-flow-designer/templates//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/346/250/241/346/235/277.md +192 -192
- package/skills/lab-flow-designer/templates//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/347/244/272/344/276/213.md +207 -207
- package/skills/lab-flow-designer/testing/test-processer.mjs +1240 -1240
- package/skills/lab-nocobase-flow-generator/SKILL.md +164 -164
- package/skills/lab-nocobase-flow-generator/examples/setting/350/241/250/350/216/267/345/217/226/345/244/226/351/203/250/346/234/215/345/212/241.js +70 -70
- package/skills/lab-nocobase-flow-generator/examples//346/237/245/350/257/242/345/214/226/345/255/246/345/223/201/344/277/241/346/201/257.js +30 -30
- package/skills/lab-nocobase-flow-generator/references/doc-standard.md +84 -84
- package/skills/lab-nocobase-flow-generator/references/runtime-api.md +224 -224
- package/skills/lab-nocobase-flow-generator/templates//350/204/232/346/234/254/351/200/273/350/276/221/346/226/207/346/241/243/346/250/241/346/235/277.md +121 -121
- package/skills/lab-nocobase-flow-generator/templates//350/204/232/346/234/254/351/200/273/350/276/221/346/226/207/346/241/243/347/244/272/344/276/213.md +67 -67
- package/skills/lab-orbit-component-builder/SKILL.md +353 -353
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.env.local.example +27 -27
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintignore +7 -7
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintrc.cjs +88 -88
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.nvmrc +1 -1
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/AgenticAppAPI.md +268 -268
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/Jenkinsfile +106 -106
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/OrbitAPI.md +453 -453
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/README.md +176 -176
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/public/index.html +12 -12
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/App.vue +151 -151
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/components/DevOpenerLauncher.vue +143 -143
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/global.d.ts +77 -77
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/main.ts +308 -308
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/mockXNBBitable.ts +119 -119
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/shims-vue.d.ts +6 -6
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/utils/devOpenerHost.ts +75 -75
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/index.html +13 -13
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/package.json +60 -60
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/api/agenticlabTickets.ts +110 -110
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/bitable.ts +4 -4
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/custom-page.ts +4 -4
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/index.ts +1 -1
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/styles/orbit-quasar-host.scss +19 -19
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/context.ts +15 -15
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/xnb-context.ts +70 -70
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useBitablePage.ts +189 -189
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperCellDemo.ts +257 -257
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperTableBitableLifecycle.ts +555 -555
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerInitParams.ts +158 -158
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerTicketIds.ts +32 -32
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/orbitHttpClient.ts +110 -110
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/request.ts +92 -92
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/bitable.vue +67 -67
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/custom-page.vue +140 -140
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/tsconfig.json +45 -45
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.config.ts +170 -170
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.dev.config.ts +58 -58
- package/skills/lab-orbit-component-builder/references/flow-document-human-ui.md +65 -65
- package/skills/lab-orbit-component-builder/references/orbit-vue-conventions.md +133 -133
- package/skills/lab-orbit-component-builder/references/pool-schema-to-columns.md +67 -67
- package/skills/lab-orbit-component-builder/references/vue-template-checklist.md +179 -179
- package/skills/lab-orbit-component-builder/references/xnb-context-vue-props.md +49 -49
- package/skills/lab-orbit-component-builder/references/xnbitable-vue-parity.md +32 -32
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"jsx": "preserve",
|
|
7
|
-
"importHelpers": true,
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"baseUrl": ".",
|
|
16
|
-
"types": ["vite/client"],
|
|
17
|
-
"paths": {
|
|
18
|
-
"@/*": ["src/*"],
|
|
19
|
-
"Views/*": ["src/views/*"],
|
|
20
|
-
"Libs/*": ["src/libs/*"],
|
|
21
|
-
"Components/*": ["src/components/*"],
|
|
22
|
-
"Api/*": ["src/api/*"],
|
|
23
|
-
"Utils/*": ["src/utils/*"],
|
|
24
|
-
"Assets/*": ["src/assets/*"],
|
|
25
|
-
"Types/*": ["src/types/*"],
|
|
26
|
-
"Plugins/*": ["src/plugins/*"]
|
|
27
|
-
},
|
|
28
|
-
"lib": [
|
|
29
|
-
"esnext",
|
|
30
|
-
"dom",
|
|
31
|
-
"dom.iterable",
|
|
32
|
-
"scripthost"
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"include": [
|
|
36
|
-
"src/**/*.ts",
|
|
37
|
-
"src/**/*.tsx",
|
|
38
|
-
"src/**/*.vue"
|
|
39
|
-
],
|
|
40
|
-
"exclude": [
|
|
41
|
-
"node_modules",
|
|
42
|
-
"dev",
|
|
43
|
-
"dist"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"jsx": "preserve",
|
|
7
|
+
"importHelpers": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"types": ["vite/client"],
|
|
17
|
+
"paths": {
|
|
18
|
+
"@/*": ["src/*"],
|
|
19
|
+
"Views/*": ["src/views/*"],
|
|
20
|
+
"Libs/*": ["src/libs/*"],
|
|
21
|
+
"Components/*": ["src/components/*"],
|
|
22
|
+
"Api/*": ["src/api/*"],
|
|
23
|
+
"Utils/*": ["src/utils/*"],
|
|
24
|
+
"Assets/*": ["src/assets/*"],
|
|
25
|
+
"Types/*": ["src/types/*"],
|
|
26
|
+
"Plugins/*": ["src/plugins/*"]
|
|
27
|
+
},
|
|
28
|
+
"lib": [
|
|
29
|
+
"esnext",
|
|
30
|
+
"dom",
|
|
31
|
+
"dom.iterable",
|
|
32
|
+
"scripthost"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"include": [
|
|
36
|
+
"src/**/*.ts",
|
|
37
|
+
"src/**/*.tsx",
|
|
38
|
+
"src/**/*.vue"
|
|
39
|
+
],
|
|
40
|
+
"exclude": [
|
|
41
|
+
"node_modules",
|
|
42
|
+
"dev",
|
|
43
|
+
"dist"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import externalGlobals from 'rollup-plugin-external-globals'
|
|
4
|
-
import viteCompression from 'vite-plugin-compression'
|
|
5
|
-
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
|
6
|
-
import { resolve } from 'path'
|
|
7
|
-
import { readFileSync } from 'fs'
|
|
8
|
-
import type { Plugin } from 'vite'
|
|
9
|
-
|
|
10
|
-
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
|
|
11
|
-
|
|
12
|
-
// ==================== 多入口组件清单 ====================
|
|
13
|
-
|
|
14
|
-
interface ComponentSpec {
|
|
15
|
-
distBaseName: string
|
|
16
|
-
registrarName: string
|
|
17
|
-
label?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const COMPONENT_MAP: Record<string, ComponentSpec> = {
|
|
21
|
-
bitable: {
|
|
22
|
-
label: '超级表格 Cell(bitable)',
|
|
23
|
-
distBaseName: 'DemoOrbitBitable',
|
|
24
|
-
registrarName: 'DemoOrbitBitable'
|
|
25
|
-
},
|
|
26
|
-
'custom-page': {
|
|
27
|
-
label: '自定义多区页面(custom-page)',
|
|
28
|
-
distBaseName: 'DemoOrbitCustomPage',
|
|
29
|
-
registrarName: 'DemoOrbitCustomPage'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const DEFAULT_COMPONENT_ID = 'bitable'
|
|
34
|
-
|
|
35
|
-
// ==================== Webb 组件包装插件 ====================
|
|
36
|
-
|
|
37
|
-
function wrapComponentPlugin (funcMode: boolean): Plugin {
|
|
38
|
-
return {
|
|
39
|
-
name: 'wrap-component',
|
|
40
|
-
enforce: 'post',
|
|
41
|
-
generateBundle (_options, bundle) {
|
|
42
|
-
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
43
|
-
if (chunk.type !== 'chunk' || !fileName.endsWith('.js')) continue
|
|
44
|
-
|
|
45
|
-
const exportRegex = /export\s*\{([^}]+)\}\s*;?/
|
|
46
|
-
const match = chunk.code.match(exportRegex)
|
|
47
|
-
if (!match) continue
|
|
48
|
-
|
|
49
|
-
const mappings: Record<string, string> = {}
|
|
50
|
-
match[1].split(',').forEach((part: string) => {
|
|
51
|
-
const tokens = part.trim().split(/\s+/)
|
|
52
|
-
if (tokens.length >= 3 && tokens[1] === 'as') {
|
|
53
|
-
mappings[tokens[2]] = tokens[0]
|
|
54
|
-
} else {
|
|
55
|
-
mappings[tokens[0]] = tokens[0]
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const viewVar = mappings['View'] || 'View'
|
|
60
|
-
const pkgDataVar = mappings['packageData'] || 'packageData'
|
|
61
|
-
|
|
62
|
-
if (!funcMode) continue
|
|
63
|
-
|
|
64
|
-
const componentId = process.env.VITE_COMPONENT_ID || DEFAULT_COMPONENT_ID
|
|
65
|
-
const spec = COMPONENT_MAP[componentId]
|
|
66
|
-
const compName = spec ? spec.registrarName : pkg.name
|
|
67
|
-
|
|
68
|
-
const wrapCode = [
|
|
69
|
-
'return {',
|
|
70
|
-
' component: {',
|
|
71
|
-
` packageData: ${pkgDataVar},`,
|
|
72
|
-
` name: '${compName}',`,
|
|
73
|
-
` "${spec ? spec.distBaseName : pkg.name}": ${viewVar}`,
|
|
74
|
-
' }',
|
|
75
|
-
'}'
|
|
76
|
-
].join('\n')
|
|
77
|
-
chunk.code = chunk.code.replace(exportRegex, wrapCode)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ==================== Vite 配置 ====================
|
|
84
|
-
|
|
85
|
-
export default defineConfig(({ mode }) => {
|
|
86
|
-
const funcMode = mode === 'func'
|
|
87
|
-
const componentId = process.env.VITE_COMPONENT_ID || DEFAULT_COMPONENT_ID
|
|
88
|
-
const spec = COMPONENT_MAP[componentId]
|
|
89
|
-
|
|
90
|
-
if (componentId !== DEFAULT_COMPONENT_ID && !spec) {
|
|
91
|
-
const keys = Object.keys(COMPONENT_MAP).join(', ')
|
|
92
|
-
throw new Error(`[vite.config] 未知组件 id "${componentId}",应为: ${keys}`)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const entryFile = spec
|
|
96
|
-
? resolve(__dirname, `src/entries/${componentId}.ts`)
|
|
97
|
-
: resolve(__dirname, 'src/index.ts')
|
|
98
|
-
const outputName = spec ? spec.distBaseName : pkg.name
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
plugins: [
|
|
102
|
-
vue(),
|
|
103
|
-
cssInjectedByJsPlugin(),
|
|
104
|
-
wrapComponentPlugin(funcMode),
|
|
105
|
-
viteCompression({
|
|
106
|
-
algorithm: 'gzip',
|
|
107
|
-
ext: '.gz',
|
|
108
|
-
threshold: 30240,
|
|
109
|
-
deleteOriginFile: false
|
|
110
|
-
})
|
|
111
|
-
],
|
|
112
|
-
define: {
|
|
113
|
-
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
114
|
-
__APP_SKILL__: JSON.stringify('lab-orbit-component-builder'),
|
|
115
|
-
},
|
|
116
|
-
resolve: {
|
|
117
|
-
alias: {
|
|
118
|
-
'@': resolve(__dirname, 'src'),
|
|
119
|
-
'Views': resolve(__dirname, 'src/views'),
|
|
120
|
-
'Libs': resolve(__dirname, 'src/libs'),
|
|
121
|
-
'Components': resolve(__dirname, 'src/components'),
|
|
122
|
-
'Api': resolve(__dirname, 'src/api'),
|
|
123
|
-
'Utils': resolve(__dirname, 'src/utils'),
|
|
124
|
-
'Assets': resolve(__dirname, 'src/assets'),
|
|
125
|
-
'Types': resolve(__dirname, 'src/types'),
|
|
126
|
-
'Plugins': resolve(__dirname, 'src/plugins')
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
css: {
|
|
130
|
-
preprocessorOptions: {
|
|
131
|
-
sass: {
|
|
132
|
-
additionalData: '@import "quasar/src/css/variables.sass"\n',
|
|
133
|
-
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
134
|
-
},
|
|
135
|
-
scss: {
|
|
136
|
-
additionalData: '@import "quasar/src/css/variables.sass";',
|
|
137
|
-
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
build: {
|
|
142
|
-
outDir: resolve(__dirname, 'dist'),
|
|
143
|
-
emptyOutDir: false,
|
|
144
|
-
sourcemap: true,
|
|
145
|
-
cssCodeSplit: false,
|
|
146
|
-
minify: false,
|
|
147
|
-
lib: {
|
|
148
|
-
entry: entryFile,
|
|
149
|
-
formats: ['es'],
|
|
150
|
-
fileName: () => `${outputName}.umd.js`
|
|
151
|
-
},
|
|
152
|
-
rollupOptions: {
|
|
153
|
-
external: ['vue', 'quasar'],
|
|
154
|
-
plugins: [
|
|
155
|
-
externalGlobals({
|
|
156
|
-
vue: 'window.Vue',
|
|
157
|
-
quasar: 'window.webb.utils.quasar'
|
|
158
|
-
})
|
|
159
|
-
],
|
|
160
|
-
onwarn (warning, warn) {
|
|
161
|
-
if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return
|
|
162
|
-
warn(warning)
|
|
163
|
-
},
|
|
164
|
-
output: {
|
|
165
|
-
inlineDynamicImports: true
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
})
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import externalGlobals from 'rollup-plugin-external-globals'
|
|
4
|
+
import viteCompression from 'vite-plugin-compression'
|
|
5
|
+
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
|
6
|
+
import { resolve } from 'path'
|
|
7
|
+
import { readFileSync } from 'fs'
|
|
8
|
+
import type { Plugin } from 'vite'
|
|
9
|
+
|
|
10
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
|
|
11
|
+
|
|
12
|
+
// ==================== 多入口组件清单 ====================
|
|
13
|
+
|
|
14
|
+
interface ComponentSpec {
|
|
15
|
+
distBaseName: string
|
|
16
|
+
registrarName: string
|
|
17
|
+
label?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const COMPONENT_MAP: Record<string, ComponentSpec> = {
|
|
21
|
+
bitable: {
|
|
22
|
+
label: '超级表格 Cell(bitable)',
|
|
23
|
+
distBaseName: 'DemoOrbitBitable',
|
|
24
|
+
registrarName: 'DemoOrbitBitable'
|
|
25
|
+
},
|
|
26
|
+
'custom-page': {
|
|
27
|
+
label: '自定义多区页面(custom-page)',
|
|
28
|
+
distBaseName: 'DemoOrbitCustomPage',
|
|
29
|
+
registrarName: 'DemoOrbitCustomPage'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const DEFAULT_COMPONENT_ID = 'bitable'
|
|
34
|
+
|
|
35
|
+
// ==================== Webb 组件包装插件 ====================
|
|
36
|
+
|
|
37
|
+
function wrapComponentPlugin (funcMode: boolean): Plugin {
|
|
38
|
+
return {
|
|
39
|
+
name: 'wrap-component',
|
|
40
|
+
enforce: 'post',
|
|
41
|
+
generateBundle (_options, bundle) {
|
|
42
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
43
|
+
if (chunk.type !== 'chunk' || !fileName.endsWith('.js')) continue
|
|
44
|
+
|
|
45
|
+
const exportRegex = /export\s*\{([^}]+)\}\s*;?/
|
|
46
|
+
const match = chunk.code.match(exportRegex)
|
|
47
|
+
if (!match) continue
|
|
48
|
+
|
|
49
|
+
const mappings: Record<string, string> = {}
|
|
50
|
+
match[1].split(',').forEach((part: string) => {
|
|
51
|
+
const tokens = part.trim().split(/\s+/)
|
|
52
|
+
if (tokens.length >= 3 && tokens[1] === 'as') {
|
|
53
|
+
mappings[tokens[2]] = tokens[0]
|
|
54
|
+
} else {
|
|
55
|
+
mappings[tokens[0]] = tokens[0]
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const viewVar = mappings['View'] || 'View'
|
|
60
|
+
const pkgDataVar = mappings['packageData'] || 'packageData'
|
|
61
|
+
|
|
62
|
+
if (!funcMode) continue
|
|
63
|
+
|
|
64
|
+
const componentId = process.env.VITE_COMPONENT_ID || DEFAULT_COMPONENT_ID
|
|
65
|
+
const spec = COMPONENT_MAP[componentId]
|
|
66
|
+
const compName = spec ? spec.registrarName : pkg.name
|
|
67
|
+
|
|
68
|
+
const wrapCode = [
|
|
69
|
+
'return {',
|
|
70
|
+
' component: {',
|
|
71
|
+
` packageData: ${pkgDataVar},`,
|
|
72
|
+
` name: '${compName}',`,
|
|
73
|
+
` "${spec ? spec.distBaseName : pkg.name}": ${viewVar}`,
|
|
74
|
+
' }',
|
|
75
|
+
'}'
|
|
76
|
+
].join('\n')
|
|
77
|
+
chunk.code = chunk.code.replace(exportRegex, wrapCode)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ==================== Vite 配置 ====================
|
|
84
|
+
|
|
85
|
+
export default defineConfig(({ mode }) => {
|
|
86
|
+
const funcMode = mode === 'func'
|
|
87
|
+
const componentId = process.env.VITE_COMPONENT_ID || DEFAULT_COMPONENT_ID
|
|
88
|
+
const spec = COMPONENT_MAP[componentId]
|
|
89
|
+
|
|
90
|
+
if (componentId !== DEFAULT_COMPONENT_ID && !spec) {
|
|
91
|
+
const keys = Object.keys(COMPONENT_MAP).join(', ')
|
|
92
|
+
throw new Error(`[vite.config] 未知组件 id "${componentId}",应为: ${keys}`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const entryFile = spec
|
|
96
|
+
? resolve(__dirname, `src/entries/${componentId}.ts`)
|
|
97
|
+
: resolve(__dirname, 'src/index.ts')
|
|
98
|
+
const outputName = spec ? spec.distBaseName : pkg.name
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
plugins: [
|
|
102
|
+
vue(),
|
|
103
|
+
cssInjectedByJsPlugin(),
|
|
104
|
+
wrapComponentPlugin(funcMode),
|
|
105
|
+
viteCompression({
|
|
106
|
+
algorithm: 'gzip',
|
|
107
|
+
ext: '.gz',
|
|
108
|
+
threshold: 30240,
|
|
109
|
+
deleteOriginFile: false
|
|
110
|
+
})
|
|
111
|
+
],
|
|
112
|
+
define: {
|
|
113
|
+
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
114
|
+
__APP_SKILL__: JSON.stringify('lab-orbit-component-builder'),
|
|
115
|
+
},
|
|
116
|
+
resolve: {
|
|
117
|
+
alias: {
|
|
118
|
+
'@': resolve(__dirname, 'src'),
|
|
119
|
+
'Views': resolve(__dirname, 'src/views'),
|
|
120
|
+
'Libs': resolve(__dirname, 'src/libs'),
|
|
121
|
+
'Components': resolve(__dirname, 'src/components'),
|
|
122
|
+
'Api': resolve(__dirname, 'src/api'),
|
|
123
|
+
'Utils': resolve(__dirname, 'src/utils'),
|
|
124
|
+
'Assets': resolve(__dirname, 'src/assets'),
|
|
125
|
+
'Types': resolve(__dirname, 'src/types'),
|
|
126
|
+
'Plugins': resolve(__dirname, 'src/plugins')
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
css: {
|
|
130
|
+
preprocessorOptions: {
|
|
131
|
+
sass: {
|
|
132
|
+
additionalData: '@import "quasar/src/css/variables.sass"\n',
|
|
133
|
+
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
134
|
+
},
|
|
135
|
+
scss: {
|
|
136
|
+
additionalData: '@import "quasar/src/css/variables.sass";',
|
|
137
|
+
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
build: {
|
|
142
|
+
outDir: resolve(__dirname, 'dist'),
|
|
143
|
+
emptyOutDir: false,
|
|
144
|
+
sourcemap: true,
|
|
145
|
+
cssCodeSplit: false,
|
|
146
|
+
minify: false,
|
|
147
|
+
lib: {
|
|
148
|
+
entry: entryFile,
|
|
149
|
+
formats: ['es'],
|
|
150
|
+
fileName: () => `${outputName}.umd.js`
|
|
151
|
+
},
|
|
152
|
+
rollupOptions: {
|
|
153
|
+
external: ['vue', 'quasar'],
|
|
154
|
+
plugins: [
|
|
155
|
+
externalGlobals({
|
|
156
|
+
vue: 'window.Vue',
|
|
157
|
+
quasar: 'window.webb.utils.quasar'
|
|
158
|
+
})
|
|
159
|
+
],
|
|
160
|
+
onwarn (warning, warn) {
|
|
161
|
+
if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return
|
|
162
|
+
warn(warning)
|
|
163
|
+
},
|
|
164
|
+
output: {
|
|
165
|
+
inlineDynamicImports: true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
})
|
package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.dev.config.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
-
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
|
|
4
|
-
import { resolve } from 'path'
|
|
5
|
-
import { readFileSync } from 'fs'
|
|
6
|
-
|
|
7
|
-
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
|
|
8
|
-
|
|
9
|
-
export default defineConfig(({ mode }) => {
|
|
10
|
-
const env = loadEnv(mode, process.cwd(), '')
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
root: resolve(__dirname),
|
|
14
|
-
plugins: [
|
|
15
|
-
vue({ template: { transformAssetUrls } }),
|
|
16
|
-
quasar({ sassVariables: 'quasar/src/css/variables.sass' })
|
|
17
|
-
],
|
|
18
|
-
define: {
|
|
19
|
-
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
20
|
-
__APP_SKILL__: JSON.stringify('lab-orbit-component-builder'),
|
|
21
|
-
},
|
|
22
|
-
resolve: {
|
|
23
|
-
alias: {
|
|
24
|
-
'@': resolve(__dirname, 'src'),
|
|
25
|
-
'Views': resolve(__dirname, 'src/views'),
|
|
26
|
-
'Libs': resolve(__dirname, 'src/libs'),
|
|
27
|
-
'Components': resolve(__dirname, 'src/components'),
|
|
28
|
-
'Api': resolve(__dirname, 'src/api'),
|
|
29
|
-
'Utils': resolve(__dirname, 'src/utils'),
|
|
30
|
-
'Assets': resolve(__dirname, 'src/assets'),
|
|
31
|
-
'Types': resolve(__dirname, 'src/types'),
|
|
32
|
-
'Plugins': resolve(__dirname, 'src/plugins')
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
css: {
|
|
36
|
-
preprocessorOptions: {
|
|
37
|
-
sass: {
|
|
38
|
-
additionalData: '@import "quasar/src/css/variables.sass"\n',
|
|
39
|
-
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
40
|
-
},
|
|
41
|
-
scss: {
|
|
42
|
-
additionalData: '@import "quasar/src/css/variables.sass";',
|
|
43
|
-
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
server: {
|
|
48
|
-
proxy: env.VITE_REQUEST_URL
|
|
49
|
-
? {
|
|
50
|
-
'/api': {
|
|
51
|
-
target: env.VITE_REQUEST_URL,
|
|
52
|
-
changeOrigin: true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
: undefined
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
})
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
|
|
4
|
+
import { resolve } from 'path'
|
|
5
|
+
import { readFileSync } from 'fs'
|
|
6
|
+
|
|
7
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
|
|
8
|
+
|
|
9
|
+
export default defineConfig(({ mode }) => {
|
|
10
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
root: resolve(__dirname),
|
|
14
|
+
plugins: [
|
|
15
|
+
vue({ template: { transformAssetUrls } }),
|
|
16
|
+
quasar({ sassVariables: 'quasar/src/css/variables.sass' })
|
|
17
|
+
],
|
|
18
|
+
define: {
|
|
19
|
+
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
20
|
+
__APP_SKILL__: JSON.stringify('lab-orbit-component-builder'),
|
|
21
|
+
},
|
|
22
|
+
resolve: {
|
|
23
|
+
alias: {
|
|
24
|
+
'@': resolve(__dirname, 'src'),
|
|
25
|
+
'Views': resolve(__dirname, 'src/views'),
|
|
26
|
+
'Libs': resolve(__dirname, 'src/libs'),
|
|
27
|
+
'Components': resolve(__dirname, 'src/components'),
|
|
28
|
+
'Api': resolve(__dirname, 'src/api'),
|
|
29
|
+
'Utils': resolve(__dirname, 'src/utils'),
|
|
30
|
+
'Assets': resolve(__dirname, 'src/assets'),
|
|
31
|
+
'Types': resolve(__dirname, 'src/types'),
|
|
32
|
+
'Plugins': resolve(__dirname, 'src/plugins')
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
css: {
|
|
36
|
+
preprocessorOptions: {
|
|
37
|
+
sass: {
|
|
38
|
+
additionalData: '@import "quasar/src/css/variables.sass"\n',
|
|
39
|
+
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
40
|
+
},
|
|
41
|
+
scss: {
|
|
42
|
+
additionalData: '@import "quasar/src/css/variables.sass";',
|
|
43
|
+
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'slash-div']
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
server: {
|
|
48
|
+
proxy: env.VITE_REQUEST_URL
|
|
49
|
+
? {
|
|
50
|
+
'/api': {
|
|
51
|
+
target: env.VITE_REQUEST_URL,
|
|
52
|
+
changeOrigin: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
: undefined
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|