chore: add type definition

This commit is contained in:
yugasun
2022-10-11 14:03:24 +08:00
parent e6fb08352f
commit c236e43f21
7 changed files with 7615 additions and 2 deletions
+27
View File
@@ -59,6 +59,25 @@ async function bundleUmd() {
});
}
async function bundleCommonjs() {
const bundle = await rollup.rollup({
input: path.join(process.cwd(), 'src/index.ts'),
plugins: [...plugins],
external: ['jsqr'],
});
await bundle.write({
file: 'dist/index.js',
exports: 'named',
name: 'QrcodeDecoder',
format: 'commonjs',
sourcemap: false,
globals: {
jsqr: 'jsqr',
tslib: 'tslib',
},
});
}
async function bundleAio() {
const bundle = await rollup.rollup({
input: path.join(process.cwd(), 'src/index.ts'),
@@ -100,6 +119,14 @@ async function bundle() {
await bundleUmd();
}
if (outputs.indexOf('commonjs') === -1) {
logBundle(`Skipping commonjs`);
} else {
logBundle(`Creating commonjs`);
await bundleCommonjs();
}
if (outputs.indexOf('aio') === -1) {
logBundle(`Skipping umd aio`);
} else {