add jsdoc comments
This commit is contained in:
1 parent
6de354ad47
commit
8c1205bc13
24 files changed
+1228
-425
No files matched your search
+73
-27
@@ -1,9 +1,68 @@
|
||||
import { build } from "vite";
|
||||
import { rmSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import dts from 'unplugin-dts/vite';
|
||||
import postcssPresetEnv from "postcss-preset-env";
|
||||
import { viteExternalsPlugin } from "vite-plugin-externals";
|
||||
|
||||
// empty out dir
|
||||
rmSync(resolve('dist'), { recursive: true, force: true });
|
||||
|
||||
const libraries = [
|
||||
{
|
||||
name: 'utility',
|
||||
path: resolve('./lib/utility.js')
|
||||
},
|
||||
{
|
||||
name: 'ui',
|
||||
path: resolve('./lib/ui.js')
|
||||
},
|
||||
/*/
|
||||
{
|
||||
name: 'app',
|
||||
path: resolve('./lib/app.js'),
|
||||
rolldownOptions: {
|
||||
external: ['../../ui'],
|
||||
output: {
|
||||
format: 'umd',
|
||||
globals(id) {
|
||||
let index = id.lastIndexOf('/');
|
||||
if (index < 0) {
|
||||
index = id.lastIndexOf('\\');
|
||||
}
|
||||
id = id.substring(index + 1);
|
||||
switch (id) {
|
||||
case 'ui': return 'lib-ui';
|
||||
default: return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'element',
|
||||
path: resolve('./lib/element.js'),
|
||||
rolldownOptions: {
|
||||
external: ['../ui'],
|
||||
output: {
|
||||
format: 'umd',
|
||||
globals(id) {
|
||||
let index = id.lastIndexOf('/');
|
||||
if (index < 0) {
|
||||
index = id.lastIndexOf('\\');
|
||||
}
|
||||
id = id.substring(index + 1);
|
||||
switch (id) {
|
||||
case 'ui': return 'lib-ui';
|
||||
default: return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},//*/
|
||||
]
|
||||
|
||||
for (const { name, path, rolldownOptions } of libraries) {
|
||||
await build({
|
||||
clearScreen: false,
|
||||
css: {
|
||||
postcss: {
|
||||
@@ -12,33 +71,20 @@ const libraries = [
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
entry: './lib/ui.js',
|
||||
name: 'lib-ui',
|
||||
formats: ['cjs', 'umd'],
|
||||
fileName: (format, name) => format === 'cjs' ? `${name}-cjs.min.js` : `${name}.min.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: info => info.name === 'style.css' ? 'ui.min.css' : info.name
|
||||
}
|
||||
},
|
||||
sourcemap: true,
|
||||
emptyOutDir: false
|
||||
}
|
||||
},
|
||||
{
|
||||
clearScreen: false,
|
||||
build: {
|
||||
lib: {
|
||||
entry: './lib/utility.js',
|
||||
name: 'lib-utility',
|
||||
entry: {
|
||||
[name]: path
|
||||
},
|
||||
name: `lib-${name}`,
|
||||
cssFileName: `${name}.min`,
|
||||
formats: ['umd'],
|
||||
fileName: (_format, name) => `${name}.min.js`
|
||||
fileName: (_format, name) => `${name}.js`
|
||||
},
|
||||
rolldownOptions,
|
||||
sourcemap: true,
|
||||
emptyOutDir: false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
libraries.forEach(async b => await build(b))
|
||||
},
|
||||
plugins: [
|
||||
dts()
|
||||
]
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user